From 43ef9c6b3f3623c3328cc510d60e50ddd94cdb1d Mon Sep 17 00:00:00 2001
From: Denis Vlasenko <vda.linux@googlemail.com>
Date: Wed, 10 Dec 2008 22:41:30 +0000
Subject: *: remove some __libc_XXX functions: __libc_accept __libc_close
 __libc_connect __libc_creat __libc_creat64 __libc_fsync __libc_lseek
 __libc_lseek64 __libc_msync __libc_nanosleep __libc_open __libc_open64
 __libc_pause __libc_read __libc_readv __libc_recv __libc_recvfrom
 __libc_recvmsg __libc_send __libc_sendmsg __libc_sendto __libc_tcdrain
 __libc_wait __libc_waitpid __libc_write __libc_writev They were removed from
 glibc 1 May 2004:
 http://sources.redhat.com/ml/libc-hacker/2004-05/msg00001.html

---
 libc/inet/socketcalls.c                 | 83 +++++++++++----------------------
 libc/misc/internals/__uClibc_main.c     |  8 ++--
 libc/sysdeps/linux/arm/sigaction.c      |  4 +-
 libc/sysdeps/linux/common/close.c       |  8 +---
 libc/sysdeps/linux/common/creat64.c     | 10 +---
 libc/sysdeps/linux/common/fsync.c       |  5 +-
 libc/sysdeps/linux/common/llseek.c      | 20 ++++----
 libc/sysdeps/linux/common/lseek.c       | 18 ++-----
 libc/sysdeps/linux/common/msync.c       |  5 +-
 libc/sysdeps/linux/common/nanosleep.c   |  9 +---
 libc/sysdeps/linux/common/open.c        | 23 +++------
 libc/sysdeps/linux/common/open64.c      | 14 ++----
 libc/sysdeps/linux/common/pause.c       | 14 +++---
 libc/sysdeps/linux/common/pread_write.c |  8 ++--
 libc/sysdeps/linux/common/read.c        |  8 +---
 libc/sysdeps/linux/common/readv.c       |  6 +--
 libc/sysdeps/linux/common/truncate64.c  | 19 ++++----
 libc/sysdeps/linux/common/wait.c        |  5 +-
 libc/sysdeps/linux/common/waitpid.c     |  7 +--
 libc/sysdeps/linux/common/write.c       | 12 ++---
 libc/sysdeps/linux/common/writev.c      |  6 +--
 libc/sysdeps/linux/mips/pread_write.c   |  8 ++--
 libc/sysdeps/linux/sh/pread_write.c     |  8 ++--
 libc/sysdeps/linux/xtensa/pread_write.c |  8 ++--
 libc/termios/tcdrain.c                  |  4 +-
 25 files changed, 104 insertions(+), 216 deletions(-)

(limited to 'libc')

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)
-- 
cgit v1.2.3