diff options
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/chdir.c | 7 | ||||
-rw-r--r-- | sys/src/close.c | 7 | ||||
-rw-r--r-- | sys/src/dup.c | 7 | ||||
-rw-r--r-- | sys/src/internal.h | 21 | ||||
-rw-r--r-- | sys/src/mmap.c | 1 | ||||
-rw-r--r-- | sys/src/open.c | 7 | ||||
-rw-r--r-- | sys/src/read.c | 7 | ||||
-rw-r--r-- | sys/src/write.c | 7 |
8 files changed, 64 insertions, 0 deletions
diff --git a/sys/src/chdir.c b/sys/src/chdir.c new file mode 100644 index 0000000..fd1385d --- /dev/null +++ b/sys/src/chdir.c @@ -0,0 +1,7 @@ +#include "internal.h" + +int +sys·chdir(char *path) +{ + return syscall(·Chdir, path); +} diff --git a/sys/src/close.c b/sys/src/close.c new file mode 100644 index 0000000..88b1e2b --- /dev/null +++ b/sys/src/close.c @@ -0,0 +1,7 @@ +#include "internal.h" + +int +sys·close(int fd) +{ + return syscall(·Close, fd); +} diff --git a/sys/src/dup.c b/sys/src/dup.c new file mode 100644 index 0000000..0943f52 --- /dev/null +++ b/sys/src/dup.c @@ -0,0 +1,7 @@ +#include "internal.h" + +int +sys·dup(int fd) +{ + return syscall(·Dup, fd); +} diff --git a/sys/src/internal.h b/sys/src/internal.h new file mode 100644 index 0000000..2bb1422 --- /dev/null +++ b/sys/src/internal.h @@ -0,0 +1,21 @@ +#pragma once + +#include <u.h> +#include <internal/syscall.h> + +#define syscall1(n,a1) _syscall1(n,sysarg(a1)) +#define syscall2(n,a1,a2) _syscall2(n,sysarg(a1),sysarg(a2)) +#define syscall3(n,a1,a2,a3) _syscall3(n,sysarg(a1),sysarg(a2),sysarg(a3)) +#define syscall4(n,a1,a2,a3,a4) _syscall4(n,sysarg(a1),sysarg(a2),sysarg(a3),sysarg(a4)) +#define syscall5(n,a1,a2,a3,a4,a5) _syscall5(n,sysarg(a1),sysarg(a2),sysarg(a3),sysarg(a4),sysarg(a5)) +#define syscall6(n,a1,a2,a3,a4,a5,a6) _syscall6(n,sysarg(a1),sysarg(a2),sysarg(a3),sysarg(a4),sysarg(a5),sysarg(a6)) +#define syscall7(n,a1,a2,a3,a4,a5,a6,a7) _syscall7(n,sysarg(a1),sysarg(a2),sysarg(a3),sysarg(a4),sysarg(a5),sysarg(a6),sysarg(a7)) + +#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n +#define __SYSCALL_NARGS(...) __SYSCALL_NARGS_X(__VA_ARGS__,7,6,5,4,3,2,1,0,) +#define __SYSCALL_CONCAT_X(a,b) a##b +#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X(a,b) +#define __SYSCALL_DISP(b,...) __SYSCALL_CONCAT(b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) + +#define syscall(...) __SYSCALL_DISP(syscall,__VA_ARGS__) + diff --git a/sys/src/mmap.c b/sys/src/mmap.c new file mode 100644 index 0000000..fb5c5f4 --- /dev/null +++ b/sys/src/mmap.c @@ -0,0 +1 @@ +#include "internal.h" diff --git a/sys/src/open.c b/sys/src/open.c new file mode 100644 index 0000000..02d2ca8 --- /dev/null +++ b/sys/src/open.c @@ -0,0 +1,7 @@ +#include "internal.h" + +int +sys·open(char *path, int flag, int mode) +{ + return syscall(·Open, flag, mode); +} diff --git a/sys/src/read.c b/sys/src/read.c new file mode 100644 index 0000000..3aa3e29 --- /dev/null +++ b/sys/src/read.c @@ -0,0 +1,7 @@ +#include "internal.h" + +intptr +sys·read(int fd, intptr len, void *buf) +{ + return syscall(·Read, fd, buf, len); +} diff --git a/sys/src/write.c b/sys/src/write.c new file mode 100644 index 0000000..c1faff5 --- /dev/null +++ b/sys/src/write.c @@ -0,0 +1,7 @@ +#include "internal.h" + +intptr +sys·write(int fd, intptr size, intptr len, void *buf) +{ + return syscall(·Write, fd, buf, size*len); +} |