8e17324c0ba8a260da8490a6e89c39e7028a245a
[lunaix-os.git] / lunaix-os / usr / libc / src / posix / unistd.c
1 #include <lunaix/syscall.h>
2 #include <lunaix/types.h>
3
4 pid_t
5 fork()
6 {
7     return do_lunaix_syscall(__SYSCALL_fork);
8 }
9
10 int
11 brk(void* addr)
12 {
13     return do_lunaix_syscall(__SYSCALL_brk, addr);
14 }
15
16 void*
17 sbrk(ssize_t size)
18 {
19     return (void*)do_lunaix_syscall(__SYSCALL_sbrk, size);
20 }
21
22 pid_t
23 getpid()
24 {
25     return do_lunaix_syscall(__SYSCALL_getpid);
26 }
27
28 pid_t
29 getppid()
30 {
31     return do_lunaix_syscall(__SYSCALL_getppid);
32 }
33
34 pid_t
35 getpgid()
36 {
37     return do_lunaix_syscall(__SYSCALL_getpgid);
38 }
39
40 pid_t
41 setpgid(pid_t pid, pid_t pgid)
42 {
43     return do_lunaix_syscall(__SYSCALL_setpgid, pid, pgid);
44 }
45 void
46 _exit(int status)
47 {
48     do_lunaix_syscall(__SYSCALL__exit, status);
49 }
50
51 unsigned int
52 sleep(unsigned int seconds)
53 {
54     return do_lunaix_syscall(__SYSCALL_sleep, seconds);
55 }
56
57 int
58 pause()
59 {
60     return do_lunaix_syscall(__SYSCALL_pause);
61 }
62
63 unsigned int
64 alarm(unsigned int seconds)
65 {
66     return do_lunaix_syscall(__SYSCALL_alarm, seconds);
67 }
68
69 int
70 link(const char* oldpath, const char* newpath)
71 {
72     return do_lunaix_syscall(__SYSCALL_link, oldpath, newpath);
73 }
74
75 int
76 rmdir(const char* pathname)
77 {
78     return do_lunaix_syscall(__SYSCALL_rmdir, pathname);
79 }
80
81 int
82 read(int fd, void* buf, size_t count)
83 {
84     return do_lunaix_syscall(__SYSCALL_read, fd, buf, count);
85 }
86
87 int
88 write(int fd, void* buf, size_t count)
89 {
90     return do_lunaix_syscall(__SYSCALL_write, fd, buf, count);
91 }
92
93 int
94 readlink(const char* path, char* buf, size_t size)
95 {
96     return do_lunaix_syscall(__SYSCALL_readlink, path, buf, size);
97 }
98
99 int
100 lseek(int fd, off_t offset, int options)
101 {
102     return do_lunaix_syscall(__SYSCALL_lseek, fd, offset, options);
103 }
104
105 int
106 unlink(const char* pathname)
107 {
108     return do_lunaix_syscall(__SYSCALL_unlink, pathname);
109 }
110
111 int
112 close(int fd)
113 {
114     return do_lunaix_syscall(__SYSCALL_close, fd);
115 }
116
117 int
118 dup2(int oldfd, int newfd)
119 {
120     return do_lunaix_syscall(__SYSCALL_dup2, oldfd, newfd);
121 }
122
123 int
124 dup(int oldfd)
125 {
126     return do_lunaix_syscall(__SYSCALL_dup, oldfd);
127 }
128
129 int
130 fsync(int fildes)
131 {
132     return do_lunaix_syscall(__SYSCALL_fsync, fildes);
133 }
134
135 int
136 symlink(const char* pathname, const char* link_target)
137 {
138     return do_lunaix_syscall(__SYSCALL_symlink, pathname, link_target);
139 }
140
141 int
142 chdir(const char* path)
143 {
144     return do_lunaix_syscall(__SYSCALL_chdir, path);
145 }
146
147 int
148 fchdir(int fd)
149 {
150     return do_lunaix_syscall(__SYSCALL_fchdir, fd);
151 }
152
153 char*
154 getcwd(char* buf, size_t size)
155 {
156     return (char*)do_lunaix_syscall(__SYSCALL_getcwd, buf, size);
157 }
158
159 int
160 rename(const char* oldpath, const char* newpath)
161 {
162     return do_lunaix_syscall(__SYSCALL_rename, oldpath, newpath);
163 }
164
165 int
166 getxattr(const char* path, const char* name, void* value, size_t len)
167 {
168     return do_lunaix_syscall(__SYSCALL_getxattr, path, name, value, len);
169 }
170
171 int
172 setxattr(const char* path, const char* name, void* value, size_t len)
173 {
174     return do_lunaix_syscall(__SYSCALL_setxattr, path, name, value, len);
175 }
176
177 int
178 fgetxattr(int fd, const char* name, void* value, size_t len)
179 {
180     return do_lunaix_syscall(__SYSCALL_fgetxattr, fd, name, value, len);
181 }
182
183 int
184 fsetxattr(int fd, const char* name, void* value, size_t len)
185 {
186     return do_lunaix_syscall(__SYSCALL_fsetxattr, fd, name, value, len);
187 }
188
189 int
190 readlinkat(int dirfd, const char* pathname, char* buf, size_t size)
191 {
192     return do_lunaix_syscall(__SYSCALL_readlinkat, dirfd, pathname, buf, size);
193 }
194
195 int
196 unlinkat(int fd, const char* pathname)
197 {
198     return do_lunaix_syscall(__SYSCALL_unlinkat, fd, pathname);
199 }
200
201 int
202 mkdir(const char* path)
203 {
204     return do_lunaix_syscall(__SYSCALL_mkdir, path);
205 }
206
207 int
208 execve(const char* filename, const char** argv, const char** envp)
209 {
210     return do_lunaix_syscall(__SYSCALL_execve, filename, argv, envp);
211 }