1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "fs.h"
#include "syscalls.h"
extern char **environ;
// TODO: errno!
int _readdir(const char *name,fs_dirent *dirs,int max)
{
return syscall(SYSCALL_READDIR,name,dirs,max);
}
int _poll(int file)
{
return syscall(SYSCALL_POLL,file,0,0);
}
void _exit(int ret)
{
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 _clone(void)
{
return syscall(SYSCALL_CLONE,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);
}
|