mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-10 08:42:02 +03:00
consistency: change all remaining syscalls to use SYS_ rather than __NR_ prefix
This commit is contained in:
parent
b2486a8922
commit
c2cd25bff8
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 }));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -3,5 +3,5 @@
|
||||
|
||||
int sigpending(sigset_t *set)
|
||||
{
|
||||
return syscall(__NR_rt_sigpending, set, 8);
|
||||
return syscall(SYS_rt_sigpending, set, 8);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
int gettimeofday(struct timeval *tv, void *tz)
|
||||
{
|
||||
__syscall(__NR_gettimeofday, tv, 0);
|
||||
__syscall(SYS_gettimeofday, tv, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user