diff options
Diffstat (limited to 'userspace/sys')
| -rw-r--r-- | userspace/sys/syscalls.c | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c index fe34f47..e6a6a4d 100644 --- a/userspace/sys/syscalls.c +++ b/userspace/sys/syscalls.c @@ -2,16 +2,6 @@ char **environ; -void _exit(int ret) -{ - _exit2(ret,environ); -} - -void _exit2(int ret,char **environ) -{ - return syscall(SYSCALL_EXIT,ret,environ,0); -} - // generic syscall interface! int syscall(int call, int p1, int p2, int p3) { @@ -38,12 +28,29 @@ int syscall(int call, int p1, int p2, int p3) return ebx; } +// fool os custom +int readdir(const char *name,fs_dirent *dirs,int max) +{ + + return syscall(SYSCALL_READDIR,name,dirs,max); +} + +void _exit(int ret) +{ + _exit2(ret,environ); +} + +void _exit2(int ret,char **environ) +{ + return syscall(SYSCALL_EXIT,ret,environ,0); +} + +//required by newlibc int close(int file) { return syscall(SYSCALL_CLOSE,file,0,0); } - int isatty(int file) { return syscall(SYSCALL_ISATTY,file,0,0); @@ -60,12 +67,6 @@ int read(int file, char *ptr, int len) return syscall(SYSCALL_READ,file,ptr,len); } -int readdir(const char *name,fs_dirent *dirs,int max) -{ - - return syscall(SYSCALL_READDIR,name,dirs,max); -} - int open(const char *name, int flags, int mode) { return syscall(SYSCALL_OPEN,name,flags,mode); @@ -91,6 +92,8 @@ int gettimeofday(struct timeval *tv, void *tz) return syscall(SYSCALL_GETTIMEOFDAY,tv,tz,0); } + + int fork(void) { return syscall(SYSCALL_FORK,0,0,0); @@ -106,36 +109,46 @@ int kill(int pid, int sig) return syscall(SYSCALL_KILL,pid,sig,0); } + + + int link(char *old, char *ne) { return syscall(SYSCALL_LINK,old,ne,0); } -int stat(const char *file, struct stat *st) +int unlink(char *name) { - return syscall(SYSCALL_STAT,file,st,0); + return syscall(SYSCALL_UNLINK,name,0,0); } -int lstat(const char *file, struct stat *st) + + +int times(struct tms *buf) { - return syscall(SYSCALL_LSTAT,file,st,0); + return syscall(SYSCALL_TIMES,buf,0,0); } -int fstat(int file, struct stat *st) + +int wait(int *status) { - return syscall(SYSCALL_FSTAT,file,st,0); + return syscall(SYSCALL_WAIT,status,0,0); } -int times(struct tms *buf) + + +int stat(const char *file, struct stat *st) { - return syscall(SYSCALL_TIMES,buf,0,0); + return syscall(SYSCALL_STAT,file,st,0); } -int unlink(char *name) +int lstat(const char *file, struct stat *st) { - return syscall(SYSCALL_UNLINK,name,0,0); + return syscall(SYSCALL_LSTAT,file,st,0); } -int wait(int *status) +int fstat(int file, struct stat *st) { - return syscall(SYSCALL_WAIT,status,0,0); + return syscall(SYSCALL_FSTAT,file,st,0); } + + |
