summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/socketcalls.c95
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl.c5
-rw-r--r--libc/sysdeps/linux/common/close.c6
-rw-r--r--libc/sysdeps/linux/common/fsync.c5
-rw-r--r--libc/sysdeps/linux/common/llseek.c5
-rw-r--r--libc/sysdeps/linux/common/lseek.c5
-rw-r--r--libc/sysdeps/linux/common/msync.c5
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c5
-rw-r--r--libc/sysdeps/linux/common/open.c5
-rw-r--r--libc/sysdeps/linux/common/open64.c5
-rw-r--r--libc/sysdeps/linux/common/pause.c11
-rw-r--r--libc/sysdeps/linux/common/poll.c23
-rw-r--r--libc/sysdeps/linux/common/read.c5
-rw-r--r--libc/sysdeps/linux/common/wait.c9
-rw-r--r--libc/sysdeps/linux/common/waitpid.c7
-rw-r--r--libc/sysdeps/linux/common/write.c6
-rw-r--r--libc/termios/tcdrain.c7
17 files changed, 154 insertions, 55 deletions
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index c84a51905..c88f239b8 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -35,9 +35,9 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden;
#ifdef L_accept
-#ifdef __NR_accept
+# ifdef __NR_accept
_syscall3(int, accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
int accept(int s, struct sockaddr *addr, socklen_t * addrlen)
{
unsigned long args[3];
@@ -47,8 +47,13 @@ int accept(int s, struct sockaddr *addr, socklen_t * addrlen)
args[2] = (unsigned long) addrlen;
return __socketcall(SYS_ACCEPT, args);
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(accept)
+# else
+libc_hidden_weak(accept)
+strong_alias(accept,__libc_accept)
+# endif
#endif
#ifdef L_bind
@@ -70,9 +75,9 @@ libc_hidden_def(bind)
#endif
#ifdef L_connect
-#ifdef __NR_connect
+# ifdef __NR_connect
_syscall3(int, connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
int connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
{
unsigned long args[3];
@@ -82,8 +87,13 @@ int connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
args[2] = addrlen;
return __socketcall(SYS_CONNECT, args);
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(connect)
+# else
+libc_hidden_weak(connect)
+strong_alias(connect,__libc_connect)
+# endif
#endif
#ifdef L_getpeername
@@ -157,10 +167,10 @@ libc_hidden_def(listen)
#endif
#ifdef L_recv
-#ifdef __NR_recv
+# ifdef __NR_recv
_syscall4(ssize_t, recv, int, sockfd, __ptr_t, buffer, size_t, len,
int, flags)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
/* recv, recvfrom added by bir7@leland.stanford.edu */
ssize_t recv(int sockfd, __ptr_t buffer, size_t len, int flags)
{
@@ -172,21 +182,25 @@ ssize_t recv(int sockfd, __ptr_t buffer, size_t len, int flags)
args[3] = flags;
return (__socketcall(SYS_RECV, args));
}
-#elif defined(__NR_recvfrom)
-/* libc_hidden_proto(recvfrom) */
+# elif defined(__NR_recvfrom)
ssize_t recv(int sockfd, __ptr_t buffer, size_t len, int flags)
{
return (recvfrom(sockfd, buffer, len, flags, NULL, NULL));
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(recv)
+# else
+libc_hidden_weak(recv)
+strong_alias(recv,__libc_recv)
+# endif
#endif
#ifdef L_recvfrom
-#ifdef __NR_recvfrom
+# ifdef __NR_recvfrom
_syscall6(ssize_t, recvfrom, int, sockfd, __ptr_t, buffer, size_t, len,
int, flags, struct sockaddr *, to, socklen_t *, tolen)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
/* recv, recvfrom added by bir7@leland.stanford.edu */
ssize_t recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
struct sockaddr *to, socklen_t * tolen)
@@ -201,14 +215,19 @@ ssize_t recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
args[5] = (unsigned long) tolen;
return (__socketcall(SYS_RECVFROM, args));
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(recvfrom)
+# else
+libc_hidden_weak(recvfrom)
+strong_alias(recvfrom,__libc_recvfrom)
+# endif
#endif
#ifdef L_recvmsg
-#ifdef __NR_recvmsg
+# ifdef __NR_recvmsg
_syscall3(ssize_t, recvmsg, int, sockfd, struct msghdr *, msg, int, flags)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags)
{
unsigned long args[3];
@@ -218,14 +237,19 @@ ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags)
args[2] = flags;
return (__socketcall(SYS_RECVMSG, args));
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(recvmsg)
+# else
+libc_hidden_weak(recvmsg)
+strong_alias(recvmsg,__libc_recvmsg)
+# endif
#endif
#ifdef L_send
-#ifdef __NR_send
+# ifdef __NR_send
_syscall4(ssize_t, send, int, sockfd, const void *, buffer, size_t, len, int, flags)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
/* send, sendto added by bir7@leland.stanford.edu */
ssize_t send(int sockfd, const void *buffer, size_t len, int flags)
{
@@ -237,21 +261,24 @@ ssize_t send(int sockfd, const void *buffer, size_t len, int flags)
args[3] = flags;
return (__socketcall(SYS_SEND, args));
}
-#elif defined(__NR_sendto)
-/* libc_hidden_proto(sendto) */
+# elif defined(__NR_sendto)
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) */
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(send)
+# else
+libc_hidden_weak(send)
+strong_alias(send,__libc_send)
+# endif
#endif
#ifdef L_sendmsg
-#ifdef __NR_sendmsg
+# ifdef __NR_sendmsg
_syscall3(ssize_t, sendmsg, int, sockfd, const struct msghdr *, msg, int, flags)
-#elif defined(__NR_socketcall)
+# elif defined(__NR_socketcall)
ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags)
{
unsigned long args[3];
@@ -261,15 +288,20 @@ ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags)
args[2] = flags;
return (__socketcall(SYS_SENDMSG, args));
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(sendmsg)
+# else
+libc_hidden_weak(sendmsg)
+strong_alias(sendmsg,__libc_sendmsg)
+# endif
#endif
#ifdef L_sendto
-#ifdef __NR_sendto
+# ifdef __NR_sendto
_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)
+# elif defined(__NR_socketcall)
/* send, sendto added by bir7@leland.stanford.edu */
ssize_t sendto(int sockfd, const void *buffer, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
@@ -284,8 +316,13 @@ ssize_t sendto(int sockfd, const void *buffer, size_t len, int flags,
args[5] = tolen;
return (__socketcall(SYS_SENDTO, args));
}
-#endif
+# endif
+# ifndef __LINUXTHREADS_OLD__
libc_hidden_def(sendto)
+# else
+libc_hidden_weak(sendto)
+strong_alias(sendto,__libc_sendto)
+# endif
#endif
#ifdef L_setsockopt
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
index 8b896b4f7..355b22b00 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -38,7 +38,12 @@ int fcntl(int fd, int cmd, ...)
return (__syscall_fcntl(fd, cmd, arg));
}
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(fcntl)
+#else
+libc_hidden_weak(fcntl)
+strong_alias(fcntl,__libc_fcntl)
+#endif
#if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
strong_alias(fcntl,fcntl64)
diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c
index be3d2e051..d6b5fbb20 100644
--- a/libc/sysdeps/linux/common/close.c
+++ b/libc/sysdeps/linux/common/close.c
@@ -11,4 +11,10 @@
#include <unistd.h>
_syscall1(int, close, int, fd)
+
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(close)
+#else
+libc_hidden_weak(close)
+strong_alias(close,__libc_close)
+#endif
diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c
index 838cb7d21..774efc9ce 100644
--- a/libc/sysdeps/linux/common/fsync.c
+++ b/libc/sysdeps/linux/common/fsync.c
@@ -10,4 +10,9 @@
#include <sys/syscall.h>
#include <unistd.h>
+#ifdef __LINUXTHREADS_OLD__
+extern __typeof(fsync) weak_function fsync;
+strong_alias(fsync,__libc_fsync)
+#endif
+
_syscall1(int, fsync, int, fd)
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index 6bb88cac5..29582f768 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -36,4 +36,9 @@ loff_t lseek64(int fd, loff_t offset, int whence)
#endif
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(lseek64)
+#else
+libc_hidden_weak(lseek64)
+strong_alias(lseek64,__libc_lseek64)
+#endif
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index b58f75c01..9ff424048 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -19,4 +19,9 @@ __off_t lseek(int fildes, __off_t offset, int whence)
return lseek64(fildes, offset, whence);
}
#endif
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(lseek)
+#else
+libc_hidden_weak(lseek)
+strong_alias(lseek,__libc_lseek)
+#endif
diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c
index a0b47f913..7a46f0c32 100644
--- a/libc/sysdeps/linux/common/msync.c
+++ b/libc/sysdeps/linux/common/msync.c
@@ -14,6 +14,11 @@
#include <sys/mman.h>
+#ifdef __LINUXTHREADS_OLD__
+extern __typeof(msync) weak_function msync;
+strong_alias(msync,__libc_msync)
+#endif
+
_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 19f01183b..0849127db 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -13,5 +13,10 @@
#if defined __USE_POSIX199309 && defined __NR_nanosleep
_syscall2(int, nanosleep, const struct timespec *, req,
struct timespec *, rem)
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(nanosleep)
+#else
+libc_hidden_weak(nanosleep)
+strong_alias(nanosleep,__libc_nanosleep)
+#endif
#endif
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 0faf02a00..66c266371 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -31,7 +31,12 @@ int open(const char *file, int oflag, ...)
return __syscall_open(file, oflag, mode);
}
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(open)
+#else
+libc_hidden_weak(open)
+strong_alias(open,__libc_open)
+#endif
int creat(const char *file, mode_t mode)
{
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index 19ec33321..cfe471c64 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -30,6 +30,11 @@ int open64 (const char *file, int oflag, ...)
return open(file, oflag | O_LARGEFILE, mode);
}
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(open64)
+#else
+libc_hidden_weak(open64)
+strong_alias(open64,__libc_open64)
+#endif
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index 7f2ca57a5..30963d623 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -10,17 +10,18 @@
#define __UCLIBC_HIDE_DEPRECATED__
#include <sys/syscall.h>
#include <unistd.h>
+#include <signal.h>
-#ifdef __NR_pause
+#ifdef __LINUXTHREADS_OLD__
+extern __typeof(pause) weak_function pause;
+strong_alias(pause,__libc_pause)
+#endif
+#ifdef __NR_pause
_syscall0(int, pause)
-
#else
-
-#include <signal.h>
int pause(void)
{
return (__sigpause(sigblock(0), 0));
}
-
#endif
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c
index e5f5f771f..4a6f06e19 100644
--- a/libc/sysdeps/linux/common/poll.c
+++ b/libc/sysdeps/linux/common/poll.c
@@ -20,18 +20,14 @@
#include <sys/syscall.h>
#include <sys/poll.h>
-extern __typeof(poll) __libc_poll;
-
#ifdef __NR_poll
-# define __NR___libc_poll __NR_poll
-_syscall3(int, __libc_poll, struct pollfd *, fds,
+_syscall3(int, poll, struct pollfd *, fds,
unsigned long int, nfds, int, timeout)
#elif defined(__NR_ppoll) && defined __UCLIBC_LINUX_SPECIFIC__
-/* libc_hidden_proto(ppoll) */
-int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
+int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
struct timespec *ts = NULL, tval;
if (timeout > 0) {
@@ -57,11 +53,6 @@ int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
#include <sys/param.h>
#include <unistd.h>
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* Experimentally off - libc_hidden_proto(memset) */
-/* libc_hidden_proto(getdtablesize) */
-/* libc_hidden_proto(select) */
-
/* uClinux 2.0 doesn't have poll, emulate it using select */
/* Poll the file descriptors described by the NFDS structures starting at
@@ -70,7 +61,7 @@ int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
Returns the number of file descriptors with events, zero if timed out,
or -1 for errors. */
-int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
+int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
static int max_fd_size;
struct timeval tv;
@@ -229,6 +220,10 @@ int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout)
}
#endif
-/* libc_hidden_proto(poll) */
-weak_alias(__libc_poll,poll)
+
+#ifndef __LINUXTHREADS_OLD__
+libc_hidden_def(poll)
+#else
libc_hidden_weak(poll)
+strong_alias(poll,__libc_poll)
+#endif
diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c
index b380812e6..9e122fc10 100644
--- a/libc/sysdeps/linux/common/read.c
+++ b/libc/sysdeps/linux/common/read.c
@@ -11,4 +11,9 @@
#include <unistd.h>
_syscall3(ssize_t, read, int, fd, __ptr_t, buf, size_t, count)
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(read)
+#else
+libc_hidden_weak(read)
+strong_alias(read,__libc_read)
+#endif
diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c
index 32602e80f..b16495314 100644
--- a/libc/sysdeps/linux/common/wait.c
+++ b/libc/sysdeps/linux/common/wait.c
@@ -10,11 +10,14 @@
#include <sys/wait.h>
#include <sys/resource.h>
-/* libc_hidden_proto(wait4) */
+#ifdef __LINUXTHREADS_OLD__
+extern __typeof(wait) weak_function wait;
+strong_alias(wait,__libc_wait)
+#endif
/* 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 wait (__WAIT_STATUS_DEFN stat_loc)
+__pid_t wait(__WAIT_STATUS_DEFN stat_loc)
{
- return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL);
+ return wait4(WAIT_ANY, stat_loc, 0, NULL);
}
diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c
index 16075cad9..e46499377 100644
--- a/libc/sysdeps/linux/common/waitpid.c
+++ b/libc/sysdeps/linux/common/waitpid.c
@@ -10,10 +10,13 @@
#include <sys/wait.h>
#include <sys/resource.h>
-/* libc_hidden_proto(wait4) */
-
__pid_t waitpid(__pid_t pid, int *wait_stat, int options)
{
return wait4(pid, wait_stat, options, NULL);
}
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(waitpid)
+#else
+libc_hidden_weak(waitpid)
+strong_alias(waitpid,__libc_waitpid)
+#endif
diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c
index b6d71f033..5a6f7225f 100644
--- a/libc/sysdeps/linux/common/write.c
+++ b/libc/sysdeps/linux/common/write.c
@@ -11,7 +11,13 @@
#include <unistd.h>
_syscall3(ssize_t, write, int, fd, const __ptr_t, buf, size_t, count)
+#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(write)
+#else
+libc_hidden_weak(write)
+strong_alias(write,__libc_write)
+#endif
+
#if 0
/* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o
* which is a blatant GNU libc-ism... */
diff --git a/libc/termios/tcdrain.c b/libc/termios/tcdrain.c
index 766f37e28..ad94803ff 100644
--- a/libc/termios/tcdrain.c
+++ b/libc/termios/tcdrain.c
@@ -20,10 +20,13 @@
#include <termios.h>
#include <sys/ioctl.h>
-/* libc_hidden_proto(ioctl) */
+#ifdef __LINUXTHREADS_OLD__
+extern __typeof(tcdrain) weak_function tcdrain;
+strong_alias(tcdrain,__libc_tcdrain)
+#endif
/* Wait for pending output to be written on FD. */
int tcdrain(int fd)
{
- return ioctl(fd, TCSBRK, 1);
+ return ioctl(fd, TCSBRK, 1);
}