diff --git a/src/dirent/__getdents.c b/src/dirent/__getdents.c index dc373440b6e88db274398b50c05b09602abd1c62..1acd5a696aa66fa8dc51ce38086aa3f80d7e0bce 100644 --- a/src/dirent/__getdents.c +++ b/src/dirent/__getdents.c @@ -4,7 +4,7 @@ int __getdents(int fd, struct dirent *buf, size_t len) { - return syscall3(__NR_getdents, fd, (long)buf, len); + return syscall(SYS_getdents, fd, buf, len); } weak_alias(__getdents, getdents); diff --git a/src/fcntl/fcntl.c b/src/fcntl/fcntl.c index 464dbf00c18901a0d7640b147b1b6ab91bfe7712..ab0ebecf32d06051aa5aa3245d920e3db70385ad 100644 --- a/src/fcntl/fcntl.c +++ b/src/fcntl/fcntl.c @@ -14,7 +14,7 @@ int fcntl(int fd, int cmd, ...) va_end(ap); if (cmd == F_SETFL) arg |= O_LARGEFILE; if (cmd == F_SETLKW) CANCELPT_BEGIN; - r = __syscall_fcntl(fd, cmd, arg); + r = syscall(SYS_fcntl, fd, cmd, arg); if (cmd == F_SETLKW) CANCELPT_END; return r; } diff --git a/src/fcntl/open.c b/src/fcntl/open.c index 4c1a591d3f029e4f3a1db48822fddac9fac8d817..064d298c01bcd15cb461d6543282b9563b241f6f 100644 --- a/src/fcntl/open.c +++ b/src/fcntl/open.c @@ -13,7 +13,7 @@ int open(const char *filename, int flags, ...) mode = va_arg(ap, mode_t); va_end(ap); CANCELPT_BEGIN; - r = __syscall_open(filename, flags, mode); + r = syscall(SYS_open, filename, flags|O_LARGEFILE, mode); CANCELPT_END; return r; } diff --git a/src/fcntl/openat.c b/src/fcntl/openat.c index eefa09016e19a791886c020cebe43996c70304c9..1a2d95350fbe8f2c4bbd94e02a4068467038f364 100644 --- a/src/fcntl/openat.c +++ b/src/fcntl/openat.c @@ -13,7 +13,7 @@ int openat(int fd, const char *filename, int flags, ...) mode = va_arg(ap, mode_t); va_end(ap); CANCELPT_BEGIN; - r = syscall4(__NR_openat, fd, (long)filename, flags|O_LARGEFILE, mode); + r = syscall(SYS_openat, fd, filename, flags|O_LARGEFILE, mode); CANCELPT_END; return r; } diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 819aafe6f4e1c4eff0e8eb404cdb0424f77a88a1..39efc42de25cfdf45f7f9ba1164efd65340081da 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -5,28 +5,6 @@ #include -#define syscall0 syscall -#define syscall1 syscall -#define syscall2 syscall -#define syscall3 syscall -#define syscall4 syscall -#define syscall5 syscall -#define syscall6 syscall - #define socketcall __socketcall -/* the following are needed for iso c functions to use */ -#define __syscall_open(filename, flags, mode) syscall(__NR_open, (filename), (flags)|0100000, (mode)) -#define __syscall_read(fd, buf, len) syscall(__NR_read, (fd), (buf), (len)) -#define __syscall_write(fd, buf, len) syscall(__NR_write, (fd), (buf), (len)) -#define __syscall_close(fd) syscall(__NR_close, (fd)) -#define __syscall_fcntl(fd, cmd, arg) syscall(__NR_fcntl, (fd), (cmd), (arg)) -#define __syscall_dup2(old, new) syscall(__NR_dup2, (old), (new)) -#define __syscall_unlink(path) syscall(__NR_unlink, (path)) -#define __syscall_getpid() syscall(__NR_getpid) -#define __syscall_kill(pid,sig) syscall(__NR_kill, (pid), (sig)) -#define __syscall_sigaction(sig,new,old) syscall(__NR_rt_sigaction, (sig), (new), (old), 8) -#define __syscall_ioctl(fd,ioc,arg) syscall(__NR_ioctl, (fd), (ioc), (arg)) -#define __syscall_exit(code) syscall(__NR_exit, code) - #endif diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c index 7ada116bf5d90436c01d22eeb3f0ec477c7f0769..392a4aac2cfbbdfe94c529a96cb95d0470d9e014 100644 --- a/src/ipc/semctl.c +++ b/src/ipc/semctl.c @@ -11,8 +11,8 @@ int semctl(int id, int num, int cmd, ...) arg = va_arg(ap, long); va_end(ap); #ifdef __NR_semctl - return syscall4(__NR_semctl, id, num, cmd, arg); + return syscall(SYS_semctl, id, num, cmd, arg); #else - return syscall5(__NR_ipc, IPCOP_semctl, id, num, cmd | 0x100, (long)&arg); + return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | 0x100, &arg); #endif } diff --git a/src/ipc/semget.c b/src/ipc/semget.c index 2dcf6eac5f279913c47cf937f98e9b5f216abb89..530c75ffa26492509e3516542651ecbe8f69fe1c 100644 --- a/src/ipc/semget.c +++ b/src/ipc/semget.c @@ -5,8 +5,8 @@ int semget(key_t key, int n, int fl) { #ifdef __NR_semget - return syscall3(__NR_semget, key, n, fl); + return syscall(SYS_semget, key, n, fl); #else - return syscall4(__NR_ipc, IPCOP_semget, key, n, fl); + return syscall(SYS_ipc, IPCOP_semget, key, n, fl); #endif } diff --git a/src/ipc/semop.c b/src/ipc/semop.c index 48d8a6546666ea5eff4e1a3a2b6fd99f8b061a7a..15453406d39a45563f932473e53fe2a558376349 100644 --- a/src/ipc/semop.c +++ b/src/ipc/semop.c @@ -5,8 +5,8 @@ int semop(int id, struct sembuf *buf, size_t n) { #ifdef __NR_semop - return syscall3(__NR_semop, id, (long)buf, n); + return syscall(SYS_semop, id, buf, n); #else - return syscall5(__NR_ipc, IPCOP_semop, id, n, 0, (long)buf); + return syscall(SYS_ipc, IPCOP_semop, id, n, 0, buf); #endif } diff --git a/src/ipc/shmat.c b/src/ipc/shmat.c index 98a2cd4288b31964817000527e00c43c6ca43118..c6ee4007a786855b41531f0a04679561d7493f32 100644 --- a/src/ipc/shmat.c +++ b/src/ipc/shmat.c @@ -5,13 +5,13 @@ #ifdef __NR_shmat void *shmat(int id, const void *addr, int flag) { - return (void *)syscall3(__NR_shmat, id, (long)addr, flag); + return (void *)syscall(SYS_shmat, id, addr, flag); } #else void *shmat(int id, const void *addr, int flag) { unsigned long ret; - ret = syscall5(__NR_ipc, IPCOP_shmat, id, flag, (long)&addr, (long)addr); + ret = syscall(SYS_ipc, IPCOP_shmat, id, flag, &addr, addr); return (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)addr; } #endif diff --git a/src/ipc/shmctl.c b/src/ipc/shmctl.c index da357fa86f499dafe8dbfbaacf48f4b198858f58..3645fe2d8d1010061973e000332deb136b9026e8 100644 --- a/src/ipc/shmctl.c +++ b/src/ipc/shmctl.c @@ -5,8 +5,8 @@ int shmctl(int id, int cmd, struct shmid_ds *buf) { #ifdef __NR_shmctl - return syscall3(__NR_shmctl, id, cmd, (long)buf); + return syscall(SYS_shmctl, id, cmd, buf); #else - return syscall4(__NR_ipc, IPCOP_shmctl, id, cmd | IPC_MODERN, (long)buf); + return syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_MODERN, buf); #endif } diff --git a/src/ipc/shmdt.c b/src/ipc/shmdt.c index e04188f9cde4d5c022f47524d4e9fb55ac991c32..b4c9e69fe62bc872bef5707ff1379a5b270ecd2a 100644 --- a/src/ipc/shmdt.c +++ b/src/ipc/shmdt.c @@ -5,8 +5,8 @@ int shmdt(const void *addr) { #ifdef __NR_shmdt - return syscall1(__NR_shmdt, (long)addr); + return syscall(SYS_shmdt, addr); #else - return syscall2(__NR_ipc, IPCOP_shmdt, (long)addr); + return syscall(SYS_ipc, IPCOP_shmdt, addr); #endif } diff --git a/src/ipc/shmget.c b/src/ipc/shmget.c index 86e254afe80153f9dfeb488a9e4f0a57df9eef22..9b14f8d37c064a0addd4ba652eabf10030381785 100644 --- a/src/ipc/shmget.c +++ b/src/ipc/shmget.c @@ -5,8 +5,8 @@ int shmget(key_t key, size_t size, int flag) { #ifdef __NR_shmget - return syscall3(__NR_shmget, key, size, flag); + return syscall(SYS_shmget, key, size, flag); #else - return syscall4(__NR_ipc, IPCOP_shmget, key, size, flag); + return syscall(SYS_ipc, IPCOP_shmget, key, size, flag); #endif } diff --git a/src/linux/brk.c b/src/linux/brk.c index 3c2982c6830fd93f314bea441d0f0a988d028cac..9f63c5a8a39d88d28b89fcf4b29cfb9f7377049d 100644 --- a/src/linux/brk.c +++ b/src/linux/brk.c @@ -2,5 +2,5 @@ int brk(void *end) { - return -(syscall1(__NR_brk, (long)end) == -1); + return -(syscall(SYS_brk, end) == -1); } diff --git a/src/linux/chroot.c b/src/linux/chroot.c index 81363a6b48b2e157967531fcf6565d99c1261886..82b4fe75c6bd183aec7b95caa3ff00826f35ecf2 100644 --- a/src/linux/chroot.c +++ b/src/linux/chroot.c @@ -3,5 +3,5 @@ int chroot(const char *path) { - return syscall1(__NR_chroot, (long)path); + return syscall(SYS_chroot, path); } diff --git a/src/linux/epoll_create.c b/src/linux/epoll_create.c index c9dea8ce0d98ab240ef570026f3bc3b573dc1850..29d82999a8a8ec2f8cf4f36fb13a4190f87335b8 100644 --- a/src/linux/epoll_create.c +++ b/src/linux/epoll_create.c @@ -3,5 +3,5 @@ int epoll_create(int size) { - return syscall1(__NR_epoll_create, size); + return syscall(SYS_epoll_create, size); } diff --git a/src/linux/epoll_create1.c b/src/linux/epoll_create1.c index 2e82e995bf33a55e52af523811ce4485e10e411b..380b5dad7838a0c91a838ce015a54d0c70ce41a8 100644 --- a/src/linux/epoll_create1.c +++ b/src/linux/epoll_create1.c @@ -3,5 +3,5 @@ int epoll_create1(int flags) { - return syscall1(__NR_epoll_create1, flags); + return syscall(SYS_epoll_create1, flags); } diff --git a/src/linux/epoll_ctl.c b/src/linux/epoll_ctl.c index 4214f40782159746f9fe7eb42465e8aec2b8a0b2..da3e999b5d82a332ba034615682c92dc59c8bcd8 100644 --- a/src/linux/epoll_ctl.c +++ b/src/linux/epoll_ctl.c @@ -3,5 +3,5 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev) { - return syscall4(__NR_epoll_ctl, fd, op, fd2, (long)ev); + return syscall(SYS_epoll_ctl, fd, op, fd2, ev); } diff --git a/src/linux/epoll_pwait.c b/src/linux/epoll_pwait.c index 5aaacba671f25f8b45a6e6ae7304567f7400ee1b..39ad5b77c25379bbd50c493f7ba1c14d6a0c976e 100644 --- a/src/linux/epoll_pwait.c +++ b/src/linux/epoll_pwait.c @@ -3,5 +3,5 @@ int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs) { - return syscall6(__NR_epoll_pwait, fd, (long)ev, cnt, to, (long)sigs, 8); + return syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, 8); } diff --git a/src/linux/epoll_wait.c b/src/linux/epoll_wait.c index 8a68ebdd0a75caea92fa5140434a32ad9fcaa5a9..9d3924e044e4f0a8a655a2f2c7a278c226ca2891 100644 --- a/src/linux/epoll_wait.c +++ b/src/linux/epoll_wait.c @@ -3,5 +3,5 @@ int epoll_wait(int fd, struct epoll_event *ev, int cnt, int to) { - return syscall4(__NR_epoll_wait, fd, (long)ev, cnt, to); + return syscall(SYS_epoll_wait, fd, ev, cnt, to); } diff --git a/src/linux/inotify_add_watch.c b/src/linux/inotify_add_watch.c index 9973f161f75d66362263fe348911b6e6d71609d5..75f207d793ff2a8bb8ae3eaae3f5b2b600fb5000 100644 --- a/src/linux/inotify_add_watch.c +++ b/src/linux/inotify_add_watch.c @@ -3,5 +3,5 @@ int inotify_add_watch(int fd, const char *pathname, uint32_t mask) { - return syscall3(__NR_inotify_add_watch, fd, (long)pathname, mask); + return syscall(SYS_inotify_add_watch, fd, pathname, mask); } diff --git a/src/linux/inotify_init.c b/src/linux/inotify_init.c index d378460d7fdf384a0f3e1876a37db885d3427ce6..05070846df1dd1dcc1626791d5d8b5578133411b 100644 --- a/src/linux/inotify_init.c +++ b/src/linux/inotify_init.c @@ -3,5 +3,5 @@ int inotify_init() { - return syscall0(__NR_inotify_init); + return syscall(SYS_inotify_init); } diff --git a/src/linux/inotify_init1.c b/src/linux/inotify_init1.c index 5fad09468dcc99e4424215a03f7a871fe1df0477..6472a7b2be5ee796ebfe2d38af10652390d4d5e7 100644 --- a/src/linux/inotify_init1.c +++ b/src/linux/inotify_init1.c @@ -3,5 +3,5 @@ int inotify_init1(int flags) { - return syscall1(__NR_inotify_init1, flags); + return syscall(SYS_inotify_init1, flags); } diff --git a/src/linux/inotify_rm_watch.c b/src/linux/inotify_rm_watch.c index 0772d71931fb2409cd2451f309a7320ef6dc1a8b..cba597eba113ae8aca037a8d7c5d1633122dedf6 100644 --- a/src/linux/inotify_rm_watch.c +++ b/src/linux/inotify_rm_watch.c @@ -3,5 +3,5 @@ int inotify_rm_watch(int fd, uint32_t wd) { - return syscall2(__NR_inotify_rm_watch, fd, wd); + return syscall(SYS_inotify_rm_watch, fd, wd); } diff --git a/src/linux/klogctl.c b/src/linux/klogctl.c index 976f29e3887b6ebf605bea6b5ad251a1f5b26ddd..209ae7421b0088fc3238eed2573cfab9e30358ac 100644 --- a/src/linux/klogctl.c +++ b/src/linux/klogctl.c @@ -2,5 +2,5 @@ int klogctl (int type, char *buf, int len) { - return syscall3(__NR_syslog, type, (long)buf, len); + return syscall(SYS_syslog, type, buf, len); } diff --git a/src/linux/mount.c b/src/linux/mount.c index 8e3cc122ea4a7e9d85397c6916bb59304376da4a..83a8db44168b2ca99ea8d837b2a59e0e08dab7c4 100644 --- a/src/linux/mount.c +++ b/src/linux/mount.c @@ -3,5 +3,5 @@ int mount(const char *special, const char *dir, const char *fstype, unsigned long flags, const void *data) { - return syscall5(__NR_mount, (long)special, (long)dir, (long)fstype, flags, (long)data); + return syscall(SYS_mount, special, dir, fstype, flags, data); } diff --git a/src/linux/prctl.c b/src/linux/prctl.c index d55168303c3150a2f9b1e4d667446f5aed38c163..1f8589e16d0d42d4fec4d48ebce6a9ce59251435 100644 --- a/src/linux/prctl.c +++ b/src/linux/prctl.c @@ -9,5 +9,5 @@ int prctl(int op, ...) va_list ap; va_start(ap, op); for (i=0; i<4; i++) x[i] = va_arg(ap, unsigned long); - return syscall5(__NR_prctl, op, x[0], x[1], x[2], x[3]); + return syscall(SYS_prctl, op, x[0], x[1], x[2], x[3]); } diff --git a/src/linux/sbrk.c b/src/linux/sbrk.c index 56f60d1b492540ea8145353e349b7562dfa2b90d..b2943a9239533967b1f8468dc607804b31335b0d 100644 --- a/src/linux/sbrk.c +++ b/src/linux/sbrk.c @@ -3,5 +3,5 @@ void *sbrk(ptrdiff_t inc) { - return (void *)syscall1(__NR_brk, syscall1(__NR_brk, 0)+inc); + return (void *)syscall(SYS_brk, syscall(SYS_brk, 0)+inc); } diff --git a/src/linux/sendfile.c b/src/linux/sendfile.c index bfbc40ae61d4da817ae7784527fa056dabb1e31f..818b19d31d4018257e99cfbb9a178cf3f551834f 100644 --- a/src/linux/sendfile.c +++ b/src/linux/sendfile.c @@ -4,7 +4,7 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *ofs, size_t count) { - return syscall4(__NR_sendfile, out_fd, in_fd, (long)ofs, count); + return syscall(SYS_sendfile, out_fd, in_fd, ofs, count); } LFS64(sendfile); diff --git a/src/linux/setgroups.c b/src/linux/setgroups.c index 4d578013d7cd15e3b7ba14720dbcd5d036028fbc..bdee58d5d9b060f53d6dfb66bbead4592d1b89d3 100644 --- a/src/linux/setgroups.c +++ b/src/linux/setgroups.c @@ -3,5 +3,5 @@ int setgroups(int count, const gid_t list[]) { - return syscall2(__NR_setgroups, count, (long)list); + return syscall(SYS_setgroups, count, list); } diff --git a/src/linux/sethostname.c b/src/linux/sethostname.c index c94325e605f5e4da4a78217de2aaf06fe7ea8a58..79a87078c936e7c71707eaef23668cdf798a93d5 100644 --- a/src/linux/sethostname.c +++ b/src/linux/sethostname.c @@ -3,5 +3,5 @@ int sethostname(const char *name, size_t len) { - return syscall2(__NR_sethostname, (long)name, len); + return syscall(SYS_sethostname, name, len); } diff --git a/src/linux/settimeofday.c b/src/linux/settimeofday.c index bd7e41046bda0964adfaa1f56699768e2e86e4b6..d741f66bcdfaf056a7f0efb1ae51377c12ac4e53 100644 --- a/src/linux/settimeofday.c +++ b/src/linux/settimeofday.c @@ -3,5 +3,5 @@ int settimeofday(const struct timeval *tv, void *tz) { - return syscall2(__NR_settimeofday, (long)tv, 0); + return syscall(SYS_settimeofday, tv, 0); } diff --git a/src/linux/signalfd.c b/src/linux/signalfd.c index ecda263e32a749566f3a7066da282a6b8b8b16d4..99c35143b52caace1281f7dbbc40f87f5d921b53 100644 --- a/src/linux/signalfd.c +++ b/src/linux/signalfd.c @@ -3,5 +3,5 @@ int signalfd(int fd, const sigset_t *sigs, int flags) { - return syscall3(__NR_signalfd, fd, (long)sigs, 8); + return syscall(SYS_signalfd, fd, sigs, 8); } diff --git a/src/linux/swapoff.c b/src/linux/swapoff.c index 4f19823fc1a0ca171ecad924e3e4733a549c7aa0..9f95e82d42743d2bedb8e289587c7bb026b32cc3 100644 --- a/src/linux/swapoff.c +++ b/src/linux/swapoff.c @@ -3,5 +3,5 @@ int swapoff(const char *path) { - return syscall1(__NR_swapoff, (long)path); + return syscall(SYS_swapoff, path); } diff --git a/src/linux/swapon.c b/src/linux/swapon.c index 5c75247fcb30e283efd9b20f4de5863334903ba6..2b40a30bfddbb54ebb4ba038f0b9a3cd00bb8739 100644 --- a/src/linux/swapon.c +++ b/src/linux/swapon.c @@ -3,5 +3,5 @@ int swapon(const char *path, int flags) { - return syscall2(__NR_swapon, (long)path, flags); + return syscall(SYS_swapon, path, flags); } diff --git a/src/linux/sysinfo.c b/src/linux/sysinfo.c index c61b7aa8c4432c4bc5f3ba6a9e12194b6033da71..2dbd0ad9237c0147834b81dc6ae44dbb548590c2 100644 --- a/src/linux/sysinfo.c +++ b/src/linux/sysinfo.c @@ -4,5 +4,5 @@ struct sysinfo; int sysinfo(struct sysinfo *info) { - return syscall1(__NR_sysinfo, (long)info); + return syscall(SYS_sysinfo, info); } diff --git a/src/linux/umount.c b/src/linux/umount.c index f709b33a92db4e631a6dceb748aba97690956499..fb9b5e73915d051dc197ede30b86cd79d661cb40 100644 --- a/src/linux/umount.c +++ b/src/linux/umount.c @@ -3,5 +3,5 @@ int umount(const char *special) { - return syscall2(__NR_umount2, (long)special, 0); + return syscall(SYS_umount2, special, 0); } diff --git a/src/linux/umount2.c b/src/linux/umount2.c index ff0803c1f3705bac7a8ffbba42b1b48310e1b73b..25ad057cda35fdc8fc73419819e0b654bedba9e2 100644 --- a/src/linux/umount2.c +++ b/src/linux/umount2.c @@ -3,5 +3,5 @@ int umount2(const char *special, int flags) { - return syscall2(__NR_umount2, (long)special, flags); + return syscall(SYS_umount2, special, flags); } diff --git a/src/linux/utimes.c b/src/linux/utimes.c index 59ee1a81a811c542dcd4f0aca9127836c34c3c76..d998b401d8db0ada06baffdad37fd38e91dfa430 100644 --- a/src/linux/utimes.c +++ b/src/linux/utimes.c @@ -3,10 +3,5 @@ int utimes(const char *path, const struct timeval times[2]) { - long ktimes[2]; - if (times) { - ktimes[0] = times[0].tv_sec; - ktimes[1] = times[1].tv_sec; - } - return syscall2(__NR_utime, (long)path, times ? (long)ktimes : 0); + return syscall(SYS_utime, path, times); } diff --git a/src/linux/wait4.c b/src/linux/wait4.c index 252beb0c917627454ff04d550502e11f3159b291..b3ae75e3229dc92c9af09eddd0cd4408913fcf2d 100644 --- a/src/linux/wait4.c +++ b/src/linux/wait4.c @@ -6,5 +6,5 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *usage) { - return syscall4(__NR_wait4, pid, (long)status, options, (long)usage); + return syscall(SYS_wait4, pid, status, options, usage); } diff --git a/src/malloc/__brk.c b/src/malloc/__brk.c index e3b3af31d39d49afeab95c846702767cc074bbd2..0b561ea046c161a252699495e30eb921b203caf5 100644 --- a/src/malloc/__brk.c +++ b/src/malloc/__brk.c @@ -3,5 +3,5 @@ uintptr_t __brk(uintptr_t newbrk) { - return syscall1(__NR_brk, newbrk); + return syscall(SYS_brk, newbrk); } diff --git a/src/misc/getpriority.c b/src/misc/getpriority.c index 2fb26b2bc44be995b2558b6bdbf521cc4589b8bb..5c0b1682b69a66e52edd33e9761bf0d7f51c92de 100644 --- a/src/misc/getpriority.c +++ b/src/misc/getpriority.c @@ -3,7 +3,7 @@ int getpriority(int which, id_t who) { - int ret = syscall2(__NR_getpriority, which, who); + int ret = syscall(SYS_getpriority, which, who); if (ret < 0) return ret; return 20-ret; } diff --git a/src/misc/getrlimit.c b/src/misc/getrlimit.c index 84a659d4cf9552a5d8f2a5b2717024f83f5fe937..1383525764f4d0ff6930db37029fe106591c917e 100644 --- a/src/misc/getrlimit.c +++ b/src/misc/getrlimit.c @@ -5,7 +5,7 @@ int getrlimit(int resource, struct rlimit *rlim) { long k_rlim[2]; - if (syscall2(__NR_getrlimit, resource, (long)k_rlim) < 0) + if (syscall(SYS_getrlimit, resource, k_rlim) < 0) return -1; rlim->rlim_cur = k_rlim[0] == -1 ? -1 : (unsigned long)k_rlim[0]; rlim->rlim_max = k_rlim[1] == -1 ? -1 : (unsigned long)k_rlim[1]; diff --git a/src/misc/getrusage.c b/src/misc/getrusage.c index 1b8850f99582ccbbbbe308e82824cb36c79b5d54..a5cbd757dbf3a5f8cd7682adf289e44206d42fd7 100644 --- a/src/misc/getrusage.c +++ b/src/misc/getrusage.c @@ -2,19 +2,7 @@ #include #include "syscall.h" -/* this is a huge hack to make up for the kernel's stupid 32bit time_t - * without having to recopy the whole rusage structure ourselves.. */ - int getrusage(int who, struct rusage *ru) { - struct { long tv_sec, tv_usec; } ktv[2]; - char *fakeaddr = ((char *)ru + sizeof(struct timeval [2]) - sizeof ktv); - if (syscall2(__NR_getrusage, who, (long)fakeaddr) < 0) - return -1; - memcpy(ktv, fakeaddr, sizeof ktv); - ru->ru_utime.tv_sec = ktv[0].tv_sec; - ru->ru_utime.tv_usec = ktv[0].tv_usec; - ru->ru_stime.tv_sec = ktv[1].tv_sec; - ru->ru_stime.tv_usec = ktv[1].tv_usec; - return 0; + return syscall(SYS_getrusage, who, ru); } diff --git a/src/misc/ioctl.c b/src/misc/ioctl.c index 808b7c9c0f3a38ddd0c03f7261aa9f4fc7b8b9b4..5a41f0e846456e5647500c0da4c23f5b39065dc6 100644 --- a/src/misc/ioctl.c +++ b/src/misc/ioctl.c @@ -9,5 +9,5 @@ int ioctl(int fd, int req, ...) va_start(ap, req); arg = va_arg(ap, void *); va_end(ap); - return syscall3(__NR_ioctl, fd, req, (long)arg); + return syscall(SYS_ioctl, fd, req, arg); } diff --git a/src/misc/sched_yield.c b/src/misc/sched_yield.c index 8a68519e4720ae48fbff634113913b85f30525c9..6c0742b4ec0c0e00da44b5db1d19220f97baacaa 100644 --- a/src/misc/sched_yield.c +++ b/src/misc/sched_yield.c @@ -4,7 +4,7 @@ int __yield() { - return syscall0(__NR_sched_yield); + return syscall(SYS_sched_yield); } weak_alias(__yield, sched_yield); diff --git a/src/misc/setpriority.c b/src/misc/setpriority.c index 26da4b8380a965dfe8cd620dcd48e2a0186648c1..866b3b6edeee3716e344e14d85182521ac957ec1 100644 --- a/src/misc/setpriority.c +++ b/src/misc/setpriority.c @@ -3,5 +3,5 @@ int setpriority(int which, id_t who, int prio) { - return syscall3(__NR_getpriority, which, who, prio); + return syscall(SYS_getpriority, which, who, prio); } diff --git a/src/misc/setrlimit.c b/src/misc/setrlimit.c index 7fdfc4e596d808eac7eadb8b908c712fd5b19d84..68bd9d749fc5954aacb12bbb675675f4662cc153 100644 --- a/src/misc/setrlimit.c +++ b/src/misc/setrlimit.c @@ -5,7 +5,7 @@ int setrlimit(int resource, const struct rlimit *rlim) { long k_rlim[2] = { rlim->rlim_cur, rlim->rlim_max }; - return syscall2(__NR_setrlimit, resource, (long)k_rlim); + return syscall(SYS_setrlimit, resource, k_rlim); } LFS64(setrlimit); diff --git a/src/misc/uname.c b/src/misc/uname.c index fbe866435ed193446f80bd273b2f4e38c3094a51..46db90d30bf7a32f87085db5d5e57ddba4992a69 100644 --- a/src/misc/uname.c +++ b/src/misc/uname.c @@ -4,5 +4,5 @@ int uname(struct utsname *uts) { - return syscall1(__NR_uname, (long)uts); + return syscall(SYS_uname, uts); } diff --git a/src/mman/madvise.c b/src/mman/madvise.c index f03647ca0449f049a0681eb6d9bf9d1e2e868a09..f80926bec487584edb2cade5b6cdc8009df61e07 100644 --- a/src/mman/madvise.c +++ b/src/mman/madvise.c @@ -4,7 +4,7 @@ int __madvise(void *addr, size_t len, int advice) { - return syscall3(__NR_madvise, (long)addr, len, advice); + return syscall(SYS_madvise, addr, len, advice); } weak_alias(__madvise, madvise); diff --git a/src/mman/mlock.c b/src/mman/mlock.c index 3c7c653c94bfc2b73ef7b5842f1d5818159fbee3..e683a44aefc97ca1ec72036c46eec5ff754c9b92 100644 --- a/src/mman/mlock.c +++ b/src/mman/mlock.c @@ -3,5 +3,5 @@ int mlock(const void *addr, size_t len) { - return syscall2(__NR_mlock, (long)addr, len); + return syscall(SYS_mlock, addr, len); } diff --git a/src/mman/mlockall.c b/src/mman/mlockall.c index 782fc9db3870e57b9e8c86900b768ce785fc60e7..0ba4e662c8fa42a0bfb213f0ca411cb40826bf22 100644 --- a/src/mman/mlockall.c +++ b/src/mman/mlockall.c @@ -3,5 +3,5 @@ int mlockall(int flags) { - return syscall1(__NR_mlockall, flags); + return syscall(SYS_mlockall, flags); } diff --git a/src/mman/mmap.c b/src/mman/mmap.c index 5be6e12de13abaaae2f3af473d6c559216e4821f..0b092ae24747b8f7c89cbc4816470a3e8dc1d5d1 100644 --- a/src/mman/mmap.c +++ b/src/mman/mmap.c @@ -11,9 +11,9 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) if (((long)off & 0xfff) | ((long)((unsigned long long)off>>(12 + 8*(sizeof(off_t)-sizeof(long)))))) start = (void *)-1; #ifdef __NR_mmap2 - return (void *)syscall6(__NR_mmap2, (long)start, len, prot, flags, fd, off>>12); + return (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off>>12); #else - return (void *)syscall6(__NR_mmap, (long)start, len, prot, flags, fd, off); + return (void *)syscall(SYS_mmap, start, len, prot, flags, fd, off); #endif } diff --git a/src/mman/mprotect.c b/src/mman/mprotect.c index 11d5e23110156e60c71a217a484fdee44d8a3c21..1db2aea2f127afeab663822b839981a36e9220f1 100644 --- a/src/mman/mprotect.c +++ b/src/mman/mprotect.c @@ -3,5 +3,5 @@ int mprotect(void *addr, size_t len, int prot) { - return syscall3(__NR_mprotect, (long)addr, len, prot); + return syscall(SYS_mprotect, addr, len, prot); } diff --git a/src/mman/mremap.c b/src/mman/mremap.c index 78491ef472e4751cca015835cb020dece7abebde..596c45fbded8426fc0ef19e03c3de5943ae629d3 100644 --- a/src/mman/mremap.c +++ b/src/mman/mremap.c @@ -13,7 +13,7 @@ void *__mremap(void *old_addr, size_t old_len, size_t new_len, int flags, ...) new_addr = va_arg(ap, void *); va_end(ap); - return (void *)syscall5(__NR_mremap, (long)old_addr, old_len, new_len, flags, (long)new_addr); + return (void *)syscall(SYS_mremap, old_addr, old_len, new_len, flags, new_addr); } weak_alias(__mremap, mremap); diff --git a/src/mman/msync.c b/src/mman/msync.c index e0926470ad37f10011ca442e3bd20ab05c92e9c2..eaf35d3bcc0789586c695df007737aec069ce6ee 100644 --- a/src/mman/msync.c +++ b/src/mman/msync.c @@ -4,5 +4,5 @@ int msync(void *start, size_t len, int flags) { - return syscall3(__NR_msync, (long)start, len, flags); + return syscall(SYS_msync, start, len, flags); } diff --git a/src/mman/munlock.c b/src/mman/munlock.c index 0db59815ad859daea2cbb68eae21b7299575c4db..2cccef0c5077f1ec7085ff9bbd2158b4fe297033 100644 --- a/src/mman/munlock.c +++ b/src/mman/munlock.c @@ -3,5 +3,5 @@ int munlock(const void *addr, size_t len) { - return syscall2(__NR_munlock, (long)addr, len); + return syscall(SYS_munlock, addr, len); } diff --git a/src/mman/munlockall.c b/src/mman/munlockall.c index ce3e86cc15978198ee0dee227feb75f3a10c3c40..6e9d39d68480150d43c0e8e9d3c98544798328c5 100644 --- a/src/mman/munlockall.c +++ b/src/mman/munlockall.c @@ -3,5 +3,5 @@ int munlockall(void) { - return syscall0(__NR_munlockall); + return syscall(SYS_munlockall); } diff --git a/src/mman/munmap.c b/src/mman/munmap.c index c9661cda3354a56c5f96b854e007c6655f26a8d1..ab7da9e2013111f3d4494968361db2a8a935f812 100644 --- a/src/mman/munmap.c +++ b/src/mman/munmap.c @@ -5,7 +5,7 @@ int __munmap(void *start, size_t len) { - return syscall2(__NR_munmap, (long)start, len); + return syscall(SYS_munmap, start, len); } weak_alias(__munmap, munmap); diff --git a/src/process/execve.c b/src/process/execve.c index 2a0b62d623da6b36f70834b6649c8440dbf5aeac..70286a17397da61e6dc31ff6db7f0c4dd2e77ef4 100644 --- a/src/process/execve.c +++ b/src/process/execve.c @@ -4,5 +4,5 @@ int execve(const char *path, char *const argv[], char *const envp[]) { /* do we need to use environ if envp is null? */ - return syscall3(__NR_execve, (long)path, (long)argv, (long)envp); + return syscall(SYS_execve, path, argv, envp); } diff --git a/src/process/fork.c b/src/process/fork.c index 87e7dc96790b3e150c439034b1235d9d105fc54f..012b7ca59c0bb681df3715ff9c6a587870f18a1c 100644 --- a/src/process/fork.c +++ b/src/process/fork.c @@ -7,11 +7,11 @@ pid_t fork(void) { pid_t ret; if (libc.fork_handler) libc.fork_handler(-1); - ret = syscall0(__NR_fork); + ret = syscall(SYS_fork); if (libc.lock && !ret) { pthread_t self = __pthread_self(); - self->pid = syscall0(__NR_getpid); - self->tid = syscall0(__NR_gettid); + self->pid = syscall(SYS_getpid); + self->tid = syscall(SYS_gettid); libc.threads_minus_1 = 0; } if (libc.fork_handler) libc.fork_handler(!ret); diff --git a/src/process/vfork.c b/src/process/vfork.c index 32a7a6edceb7999ce5b67dd3f21eac59908a0351..a7dd86c82775bf42d284bb71e64390134f5ca616 100644 --- a/src/process/vfork.c +++ b/src/process/vfork.c @@ -4,5 +4,5 @@ pid_t vfork(void) { /* vfork syscall cannot be made from C code */ - return syscall0(__NR_fork); + return syscall(SYS_fork); } diff --git a/src/process/waitid.c b/src/process/waitid.c index 0ec0d55c2ec7ae18fc40e34c7741d1227aa661c6..b1e5e9b19013998cbcc044246d9a0fd9138af272 100644 --- a/src/process/waitid.c +++ b/src/process/waitid.c @@ -3,5 +3,5 @@ int waitid(idtype_t type, id_t id, siginfo_t *info, int options) { - return syscall5(__NR_waitid, type, id, (long)info, options, 0); + return syscall(SYS_waitid, type, id, info, options, 0); } diff --git a/src/process/waitpid.c b/src/process/waitpid.c index 0ddcd15a71c2d50cc2da2657a9db8a5efa7ec5bf..ec2757b3b30905310510668c6ed3f2f2d93b3a17 100644 --- a/src/process/waitpid.c +++ b/src/process/waitpid.c @@ -3,5 +3,5 @@ pid_t waitpid(pid_t pid, int *status, int options) { - return syscall4(__NR_wait4, pid, (long)status, options, 0); + return syscall(SYS_wait4, pid, status, options, 0); } diff --git a/src/select/poll.c b/src/select/poll.c index e92943e110704ec1a49903fb716f2301fc276e23..caceebaf08c819c2beae94d19416db78541dd3e9 100644 --- a/src/select/poll.c +++ b/src/select/poll.c @@ -6,7 +6,7 @@ int poll(struct pollfd *fds, nfds_t n, int timeout) { int r; CANCELPT_BEGIN; - r = syscall3(__NR_poll, (long)fds, n, timeout); + r = syscall(SYS_poll, fds, n, timeout); CANCELPT_END; return r; } diff --git a/src/select/pselect.c b/src/select/pselect.c index 795c5b0da03555cc9623e62efdc080852f6486a8..63ea0695dbfacda12c7a8e4d965dc70b1aecb751 100644 --- a/src/select/pselect.c +++ b/src/select/pselect.c @@ -9,7 +9,7 @@ int pselect(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, const struct timesp struct timespec ts_tmp; if (ts) ts_tmp = *ts; CANCELPT_BEGIN; - r = syscall6(__NR_pselect6, n, (long)rfds, (long)wfds, (long)efds, ts ? (long)&ts_tmp : 0, (long)data); + r = syscall(SYS_pselect6, n, rfds, wfds, efds, ts ? &ts_tmp : 0, data); CANCELPT_END; return r; } diff --git a/src/select/select.c b/src/select/select.c index b3946635f9d85d3cb2c8e37046fd73268912b4e4..12322718f9e1377ae608fc1dceafdefe66d6d12e 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -6,7 +6,7 @@ int select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv) { int r; CANCELPT_BEGIN; - r = syscall5(__NR_select, n, (long)rfds, (long)wfds, (long)efds, (long)tv); + r = syscall(SYS_select, n, rfds, wfds, efds, tv); CANCELPT_END; return r; } diff --git a/src/signal/getitimer.c b/src/signal/getitimer.c index 222d113e8602a82a6b2cd3f3001f60a16f54e2d3..8a8046a76b5c6511b8b8a81614622a39dd6ced97 100644 --- a/src/signal/getitimer.c +++ b/src/signal/getitimer.c @@ -3,10 +3,5 @@ int getitimer(int which, struct itimerval *old) { - int ret; - long kold[4]; - - if (!(ret = syscall2(__NR_getitimer, which, (long)&kold))) - *old = (struct itimerval){ { kold[0], kold[1] }, { kold[2], kold[3] } }; - return ret; + return syscall(SYS_getitimer, which, old); } diff --git a/src/signal/kill.c b/src/signal/kill.c index cc4b51e16ff7eb1980b706bc513baec4101c25d8..0580573309000c5bafb9b602443f9a675a8b7682 100644 --- a/src/signal/kill.c +++ b/src/signal/kill.c @@ -3,5 +3,5 @@ int kill(pid_t pid, int sig) { - return syscall2(__NR_kill, pid, sig); + return syscall(SYS_kill, pid, sig); } diff --git a/src/signal/raise.c b/src/signal/raise.c index cc2b19b755df641e4e2a4b4aa30e88339efb166c..9948f4189bc7dce65196fa8652c4f0c95998200f 100644 --- a/src/signal/raise.c +++ b/src/signal/raise.c @@ -10,9 +10,9 @@ int raise(int sig) sigset_t set; sigfillset(&set); __sigprocmask(SIG_BLOCK, &set, &set); - tid = syscall0(__NR_gettid); - pid = syscall0(__NR_getpid); - ret = syscall3(__NR_tgkill, pid, tid, sig); + tid = syscall(SYS_gettid); + pid = syscall(SYS_getpid); + ret = syscall(SYS_tgkill, pid, tid, sig); __sigprocmask(SIG_SETMASK, &set, 0); return ret; } diff --git a/src/signal/setitimer.c b/src/signal/setitimer.c index cacab036a2ee4c58664c46a4ff117fe753415d92..3b2375809a7bd946ba2d420859a47b49d87414a7 100644 --- a/src/signal/setitimer.c +++ b/src/signal/setitimer.c @@ -3,13 +3,5 @@ int setitimer(int which, const struct itimerval *new, struct itimerval *old) { - int ret; - long knew[4] = { - new->it_interval.tv_sec, new->it_interval.tv_usec, - new->it_value.tv_sec, new->it_value.tv_usec - }, kold[4]; - - if (!(ret = syscall3(__NR_setitimer, which, (long)&knew, old ? (long)&kold : 0)) && old) - *old = (struct itimerval){ { kold[0], kold[1] }, { kold[2], kold[3] } }; - return ret; + return syscall(SYS_setitimer, which, new, old); } diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c index b1603b9f4772e8b6e30625b4d8c1ca3fa7626cf4..3d374e1f45bf661a7a278fc1ba060ada8e3e6735 100644 --- a/src/signal/sigaction.c +++ b/src/signal/sigaction.c @@ -23,7 +23,7 @@ int __libc_sigaction(int sig, const struct sigaction *sa, struct sigaction *old) pksa = (long)&ksa; } if (old) pkold = (long)&kold; - if (syscall4(__NR_rt_sigaction, sig, pksa, pkold, 8)) + if (syscall(SYS_rt_sigaction, sig, pksa, pkold, 8)) return -1; if (old) { old->sa_handler = kold.handler; diff --git a/src/signal/sigaltstack.c b/src/signal/sigaltstack.c index 6e46d098e43b02c1d7a68575620c6a3018eca682..550f2f9df892b4a7b18f0f4de57b7562f4be73de 100644 --- a/src/signal/sigaltstack.c +++ b/src/signal/sigaltstack.c @@ -14,5 +14,5 @@ int sigaltstack(const stack_t *ss, stack_t *old) return -1; } } - return syscall2(__NR_sigaltstack, (long)ss, (long)old); + return syscall(SYS_sigaltstack, ss, old); } diff --git a/src/signal/sigprocmask.c b/src/signal/sigprocmask.c index 96d084783787fb6bc76d525c66ddc5fa4090cb38..66b17a4228d9c57496dce365cd660ff950426958 100644 --- a/src/signal/sigprocmask.c +++ b/src/signal/sigprocmask.c @@ -6,7 +6,7 @@ int __libc_sigprocmask(int how, const sigset_t *set, sigset_t *old) { - return syscall4(__NR_rt_sigprocmask, how, (long)set, (long)old, 8); + return syscall(SYS_rt_sigprocmask, how, set, old, 8); } int __sigprocmask(int how, const sigset_t *set, sigset_t *old) diff --git a/src/signal/sigqueue.c b/src/signal/sigqueue.c index b8135d56234e16a9cd75b49863f0c929385d96d5..aeac4875b3bd3d9aeecd0b3f28ffb752146924ab 100644 --- a/src/signal/sigqueue.c +++ b/src/signal/sigqueue.c @@ -12,5 +12,5 @@ int sigqueue(pid_t pid, int sig, const union sigval value) si.si_value = value; si.si_pid = getpid(); si.si_uid = getuid(); - return syscall3(__NR_rt_sigqueueinfo, pid, sig, (long)&si); + return syscall(SYS_rt_sigqueueinfo, pid, sig, &si); } diff --git a/src/stat/chmod.c b/src/stat/chmod.c index cb310fecd63f38e4035aa25c95bdfb0e464bcbf9..beb66e59d0611cfbe08b0bf5aad6888fc9df32ee 100644 --- a/src/stat/chmod.c +++ b/src/stat/chmod.c @@ -3,5 +3,5 @@ int chmod(const char *path, mode_t mode) { - return syscall2(__NR_chmod, (long)path, mode); + return syscall(SYS_chmod, path, mode); } diff --git a/src/stat/fchmod.c b/src/stat/fchmod.c index 91897383f74ba25d2fd7e63591a20e58276e5b36..f9b99366e4790b01b1f94f460e657fc9439cd9cc 100644 --- a/src/stat/fchmod.c +++ b/src/stat/fchmod.c @@ -3,5 +3,5 @@ int fchmod(int fd, mode_t mode) { - return syscall2(__NR_fchmod, fd, mode); + return syscall(SYS_fchmod, fd, mode); } diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c index f4f22b2c7f4f271c2402fd5a8ebb250dbc7858e9..61d3206553e6770d18ae1b53bda2f071fb5e7768 100644 --- a/src/stat/fchmodat.c +++ b/src/stat/fchmodat.c @@ -3,5 +3,5 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) { - return syscall4(__NR_fchmodat, fd, (long)path, mode, flag); + return syscall(SYS_fchmodat, fd, path, mode, flag); } diff --git a/src/stat/fstat.c b/src/stat/fstat.c index 88ac6f3c5a120d9dd75245a1fbdbc941687697a9..10228f75240c9b38dfadc101125cc03f07780697 100644 --- a/src/stat/fstat.c +++ b/src/stat/fstat.c @@ -4,7 +4,7 @@ int fstat(int fd, struct stat *buf) { - return syscall2(__NR_fstat, fd, (long)buf); + return syscall(SYS_fstat, fd, buf); } LFS64(fstat); diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c index e39f833bbd37799fa37e7980c383bd3c73b7f306..d6b9390ca442cdffe9620f3335232ca50278444d 100644 --- a/src/stat/fstatat.c +++ b/src/stat/fstatat.c @@ -4,7 +4,7 @@ int fstatat(int fd, const char *path, struct stat *buf, int flag) { - return syscall4(__NR_fstatat, fd, (long)path, (long)buf, flag); + return syscall(SYS_fstatat, fd, path, buf, flag); } LFS64(fstatat); diff --git a/src/stat/fstatvfs.c b/src/stat/fstatvfs.c index 4a8bfe2e1ea1238be352c6244ca981629a3b6d46..8a2e423511a2423d8f331bc98c2e0c9ca72c0173 100644 --- a/src/stat/fstatvfs.c +++ b/src/stat/fstatvfs.c @@ -4,7 +4,7 @@ int fstatvfs(int fd, struct statvfs *buf) { - return syscall2(__NR_fstatfs, fd, (long)buf); + return syscall(SYS_fstatfs, fd, buf); } weak_alias(fstatvfs, fstatfs); diff --git a/src/stat/lstat.c b/src/stat/lstat.c index 3b22e620bd21399def24bf2ae70febf12a1a2b3e..9053d998dc56006071f2f9b4065c1ed4f061b8c4 100644 --- a/src/stat/lstat.c +++ b/src/stat/lstat.c @@ -4,7 +4,7 @@ int lstat(const char *path, struct stat *buf) { - return syscall2(__NR_lstat, (long)path, (long)buf); + return syscall(SYS_lstat, path, buf); } LFS64(lstat); diff --git a/src/stat/mkdir.c b/src/stat/mkdir.c index 8295cad5a90b3972529015bc7b48ef43fb45b781..770e1cccea8896c966f39fa77d191b8d3b1db5f7 100644 --- a/src/stat/mkdir.c +++ b/src/stat/mkdir.c @@ -3,5 +3,5 @@ int mkdir(const char *path, mode_t mode) { - return syscall2(__NR_mkdir, (long)path, mode); + return syscall(SYS_mkdir, path, mode); } diff --git a/src/stat/mkdirat.c b/src/stat/mkdirat.c index 1fb3825068bc8897c87441d165e73756ec67c6f0..b8bc2527d757e62d02db0f2fd6ffa2751744e0d8 100644 --- a/src/stat/mkdirat.c +++ b/src/stat/mkdirat.c @@ -3,5 +3,5 @@ int mkdirat(int fd, const char *path, mode_t mode) { - return syscall3(__NR_mkdirat, fd, (long)path, mode); + return syscall(SYS_mkdirat, fd, path, mode); } diff --git a/src/stat/mknod.c b/src/stat/mknod.c index 0123eeef09b6911152ec7d1f67f4e395e06f8a2f..90c6a1ca877ee9fb2e50862fbf12bb60452f80a4 100644 --- a/src/stat/mknod.c +++ b/src/stat/mknod.c @@ -6,5 +6,5 @@ int mknod(const char *path, mode_t mode, dev_t dev) /* since dev_t is system-specific anyway we defer to the idiotic * legacy-compatible bitfield mapping of the type.. at least we've * made it large enough to leave space for future expansion.. */ - return syscall3(__NR_mknod, (long)path, mode, dev & 0xffff); + return syscall(SYS_mknod, path, mode, dev & 0xffff); } diff --git a/src/stat/mknodat.c b/src/stat/mknodat.c index b5687e4706c4cf9d4de8337b180c747466050e48..63cacd58412420848a35a8cf7dc4f9c28d175c78 100644 --- a/src/stat/mknodat.c +++ b/src/stat/mknodat.c @@ -3,5 +3,5 @@ int mknodat(int fd, const char *path, mode_t mode, dev_t dev) { - return syscall4(__NR_mknodat, fd, (long)path, mode, dev & 0xffff); + return syscall(SYS_mknodat, fd, path, mode, dev & 0xffff); } diff --git a/src/stat/stat.c b/src/stat/stat.c index 9847552afddf29e2f590f8fe43d5a5bb30ac7f43..c5491eb0ed26364d2d7ce5f6442c7ba00087dee8 100644 --- a/src/stat/stat.c +++ b/src/stat/stat.c @@ -4,7 +4,7 @@ int stat(const char *path, struct stat *buf) { - return syscall2(__NR_stat, (long)path, (long)buf); + return syscall(SYS_stat, path, buf); } LFS64(stat); diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c index ebf14b43515a6c02f77fb62e3e5cfd164bf0889f..1725299785316ad1024f8a507aa5c5886b5f53b2 100644 --- a/src/stat/statvfs.c +++ b/src/stat/statvfs.c @@ -4,7 +4,7 @@ int statvfs(const char *path, struct statvfs *buf) { - return syscall2(__NR_statfs, (long)path, (long)buf); + return syscall(SYS_statfs, path, buf); } weak_alias(statvfs, statfs); diff --git a/src/stat/umask.c b/src/stat/umask.c index 49cb48a6768c8028382c7114fd43a3f57ad041bc..5ee913e2d08846af8fdad4a1308d772bf145d1df 100644 --- a/src/stat/umask.c +++ b/src/stat/umask.c @@ -3,5 +3,5 @@ mode_t umask(mode_t mode) { - return syscall1(__NR_umask, mode); + return syscall(SYS_umask, mode); } diff --git a/src/stat/utimensat.c b/src/stat/utimensat.c index b9b02adfb50676daca2606d806a071ed321ec843..929698bcc47de1168db21422d66088207a572c9e 100644 --- a/src/stat/utimensat.c +++ b/src/stat/utimensat.c @@ -3,5 +3,5 @@ int utimensat(int fd, const char *path, const struct timespec times[2], int flags) { - return syscall4(__NR_utimensat, fd, (long)path, (long)times, flags); + return syscall(SYS_utimensat, fd, path, times, flags); } diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c index 6ad7c57de61c3e02f2b2de853ffab21d42942a91..235d348fa201f658a784aaa0a116620eedf353ce 100644 --- a/src/stdio/__fdopen.c +++ b/src/stdio/__fdopen.c @@ -20,8 +20,8 @@ FILE *__fdopen(int fd, const char *mode) /* Set append mode on fd if opened for append */ if (*mode == 'a') { - int flags = __syscall_fcntl(fd, F_GETFL, 0); - __syscall_fcntl(fd, F_SETFL, flags | O_APPEND); + int flags = syscall(SYS_fcntl, fd, F_GETFL, 0); + syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND); } f->fd = fd; @@ -30,7 +30,7 @@ FILE *__fdopen(int fd, const char *mode) /* Activate line buffered mode for terminals */ f->lbf = EOF; - if (!(f->flags & F_NOWR) && !__syscall_ioctl(fd, TCGETS, &tio)) + if (!(f->flags & F_NOWR) && !syscall(SYS_ioctl, fd, TCGETS, &tio)) f->lbf = '\n'; /* Initialize op ptrs. No problem if some are unneeded. */ diff --git a/src/stdio/__fopen_rb_ca.c b/src/stdio/__fopen_rb_ca.c index 57d9b73c9f2251b7ef10beef646dc21f8b9527cc..4ba50d61470311ca28fa3f6370f0a70552765ff7 100644 --- a/src/stdio/__fopen_rb_ca.c +++ b/src/stdio/__fopen_rb_ca.c @@ -4,7 +4,7 @@ FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t le { memset(f, 0, sizeof *f); - f->fd = __syscall_open(filename, O_RDONLY, 0); + f->fd = syscall(SYS_open, filename, O_RDONLY|O_LARGEFILE, 0); if (f->fd < 0) return 0; f->flags = F_NOWR | F_PERM; diff --git a/src/stdio/__lockfile.c b/src/stdio/__lockfile.c index 82f50b421efa1a0152351c63bcb1bba90ad8fb92..e4320f050c9f85fd83d1f0e06a32b05cddb40b9f 100644 --- a/src/stdio/__lockfile.c +++ b/src/stdio/__lockfile.c @@ -13,7 +13,7 @@ void __lockfile(FILE *f) spins = 100000; while (a_swap(&f->lock, 1)) if (spins) spins--, a_spin(); - else syscall0(__NR_sched_yield); + else syscall(SYS_sched_yield); f->owner = __pthread_self()->tid; f->lockcount = 1; } diff --git a/src/stdio/__stdio_close.c b/src/stdio/__stdio_close.c index 24fef33f8d5e8df0078cde072a46fcc5efe8762b..9f7ee18c23fa98837aa44f49b2d58ecef8b3e4a6 100644 --- a/src/stdio/__stdio_close.c +++ b/src/stdio/__stdio_close.c @@ -2,5 +2,5 @@ int __stdio_close(FILE *f) { - return __syscall_close(f->fd); + return syscall(SYS_close, f->fd); } diff --git a/src/stdio/__stdio_read.c b/src/stdio/__stdio_read.c index ee7e12587ee667ce753206517d00c749b122bee2..d9bb3269c41821031be8e5c8e1d95020fbe03218 100644 --- a/src/stdio/__stdio_read.c +++ b/src/stdio/__stdio_read.c @@ -2,5 +2,5 @@ size_t __stdio_read(FILE *f, unsigned char *buf, size_t len) { - return __syscall_read(f->fd, buf, len); + return syscall(SYS_read, f->fd, buf, len); } diff --git a/src/stdio/__stdio_seek.c b/src/stdio/__stdio_seek.c index c7a5b73066f6de8d6ed46be823b0647f7b00af37..c205ab8206a36341fada87615b0af7706ed26dfd 100644 --- a/src/stdio/__stdio_seek.c +++ b/src/stdio/__stdio_seek.c @@ -8,11 +8,11 @@ static off_t retneg1(FILE *f, off_t off, int whence) off_t __stdio_seek(FILE *f, off_t off, int whence) { off_t ret; -#ifdef __NR__llseek - if (syscall5(__NR__llseek, f->fd, off>>32, off, (long)&ret, whence)<0) +#ifdef SYS__llseek + if (syscall(SYS__llseek, f->fd, off>>32, off, &ret, whence)<0) ret = -1; #else - ret = syscall3(__NR_lseek, f->fd, off, whence); + ret = syscall(SYS_lseek, f->fd, off, whence); #endif /* Detect unseekable files and optimize future failures out */ if (ret < 0 && off == 0 && whence == SEEK_CUR) diff --git a/src/stdio/__stdio_write.c b/src/stdio/__stdio_write.c index 785456265ac6f33910fa343dfff55d355b1e809d..d4264eff29b10a27adc1709e67dc3bd4bf763a79 100644 --- a/src/stdio/__stdio_write.c +++ b/src/stdio/__stdio_write.c @@ -4,6 +4,6 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) { const unsigned char *stop = buf+len; ssize_t cnt = 1; - for (; buffd, buf, len))>0; buf+=cnt); + for (; buffd, buf, len))>0; buf+=cnt); return len-(stop-buf); } diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c index 670cf5f3a61f8dc8b1f8cc2b759175e279c5a19a..c2a350d119bf258fba48e5a88efaaa8ae33ee248 100644 --- a/src/stdio/fopen.c +++ b/src/stdio/fopen.c @@ -21,13 +21,13 @@ FILE *fopen(const char *filename, const char *mode) if (*mode == 'w') flags |= O_TRUNC; if (*mode == 'a') flags |= O_APPEND; - fd = __syscall_open(filename, flags, 0666); + fd = syscall(SYS_open, filename, flags|O_LARGEFILE, 0666); if (fd < 0) return 0; f = __fdopen(fd, mode); if (f) return f; - __syscall_close(fd); + syscall(SYS_close, fd); return 0; } diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index 8d3af9fc0862e6650426c1a0f7c1d8588afd7dfe..958dbd20fe7a8d3cb459ae8024e7018958e2db53 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -17,13 +17,13 @@ FILE *freopen(const char *filename, const char *mode, FILE *f) if (!filename) { f2 = fopen("/dev/null", mode); if (!f2) goto fail; - fl = __syscall_fcntl(f2->fd, F_GETFL, 0); - if (fl < 0 || __syscall_fcntl(f->fd, F_SETFL, fl) < 0) + fl = syscall(SYS_fcntl, f2->fd, F_GETFL, 0); + if (fl < 0 || syscall(SYS_fcntl, f->fd, F_SETFL, fl) < 0) goto fail2; } else { f2 = fopen(filename, mode); if (!f2) goto fail; - if (__syscall_dup2(f2->fd, f->fd) < 0) + if (syscall(SYS_dup2, f2->fd, f->fd) < 0) goto fail2; } diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 8e338277eb967dcbac1f76f8d8994f8b47b8f668..9e1de7f239f698aac83307c1034863fb902c1501 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -3,5 +3,5 @@ int remove(const char *path) { - return __syscall_unlink(path); + return syscall(SYS_unlink, path); } diff --git a/src/stdio/rename.c b/src/stdio/rename.c index 4eced08a6656b4c19322a9c3dee85f14ce7c3d12..97f14535e0081109c27de7e135c9359c7b12087a 100644 --- a/src/stdio/rename.c +++ b/src/stdio/rename.c @@ -3,5 +3,5 @@ int rename(const char *old, const char *new) { - return syscall2(__NR_rename, (long)old, (long)new); + return syscall(SYS_rename, old, new); } diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c index 185025f13ee3c7872b2fa85c52e400d82b4021a6..b050f7fdba85c764995e999141a5b5b6db302b6d 100644 --- a/src/stdio/tmpfile.c +++ b/src/stdio/tmpfile.c @@ -11,7 +11,7 @@ FILE *tmpfile(void) for (;;) { s = tmpnam(buf); if (!s) return NULL; - fd = __syscall_open(s, O_RDWR | O_CREAT | O_EXCL, 0600); + fd = syscall(SYS_open, s, O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600); if (fd >= 0) { f = __fdopen(fd, "w+"); remove(s); diff --git a/src/thread/__futex.c b/src/thread/__futex.c index 93352fa3c1323fb62ab8edcac385cf10347ffa14..96307c0888ed486617e18d1da2c4730f9714baf6 100644 --- a/src/thread/__futex.c +++ b/src/thread/__futex.c @@ -3,6 +3,5 @@ int __futex(volatile int *addr, int op, int val, void *ts) { - return syscall4(__NR_futex, (long)addr, op, val, (long)ts); + return syscall(SYS_futex, addr, op, val, ts); } - diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 3716f75a1d76103a4dbfb6820d90164973065a33..17a47f6ac00fa05fe7c39c80dad99f2de9956110 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -36,7 +36,7 @@ void __pthread_unwind_next(struct __ptcb *cb) __unmapself(self->map_base, self->map_size); } - __syscall_exit(0); + syscall(SYS_exit, 0); } static void docancel(struct pthread *self) diff --git a/src/thread/pthread_mutex_trylock.c b/src/thread/pthread_mutex_trylock.c index f48aaadec3c761e83b42ad4052417972d8b5c30d..232e172b6e0f5fcd1ee1b9d10df3e1694317f6e5 100644 --- a/src/thread/pthread_mutex_trylock.c +++ b/src/thread/pthread_mutex_trylock.c @@ -14,8 +14,8 @@ int pthread_mutex_trylock(pthread_mutex_t *m) if (m->_m_type >= 4) { if (!self->robust_list.off) - syscall2(__NR_set_robust_list, - (long)&self->robust_list, 3*sizeof(long)); + syscall(SYS_set_robust_list, + &self->robust_list, 3*sizeof(long)); self->robust_list.off = (char*)&m->_m_lock-(char *)&m->_m_next; self->robust_list.pending = &m->_m_next; } diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c index d2de2cb8f0b207be46b091365b1cc11ad2249db1..c3d1be78be66b62101dfcfba8a0cc8dc101800ca 100644 --- a/src/thread/pthread_self.c +++ b/src/thread/pthread_self.c @@ -27,7 +27,7 @@ static int init_main_thread() main_thread.errno_ptr = __errno_location(); libc.errno_location = errno_location; main_thread.tid = main_thread.pid = - syscall1(__NR_set_tid_address, (long)&main_thread.tid); + syscall(SYS_set_tid_address, &main_thread.tid); return 0; } diff --git a/src/time/clock_getres.c b/src/time/clock_getres.c index 539d4f94775da678914538b6ef526048431a6e04..36a0d695b02e29b1bbfd162061cb113c8550bfc2 100644 --- a/src/time/clock_getres.c +++ b/src/time/clock_getres.c @@ -3,5 +3,5 @@ int clock_getres(clockid_t clk, struct timespec *ts) { - return syscall2(__NR_clock_getres, clk, (long)ts); + return syscall(SYS_clock_getres, clk, ts); } diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c index dab09d50cfc49af32433caa890218301549aa220..c345c46e03e5be739dc1871b7706bf23424fac6a 100644 --- a/src/time/clock_gettime.c +++ b/src/time/clock_gettime.c @@ -3,5 +3,5 @@ int clock_gettime(clockid_t clk, struct timespec *ts) { - return syscall2(__NR_clock_gettime, clk, (long)ts); + return syscall(SYS_clock_gettime, clk, ts); } diff --git a/src/time/clock_settime.c b/src/time/clock_settime.c index a80b94e12293d9dbb2c86a94f49aae2d71764165..66b8162d72b540de5cefdbb62e8af6d3963d166c 100644 --- a/src/time/clock_settime.c +++ b/src/time/clock_settime.c @@ -3,5 +3,5 @@ int clock_settime(clockid_t clk, const struct timespec *ts) { - return syscall2(__NR_clock_settime, clk, (long)ts); + return syscall(SYS_clock_settime, clk, ts); } diff --git a/src/time/nanosleep.c b/src/time/nanosleep.c index 5ac4c35907721491fa11e35100486401b4bb3177..2f65762f8f5f01981f15c4e4c7c735fc96a898e8 100644 --- a/src/time/nanosleep.c +++ b/src/time/nanosleep.c @@ -7,7 +7,7 @@ int nanosleep(const struct timespec *req, struct timespec *rem) { int ret; CANCELPT_BEGIN; - ret = syscall2(__NR_nanosleep, (long)req, (long)rem); + ret = syscall(SYS_nanosleep, req, rem); CANCELPT_END; return ret; } diff --git a/src/time/times.c b/src/time/times.c index d63cd2031d3445a8ab1d45a7dc947f987ca10494..9c50144f6316946397d3d9b1235838d134e86e05 100644 --- a/src/time/times.c +++ b/src/time/times.c @@ -3,5 +3,5 @@ clock_t times(struct tms *tms) { - return syscall1(__NR_times, (long)tms); + return syscall(SYS_times, tms); } diff --git a/src/time/utime.c b/src/time/utime.c index 56e9e13a4ed19d4a6e7168e613b90b9b3ff44406..856315b4ab6dd66ccc3e5acab33882b805cd490c 100644 --- a/src/time/utime.c +++ b/src/time/utime.c @@ -3,10 +3,5 @@ int utime(const char *path, const struct utimbuf *times) { - long ktimes[2]; - if (times) { - ktimes[0] = times->actime; - ktimes[1] = times->modtime; - } - return syscall2(__NR_utime, (long)path, times ? (long)ktimes : 0); + return syscall(SYS_utime, path, times); } diff --git a/src/unistd/access.c b/src/unistd/access.c index 2c10e58cc94bb9f254b2885251e3f02a9f6326ad..e7ce73a2a7ab9a44b57b6bd64860f57276b7e520 100644 --- a/src/unistd/access.c +++ b/src/unistd/access.c @@ -3,5 +3,5 @@ int access(const char *filename, int amode) { - return syscall2(__NR_access, (long)filename, amode); + return syscall(SYS_access, filename, amode); } diff --git a/src/unistd/alarm.c b/src/unistd/alarm.c index bba444d8721774f6b78b626c88356636ae6094e5..244af1c0470f0e3e2ff2d2bd20d5600448eb6320 100644 --- a/src/unistd/alarm.c +++ b/src/unistd/alarm.c @@ -3,5 +3,5 @@ unsigned alarm(unsigned seconds) { - return syscall1(__NR_alarm, seconds); + return syscall(SYS_alarm, seconds); } diff --git a/src/unistd/chdir.c b/src/unistd/chdir.c index c89bda3889ed362ac6e41aae69cd40c8be02471c..5ba78b6317dc34ef50bc3278889b357afcfc978b 100644 --- a/src/unistd/chdir.c +++ b/src/unistd/chdir.c @@ -3,5 +3,5 @@ int chdir(const char *path) { - return syscall1(__NR_chdir, (long)path); + return syscall(SYS_chdir, path); } diff --git a/src/unistd/chown.c b/src/unistd/chown.c index b89b17355973d2b7a89cd8f94fad8ff1df0c8d92..95f6f61e9eb1470a997b771e8102d457a55923dd 100644 --- a/src/unistd/chown.c +++ b/src/unistd/chown.c @@ -3,5 +3,5 @@ int chown(const char *path, uid_t uid, gid_t gid) { - return syscall3(__NR_chown, (long)path, uid, gid); + return syscall(SYS_chown, path, uid, gid); } diff --git a/src/unistd/close.c b/src/unistd/close.c index 97302f676719074f6d46a674654cdfed30ee90b9..f52c0ef3a91736264a3c9ae0c06e3182ea44d7dc 100644 --- a/src/unistd/close.c +++ b/src/unistd/close.c @@ -4,7 +4,7 @@ int close(int fd) { - int ret = __syscall_close(fd); + int ret = syscall(SYS_close, fd); CANCELPT_BEGIN; CANCELPT_END; return ret; diff --git a/src/unistd/dup.c b/src/unistd/dup.c index b11cd715907505b25598a6b12dc552f302a8cffc..7fee01201b82709a3cd0b04b3a457a846243d1a8 100644 --- a/src/unistd/dup.c +++ b/src/unistd/dup.c @@ -3,5 +3,5 @@ int dup(int fd) { - return syscall1(__NR_dup, fd); + return syscall(SYS_dup, fd); } diff --git a/src/unistd/dup2.c b/src/unistd/dup2.c index 93325446739ca3db0acea5e0438ddf489ef5cfd0..7945f853cae600b317ebab09306c4a8df1d06aa4 100644 --- a/src/unistd/dup2.c +++ b/src/unistd/dup2.c @@ -3,5 +3,5 @@ int dup2(int old, int new) { - return __syscall_dup2(old, new); + return syscall(SYS_dup2, old, new); } diff --git a/src/unistd/faccessat.c b/src/unistd/faccessat.c index 99a93785e132f2ca59da07399c1554b7d7b09f1f..1efbb778a584959d28611c433589b8a3c75d0266 100644 --- a/src/unistd/faccessat.c +++ b/src/unistd/faccessat.c @@ -3,5 +3,5 @@ int faccessat(int fd, const char *filename, int amode, int flag) { - return syscall4(__NR_faccessat, fd, (long)filename, amode, flag); + return syscall(SYS_faccessat, fd, filename, amode, flag); } diff --git a/src/unistd/fchdir.c b/src/unistd/fchdir.c index b2acbc29197cbc7e8cee34266736781d1cb8e4de..e5595f7749f35f0d959da1fc186e6361e648e90d 100644 --- a/src/unistd/fchdir.c +++ b/src/unistd/fchdir.c @@ -3,5 +3,5 @@ int fchdir(int fd) { - return syscall1(__NR_fchdir, fd); + return syscall(SYS_fchdir, fd); } diff --git a/src/unistd/fchown.c b/src/unistd/fchown.c index 6050b77417c2c896f7bab5fe49f69c5a3a79015a..b05f0be41d9dae32dfd6c82ba96c364fd2606eaf 100644 --- a/src/unistd/fchown.c +++ b/src/unistd/fchown.c @@ -3,5 +3,5 @@ int fchown(int fd, uid_t uid, gid_t gid) { - return syscall3(__NR_fchown, fd, uid, gid); + return syscall(SYS_fchown, fd, uid, gid); } diff --git a/src/unistd/fchownat.c b/src/unistd/fchownat.c index 706264281812eea2ed4aa25c17e41f6b5c1ab3a2..62457a3ec0eb794d63043f8dc8be0e32415347b7 100644 --- a/src/unistd/fchownat.c +++ b/src/unistd/fchownat.c @@ -3,5 +3,5 @@ int fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag) { - return syscall5(__NR_fchownat, fd, (long)path, uid, gid, flag); + return syscall(SYS_fchownat, fd, path, uid, gid, flag); } diff --git a/src/unistd/fsync.c b/src/unistd/fsync.c index 7cfedc98d6517f2f269b711f76f6947d7cba82c7..5991c66b3172b78790b35adb48980d5697133b0e 100644 --- a/src/unistd/fsync.c +++ b/src/unistd/fsync.c @@ -3,6 +3,6 @@ int fsync(int fd) { - //return syscall1(__NR_fsync, fd); + //return syscall(SYS_fsync, fd); return 0; } diff --git a/src/unistd/getcwd.c b/src/unistd/getcwd.c index 4910f42c2a5c3e0eae3ff6b0685ecb14e72d7e24..b64b560feeb5bf71d24f2354721a7b39d1f85004 100644 --- a/src/unistd/getcwd.c +++ b/src/unistd/getcwd.c @@ -4,5 +4,5 @@ char *getcwd(char *buf, size_t size) { - return syscall2(__NR_getcwd, (long)buf, size) < 0 ? NULL : buf; + return syscall(SYS_getcwd, buf, size) < 0 ? NULL : buf; } diff --git a/src/unistd/getegid.c b/src/unistd/getegid.c index 33ee2057227f71781db535fc4ffd5a6c4054fc72..76038f63e2bee6c729e49f8c04ceee488dac5cb3 100644 --- a/src/unistd/getegid.c +++ b/src/unistd/getegid.c @@ -3,5 +3,5 @@ gid_t getegid(void) { - return syscall0(__NR_getegid); + return syscall(SYS_getegid); } diff --git a/src/unistd/geteuid.c b/src/unistd/geteuid.c index cdec631a6aea1612f103cc5213347f71205e5fed..187ba0a19a838d2f97ec7ec619e5630587f209db 100644 --- a/src/unistd/geteuid.c +++ b/src/unistd/geteuid.c @@ -3,5 +3,5 @@ uid_t geteuid(void) { - return syscall0(__NR_geteuid); + return syscall(SYS_geteuid); } diff --git a/src/unistd/getgid.c b/src/unistd/getgid.c index 8a4590be92a46439b2ee2aa161d5ebf639f9347c..84823103ffbefda5cd61f39fb4187aaec88bb41d 100644 --- a/src/unistd/getgid.c +++ b/src/unistd/getgid.c @@ -3,5 +3,5 @@ gid_t getgid(void) { - return syscall0(__NR_getgid); + return syscall(SYS_getgid); } diff --git a/src/unistd/getgroups.c b/src/unistd/getgroups.c index 37619b9a5445019b808187f361cbc55caba6836b..0e6e63af0129d7c9a6cc8ddb8d86a5e534a315b7 100644 --- a/src/unistd/getgroups.c +++ b/src/unistd/getgroups.c @@ -3,5 +3,5 @@ int getgroups(int count, gid_t list[]) { - return syscall2(__NR_getgroups, count, (long)list); + return syscall(SYS_getgroups, count, list); } diff --git a/src/unistd/getpgid.c b/src/unistd/getpgid.c index 50d716b5eab744d07d4aba21713c3f369229f4ae..d295bfd59b0748e6ae0dae27ed2365a1888442b1 100644 --- a/src/unistd/getpgid.c +++ b/src/unistd/getpgid.c @@ -3,5 +3,5 @@ pid_t getpgid(pid_t pid) { - return syscall1(__NR_getpgid, pid); + return syscall(SYS_getpgid, pid); } diff --git a/src/unistd/getpgrp.c b/src/unistd/getpgrp.c index 2004630a8fd898ae38eeaf65d631b44cf39e93ba..02449da9f2e6330a479f0a61a065605d3bfdf711 100644 --- a/src/unistd/getpgrp.c +++ b/src/unistd/getpgrp.c @@ -3,5 +3,5 @@ pid_t getpgrp(void) { - return syscall0(__NR_getpgrp); + return syscall(SYS_getpgrp); } diff --git a/src/unistd/getpid.c b/src/unistd/getpid.c index 31cbe1cbc248b0751ccd2c144ea2caec2ba709d4..4ab2b7f1720586245ae4fe8436f5d5101d1e8019 100644 --- a/src/unistd/getpid.c +++ b/src/unistd/getpid.c @@ -3,5 +3,5 @@ pid_t getpid(void) { - return syscall0(__NR_getpid); + return syscall(SYS_getpid); } diff --git a/src/unistd/getppid.c b/src/unistd/getppid.c index a3241829964940c1bd273b632ca56de89baea5a5..7d10320716b84cac9202fb21a2dfce92d22e5301 100644 --- a/src/unistd/getppid.c +++ b/src/unistd/getppid.c @@ -3,5 +3,5 @@ pid_t getppid(void) { - return syscall0(__NR_getppid); + return syscall(SYS_getppid); } diff --git a/src/unistd/getsid.c b/src/unistd/getsid.c index 064229cfd9351c40fb4185896fda4653cca4c83a..93ba690e7ec22dde72bcd902924ae89dfb359306 100644 --- a/src/unistd/getsid.c +++ b/src/unistd/getsid.c @@ -3,5 +3,5 @@ pid_t getsid(pid_t pid) { - return syscall1(__NR_getsid, pid); + return syscall(SYS_getsid, pid); } diff --git a/src/unistd/getuid.c b/src/unistd/getuid.c index cd7233d1f7cb4c20ecf28b2c4b3c23bdc85a90ad..0bf9e714f19a7deaa36777d200c52586fc3ecd48 100644 --- a/src/unistd/getuid.c +++ b/src/unistd/getuid.c @@ -3,5 +3,5 @@ uid_t getuid(void) { - return syscall0(__NR_getuid); + return syscall(SYS_getuid); } diff --git a/src/unistd/lchown.c b/src/unistd/lchown.c index a8402132561a5fb86284153787af9f7bd4ac6426..de871aebb2155826716ee13a5d7e71ca0b0ad32d 100644 --- a/src/unistd/lchown.c +++ b/src/unistd/lchown.c @@ -3,5 +3,5 @@ int lchown(const char *path, uid_t uid, gid_t gid) { - return syscall3(__NR_lchown, (long)path, uid, gid); + return syscall(SYS_lchown, path, uid, gid); } diff --git a/src/unistd/link.c b/src/unistd/link.c index f121bb9e350ae3e7ebdb27858aab857b1edf8b58..20193f2ac831b5e72e3f8d92aa9a54ba5b94bda0 100644 --- a/src/unistd/link.c +++ b/src/unistd/link.c @@ -3,5 +3,5 @@ int link(const char *existing, const char *new) { - return syscall2(__NR_link, (long)existing, (long)new); + return syscall(SYS_link, existing, new); } diff --git a/src/unistd/linkat.c b/src/unistd/linkat.c index 0eb51221ff2b64156fecdf85e89a6118d8b5530a..6a9a0b77591a2273ad99d46cd228ead6a60b73f6 100644 --- a/src/unistd/linkat.c +++ b/src/unistd/linkat.c @@ -3,5 +3,5 @@ int linkat(int fd1, const char *existing, int fd2, const char *new, int flag) { - return syscall5(__NR_linkat, fd1, (long)existing, fd2, (long)new, flag); + return syscall(SYS_linkat, fd1, existing, fd2, new, flag); } diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c index 0152866f8df42302f9bfb947796fef3c423dbb6a..63cea58817e4ccb7f1a6b9b50fe29b64cf9bfd8b 100644 --- a/src/unistd/lseek.c +++ b/src/unistd/lseek.c @@ -6,9 +6,9 @@ off_t lseek(int fd, off_t offset, int whence) { #ifdef __NR__llseek off_t result; - return syscall5(__NR__llseek, fd, offset>>32, offset, (long)&result, whence) ? -1 : result; + return syscall(SYS__llseek, fd, offset>>32, offset, &result, whence) ? -1 : result; #else - return syscall3(__NR_lseek, fd, offset, whence); + return syscall(SYS_lseek, fd, offset, whence); #endif } diff --git a/src/unistd/nice.c b/src/unistd/nice.c index f38db678d892c7c570e2f4226090922bda1d55c5..34f7c7f9c8f3e5af47f5281aa2a088efd2d6394f 100644 --- a/src/unistd/nice.c +++ b/src/unistd/nice.c @@ -5,7 +5,7 @@ int nice(int inc) { #ifdef __NR_nice - return syscall1(__NR_nice, inc); + return syscall(SYS_nice, inc); #else return setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0)+inc); #endif diff --git a/src/unistd/pause.c b/src/unistd/pause.c index 14720651c4117f748964134b5a6e9e247a2f5b0e..57ed25e5d302c08c4dbdcc815293b2e0b4620e9a 100644 --- a/src/unistd/pause.c +++ b/src/unistd/pause.c @@ -6,7 +6,7 @@ int pause(void) { int r; CANCELPT_BEGIN; - r = syscall0(__NR_pause); + r = syscall(SYS_pause); CANCELPT_END; return r; } diff --git a/src/unistd/pipe.c b/src/unistd/pipe.c index 2dfc9c995f0666aa18358496f6eed2fb16a07b88..36c6f13e7a1684acb6340f4e59338d99fd9fcf32 100644 --- a/src/unistd/pipe.c +++ b/src/unistd/pipe.c @@ -3,5 +3,5 @@ int pipe(int fd[2]) { - return syscall1(__NR_pipe, (long)fd); + return syscall(SYS_pipe, fd); } diff --git a/src/unistd/read.c b/src/unistd/read.c index 87ff1f107f403b9aa2df5bc7c378c4390229b202..194b389e860e5ee5b9b9487fa0467e76c23cc4bf 100644 --- a/src/unistd/read.c +++ b/src/unistd/read.c @@ -6,7 +6,7 @@ ssize_t read(int fd, void *buf, size_t count) { ssize_t r; CANCELPT_BEGIN; - r = __syscall_read(fd, buf, count); + r = syscall(SYS_read, fd, buf, count); CANCELPT_END; return r; } diff --git a/src/unistd/readlink.c b/src/unistd/readlink.c index f6b1635c631c82ce96c950b0c31434119eacc841..11f45c01d70286253639bd293e5e7c92d8ed30aa 100644 --- a/src/unistd/readlink.c +++ b/src/unistd/readlink.c @@ -3,5 +3,5 @@ int readlink(const char *path, char *buf, size_t bufsize) { - return syscall3(__NR_readlink, (long)path, (long)buf, bufsize); + return syscall(SYS_readlink, path, buf, bufsize); } diff --git a/src/unistd/readlinkat.c b/src/unistd/readlinkat.c index 8171050dace289e490067d5a3ee47792f9d127a3..9565b89a78d317b50c8152aea939a1b6b805b2a6 100644 --- a/src/unistd/readlinkat.c +++ b/src/unistd/readlinkat.c @@ -3,5 +3,5 @@ int readlinkat(int fd, const char *path, char *buf, size_t bufsize) { - return syscall4(__NR_readlinkat, fd, (long)path, (long)buf, bufsize); + return syscall(SYS_readlinkat, fd, path, buf, bufsize); } diff --git a/src/unistd/readv.c b/src/unistd/readv.c index e311f9de67f9997bba06ab3212d6963c33bbdd7a..9b87728e08bdb88bed07c13d5cd4453441edb861 100644 --- a/src/unistd/readv.c +++ b/src/unistd/readv.c @@ -6,7 +6,7 @@ ssize_t readv(int fd, const struct iovec *iov, int count) { ssize_t r; CANCELPT_BEGIN; - r = syscall3(__NR_readv, fd, (long)iov, count); + r = syscall(SYS_readv, fd, iov, count); CANCELPT_END; return r; } diff --git a/src/unistd/renameat.c b/src/unistd/renameat.c index 0dae9f11d4861f44a4219353ee92d082dd6ca03f..125748221f13c3a4fe5fb33684f309c18f802ed7 100644 --- a/src/unistd/renameat.c +++ b/src/unistd/renameat.c @@ -3,5 +3,5 @@ int renameat(int oldfd, const char *old, int newfd, const char *new) { - return syscall4(__NR_renameat, oldfd, (long)old, newfd, (long)new); + return syscall(SYS_renameat, oldfd, old, newfd, new); } diff --git a/src/unistd/rmdir.c b/src/unistd/rmdir.c index 8e18c7a825dc98b1b681c240ce6b22da5da07bee..dfe1605d05173460c395e97eb7968da6a4698997 100644 --- a/src/unistd/rmdir.c +++ b/src/unistd/rmdir.c @@ -3,5 +3,5 @@ int rmdir(const char *path) { - return syscall1(__NR_rmdir, (long)path); + return syscall(SYS_rmdir, path); } diff --git a/src/unistd/setgid.c b/src/unistd/setgid.c index 42976d9510c2b97832d9d2585861174c230c2838..e98a2982a6ece851310c17a3f6f4ef662d393d43 100644 --- a/src/unistd/setgid.c +++ b/src/unistd/setgid.c @@ -5,5 +5,5 @@ int setgid(gid_t gid) { if (libc.rsyscall) return libc.rsyscall(__NR_setgid, gid, 0, 0, 0, 0, 0); - return syscall1(__NR_setgid, gid); + return syscall(SYS_setgid, gid); } diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c index 748d2907230fb6421a2c304ccf3ba783e2a89311..4a5a3d6b3797cea7e24e2e45b484f7b464f417d6 100644 --- a/src/unistd/setpgid.c +++ b/src/unistd/setpgid.c @@ -3,5 +3,5 @@ pid_t setpgid(pid_t pid, pid_t pgid) { - return syscall2(__NR_setpgid, pid, pgid); + return syscall(SYS_setpgid, pid, pgid); } diff --git a/src/unistd/setregid.c b/src/unistd/setregid.c index 158753bea0e3d0a14d69db95f79c51c7c912c952..ff2607dc2459130eb4ac8af951a84b06c5d083a1 100644 --- a/src/unistd/setregid.c +++ b/src/unistd/setregid.c @@ -5,5 +5,5 @@ int setregid(gid_t rgid, gid_t egid) { if (libc.rsyscall) return libc.rsyscall(__NR_setregid, rgid, egid, 0, 0, 0, 0); - return syscall2(__NR_setregid, rgid, egid); + return syscall(SYS_setregid, rgid, egid); } diff --git a/src/unistd/setreuid.c b/src/unistd/setreuid.c index 47c6730658c6298fc3f16919f8d9496c222a2719..505e8bc1f2496699f5b32343c5973a0b3809b601 100644 --- a/src/unistd/setreuid.c +++ b/src/unistd/setreuid.c @@ -5,5 +5,5 @@ int setreuid(uid_t ruid, uid_t euid) { if (libc.rsyscall) return libc.rsyscall(__NR_setreuid, ruid, euid, 0, 0, 0, 0); - return syscall2(__NR_setreuid, ruid, euid); + return syscall(SYS_setreuid, ruid, euid); } diff --git a/src/unistd/setsid.c b/src/unistd/setsid.c index e2c5690c8f66b74af1aa5ec03a586ded0a37a15f..609bbe4ace41f02a55cea3e7eda48b3a4487b848 100644 --- a/src/unistd/setsid.c +++ b/src/unistd/setsid.c @@ -3,5 +3,5 @@ pid_t setsid(void) { - return syscall0(__NR_setsid); + return syscall(SYS_setsid); } diff --git a/src/unistd/setuid.c b/src/unistd/setuid.c index 9e9da61fac39a1870c22d5c8e3065aaee815097f..61e8be557d9a8a6b9a32489e96f4c1c82569c3bf 100644 --- a/src/unistd/setuid.c +++ b/src/unistd/setuid.c @@ -5,5 +5,5 @@ int setuid(uid_t uid) { if (libc.rsyscall) return libc.rsyscall(__NR_setuid, uid, 0, 0, 0, 0, 0); - return syscall1(__NR_setuid, uid); + return syscall(SYS_setuid, uid); } diff --git a/src/unistd/symlink.c b/src/unistd/symlink.c index 8d380d8531250e6ebb135062622f657f547be89c..5902d45a1af556ce5de7ea32e17aafb68b2e8540 100644 --- a/src/unistd/symlink.c +++ b/src/unistd/symlink.c @@ -3,5 +3,5 @@ int symlink(const char *existing, const char *new) { - return syscall2(__NR_symlink, (long)existing, (long)new); + return syscall(SYS_symlink, existing, new); } diff --git a/src/unistd/symlinkat.c b/src/unistd/symlinkat.c index 9693b226e24140b2b8fa9f16509941a1a9952871..d1c59b4db0991d18e2d15895709d72c636f09556 100644 --- a/src/unistd/symlinkat.c +++ b/src/unistd/symlinkat.c @@ -3,5 +3,5 @@ int symlinkat(const char *existing, int fd, const char *new) { - return syscall3(__NR_symlinkat, (long)existing, fd, (long)new); + return syscall(SYS_symlinkat, existing, fd, new); } diff --git a/src/unistd/sync.c b/src/unistd/sync.c index a49808fdcf9cb8970135197242e91559b33420e4..20fafb4a93c6b28270ddeaa6c24d8aa6bb3756ef 100644 --- a/src/unistd/sync.c +++ b/src/unistd/sync.c @@ -3,5 +3,5 @@ void sync(void) { - syscall0(__NR_sync); + syscall(SYS_sync); } diff --git a/src/unistd/unlink.c b/src/unistd/unlink.c index fb5779208bbab59808cd9decb4107408702c4fda..bdb37bea02d7b5f4336d3212b7eb23db9e9dac25 100644 --- a/src/unistd/unlink.c +++ b/src/unistd/unlink.c @@ -3,5 +3,5 @@ int unlink(const char *path) { - return __syscall_unlink(path); + return syscall(SYS_unlink, path); } diff --git a/src/unistd/unlinkat.c b/src/unistd/unlinkat.c index 47fccc17adad3027f7796c79a9dbd8ca78afc210..e0e25d22a30c47efc6e98df9f2d4c89953039919 100644 --- a/src/unistd/unlinkat.c +++ b/src/unistd/unlinkat.c @@ -3,5 +3,5 @@ int unlinkat(int fd, const char *path, int flag) { - return syscall3(__NR_unlinkat, fd, (long)path, flag); + return syscall(SYS_unlinkat, fd, path, flag); } diff --git a/src/unistd/write.c b/src/unistd/write.c index 426cfc5b82775494ae1a600d68bd11505c3ade61..a8284b3216684c9ed8033b69ae0d73494729f535 100644 --- a/src/unistd/write.c +++ b/src/unistd/write.c @@ -6,7 +6,7 @@ ssize_t write(int fd, const void *buf, size_t count) { int r; CANCELPT_BEGIN; - r = __syscall_write(fd, buf, count); + r = syscall(SYS_write, fd, buf, count); CANCELPT_END; return r; } diff --git a/src/unistd/writev.c b/src/unistd/writev.c index a6a118af786f7f88c9c3021b4cdb37b9ea53a0f9..a45afeb757af56b1ac21c10e901bb47e656d65b4 100644 --- a/src/unistd/writev.c +++ b/src/unistd/writev.c @@ -6,7 +6,7 @@ ssize_t writev(int fd, const struct iovec *iov, int count) { ssize_t r; CANCELPT_BEGIN; - r = syscall3(__NR_writev, fd, (long)iov, count); + r = syscall(SYS_writev, fd, iov, count); CANCELPT_END; return r; }