diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-02-23 15:22:33 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-02-23 15:22:33 -0500 |
commit | 1221e834f49adb91eb0b7443a57274f2611459c2 (patch) | |
tree | 7afb7ed5a203ddefd5559005af7ec61d801b972e /src/unistd | |
parent | f546f27d1fdb8d2663b2fbb130f53ee32cac90b0 (diff) |
compile in current environment
Diffstat (limited to 'src/unistd')
-rw-r--r-- | src/unistd/_exit.c | 2 | ||||
-rw-r--r-- | src/unistd/chdir.c | 2 | ||||
-rw-r--r-- | src/unistd/chown.c | 2 | ||||
-rw-r--r-- | src/unistd/close.c | 2 | ||||
-rw-r--r-- | src/unistd/confstr.c | 4 | ||||
-rw-r--r-- | src/unistd/execve.c | 4 | ||||
-rw-r--r-- | src/unistd/fork.c | 2 | ||||
-rw-r--r-- | src/unistd/getcwd.c | 10 | ||||
-rw-r--r-- | src/unistd/getgroups.c | 2 | ||||
-rw-r--r-- | src/unistd/getopt.c | 1 | ||||
-rw-r--r-- | src/unistd/isatty.c | 8 | ||||
-rw-r--r-- | src/unistd/link.c | 2 | ||||
-rw-r--r-- | src/unistd/lseek.c | 2 | ||||
-rw-r--r-- | src/unistd/optarg.c | 1 | ||||
-rw-r--r-- | src/unistd/opterr.c | 1 | ||||
-rw-r--r-- | src/unistd/optind.c | 1 | ||||
-rw-r--r-- | src/unistd/optopt.c | 1 | ||||
-rw-r--r-- | src/unistd/pause.c | 3 | ||||
-rw-r--r-- | src/unistd/pipe.c | 2 | ||||
-rw-r--r-- | src/unistd/read.c | 2 | ||||
-rw-r--r-- | src/unistd/rmdir.c | 2 | ||||
-rw-r--r-- | src/unistd/setgid.c | 3 | ||||
-rw-r--r-- | src/unistd/setpgid.c | 2 | ||||
-rw-r--r-- | src/unistd/setsid.c | 2 | ||||
-rw-r--r-- | src/unistd/setuid.c | 2 | ||||
-rw-r--r-- | src/unistd/unlink.c | 2 | ||||
-rw-r--r-- | src/unistd/write.c | 2 |
27 files changed, 30 insertions, 39 deletions
diff --git a/src/unistd/_exit.c b/src/unistd/_exit.c index fde6d675..4f1ef7e6 100644 --- a/src/unistd/_exit.c +++ b/src/unistd/_exit.c @@ -5,7 +5,7 @@ void _exit(int status) { - __libc.syscall(__libc.syscall_lookup("exit"), status); + __syscall(((syscall_lookup_t)__libc(SYSCALL_LOOKUP))("exit"), status); for (;;); } /* diff --git a/src/unistd/chdir.c b/src/unistd/chdir.c index 82dc997a..828487d3 100644 --- a/src/unistd/chdir.c +++ b/src/unistd/chdir.c @@ -5,7 +5,7 @@ int chdir(const char *path) { - SC(int, path); + SYSCALL("chdir", int, -1, path, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/chown.c b/src/unistd/chown.c index 55b32b07..08c52364 100644 --- a/src/unistd/chown.c +++ b/src/unistd/chown.c @@ -5,7 +5,7 @@ int chown(const char *path, uid_t owner, gid_t group) { - SC(int, path, owner, group); + SYSCALL("chown", int, -1, path, owner, group, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/close.c b/src/unistd/close.c index b4f402eb..3744aa86 100644 --- a/src/unistd/close.c +++ b/src/unistd/close.c @@ -5,7 +5,7 @@ int close(int fildes) { - SC(int, fildes); + SYSCALL("close", int, -1, fildes, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/confstr.c b/src/unistd/confstr.c index a0f57b30..0cf00319 100644 --- a/src/unistd/confstr.c +++ b/src/unistd/confstr.c @@ -1,13 +1,15 @@ +#include "sys/types.h" #include <unistd.h> #include "errno.h" #include "string.h" +#include "nonstd/assert.h" size_t confstr(int name, char *buf, size_t len) { char *value = NULL; if (len > 0) { - __ASSERT_NONNULL(buf); + ASSERT_NONNULL(buf); } switch (name) { diff --git a/src/unistd/execve.c b/src/unistd/execve.c index 7d54ec91..8d7a1225 100644 --- a/src/unistd/execve.c +++ b/src/unistd/execve.c @@ -5,8 +5,8 @@ int execve(const char *path, char *const argv[], char *const envp[]) { - SCNO(scno, "execve", -1); - errno = -__libc.syscall(scno, path, argv, envp); + SYSCALL_NUMBER(scno, "execve", -1); + errno = -__syscall(scno, path, argv, envp); return -1; } /* diff --git a/src/unistd/fork.c b/src/unistd/fork.c index 3da5c822..4efcc0f4 100644 --- a/src/unistd/fork.c +++ b/src/unistd/fork.c @@ -6,7 +6,7 @@ pid_t fork(void) { - SC0(pid_t); + SYSCALL("fork", pid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getcwd.c b/src/unistd/getcwd.c index e8e46a60..904e2c7d 100644 --- a/src/unistd/getcwd.c +++ b/src/unistd/getcwd.c @@ -1,20 +1,12 @@ -#include "stddef.h" #include "sys/types.h" #include <unistd.h> -#include "errno.h" #include "nonstd/assert.h" #include "nonstd/syscall.h" char * getcwd(char *buf, size_t size) { ASSERT_NONNULL(buf); - SCNO(scno, "getcwd", NULL); - int r = __libc.syscall(scno, buf, size); - if (r < 0) { - errno = -r; - return NULL; - } - return buf; + SYSCALL("getcwd", char *, NULL, buf, size, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getgroups.c b/src/unistd/getgroups.c index 1e1dd584..8af2634b 100644 --- a/src/unistd/getgroups.c +++ b/src/unistd/getgroups.c @@ -10,7 +10,7 @@ int getgroups(int gidsetsize, gid_t grouplist[]) if (gidsetsize != 0) { ASSERT_NONNULL(grouplist); } - SC(int, gidsetsize, grouplist); + SYSCALL("getgroups", int, -1, gidsetsize, grouplist, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/getopt.c b/src/unistd/getopt.c index 29fe5590..dc1803dd 100644 --- a/src/unistd/getopt.c +++ b/src/unistd/getopt.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include "string.h" #include "stdio.h" #include <unistd.h> diff --git a/src/unistd/isatty.c b/src/unistd/isatty.c index baafa508..1b502d75 100644 --- a/src/unistd/isatty.c +++ b/src/unistd/isatty.c @@ -6,13 +6,7 @@ int isatty(int fildes) { - SCNO(scno, "isatty", 0); - int r = __libc.syscall(scno, fildes); - if (r < 0) { - errno = -r; - return 0; - } - return r; + SYSCALL("isatty", int, -1, fildes, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/link.c b/src/unistd/link.c index 8960d1f1..96e1e7b4 100644 --- a/src/unistd/link.c +++ b/src/unistd/link.c @@ -5,7 +5,7 @@ int link(const char *path1, const char *path2) { - SC(int, path1, path2); + SYSCALL("link", int, -1, path1, path2, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c index 86436a9e..dd194761 100644 --- a/src/unistd/lseek.c +++ b/src/unistd/lseek.c @@ -5,7 +5,7 @@ off_t lseek(int fildes, off_t offset, int whence) { - SC(off_t, fildes, offset, whence); + SYSCALL("lseek", off_t, -1, fildes, offset, whence, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/optarg.c b/src/unistd/optarg.c index be7407c1..8eddca9d 100644 --- a/src/unistd/optarg.c +++ b/src/unistd/optarg.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include <unistd.h> char * optarg; /* diff --git a/src/unistd/opterr.c b/src/unistd/opterr.c index f5e831e4..68d44563 100644 --- a/src/unistd/opterr.c +++ b/src/unistd/opterr.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include <unistd.h> int opterr; /* diff --git a/src/unistd/optind.c b/src/unistd/optind.c index 8cd6e14b..b6cff979 100644 --- a/src/unistd/optind.c +++ b/src/unistd/optind.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include <unistd.h> int optind; /* diff --git a/src/unistd/optopt.c b/src/unistd/optopt.c index 7ab8471c..797f4fd9 100644 --- a/src/unistd/optopt.c +++ b/src/unistd/optopt.c @@ -1,3 +1,4 @@ +#include "sys/types.h" #include <unistd.h> int optopt; /* diff --git a/src/unistd/pause.c b/src/unistd/pause.c index 4ce5771c..41e25101 100644 --- a/src/unistd/pause.c +++ b/src/unistd/pause.c @@ -1,12 +1,11 @@ #include "stddef.h" #include "sys/types.h" #include <unistd.h> -#include "errno.h" #include "nonstd/syscall.h" int pause(void) { - SC0(int); + SYSCALL("pause", int, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/pipe.c b/src/unistd/pipe.c index 0ceb1181..5ab8b5e7 100644 --- a/src/unistd/pipe.c +++ b/src/unistd/pipe.c @@ -7,7 +7,7 @@ int pipe(int fildes[2]) { ASSERT_NONNULL(fildes); - SC(int, fildes); + SYSCALL("pipe", int, -1, fildes, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/read.c b/src/unistd/read.c index dd82ce9c..c44e406d 100644 --- a/src/unistd/read.c +++ b/src/unistd/read.c @@ -6,7 +6,7 @@ ssize_t read(int fildes, void *buf, size_t nbyte) { - SC(ssize_t, fildes, buf, nbyte); + SYSCALL("read", ssize_t, -1, fildes, buf, nbyte, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/rmdir.c b/src/unistd/rmdir.c index 2991dcbb..6c6df741 100644 --- a/src/unistd/rmdir.c +++ b/src/unistd/rmdir.c @@ -6,7 +6,7 @@ int rmdir(const char *path) { - SC(int, path); + SYSCALL("rmdir", int, -1, path, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/setgid.c b/src/unistd/setgid.c index 947df23e..79f9695b 100644 --- a/src/unistd/setgid.c +++ b/src/unistd/setgid.c @@ -1,12 +1,11 @@ #include "stddef.h" #include "sys/types.h" #include <unistd.h> -#include "errno.h" #include "nonstd/syscall.h" int setgid(gid_t gid) { - SC(int, gid); + SYSCALL("setgid", int, -1, gid, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c index 561dadf0..28769713 100644 --- a/src/unistd/setpgid.c +++ b/src/unistd/setpgid.c @@ -6,7 +6,7 @@ int setpgid(pid_t pid, pid_t pgid) { - SC(int, pid, pgid); + SYSCALL("setpgid", int, -1, pid, pgid, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/setsid.c b/src/unistd/setsid.c index 5c39fe0a..8c1aa0c7 100644 --- a/src/unistd/setsid.c +++ b/src/unistd/setsid.c @@ -5,7 +5,7 @@ pid_t setsid(void) { - SC0(pid_t); + SYSCALL("setsid", pid_t, -1, 0, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/setuid.c b/src/unistd/setuid.c index ce08fcef..4c6053df 100644 --- a/src/unistd/setuid.c +++ b/src/unistd/setuid.c @@ -5,7 +5,7 @@ int setuid(uid_t uid) { - SC(int, uid); + SYSCALL("setuid", int, -1, uid, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/unlink.c b/src/unistd/unlink.c index 38279888..09fc20b0 100644 --- a/src/unistd/unlink.c +++ b/src/unistd/unlink.c @@ -7,7 +7,7 @@ int unlink(const char *path) { ASSERT_NONNULL(path); - SC(int, path); + SYSCALL("unlink", int, -1, path, 0, 0, 0, 0, 0); } /* POSIX(1) diff --git a/src/unistd/write.c b/src/unistd/write.c index c591c279..352ef43f 100644 --- a/src/unistd/write.c +++ b/src/unistd/write.c @@ -9,7 +9,7 @@ ssize_t write(int fildes, const void *buf, size_t nbyte) if (nbyte != 0) { ASSERT_NONNULL(buf); } - SC(ssize_t, fildes, buf, nbyte); + SYSCALL("write", ssize_t, -1, fildes, buf, nbyte, 0, 0, 0); } /* POSIX(1) |