diff options
| author | Miguel <m.i@gmx.at> | 2018-08-18 13:23:53 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-08-18 13:23:53 +0200 |
| commit | 7b0d88b2dff9b635d9ff69f6d51b6832c1ca4c40 (patch) | |
| tree | 22c452e9c7ad586136721e776e0b67b23fb33119 /syscalls.c | |
| parent | 17fd357bad5f6c3362cfdab1d807aa463c69a4e9 (diff) | |
cleaning up syscalls and playing with new pipes
Diffstat (limited to 'syscalls.c')
| -rw-r--r-- | syscalls.c | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/syscalls.c b/syscalls.c deleted file mode 100644 index f2978cc..0000000 --- a/syscalls.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <sys/time.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdint.h> - -typedef struct fs_dirent_struct -{ - uint32_t inode; - uint32_t offset; - uint16_t length; - uint8_t type; - char name[256]; -}fs_dirent; - -#define SYSCALL_EXIT 60 -#define SYSCALL_WRITE 61 -#define SYSCALL_READ 62 -#define SYSCALL_READDIR 63 // fool-os-special -#define SYSCALL_EXECVE 64 -#define SYSCALL_OPEN 65 -#define SYSCALL_CLOSE 66 -#define SYSCALL_FSTAT 67 -#define SYSCALL_ISATTY 68 -#define SYSCALL_LSEEK 69 -#define SYSCALL_SBRK 70 -#define SYSCALL_GETTIMEOFDAY 71 -#define SYSCALL_FORK 72 -#define SYSCALL_KILL 73 -#define SYSCALL_STAT 74 -#define SYSCALL_TIMES 75 -#define SYSCALL_UNLINK 76 -#define SYSCALL_WAIT 77 -#define SYSCALL_GETPID 78 -#define SYSCALL_LSTAT 79 -#define SYSCALL_HAS_DATA 80 // fool-os-special -#define SYSCALL_TUNE 81 // fool-os-special -#define SYSCALL_LINK 82 - -extern char **environ; -//struct _reent *_impure_ptr; - -// fool os custom -int readdir(const char *name,fs_dirent *dirs,int max) -{ - return syscall(SYSCALL_READDIR,name,dirs,max); -} - -int has_data_waiting() -{ - return syscall(SYSCALL_HAS_DATA,0,0,0); -} - -int fool_tune(int v1, int v2, int v3) -{ - return syscall(SYSCALL_TUNE,v1,v2,v3); -} -// - -void _exit(int ret) -{ - _exit2(ret,environ); -} - -void _exit2(int ret,char **environ) -{ - return syscall(SYSCALL_EXIT,ret,environ,0); -} - -int _close(int file) -{ - return syscall(SYSCALL_CLOSE,file,0,0); -} - -int _isatty(int file) -{ - return syscall(SYSCALL_ISATTY,file,0,0); -} - -int _lseek(int file, int ptr, int dir) -{ - return syscall(SYSCALL_LSEEK,file,ptr,dir); -} - -int _read(int file, char *ptr, int len) -{ - return syscall(SYSCALL_READ,file,ptr,len); -} - -int _open(const char *name, int flags, int mode) -{ - return syscall(SYSCALL_OPEN,name,flags,mode); -} - -int _write(int file, char *ptr, int len) -{ - return syscall(SYSCALL_WRITE,file,ptr,len); -} - -int _execve(char *name, char **argv, char **env) -{ - return syscall(SYSCALL_EXECVE,name,argv,env); -} - -uint32_t _sbrk(int incr) -{ - return syscall(SYSCALL_SBRK,incr,0,0); -} - -int _gettimeofday(struct timeval *tv, void *tz) -{ - return syscall(SYSCALL_GETTIMEOFDAY,tv,tz,0); -} - -int _fork(void) -{ - return syscall(SYSCALL_FORK,0,0,0); -} - -int _getpid(void) -{ - return syscall(SYSCALL_GETPID,0,0,0); -} - -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 _unlink(char *name) -{ - return syscall(SYSCALL_UNLINK,name,0,0); -} - -int _times(struct tms *buf) -{ - return syscall(SYSCALL_TIMES,buf,0,0); -} - -int _wait(int *status) -{ - return syscall(SYSCALL_WAIT,status,0,0); -} - -int _stat(const char *file, struct stat *st) -{ - return syscall(SYSCALL_STAT,file,st,0); -} - -int _lstat(const char *file, struct stat *st) -{ - return syscall(SYSCALL_LSTAT,file,st,0); -} - -int _fstat(int file, struct stat *st) -{ - return syscall(SYSCALL_FSTAT,file,st,0); -} |
