summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/bits/syscalls-common.h1
-rw-r--r--libc/sysdeps/linux/common/getegid.c22
-rw-r--r--libc/sysdeps/linux/common/geteuid.c21
-rw-r--r--libc/sysdeps/linux/common/getgid.c8
-rw-r--r--libc/sysdeps/linux/common/getpgrp.c2
-rw-r--r--libc/sysdeps/linux/common/getpid.c12
-rw-r--r--libc/sysdeps/linux/common/getppid.c8
-rw-r--r--libc/sysdeps/linux/common/getuid.c8
-rw-r--r--libc/sysdeps/linux/common/umask.c2
9 files changed, 33 insertions, 51 deletions
diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h
index 5e4e350c5..1b84d9e2b 100644
--- a/libc/sysdeps/linux/common/bits/syscalls-common.h
+++ b/libc/sysdeps/linux/common/bits/syscalls-common.h
@@ -97,6 +97,7 @@ type name(C_DECL_ARGS_##nargs(args)) { \
}
#define _syscall0(args...) SYSCALL_FUNC(0, args)
+#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args)
#define _syscall1(args...) SYSCALL_FUNC(1, args)
#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args)
#define _syscall2(args...) SYSCALL_FUNC(2, args)
diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c
index f2b6401cf..80a8ac9bb 100644
--- a/libc/sysdeps/linux/common/getegid.c
+++ b/libc/sysdeps/linux/common/getegid.c
@@ -10,24 +10,12 @@
#include <sys/syscall.h>
#include <unistd.h>
-
-#if defined(__NR_getegid32)
+#ifdef __NR_getegid32
# undef __NR_getegid
# define __NR_getegid __NR_getegid32
-_syscall0(gid_t, getegid)
-
-#elif defined(__NR_getegid)
-# define __NR___syscall_getegid __NR_getegid
-static __inline__ _syscall0(int, __syscall_getegid)
-gid_t getegid(void)
-{
- return (__syscall_getegid());
-}
-#else
-
-gid_t getegid(void)
-{
- return (getgid());
-}
#endif
+
+#ifdef __NR_getegid
+_syscall_noerr0(gid_t, getegid)
libc_hidden_def(getegid)
+#endif
diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c
index 6111e5d1b..610fbc170 100644
--- a/libc/sysdeps/linux/common/geteuid.c
+++ b/libc/sysdeps/linux/common/geteuid.c
@@ -10,25 +10,12 @@
#include <sys/syscall.h>
#include <unistd.h>
-
-#if defined(__NR_geteuid32)
+#ifdef __NR_geteuid32
# undef __NR_geteuid
# define __NR_geteuid __NR_geteuid32
-_syscall0(uid_t, geteuid)
-
-#elif defined(__NR_geteuid)
-# define __NR___syscall_geteuid __NR_geteuid
-static __inline__ _syscall0(int, __syscall_geteuid)
-uid_t geteuid(void)
-{
- return (__syscall_geteuid());
-}
-
-#else
-uid_t geteuid(void)
-{
- return (getuid());
-}
#endif
+#ifdef __NR_geteuid
+_syscall_noerr0(uid_t, geteuid)
libc_hidden_def(geteuid)
+#endif
diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c
index 80c60034e..ccfbfc067 100644
--- a/libc/sysdeps/linux/common/getgid.c
+++ b/libc/sysdeps/linux/common/getgid.c
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#if defined __NR_getxgid
+#ifdef __NR_getxgid
# undef __NR_getgid
# define __NR_getgid __NR_getxgid
#endif
@@ -19,5 +19,9 @@
# define __NR_getgid __NR_getgid32
#endif
-_syscall0(gid_t, getgid)
+_syscall_noerr0(gid_t, getgid)
libc_hidden_def(getgid)
+#if !defined __NR_getegid32 && !defined __NR_getegid
+strong_alias(getgid,getegid)
+libc_hidden_def(getegid)
+#endif
diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c
index 80a53daee..0af9dc499 100644
--- a/libc/sysdeps/linux/common/getpgrp.c
+++ b/libc/sysdeps/linux/common/getpgrp.c
@@ -12,7 +12,7 @@
#ifdef __NR_getpgrp
/* According to the manpage the POSIX.1 version is favoured */
-_syscall0(pid_t, getpgrp)
+_syscall_noerr0(pid_t, getpgrp)
#elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid)
/* IA64 doesn't have a getpgrp syscall */
pid_t getpgrp(void)
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index 8041022e7..d9a69084f 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -10,11 +10,13 @@
#include <sys/syscall.h>
#include <unistd.h>
-extern __typeof(getpid) __libc_getpid;
-#if defined __NR_getxpid
+#ifdef __NR_getxpid
+# undef __NR_getpid
# define __NR_getpid __NR_getxpid
#endif
-#define __NR___libc_getpid __NR_getpid
-_syscall0(pid_t, __libc_getpid)
-weak_alias(__libc_getpid, getpid)
+
+_syscall_noerr0(pid_t, getpid)
libc_hidden_weak(getpid)
+#ifndef __NR_getppid
+strong_alias(getpid,getppid)
+#endif
diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c
index 4f2b0e933..9d85661d9 100644
--- a/libc/sysdeps/linux/common/getppid.c
+++ b/libc/sysdeps/linux/common/getppid.c
@@ -9,11 +9,7 @@
#include <sys/syscall.h>
#include <unistd.h>
+
#ifdef __NR_getppid
-_syscall0(pid_t, getppid)
-#else
-pid_t getppid(void)
-{
- return getpid();
-}
+_syscall_noerr0(pid_t, getppid)
#endif
diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c
index b6f813a06..f921acb2e 100644
--- a/libc/sysdeps/linux/common/getuid.c
+++ b/libc/sysdeps/linux/common/getuid.c
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-#if defined __NR_getxuid
+#ifdef __NR_getxuid
# undef __NR_getuid
# define __NR_getuid __NR_getxuid
#endif
@@ -19,5 +19,9 @@
# define __NR_getuid __NR_getuid32
#endif
-_syscall0(uid_t, getuid)
+_syscall_noerr0(uid_t, getuid)
libc_hidden_def(getuid)
+#if !defined __NR_geteuid32 && !defined __NR_geteuid
+strong_alias(getuid,geteuid)
+libc_hidden_def(geteuid)
+#endif
diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c
index ef9860e31..b838e1731 100644
--- a/libc/sysdeps/linux/common/umask.c
+++ b/libc/sysdeps/linux/common/umask.c
@@ -15,5 +15,5 @@ static __inline__ _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, m
mode_t umask(mode_t mode)
{
- return (__syscall_umask(mode));
+ return __syscall_umask(mode);
}