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 d18b618..6ceb143 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 7c84291..d50e395 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 9d79fe7..9dfbc4e 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 ee07176..13c282e 100644
--- a/src/ipc/msgrcv.c
+++ b/src/ipc/msgrcv.c
@@ -7,7 +7,7 @@
{
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 26057f2..1e0b2fa 100644
--- a/src/ipc/msgsnd.c
+++ b/src/ipc/msgsnd.c
@@ -7,7 +7,7 @@
{
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 392a4aa..df05ec7 100644
--- a/src/ipc/semctl.c
+++ b/src/ipc/semctl.c
@@ -10,7 +10,7 @@
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 530c75f..5f110e3 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 1545340..8046e43 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 c6ee400..38db92f 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 3645fe2..b2bdfa1 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 b4c9e69..2e198b3 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 9b14f8d..61fb11d 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 0b092ae..883acb2 100644
--- a/src/mman/mmap.c
+++ b/src/mman/mmap.c
@@ -10,7 +10,7 @@
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 496025a..f6b8972 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 9ee7124..cec5ddc 100644
--- a/src/signal/sigsuspend.c
+++ b/src/signal/sigsuspend.c
@@ -6,7 +6,7 @@
{
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 86a2c87..1694cbe 100644
--- a/src/signal/sigtimedwait.c
+++ b/src/signal/sigtimedwait.c
@@ -8,7 +8,7 @@
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 21cb71a..2e00636 100644
--- a/src/thread/__lock.c
+++ b/src/thread/__lock.c
@@ -7,5 +7,5 @@
* 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 a673099..5c84e80 100644
--- a/src/thread/__timedwait.c
+++ b/src/thread/__timedwait.c
@@ -17,7 +17,7 @@
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 b0969bb..d024fb3 100644
--- a/src/thread/__wait.c
+++ b/src/thread/__wait.c
@@ -10,6 +10,6 @@
}
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 6f2f894..8fd0599 100644
--- a/src/thread/__wake.c
+++ b/src/thread/__wake.c
@@ -4,5 +4,5 @@
{
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 ec329f5..acbd5a4 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -36,7 +36,7 @@
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 17aa5c4..36e9b6d 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 d36257d..0b04d99 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 721e794..4667725 100644
--- a/src/time/clock_nanosleep.c
+++ b/src/time/clock_nanosleep.c
@@ -6,7 +6,7 @@
{
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 521b4d5..2436e49 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 2d2cfd4..05e075b 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 f57ea12..7ed69ff 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 63cea58..0a5ed39 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 34f7c7f..da56996 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 16320e2..0a04501 100644
--- a/src/unistd/pread.c
+++ b/src/unistd/pread.c
@@ -6,7 +6,7 @@
{
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 c4d3aff..f878bb6 100644
--- a/src/unistd/pwrite.c
+++ b/src/unistd/pwrite.c
@@ -6,7 +6,7 @@
{
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 b54d2b2..87b2717 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 49c5985..665b555 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 2b0c96d..9b9fe50 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 7fa6bc3..497f759 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 d926454..93d68c0 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 da6816d..e778c7f 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 3edacd1..461f6de 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);