From: Rich Felker Date: Thu, 7 Apr 2011 00:32:53 +0000 (-0400) Subject: consistency: change all remaining syscalls to use SYS_ rather than __NR_ prefix X-Git-Tag: v0.7.8~41 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c2cd25bff89c3581780e7eb267262cb8c4da0d38;p=oweals%2Fmusl.git consistency: change all remaining syscalls to use SYS_ rather than __NR_ prefix --- diff --git a/src/exit/_Exit.c b/src/exit/_Exit.c index d18b6183..6ceb1437 100644 --- a/src/exit/_Exit.c +++ b/src/exit/_Exit.c @@ -3,6 +3,6 @@ void _Exit(int ec) { - __syscall(__NR_exit_group, ec); - __syscall(__NR_exit, ec); + __syscall(SYS_exit_group, ec); + __syscall(SYS_exit, ec); } diff --git a/src/ipc/msgctl.c b/src/ipc/msgctl.c index 7c84291c..d50e395b 100644 --- a/src/ipc/msgctl.c +++ b/src/ipc/msgctl.c @@ -4,7 +4,7 @@ int msgctl(int q, int cmd, struct msqid_ds *buf) { -#ifdef __NR_msgctl +#ifdef SYS_msgctl return syscall(SYS_msgctl, q, cmd, buf); #else return syscall(SYS_ipc, IPCOP_msgctl, q, cmd, buf); diff --git a/src/ipc/msgget.c b/src/ipc/msgget.c index 9d79fe76..9dfbc4ea 100644 --- a/src/ipc/msgget.c +++ b/src/ipc/msgget.c @@ -4,7 +4,7 @@ int msgget(key_t k, int flag) { -#ifdef __NR_msgget +#ifdef SYS_msgget return syscall(SYS_msgget, k, flag); #else return syscall(SYS_ipc, IPCOP_msgget, k, flag); diff --git a/src/ipc/msgrcv.c b/src/ipc/msgrcv.c index ee071766..13c282ee 100644 --- a/src/ipc/msgrcv.c +++ b/src/ipc/msgrcv.c @@ -7,7 +7,7 @@ ssize_t msgrcv(int q, void *m, size_t len, long type, int flag) { ssize_t r; CANCELPT_BEGIN; -#ifdef __NR_msgrcv +#ifdef SYS_msgrcv r = syscall(SYS_msgrcv, q, m, len, type, flag); #else r = syscall(SYS_ipc, IPCOP_msgrcv, q, len, flag, ((long[]){ (long)m, type })); diff --git a/src/ipc/msgsnd.c b/src/ipc/msgsnd.c index 26057f2e..1e0b2fa5 100644 --- a/src/ipc/msgsnd.c +++ b/src/ipc/msgsnd.c @@ -7,7 +7,7 @@ int msgsnd(int q, const void *m, size_t len, int flag) { ssize_t r; CANCELPT_BEGIN; -#ifdef __NR_msgsnd +#ifdef SYS_msgsnd r = syscall(SYS_msgsnd, q, m, len, flag); #else r = syscall(SYS_ipc, IPCOP_msgsnd, q, len, flag, m); diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c index 392a4aac..df05ec74 100644 --- a/src/ipc/semctl.c +++ b/src/ipc/semctl.c @@ -10,7 +10,7 @@ int semctl(int id, int num, int cmd, ...) va_start(ap, cmd); arg = va_arg(ap, long); va_end(ap); -#ifdef __NR_semctl +#ifdef SYS_semctl return syscall(SYS_semctl, id, num, cmd, arg); #else return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | 0x100, &arg); diff --git a/src/ipc/semget.c b/src/ipc/semget.c index 530c75ff..5f110e3b 100644 --- a/src/ipc/semget.c +++ b/src/ipc/semget.c @@ -4,7 +4,7 @@ int semget(key_t key, int n, int fl) { -#ifdef __NR_semget +#ifdef SYS_semget return syscall(SYS_semget, key, n, fl); #else return syscall(SYS_ipc, IPCOP_semget, key, n, fl); diff --git a/src/ipc/semop.c b/src/ipc/semop.c index 15453406..8046e437 100644 --- a/src/ipc/semop.c +++ b/src/ipc/semop.c @@ -4,7 +4,7 @@ int semop(int id, struct sembuf *buf, size_t n) { -#ifdef __NR_semop +#ifdef SYS_semop return syscall(SYS_semop, id, buf, n); #else return syscall(SYS_ipc, IPCOP_semop, id, n, 0, buf); diff --git a/src/ipc/shmat.c b/src/ipc/shmat.c index c6ee4007..38db92f9 100644 --- a/src/ipc/shmat.c +++ b/src/ipc/shmat.c @@ -2,7 +2,7 @@ #include "syscall.h" #include "ipc.h" -#ifdef __NR_shmat +#ifdef SYS_shmat void *shmat(int id, const void *addr, int flag) { return (void *)syscall(SYS_shmat, id, addr, flag); diff --git a/src/ipc/shmctl.c b/src/ipc/shmctl.c index 3645fe2d..b2bdfa18 100644 --- a/src/ipc/shmctl.c +++ b/src/ipc/shmctl.c @@ -4,7 +4,7 @@ int shmctl(int id, int cmd, struct shmid_ds *buf) { -#ifdef __NR_shmctl +#ifdef SYS_shmctl return syscall(SYS_shmctl, id, cmd, buf); #else return syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_MODERN, buf); diff --git a/src/ipc/shmdt.c b/src/ipc/shmdt.c index b4c9e69f..2e198b3e 100644 --- a/src/ipc/shmdt.c +++ b/src/ipc/shmdt.c @@ -4,7 +4,7 @@ int shmdt(const void *addr) { -#ifdef __NR_shmdt +#ifdef SYS_shmdt return syscall(SYS_shmdt, addr); #else return syscall(SYS_ipc, IPCOP_shmdt, addr); diff --git a/src/ipc/shmget.c b/src/ipc/shmget.c index 9b14f8d3..61fb11d9 100644 --- a/src/ipc/shmget.c +++ b/src/ipc/shmget.c @@ -4,7 +4,7 @@ int shmget(key_t key, size_t size, int flag) { -#ifdef __NR_shmget +#ifdef SYS_shmget return syscall(SYS_shmget, key, size, flag); #else return syscall(SYS_ipc, IPCOP_shmget, key, size, flag); diff --git a/src/mman/mmap.c b/src/mman/mmap.c index 0b092ae2..883acb28 100644 --- a/src/mman/mmap.c +++ b/src/mman/mmap.c @@ -10,7 +10,7 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) if (sizeof(off_t) > sizeof(long)) if (((long)off & 0xfff) | ((long)((unsigned long long)off>>(12 + 8*(sizeof(off_t)-sizeof(long)))))) start = (void *)-1; -#ifdef __NR_mmap2 +#ifdef SYS_mmap2 return (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off>>12); #else return (void *)syscall(SYS_mmap, start, len, prot, flags, fd, off); diff --git a/src/signal/sigpending.c b/src/signal/sigpending.c index 496025a7..f6b8972e 100644 --- a/src/signal/sigpending.c +++ b/src/signal/sigpending.c @@ -3,5 +3,5 @@ int sigpending(sigset_t *set) { - return syscall(__NR_rt_sigpending, set, 8); + return syscall(SYS_rt_sigpending, set, 8); } diff --git a/src/signal/sigsuspend.c b/src/signal/sigsuspend.c index 9ee71240..cec5ddce 100644 --- a/src/signal/sigsuspend.c +++ b/src/signal/sigsuspend.c @@ -6,7 +6,7 @@ int sigsuspend(const sigset_t *mask) { int ret; CANCELPT_BEGIN; - ret = syscall(__NR_rt_sigsuspend, mask, 8); + ret = syscall(SYS_rt_sigsuspend, mask, 8); if (ret<0) CANCELPT_TRY; CANCELPT_END; return ret; diff --git a/src/signal/sigtimedwait.c b/src/signal/sigtimedwait.c index 86a2c879..1694cbe1 100644 --- a/src/signal/sigtimedwait.c +++ b/src/signal/sigtimedwait.c @@ -8,7 +8,7 @@ int sigtimedwait(const sigset_t *mask, siginfo_t *si, const struct timespec *tim int ret; CANCELPT_BEGIN; do { - ret = syscall(__NR_rt_sigtimedwait, mask, si, timeout, 8); + ret = syscall(SYS_rt_sigtimedwait, mask, si, timeout, 8); if (ret<0) CANCELPT_TRY; } while (ret<0 && errno==EINTR); CANCELPT_END; diff --git a/src/thread/__lock.c b/src/thread/__lock.c index 21cb71a8..2e00636f 100644 --- a/src/thread/__lock.c +++ b/src/thread/__lock.c @@ -7,5 +7,5 @@ void __lock(volatile int *l) * assignment to optimize non-pathological code with no contention. */ while (a_xchg(l, 1)) if (spins) spins--, a_spin(); - else __syscall(__NR_sched_yield); + else __syscall(SYS_sched_yield); } diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c index a673099b..5c84e80c 100644 --- a/src/thread/__timedwait.c +++ b/src/thread/__timedwait.c @@ -17,7 +17,7 @@ int __timedwait(volatile int *addr, int val, clockid_t clk, const struct timespe if (to.tv_sec < 0) return ETIMEDOUT; } if (priv) priv = 128; priv=0; - r = -__syscall(__NR_futex, (long)addr, FUTEX_WAIT | priv, val, at ? (long)&to : 0); + r = -__syscall(SYS_futex, (long)addr, FUTEX_WAIT | priv, val, at ? (long)&to : 0); if (r == ETIMEDOUT || r == EINTR) return r; return 0; } diff --git a/src/thread/__wait.c b/src/thread/__wait.c index b0969bb2..d024fb37 100644 --- a/src/thread/__wait.c +++ b/src/thread/__wait.c @@ -10,6 +10,6 @@ void __wait(volatile int *addr, volatile int *waiters, int val, int priv) } if (waiters) a_inc(waiters); while (*addr==val) - __syscall(__NR_futex, (long)addr, FUTEX_WAIT|priv, val, 0); + __syscall(SYS_futex, (long)addr, FUTEX_WAIT|priv, val, 0); if (waiters) a_dec(waiters); } diff --git a/src/thread/__wake.c b/src/thread/__wake.c index 6f2f894a..8fd0599c 100644 --- a/src/thread/__wake.c +++ b/src/thread/__wake.c @@ -4,5 +4,5 @@ void __wake(volatile int *addr, int cnt, int priv) { if (priv) priv = 128; priv=0; if (cnt<0) cnt = INT_MAX; - __syscall(__NR_futex, (long)addr, FUTEX_WAKE | priv, cnt); + __syscall(SYS_futex, (long)addr, FUTEX_WAKE | priv, cnt); } diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index ec329f50..acbd5a41 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -36,7 +36,7 @@ void __pthread_unwind_next(struct __ptcb *cb) exit(0); if (self->detached && self->map_base) { - __syscall(__NR_rt_sigprocmask, SIG_BLOCK, (long)(uint64_t[1]){-1},0,8); + __syscall(SYS_rt_sigprocmask, SIG_BLOCK, (long)(uint64_t[1]){-1},0,8); __unmapself(self->map_base, self->map_size); } diff --git a/src/thread/pthread_kill.c b/src/thread/pthread_kill.c index 17aa5c4b..36e9b6da 100644 --- a/src/thread/pthread_kill.c +++ b/src/thread/pthread_kill.c @@ -2,5 +2,5 @@ int pthread_kill(pthread_t t, int sig) { - return -__syscall(__NR_tgkill, t->pid, t->tid, sig); + return -__syscall(SYS_tgkill, t->pid, t->tid, sig); } diff --git a/src/thread/x86_64/__unmapself.s b/src/thread/x86_64/__unmapself.s index d36257d0..0b04d99c 100644 --- a/src/thread/x86_64/__unmapself.s +++ b/src/thread/x86_64/__unmapself.s @@ -3,9 +3,9 @@ .global __unmapself .type __unmapself,%function __unmapself: - movl $11,%eax /* __NR_munmap */ + movl $11,%eax /* SYS_munmap */ syscall /* munmap(arg2,arg3) */ xor %rdi,%rdi /* exit() args: always return success */ - movl $60,%eax /* __NR_exit */ + movl $60,%eax /* SYS_exit */ syscall /* exit(0) */ .size __unmapself,.-__unmapself diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c index 721e7941..4667725b 100644 --- a/src/time/clock_nanosleep.c +++ b/src/time/clock_nanosleep.c @@ -6,7 +6,7 @@ int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct { int ret; CANCELPT_BEGIN; - ret = -__syscall(__NR_clock_nanosleep, clk, flags, req, rem); + ret = -__syscall(SYS_clock_nanosleep, clk, flags, req, rem); CANCELPT_END; return ret; } diff --git a/src/time/gettimeofday.c b/src/time/gettimeofday.c index 521b4d57..2436e490 100644 --- a/src/time/gettimeofday.c +++ b/src/time/gettimeofday.c @@ -3,6 +3,6 @@ int gettimeofday(struct timeval *tv, void *tz) { - __syscall(__NR_gettimeofday, tv, 0); + __syscall(SYS_gettimeofday, tv, 0); return 0; } diff --git a/src/time/time.c b/src/time/time.c index 2d2cfd44..05e075b9 100644 --- a/src/time/time.c +++ b/src/time/time.c @@ -5,7 +5,7 @@ time_t time(time_t *t) { struct timeval tv; - __syscall(__NR_gettimeofday, &tv, 0); + __syscall(SYS_gettimeofday, &tv, 0); if (t) *t = tv.tv_sec; return tv.tv_sec; } diff --git a/src/unistd/ftruncate.c b/src/unistd/ftruncate.c index f57ea120..7ed69ff6 100644 --- a/src/unistd/ftruncate.c +++ b/src/unistd/ftruncate.c @@ -4,7 +4,7 @@ int ftruncate(int fd, off_t length) { - return syscall(__NR_ftruncate, fd, __SYSCALL_LL(length)); + return syscall(SYS_ftruncate, fd, __SYSCALL_LL(length)); } LFS64(ftruncate); diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c index 63cea588..0a5ed392 100644 --- a/src/unistd/lseek.c +++ b/src/unistd/lseek.c @@ -4,7 +4,7 @@ off_t lseek(int fd, off_t offset, int whence) { -#ifdef __NR__llseek +#ifdef SYS__llseek off_t result; return syscall(SYS__llseek, fd, offset>>32, offset, &result, whence) ? -1 : result; #else diff --git a/src/unistd/nice.c b/src/unistd/nice.c index 34f7c7f9..da569967 100644 --- a/src/unistd/nice.c +++ b/src/unistd/nice.c @@ -4,7 +4,7 @@ int nice(int inc) { -#ifdef __NR_nice +#ifdef SYS_nice return syscall(SYS_nice, inc); #else return setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0)+inc); diff --git a/src/unistd/pread.c b/src/unistd/pread.c index 16320e2c..0a045013 100644 --- a/src/unistd/pread.c +++ b/src/unistd/pread.c @@ -6,7 +6,7 @@ ssize_t pread(int fd, void *buf, size_t size, off_t ofs) { ssize_t r; CANCELPT_BEGIN; - r = syscall(__NR_pread, fd, buf, size, __SYSCALL_LL(ofs)); + r = syscall(SYS_pread, fd, buf, size, __SYSCALL_LL(ofs)); CANCELPT_END; return r; } diff --git a/src/unistd/pwrite.c b/src/unistd/pwrite.c index c4d3aff5..f878bb63 100644 --- a/src/unistd/pwrite.c +++ b/src/unistd/pwrite.c @@ -6,7 +6,7 @@ ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs) { ssize_t r; CANCELPT_BEGIN; - r = syscall(__NR_pwrite, fd, buf, size, __SYSCALL_LL(ofs)); + r = syscall(SYS_pwrite, fd, buf, size, __SYSCALL_LL(ofs)); CANCELPT_END; return r; } diff --git a/src/unistd/setgid.c b/src/unistd/setgid.c index b54d2b22..87b2717e 100644 --- a/src/unistd/setgid.c +++ b/src/unistd/setgid.c @@ -4,5 +4,5 @@ int setgid(gid_t gid) { - return __rsyscall(__NR_setgid, gid, 0, 0, 0, 0, 0); + return __rsyscall(SYS_setgid, gid, 0, 0, 0, 0, 0); } diff --git a/src/unistd/setregid.c b/src/unistd/setregid.c index 49c59858..665b5556 100644 --- a/src/unistd/setregid.c +++ b/src/unistd/setregid.c @@ -4,5 +4,5 @@ int setregid(gid_t rgid, gid_t egid) { - return __rsyscall(__NR_setregid, rgid, egid, 0, 0, 0, 0); + return __rsyscall(SYS_setregid, rgid, egid, 0, 0, 0, 0); } diff --git a/src/unistd/setresgid.c b/src/unistd/setresgid.c index 2b0c96d8..9b9fe50b 100644 --- a/src/unistd/setresgid.c +++ b/src/unistd/setresgid.c @@ -5,5 +5,5 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { - return __rsyscall(__NR_setresgid, rgid, egid, sgid, 0, 0, 0); + return __rsyscall(SYS_setresgid, rgid, egid, sgid, 0, 0, 0); } diff --git a/src/unistd/setresuid.c b/src/unistd/setresuid.c index 7fa6bc38..497f7592 100644 --- a/src/unistd/setresuid.c +++ b/src/unistd/setresuid.c @@ -5,5 +5,5 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid) { - return __rsyscall(__NR_setresuid, ruid, euid, suid, 0, 0, 0); + return __rsyscall(SYS_setresuid, ruid, euid, suid, 0, 0, 0); } diff --git a/src/unistd/setreuid.c b/src/unistd/setreuid.c index d926454a..93d68c03 100644 --- a/src/unistd/setreuid.c +++ b/src/unistd/setreuid.c @@ -4,5 +4,5 @@ int setreuid(uid_t ruid, uid_t euid) { - return __rsyscall(__NR_setreuid, ruid, euid, 0, 0, 0, 0); + return __rsyscall(SYS_setreuid, ruid, euid, 0, 0, 0, 0); } diff --git a/src/unistd/setuid.c b/src/unistd/setuid.c index da6816de..e778c7f3 100644 --- a/src/unistd/setuid.c +++ b/src/unistd/setuid.c @@ -4,5 +4,5 @@ int setuid(uid_t uid) { - return __rsyscall(__NR_setuid, uid, 0, 0, 0, 0, 0); + return __rsyscall(SYS_setuid, uid, 0, 0, 0, 0, 0); } diff --git a/src/unistd/truncate.c b/src/unistd/truncate.c index 3edacd12..461f6de1 100644 --- a/src/unistd/truncate.c +++ b/src/unistd/truncate.c @@ -4,7 +4,7 @@ int truncate(const char *path, off_t length) { - return syscall(__NR_truncate, path, __SYSCALL_LL(length)); + return syscall(SYS_truncate, path, __SYSCALL_LL(length)); } LFS64(truncate);