mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:27:36 +00:00
A bunch of compat work (mostly stubs but some real implementations, too.)
Another pass at getting bash-1.14.7 to build. Not that many symbols remain.
This commit is contained in:
parent
6a0a2c9ab4
commit
3b2f172d48
9 changed files with 134 additions and 2 deletions
|
@ -0,0 +1,13 @@
|
|||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
|
||||
int setjmp(jmp_buf)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void longjmp(jmp_buf, int val)
|
||||
{
|
||||
assert(false);
|
||||
}
|
|
@ -11,6 +11,12 @@ int kill(pid_t pid, int sig)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int killpg(int pgrp, int sig)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_killpg, (dword)pgrp, (dword)sig);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
sighandler_t signal(int signum, sighandler_t handler)
|
||||
{
|
||||
sighandler_t old_handler = (sighandler_t)Syscall::invoke(Syscall::SC_signal, (dword)signum, (dword)handler);
|
||||
|
|
|
@ -22,6 +22,7 @@ struct sigaction {
|
|||
};
|
||||
|
||||
int kill(pid_t, int sig);
|
||||
int killpg(int pgrp, int sig);
|
||||
sighandler_t signal(int sig, sighandler_t);
|
||||
int sigaction(int sig, const struct sigaction* act, struct sigaction* old_act);
|
||||
int sigemptyset(sigset_t*);
|
||||
|
|
|
@ -147,6 +147,12 @@ int stat(const char* path, struct stat* statbuf)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int fstat(int fd, struct stat *statbuf)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_fstat, (dword)fd, (dword)statbuf);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int chdir(const char* path)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_chdir, (dword)path);
|
||||
|
@ -233,4 +239,33 @@ int getgroups(int size, gid_t list[])
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int pipe(int pipefd[2])
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_pipe, (dword)pipefd);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
unsigned int alarm(unsigned int seconds)
|
||||
{
|
||||
return Syscall::invoke(Syscall::SC_alarm, (dword)seconds);
|
||||
}
|
||||
|
||||
int setuid(uid_t uid)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_setuid, (dword)uid);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int setgid(uid_t gid)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_setgid, (dword)gid);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int access(const char* pathname, int mode)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::SC_access, (dword)pathname, (dword)mode);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ pid_t waitpid(pid_t, int* wstatus, int options);
|
|||
int chdir(const char* path);
|
||||
char* getcwd(char* buffer, size_t size);
|
||||
char* getwd(char* buffer);
|
||||
int fstat(int fd, struct stat* statbuf);
|
||||
int lstat(const char* path, struct stat* statbuf);
|
||||
int stat(const char* path, struct stat* statbuf);
|
||||
int sleep(unsigned seconds);
|
||||
|
@ -46,6 +47,9 @@ int unlink(const char* pathname);
|
|||
int getdtablesize();
|
||||
int dup(int old_fd);
|
||||
int dup2(int old_fd, int new_fd);
|
||||
int pipe(int pipefd[2]);
|
||||
unsigned int alarm(unsigned int seconds);
|
||||
int access(const char* pathname, int mode);
|
||||
|
||||
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
|
||||
#define WTERMSIG(status) ((status) & 0x7f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue