From b2486a8922bf4977bd82c8190258e39de28c053b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 6 Apr 2011 20:27:07 -0400 Subject: move rsyscall out of pthread_create module this is something of a tradeoff, as now set*id() functions, rather than pthread_create, are what pull in the code overhead for dealing with linux's refusal to implement proper POSIX thread-vs-process semantics. my motivations are: 1. it's cleaner this way, especially cleaner to optimize out the rsyscall locking overhead from pthread_create when it's not needed. 2. it's expected that only a tiny number of core system programs will ever use set*id() functions, whereas many programs may want to use threads, and making thread overhead tiny is an incentive for "light" programs to try threads. --- src/unistd/setgid.c | 3 +-- src/unistd/setregid.c | 3 +-- src/unistd/setresgid.c | 3 +-- src/unistd/setresuid.c | 3 +-- src/unistd/setreuid.c | 3 +-- src/unistd/setuid.c | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/unistd') diff --git a/src/unistd/setgid.c b/src/unistd/setgid.c index e98a2982..b54d2b22 100644 --- a/src/unistd/setgid.c +++ b/src/unistd/setgid.c @@ -4,6 +4,5 @@ int setgid(gid_t gid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setgid, gid, 0, 0, 0, 0, 0); - return syscall(SYS_setgid, gid); + return __rsyscall(__NR_setgid, gid, 0, 0, 0, 0, 0); } diff --git a/src/unistd/setregid.c b/src/unistd/setregid.c index ff2607dc..49c59858 100644 --- a/src/unistd/setregid.c +++ b/src/unistd/setregid.c @@ -4,6 +4,5 @@ int setregid(gid_t rgid, gid_t egid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setregid, rgid, egid, 0, 0, 0, 0); - return syscall(SYS_setregid, rgid, egid); + return __rsyscall(__NR_setregid, rgid, egid, 0, 0, 0, 0); } diff --git a/src/unistd/setresgid.c b/src/unistd/setresgid.c index 3c85a828..2b0c96d8 100644 --- a/src/unistd/setresgid.c +++ b/src/unistd/setresgid.c @@ -5,6 +5,5 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setresgid, rgid, egid, sgid, 0, 0, 0); - return syscall(SYS_setresgid, rgid, egid, sgid); + return __rsyscall(__NR_setresgid, rgid, egid, sgid, 0, 0, 0); } diff --git a/src/unistd/setresuid.c b/src/unistd/setresuid.c index 376ce406..7fa6bc38 100644 --- a/src/unistd/setresuid.c +++ b/src/unistd/setresuid.c @@ -5,6 +5,5 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setresuid, ruid, euid, suid, 0, 0, 0); - return syscall(SYS_setresuid, ruid, euid, suid); + return __rsyscall(__NR_setresuid, ruid, euid, suid, 0, 0, 0); } diff --git a/src/unistd/setreuid.c b/src/unistd/setreuid.c index 505e8bc1..d926454a 100644 --- a/src/unistd/setreuid.c +++ b/src/unistd/setreuid.c @@ -4,6 +4,5 @@ int setreuid(uid_t ruid, uid_t euid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setreuid, ruid, euid, 0, 0, 0, 0); - return syscall(SYS_setreuid, ruid, euid); + return __rsyscall(__NR_setreuid, ruid, euid, 0, 0, 0, 0); } diff --git a/src/unistd/setuid.c b/src/unistd/setuid.c index 61e8be55..da6816de 100644 --- a/src/unistd/setuid.c +++ b/src/unistd/setuid.c @@ -4,6 +4,5 @@ int setuid(uid_t uid) { - if (libc.rsyscall) return libc.rsyscall(__NR_setuid, uid, 0, 0, 0, 0, 0); - return syscall(SYS_setuid, uid); + return __rsyscall(__NR_setuid, uid, 0, 0, 0, 0, 0); } -- cgit v1.2.1