From 9b235e8374bfe15f73d470b4ad7d1c579fd9a71e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 15 Feb 2011 14:39:02 -0500 Subject: [PATCH] remove standalone syscall cruft this was originally written for an early draft of the library where non-standard functions would reside in a static library separate from the shared libc.so, which would implement a pure standard. the idea was not to depend on an implementation-dependent __syscall_ret function in the main libc. but it turned out to be better to put everything in a single library for both static and dynamic linking uses, and thus the (incomplete) remnants of this feature were just enlarging the source and binary. --- arch/i386/syscall.h | 12 +----------- arch/x86_64/syscall.h | 12 +----------- src/linux/chroot.c | 1 - src/linux/klogctl.c | 1 - src/linux/mount.c | 1 - src/linux/sethostname.c | 1 - src/linux/swapoff.c | 1 - src/linux/swapon.c | 1 - src/linux/sysinfo.c | 1 - src/linux/utimes.c | 1 - src/linux/wait3.c | 1 - src/linux/wait4.c | 1 - 12 files changed, 2 insertions(+), 32 deletions(-) diff --git a/arch/i386/syscall.h b/arch/i386/syscall.h index c87401f3..ee871a9d 100644 --- a/arch/i386/syscall.h +++ b/arch/i386/syscall.h @@ -7,17 +7,7 @@ #define SYSCALL_SIGSET_SIZE 8 -#if defined(SYSCALL_STANDALONE) -#include -static inline long __syscall_ret(unsigned long r) -{ - if (r >= (unsigned long)-1 - 4096) { - errno = -(long)r; - return -1; - } - return (long)r; -} -#elif defined(SYSCALL_NORETURN) +#if defined(SYSCALL_NORETURN) static inline long __syscall_ret(unsigned long r) { for(;;); diff --git a/arch/x86_64/syscall.h b/arch/x86_64/syscall.h index 0b04b29e..cfaa790f 100644 --- a/arch/x86_64/syscall.h +++ b/arch/x86_64/syscall.h @@ -4,17 +4,7 @@ #define SYSCALL_LL(x) x, 0 #define SYSCALL_SIGSET_SIZE 8 -#if defined(SYSCALL_STANDALONE) -#include -static inline long __syscall_ret(unsigned long r) -{ - if (r >= (unsigned long)-1 - 4096) { - errno = -(long)r; - return -1; - } - return (long)r; -} -#elif defined(SYSCALL_NORETURN) +#if defined(SYSCALL_NORETURN) static inline long __syscall_ret(unsigned long r) { for(;;); diff --git a/src/linux/chroot.c b/src/linux/chroot.c index b5af62dc..81363a6b 100644 --- a/src/linux/chroot.c +++ b/src/linux/chroot.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int chroot(const char *path) diff --git a/src/linux/klogctl.c b/src/linux/klogctl.c index 6c288aff..976f29e3 100644 --- a/src/linux/klogctl.c +++ b/src/linux/klogctl.c @@ -1,4 +1,3 @@ -#define SYSCALL_STANDALONE #include "syscall.h" int klogctl (int type, char *buf, int len) diff --git a/src/linux/mount.c b/src/linux/mount.c index 61299d48..8e3cc122 100644 --- a/src/linux/mount.c +++ b/src/linux/mount.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int mount(const char *special, const char *dir, const char *fstype, unsigned long flags, const void *data) diff --git a/src/linux/sethostname.c b/src/linux/sethostname.c index f61e0cb4..c94325e6 100644 --- a/src/linux/sethostname.c +++ b/src/linux/sethostname.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int sethostname(const char *name, size_t len) diff --git a/src/linux/swapoff.c b/src/linux/swapoff.c index f6fa794e..4f19823f 100644 --- a/src/linux/swapoff.c +++ b/src/linux/swapoff.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int swapoff(const char *path) diff --git a/src/linux/swapon.c b/src/linux/swapon.c index 13d2876b..5c75247f 100644 --- a/src/linux/swapon.c +++ b/src/linux/swapon.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int swapon(const char *path, int flags) diff --git a/src/linux/sysinfo.c b/src/linux/sysinfo.c index 98669472..c61b7aa8 100644 --- a/src/linux/sysinfo.c +++ b/src/linux/sysinfo.c @@ -1,4 +1,3 @@ -#define SYSCALL_STANDALONE #include "syscall.h" struct sysinfo; diff --git a/src/linux/utimes.c b/src/linux/utimes.c index 99a3b2b8..59ee1a81 100644 --- a/src/linux/utimes.c +++ b/src/linux/utimes.c @@ -1,5 +1,4 @@ #include -#define SYSCALL_STANDALONE #include "syscall.h" int utimes(const char *path, const struct timeval times[2]) diff --git a/src/linux/wait3.c b/src/linux/wait3.c index dd63707c..d1d91b05 100644 --- a/src/linux/wait3.c +++ b/src/linux/wait3.c @@ -1,6 +1,5 @@ #include #include -#define SYSCALL_STANDALONE #include "syscall.h" pid_t wait4(pid_t, int *, int, struct rusage *); diff --git a/src/linux/wait4.c b/src/linux/wait4.c index dda942d3..5dd505a9 100644 --- a/src/linux/wait4.c +++ b/src/linux/wait4.c @@ -1,7 +1,6 @@ #include #include #include -#define SYSCALL_STANDALONE #include "syscall.h" pid_t wait4(pid_t pid, int *status, int options, struct rusage *usage) -- GitLab