From aa398f56fa398f2202b04e82c67f822f3233786f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 20 Mar 2011 00:16:43 -0400 Subject: global cleanup to use the new syscall interface --- src/linux/brk.c | 2 +- src/linux/chroot.c | 2 +- src/linux/epoll_create.c | 2 +- src/linux/epoll_create1.c | 2 +- src/linux/epoll_ctl.c | 2 +- src/linux/epoll_pwait.c | 2 +- src/linux/epoll_wait.c | 2 +- src/linux/inotify_add_watch.c | 2 +- src/linux/inotify_init.c | 2 +- src/linux/inotify_init1.c | 2 +- src/linux/inotify_rm_watch.c | 2 +- src/linux/klogctl.c | 2 +- src/linux/mount.c | 2 +- src/linux/prctl.c | 2 +- src/linux/sbrk.c | 2 +- src/linux/sendfile.c | 2 +- src/linux/setgroups.c | 2 +- src/linux/sethostname.c | 2 +- src/linux/settimeofday.c | 2 +- src/linux/signalfd.c | 2 +- src/linux/swapoff.c | 2 +- src/linux/swapon.c | 2 +- src/linux/sysinfo.c | 2 +- src/linux/umount.c | 2 +- src/linux/umount2.c | 2 +- src/linux/utimes.c | 7 +------ src/linux/wait4.c | 2 +- 27 files changed, 27 insertions(+), 32 deletions(-) (limited to 'src/linux') diff --git a/src/linux/brk.c b/src/linux/brk.c index 3c2982c6..9f63c5a8 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 81363a6b..82b4fe75 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 c9dea8ce..29d82999 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 2e82e995..380b5dad 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 4214f407..da3e999b 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 5aaacba6..39ad5b77 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 8a68ebdd..9d3924e0 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 9973f161..75f207d7 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 d378460d..05070846 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 5fad0946..6472a7b2 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 0772d719..cba597eb 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 976f29e3..209ae742 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 8e3cc122..83a8db44 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 d5516830..1f8589e1 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 56f60d1b..b2943a92 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 bfbc40ae..818b19d3 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 4d578013..bdee58d5 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 c94325e6..79a87078 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 bd7e4104..d741f66b 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 ecda263e..99c35143 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 4f19823f..9f95e82d 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 5c75247f..2b40a30b 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 c61b7aa8..2dbd0ad9 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 f709b33a..fb9b5e73 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 ff0803c1..25ad057c 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 59ee1a81..d998b401 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 252beb0c..b3ae75e3 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); } -- cgit v1.2.1