diff options
32 files changed, 127 insertions, 252 deletions
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index d9103ea9f..c84a51905 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -35,12 +35,10 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden; #ifdef L_accept -extern __typeof(accept) __libc_accept; #ifdef __NR_accept -#define __NR___libc_accept __NR_accept -_syscall3(int, __libc_accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen) +_syscall3(int, accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen) #elif defined(__NR_socketcall) -int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) +int accept(int s, struct sockaddr *addr, socklen_t * addrlen) { unsigned long args[3]; @@ -50,9 +48,7 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) return __socketcall(SYS_ACCEPT, args); } #endif -/* libc_hidden_proto(accept) */ -weak_alias(__libc_accept,accept) -libc_hidden_weak(accept) +libc_hidden_def(accept) #endif #ifdef L_bind @@ -74,12 +70,10 @@ libc_hidden_def(bind) #endif #ifdef L_connect -extern __typeof(connect) __libc_connect; #ifdef __NR_connect -#define __NR___libc_connect __NR_connect -_syscall3(int, __libc_connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen) +_syscall3(int, connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen) #elif defined(__NR_socketcall) -int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) +int connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) { unsigned long args[3]; @@ -89,9 +83,7 @@ int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) return __socketcall(SYS_CONNECT, args); } #endif -/* libc_hidden_proto(connect) */ -weak_alias(__libc_connect,connect) -libc_hidden_weak(connect) +libc_hidden_def(connect) #endif #ifdef L_getpeername @@ -165,14 +157,12 @@ libc_hidden_def(listen) #endif #ifdef L_recv -extern __typeof(recv) __libc_recv; #ifdef __NR_recv -#define __NR___libc_recv __NR_recv -_syscall4(ssize_t, __libc_recv, int, sockfd, __ptr_t, buffer, size_t, len, +_syscall4(ssize_t, recv, int, sockfd, __ptr_t, buffer, size_t, len, int, flags) #elif defined(__NR_socketcall) /* recv, recvfrom added by bir7@leland.stanford.edu */ -ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) +ssize_t recv(int sockfd, __ptr_t buffer, size_t len, int flags) { unsigned long args[4]; @@ -184,25 +174,21 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) } #elif defined(__NR_recvfrom) /* libc_hidden_proto(recvfrom) */ -ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) +ssize_t recv(int sockfd, __ptr_t buffer, size_t len, int flags) { return (recvfrom(sockfd, buffer, len, flags, NULL, NULL)); } #endif -/* libc_hidden_proto(recv) */ -weak_alias(__libc_recv,recv) -libc_hidden_weak(recv) +libc_hidden_def(recv) #endif #ifdef L_recvfrom -extern __typeof(recvfrom) __libc_recvfrom; #ifdef __NR_recvfrom -#define __NR___libc_recvfrom __NR_recvfrom -_syscall6(ssize_t, __libc_recvfrom, int, sockfd, __ptr_t, buffer, size_t, len, +_syscall6(ssize_t, recvfrom, int, sockfd, __ptr_t, buffer, size_t, len, int, flags, struct sockaddr *, to, socklen_t *, tolen) #elif defined(__NR_socketcall) /* recv, recvfrom added by bir7@leland.stanford.edu */ -ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, +ssize_t recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, struct sockaddr *to, socklen_t * tolen) { unsigned long args[6]; @@ -216,18 +202,14 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, return (__socketcall(SYS_RECVFROM, args)); } #endif -/* libc_hidden_proto(recvfrom) */ -weak_alias(__libc_recvfrom,recvfrom) -libc_hidden_weak(recvfrom) +libc_hidden_def(recvfrom) #endif #ifdef L_recvmsg -extern __typeof(recvmsg) __libc_recvmsg; #ifdef __NR_recvmsg -#define __NR___libc_recvmsg __NR_recvmsg -_syscall3(ssize_t, __libc_recvmsg, int, sockfd, struct msghdr *, msg, int, flags) +_syscall3(ssize_t, recvmsg, int, sockfd, struct msghdr *, msg, int, flags) #elif defined(__NR_socketcall) -ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) +ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags) { unsigned long args[3]; @@ -237,19 +219,15 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) return (__socketcall(SYS_RECVMSG, args)); } #endif -/* libc_hidden_proto(recvmsg) */ -weak_alias(__libc_recvmsg,recvmsg) -libc_hidden_weak(recvmsg) +libc_hidden_def(recvmsg) #endif #ifdef L_send -extern __typeof(send) __libc_send; #ifdef __NR_send -#define __NR___libc_send __NR_send -_syscall4(ssize_t, __libc_send, int, sockfd, const void *, buffer, size_t, len, int, flags) +_syscall4(ssize_t, send, int, sockfd, const void *, buffer, size_t, len, int, flags) #elif defined(__NR_socketcall) /* send, sendto added by bir7@leland.stanford.edu */ -ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) +ssize_t send(int sockfd, const void *buffer, size_t len, int flags) { unsigned long args[4]; @@ -261,23 +239,20 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) } #elif defined(__NR_sendto) /* libc_hidden_proto(sendto) */ -ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) +ssize_t send(int sockfd, const void *buffer, size_t len, int flags) { return (sendto(sockfd, buffer, len, flags, NULL, 0)); } #endif /* libc_hidden_proto(send) */ -weak_alias(__libc_send,send) -libc_hidden_weak(send) +libc_hidden_def(send) #endif #ifdef L_sendmsg -extern __typeof(sendmsg) __libc_sendmsg; #ifdef __NR_sendmsg -#define __NR___libc_sendmsg __NR_sendmsg -_syscall3(ssize_t, __libc_sendmsg, int, sockfd, const struct msghdr *, msg, int, flags) +_syscall3(ssize_t, sendmsg, int, sockfd, const struct msghdr *, msg, int, flags) #elif defined(__NR_socketcall) -ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) +ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags) { unsigned long args[3]; @@ -287,20 +262,16 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) return (__socketcall(SYS_SENDMSG, args)); } #endif -/* libc_hidden_proto(sendmsg) */ -weak_alias(__libc_sendmsg,sendmsg) -libc_hidden_weak(sendmsg) +libc_hidden_def(sendmsg) #endif #ifdef L_sendto -extern __typeof(sendto) __libc_sendto; #ifdef __NR_sendto -#define __NR___libc_sendto __NR_sendto -_syscall6(ssize_t, __libc_sendto, int, sockfd, const void *, buffer, +_syscall6(ssize_t, sendto, int, sockfd, const void *, buffer, size_t, len, int, flags, const struct sockaddr *, to, socklen_t, tolen) #elif defined(__NR_socketcall) /* send, sendto added by bir7@leland.stanford.edu */ -ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, +ssize_t sendto(int sockfd, const void *buffer, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { unsigned long args[6]; @@ -314,9 +285,7 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, return (__socketcall(SYS_SENDTO, args)); } #endif -/* libc_hidden_proto(sendto) */ -weak_alias(__libc_sendto,sendto) -libc_hidden_weak(sendto) +libc_hidden_def(sendto) #endif #ifdef L_setsockopt diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 3804e5e15..7de372387 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -41,12 +41,10 @@ /* libc_hidden_proto(fstat) */ /* libc_hidden_proto(abort) */ -extern __typeof(open) __libc_open; -libc_hidden_proto(__libc_open) #endif #ifndef SHARED -void *__libc_stack_end=NULL; +void *__libc_stack_end = NULL; # ifdef __UCLIBC_HAS_SSP__ # include <dl-osinfo.h> @@ -140,10 +138,10 @@ static void __check_one_fd(int fd, int mode) if (fcntl(fd, F_GETFD) == -1) { /* The descriptor is probably not open, so try to use /dev/null */ - int nullfd = __libc_open(_PATH_DEVNULL, mode); + int nullfd = open(_PATH_DEVNULL, mode); /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not - * some other wierd file... [removed in uclibc] */ + * some other weird file... [removed in uclibc] */ if (nullfd!=fd) { abort(); diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index e3c19eba3..fc7f200d0 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -49,8 +49,8 @@ extern __typeof(sigaction) __libc_sigaction; If OACT is not NULL, put the old action for SIG in *OACT. */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { - int result; - struct kernel_sigaction kact, koact; + int result; + struct kernel_sigaction kact, koact; enum { SIGSET_MIN_SIZE = sizeof(kact.sa_mask) < sizeof(act->sa_mask) ? sizeof(kact.sa_mask) : sizeof(act->sa_mask) diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c index 6a160b43e..be3d2e051 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -10,9 +10,5 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(close) __libc_close; -#define __NR___libc_close __NR_close -_syscall1(int, __libc_close, int, fd) -/* libc_hidden_proto(close) */ -weak_alias(__libc_close,close) -libc_hidden_weak(close) +_syscall1(int, close, int, fd) +libc_hidden_def(close) diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 6fa010545..577ad14b5 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -22,15 +22,9 @@ #include <fcntl.h> #include <sys/types.h> -extern __typeof(open64) __libc_open64; -libc_hidden_proto(__libc_open64) - -extern __typeof(creat64) __libc_creat64; - /* Create FILE with protections MODE. */ -int __libc_creat64 (const char *file, mode_t mode) +int creat64(const char *file, mode_t mode) { - return __libc_open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode); + return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode); } -weak_alias(__libc_creat64,creat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index 1066770d5..838cb7d21 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -10,7 +10,4 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(fsync) __libc_fsync; -#define __NR___libc_fsync __NR_fsync -_syscall1(int, __libc_fsync, int, fd) -weak_alias(__libc_fsync, fsync) +_syscall1(int, fsync, int, fd) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index 1879464f7..6bb88cac5 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -11,8 +11,6 @@ #include <sys/types.h> #include <sys/syscall.h> -extern __typeof(lseek64) __libc_lseek64; - #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__ # ifndef INLINE_SYSCALL @@ -22,22 +20,20 @@ static __inline__ _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi, off_t, offset_lo, loff_t *, result, int, whence) # endif -loff_t __libc_lseek64(int fd, loff_t offset, int whence) +loff_t lseek64(int fd, loff_t offset, int whence) { loff_t result; - return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32), + return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32), (off_t) (offset & 0xffffffff), &result, whence) ?: result); } + #else -extern __typeof(lseek) __libc_lseek; -/* libc_hidden_proto(__libc_lseek) */ -loff_t __libc_lseek64(int fd, loff_t offset, int whence) +loff_t lseek64(int fd, loff_t offset, int whence) { - return(loff_t)(__libc_lseek(fd, (off_t) (offset), whence)); + return (loff_t)(lseek(fd, (off_t) (offset), whence)); } + #endif -/* libc_hidden_proto(lseek64) */ -weak_alias(__libc_lseek64,lseek64) -libc_hidden_weak(lseek64) -/*strong_alias(__libc_lseek64,_llseek) */ + +libc_hidden_def(lseek64) diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index ee49c9f25..b58f75c01 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -10,23 +10,13 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(lseek) __libc_lseek; -libc_hidden_proto(__libc_lseek) - #ifdef __NR_lseek -#define __NR___libc_lseek __NR_lseek -_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence) +_syscall3(__off_t, lseek, int, fildes, __off_t, offset, int, whence) #else -extern __typeof(lseek64) __libc_lseek64; -libc_hidden_proto(__libc_lseek64) -__off_t __libc_lseek(int fildes, __off_t offset, int whence) +__off_t lseek(int fildes, __off_t offset, int whence) { - return __libc_lseek64(fildes, offset, whence); + return lseek64(fildes, offset, whence); } #endif -libc_hidden_def(__libc_lseek) - -/* libc_hidden_proto(lseek) */ -weak_alias(__libc_lseek,lseek) -libc_hidden_weak(lseek) +libc_hidden_def(lseek) diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 0b33fb659..a0b47f913 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -14,9 +14,6 @@ #include <sys/mman.h> -extern __typeof(msync) __libc_msync; -#define __NR___libc_msync __NR_msync -_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags) -weak_alias(__libc_msync,msync) +_syscall3(int, msync, void *, addr, size_t, length, int, flags) #endif diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 24b2eb080..19f01183b 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -11,12 +11,7 @@ #include <time.h> #if defined __USE_POSIX199309 && defined __NR_nanosleep - -extern __typeof(nanosleep) __libc_nanosleep; -#define __NR___libc_nanosleep __NR_nanosleep -_syscall2(int, __libc_nanosleep, const struct timespec *, req, +_syscall2(int, nanosleep, const struct timespec *, req, struct timespec *, rem) -/* libc_hidden_proto(nanosleep) */ -weak_alias(__libc_nanosleep,nanosleep) -libc_hidden_weak(nanosleep) +libc_hidden_def(nanosleep) #endif diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index a39093bd1..0faf02a00 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -14,35 +14,26 @@ #include <string.h> #include <sys/param.h> -extern __typeof(open) __libc_open; -extern __typeof(creat) __libc_creat; - #define __NR___syscall_open __NR_open static __inline__ _syscall3(int, __syscall_open, const char *, file, int, flags, __kernel_mode_t, mode) -libc_hidden_proto(__libc_open) -int __libc_open(const char *file, int oflag, ...) +int open(const char *file, int oflag, ...) { mode_t mode = 0; if (oflag & O_CREAT) { va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, mode_t); - va_end (arg); + va_start(arg, oflag); + mode = va_arg(arg, mode_t); + va_end(arg); } return __syscall_open(file, oflag, mode); } -libc_hidden_def(__libc_open) - -/* libc_hidden_proto(open) */ -weak_alias(__libc_open,open) -libc_hidden_weak(open) +libc_hidden_def(open) -int __libc_creat(const char *file, mode_t mode) +int creat(const char *file, mode_t mode) { - return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); + return open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); } -weak_alias(__libc_creat,creat) diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index 4d965aeba..19ec33321 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -14,14 +14,9 @@ # define O_LARGEFILE 0100000 #endif -extern __typeof(open64) __libc_open64; -extern __typeof(open) __libc_open; -libc_hidden_proto(__libc_open) - /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ -libc_hidden_proto(__libc_open64) -int __libc_open64 (const char *file, int oflag, ...) +int open64 (const char *file, int oflag, ...) { mode_t mode = 0; @@ -33,11 +28,8 @@ int __libc_open64 (const char *file, int oflag, ...) va_end (arg); } - return __libc_open(file, oflag | O_LARGEFILE, mode); + return open(file, oflag | O_LARGEFILE, mode); } -libc_hidden_def(__libc_open64) +libc_hidden_def(open64) -/* libc_hidden_proto(open64) */ -weak_alias(__libc_open64,open64) -libc_hidden_weak(open64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index 5c75211a7..7f2ca57a5 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -11,18 +11,16 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(pause) __libc_pause; #ifdef __NR_pause -#define __NR___libc_pause __NR_pause -_syscall0(int, __libc_pause) + +_syscall0(int, pause) + #else -#include <signal.h> -/* libc_hidden_proto(__sigpause) */ -/* libc_hidden_proto(sigblock) */ -int __libc_pause(void) +#include <signal.h> +int pause(void) { return (__sigpause(sigblock(0), 0)); } + #endif -weak_alias(__libc_pause,pause) diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c index cb1d83820..83d5fdfb0 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -42,8 +42,8 @@ weak_alias(__libc_pread,pread) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); } weak_alias(__libc_pread64,pread64) @@ -66,8 +66,8 @@ weak_alias(__libc_pwrite,pwrite) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); } weak_alias(__libc_pwrite64,pwrite64) diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c index cfa857319..b380812e6 100644 --- a/libc/sysdeps/linux/common/read.c +++ b/libc/sysdeps/linux/common/read.c @@ -10,9 +10,5 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(read) __libc_read; -#define __NR___libc_read __NR_read -_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count) -/* libc_hidden_proto(read) */ -weak_alias(__libc_read,read) -libc_hidden_weak(read) +_syscall3(ssize_t, read, int, fd, __ptr_t, buf, size_t, count) +libc_hidden_def(read) diff --git a/libc/sysdeps/linux/common/readv.c b/libc/sysdeps/linux/common/readv.c index 86e94d8a1..3c40a0d8d 100644 --- a/libc/sysdeps/linux/common/readv.c +++ b/libc/sysdeps/linux/common/readv.c @@ -10,9 +10,5 @@ #include <sys/syscall.h> #include <sys/uio.h> -extern __typeof(readv) __libc_readv; - -#define __NR___libc_readv __NR_readv -_syscall3(ssize_t, __libc_readv, int, filedes, const struct iovec *, vector, +_syscall3(ssize_t, readv, int, filedes, const struct iovec *, vector, int, count) -weak_alias(__libc_readv,readv) diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 40989334f..d542679ce 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -30,7 +30,7 @@ _syscall2(int, truncate64, const char *, path, __off64_t, length) #elif __WORDSIZE == 32 #ifndef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) __syscall_truncate64 (args) +#define INLINE_SYSCALL(name, nr, args...) __syscall_truncate64(args) #define __NR___syscall_truncate64 __NR_truncate64 #if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) static __inline__ _syscall4(int, __syscall_truncate64, const char *, path, @@ -41,18 +41,17 @@ static __inline__ _syscall3(int, __syscall_truncate64, const char *, path, #endif #endif - /* The exported truncate64 function. */ -int truncate64 (const char * path, __off64_t length) +int truncate64(const char * path, __off64_t length) { - uint32_t low = length & 0xffffffff; - uint32_t high = length >> 32; + uint32_t low = length & 0xffffffff; + uint32_t high = length >> 32; #if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) - return INLINE_SYSCALL(truncate64, 4, path, 0, - __LONG_LONG_PAIR (high, low)); + return INLINE_SYSCALL(truncate64, 4, path, 0, + __LONG_LONG_PAIR(high, low)); #else - return INLINE_SYSCALL(truncate64, 3, path, - __LONG_LONG_PAIR (high, low)); + return INLINE_SYSCALL(truncate64, 3, path, + __LONG_LONG_PAIR(high, low)); #endif } @@ -64,7 +63,7 @@ int truncate64 (const char * path, __off64_t length) /* libc_hidden_proto(truncate) */ -int truncate64 (const char * path, __off64_t length) +int truncate64(const char * path, __off64_t length) { __off_t x = (__off_t) length; diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index e1b41112d..32602e80f 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -12,12 +12,9 @@ /* libc_hidden_proto(wait4) */ -extern __typeof(wait) __libc_wait; - /* Wait for a child to die. When one does, put its status in *STAT_LOC * and return its process ID. For errors, return (pid_t) -1. */ -__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc) +__pid_t wait (__WAIT_STATUS_DEFN stat_loc) { return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); } -weak_alias(__libc_wait,wait) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index d5afd8262..16075cad9 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -12,11 +12,8 @@ /* libc_hidden_proto(wait4) */ -extern __typeof(waitpid) __libc_waitpid; -__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) +__pid_t waitpid(__pid_t pid, int *wait_stat, int options) { return wait4(pid, wait_stat, options, NULL); } -/* libc_hidden_proto(waitpid) */ -weak_alias(__libc_waitpid,waitpid) -libc_hidden_weak(waitpid) +libc_hidden_def(waitpid) diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index 7776ec955..b6d71f033 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -10,14 +10,10 @@ #include <sys/syscall.h> #include <unistd.h> -extern __typeof(write) __libc_write; -#define __NR___libc_write __NR_write -_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count) -/* libc_hidden_proto(write) */ -weak_alias(__libc_write,write) -libc_hidden_weak(write) +_syscall3(ssize_t, write, int, fd, const __ptr_t, buf, size_t, count) +libc_hidden_def(write) #if 0 /* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o - * which is a blatent GNU libc-ism... */ -strong_alias(__libc_write,__write) + * which is a blatant GNU libc-ism... */ +strong_alias(write,__write) #endif diff --git a/libc/sysdeps/linux/common/writev.c b/libc/sysdeps/linux/common/writev.c index c393beec1..99de7e43d 100644 --- a/libc/sysdeps/linux/common/writev.c +++ b/libc/sysdeps/linux/common/writev.c @@ -10,9 +10,5 @@ #include <sys/syscall.h> #include <sys/uio.h> -extern __typeof(writev) __libc_writev; - -#define __NR___libc_writev __NR_writev -_syscall3(ssize_t, __libc_writev, int, filedes, const struct iovec *, vector, +_syscall3(ssize_t, writev, int, filedes, const struct iovec *, vector, int, count) -weak_alias(__libc_writev,writev) diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c index b1cce027f..ea6b15f6a 100644 --- a/libc/sysdeps/linux/mips/pread_write.c +++ b/libc/sysdeps/linux/mips/pread_write.c @@ -61,8 +61,8 @@ weak_alias(__libc_pread,pread) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } weak_alias(__libc_pread64,pread64) @@ -105,8 +105,8 @@ weak_alias(__libc_pwrite,pwrite) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } weak_alias(__libc_pwrite64,pwrite64) diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c index e03aaee5f..84a28e766 100644 --- a/libc/sysdeps/linux/sh/pread_write.c +++ b/libc/sysdeps/linux/sh/pread_write.c @@ -41,8 +41,8 @@ weak_alias(__libc_pread,pread) extern __typeof(pread64) __libc_pread64; ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } weak_alias(__libc_pread64,pread64) @@ -74,8 +74,8 @@ weak_alias(__libc_pwrite,pwrite) extern __typeof(pwrite64) __libc_pwrite64; ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } weak_alias(__libc_pwrite64,pwrite64) diff --git a/libc/sysdeps/linux/xtensa/pread_write.c b/libc/sysdeps/linux/xtensa/pread_write.c index 212a40935..bf69452d2 100644 --- a/libc/sysdeps/linux/xtensa/pread_write.c +++ b/libc/sysdeps/linux/xtensa/pread_write.c @@ -43,8 +43,8 @@ weak_alias(__libc_pread,pread) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR(high, low)); } weak_alias(__libc_pread64,pread64) @@ -68,8 +68,8 @@ weak_alias(__libc_pwrite,pwrite) # ifdef __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { - uint32_t low = offset & 0xffffffff; - uint32_t high = offset >> 32; + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; return __syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR(high, low)); } weak_alias(__libc_pwrite64,pwrite64) diff --git a/libc/termios/tcdrain.c b/libc/termios/tcdrain.c index 0158649bd..766f37e28 100644 --- a/libc/termios/tcdrain.c +++ b/libc/termios/tcdrain.c @@ -22,10 +22,8 @@ /* libc_hidden_proto(ioctl) */ -extern __typeof(tcdrain) __libc_tcdrain; /* Wait for pending output to be written on FD. */ -int __libc_tcdrain (int fd) +int tcdrain(int fd) { return ioctl(fd, TCSBRK, 1); } -weak_alias(__libc_tcdrain,tcdrain) diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 0cb97357c..a4da09910 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -497,14 +497,6 @@ extern void __pthread_wait_for_restart_signal(pthread_descr self); extern void (*__pthread_restart)(pthread_descr); extern void (*__pthread_suspend)(pthread_descr); -/* Prototypes for the function without cancelation support when the - normal version has it. */ -extern __typeof(close) __libc_close; -extern __typeof(nanosleep) __libc_nanosleep; -extern __typeof(read) __libc_read; -extern __typeof(waitpid) __libc_waitpid; -extern __typeof(write) __libc_write; - extern __typeof(pthread_mutex_init) __pthread_mutex_init attribute_hidden; extern __typeof(pthread_mutex_destroy) __pthread_mutex_destroy attribute_hidden; extern __typeof(pthread_mutex_lock) __pthread_mutex_lock attribute_hidden; diff --git a/libpthread/linuxthreads.old/join.c b/libpthread/linuxthreads.old/join.c index a46d0b68d..96db153bc 100644 --- a/libpthread/linuxthreads.old/join.c +++ b/libpthread/linuxthreads.old/join.c @@ -87,7 +87,7 @@ void __pthread_do_exit(void *retval, char *currentframe) if (self == __pthread_main_thread && __pthread_manager_request >= 0) { request.req_thread = self; request.req_kind = REQ_MAIN_THREAD_EXIT; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *)&request, sizeof(request))); suspend(self); /* Main thread flushes stdio streams and runs atexit functions. @@ -186,7 +186,7 @@ int pthread_join(pthread_t thread_id, void ** thread_return) request.req_thread = self; request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); } return 0; @@ -224,7 +224,7 @@ int pthread_detach(pthread_t thread_id) request.req_thread = thread_self(); request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); } return 0; diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 2be474c53..19be92fdf 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -146,7 +146,7 @@ int attribute_noreturn __pthread_manager(void *arg) /* Raise our priority to match that of main thread */ __pthread_manager_adjust_prio(__pthread_main_thread->p_priority); /* Synchronize debugging of the thread manager */ - n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, + n = TEMP_FAILURE_RETRY(read(reqfd, (char *)&request, sizeof(request))); #ifndef USE_SELECT ufd.fd = reqfd; @@ -183,9 +183,9 @@ int attribute_noreturn __pthread_manager(void *arg) #endif { - PDEBUG("before __libc_read\n"); - n = __libc_read(reqfd, (char *)&request, sizeof(request)); - PDEBUG("after __libc_read, n=%d\n", n); + PDEBUG("before read\n"); + n = read(reqfd, (char *)&request, sizeof(request)); + PDEBUG("after read, n=%d\n", n); switch(request.req_kind) { case REQ_CREATE: PDEBUG("got REQ_CREATE\n"); @@ -301,7 +301,7 @@ pthread_start_thread(void *arg) if (__pthread_threads_debug && __pthread_sig_debug > 0) { request.req_thread = self; request.req_kind = REQ_DEBUG; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); suspend(self); } @@ -807,7 +807,7 @@ static void pthread_reap_children(void) int status; PDEBUG("\n"); - while ((pid = __libc_waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) { + while ((pid = waitpid(-1, &status, WNOHANG | __WCLONE)) > 0) { pthread_exited(pid); if (WIFSIGNALED(status)) { /* If a thread died due to a signal, send the same signal to @@ -906,7 +906,7 @@ void __pthread_manager_sighandler(int sig attribute_unused) struct pthread_request request; request.req_thread = 0; request.req_kind = REQ_KICK; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); } } diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index 562aa433c..119c1cdda 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -610,8 +610,8 @@ int __pthread_initialize_manager(void) } if (pid == -1) { free(__pthread_manager_thread_bos); - __libc_close(manager_pipe[0]); - __libc_close(manager_pipe[1]); + close(manager_pipe[0]); + close(manager_pipe[1]); return -1; } __pthread_manager_request = manager_pipe[1]; /* writing end */ @@ -630,7 +630,7 @@ int __pthread_initialize_manager(void) /* Synchronize debugging of the thread manager */ PDEBUG("send REQ_DEBUG to manager thread\n"); request.req_kind = REQ_DEBUG; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); return 0; } @@ -652,7 +652,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr, request.req_args.create.arg = arg; sigprocmask(SIG_SETMASK, NULL, &request.req_args.create.mask); PDEBUG("write REQ_CREATE to manager thread\n"); - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); PDEBUG("before suspend(self)\n"); suspend(self); @@ -781,7 +781,7 @@ static void pthread_onexit_process(int retcode, void *arg attribute_unused) request.req_thread = self; request.req_kind = REQ_PROCESS_EXIT; request.req_args.exit.code = retcode; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); suspend(self); /* Main thread should accumulate times for thread manager and its @@ -895,8 +895,8 @@ void __pthread_reset_main_thread(void) free(__pthread_manager_thread_bos); __pthread_manager_thread_bos = __pthread_manager_thread_tos = NULL; /* Close the two ends of the pipe */ - __libc_close(__pthread_manager_request); - __libc_close(__pthread_manager_reader); + close(__pthread_manager_request); + close(__pthread_manager_reader); __pthread_manager_request = __pthread_manager_reader = -1; } @@ -1022,7 +1022,7 @@ __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ - if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + if (reltime.tv_sec < 0 || nanosleep(&reltime, NULL) == 0) break; } @@ -1107,7 +1107,7 @@ int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstim /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ - if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + if (reltime.tv_sec < 0 || nanosleep(&reltime, NULL) == 0) break; } @@ -1147,7 +1147,7 @@ void __pthread_message(char * fmt, ...) va_start(args, fmt); vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args); va_end(args); - TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer))); + TEMP_FAILURE_RETRY(write(2, buffer, strlen(buffer))); } #endif diff --git a/libpthread/linuxthreads.old/semaphore.c b/libpthread/linuxthreads.old/semaphore.c index 7502b6e78..c892a601b 100644 --- a/libpthread/linuxthreads.old/semaphore.c +++ b/libpthread/linuxthreads.old/semaphore.c @@ -172,7 +172,7 @@ int __new_sem_post(sem_t * sem) } request.req_kind = REQ_POST; request.req_args.post = sem; - TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + TEMP_FAILURE_RETRY(write(__pthread_manager_request, (char *) &request, sizeof(request))); } return 0; diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h index ecb7b03dd..eb0a51984 100644 --- a/libpthread/linuxthreads/internals.h +++ b/libpthread/linuxthreads/internals.h @@ -416,11 +416,6 @@ extern void (*__pthread_restart)(pthread_descr); extern void (*__pthread_suspend)(pthread_descr); extern int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *); -/* Prototypes for the function without cancelation support when the - normal version has it. */ -extern int __libc_close (int fd); -extern int __libc_nanosleep (const struct timespec *requested_time, - struct timespec *remaining); /* Prototypes for some of the new semaphore functions. */ extern int sem_post (sem_t * sem); extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value); diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 2d0f49ee9..91333f2d1 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -1245,7 +1245,7 @@ __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ - if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + if (reltime.tv_sec < 0 || nanosleep(&reltime, NULL) == 0) break; } @@ -1332,7 +1332,7 @@ __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstime) /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ - if (reltime.tv_sec < 0 || __libc_nanosleep(&reltime, NULL) == 0) + if (reltime.tv_sec < 0 || nanosleep(&reltime, NULL) == 0) break; } |