void _Exit(int ec)
{
- __syscall(__NR_exit_group, ec);
- __syscall(__NR_exit, ec);
+ __syscall(SYS_exit_group, ec);
+ __syscall(SYS_exit, ec);
}
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);
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);
{
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 }));
{
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);
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);
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);
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);
#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);
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);
int shmdt(const void *addr)
{
-#ifdef __NR_shmdt
+#ifdef SYS_shmdt
return syscall(SYS_shmdt, addr);
#else
return syscall(SYS_ipc, IPCOP_shmdt, addr);
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);
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);
int sigpending(sigset_t *set)
{
- return syscall(__NR_rt_sigpending, set, 8);
+ return syscall(SYS_rt_sigpending, set, 8);
}
{
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;
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;
* 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);
}
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;
}
}
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);
}
{
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);
}
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);
}
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);
}
.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
{
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;
}
int gettimeofday(struct timeval *tv, void *tz)
{
- __syscall(__NR_gettimeofday, tv, 0);
+ __syscall(SYS_gettimeofday, tv, 0);
return 0;
}
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;
}
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);
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
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);
{
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;
}
{
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;
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);