Framework for exporting system header to user space (#59)
[lunaix-os.git] / lunaix-os / usr / libc / src / posix / lunaix.c
1 #include <syscall.h>
2 #include <sys/types.h>
3 #include <stdio.h>
4
5 void
6 yield()
7 {
8     do_lunaix_syscall(__NR__lxsys_yield);
9 }
10
11 pid_t
12 wait(int* status)
13 {
14     return do_lunaix_syscall(__NR__lxsys_wait, status);
15 }
16
17 pid_t
18 waitpid(pid_t pid, int* status, int options)
19 {
20     return do_lunaix_syscall(__NR__lxsys_waitpid, pid, status, options);
21 }
22
23 void
24 syslog(int level, const char* fmt, ...)
25 {
26     char buf[1024];
27     va_list ap;
28     va_start(ap, fmt);
29
30     unsigned int size = vsnprintf(buf, 1024, fmt, ap);
31     do_lunaix_syscall(__NR__lxsys_syslog, level, buf, size);
32
33     va_end(ap);
34 }
35
36 int
37 realpathat(int fd, char* buf, size_t size)
38 {
39     return do_lunaix_syscall(__NR__lxsys_realpathat, fd, buf, size);
40 }