From faa7c8dc974c9b1565df3abff5c31b9626a4c3c6 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 8 Dec 2005 19:25:17 +0000 Subject: Similar impl. of __libc_x using hidden_weak_alias, hope threads work w/ it --- libc/inet/socketcalls.c | 53 +++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 02b887b93..3f1770659 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -43,14 +43,14 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) return __socketcall(SYS_ACCEPT, args); } #endif -weak_alias(__libc_accept, accept); +hidden_weak_alias(__libc_accept,__accept) +weak_alias(__libc_accept,accept) #endif #ifdef L_bind #ifdef __NR_bind #define __NR___bind __NR_bind attribute_hidden _syscall3(int, __bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); -strong_alias(__bind,bind) #elif defined(__NR_socketcall) int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) { @@ -61,18 +61,16 @@ int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t args[2] = addrlen; return __socketcall(SYS_BIND, args); } -strong_alias(__bind,bind) #endif +strong_alias(__bind,bind) #endif #ifdef L_connect #ifdef __NR_connect -#define __NR___connect __NR_connect -attribute_hidden _syscall3(int, __connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen); -strong_alias(__connect,connect) -weak_alias(__connect,__libc_connect) +#define __NR___libc_connect __NR_connect +_syscall3(int, __libc_connect, int, sockfd, const struct sockaddr *, saddr, socklen_t, addrlen); #elif defined(__NR_socketcall) -int attribute_hidden __connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) +int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) { unsigned long args[3]; @@ -81,9 +79,9 @@ int attribute_hidden __connect(int sockfd, const struct sockaddr *saddr, socklen args[2] = addrlen; return __socketcall(SYS_CONNECT, args); } -strong_alias(__connect,connect) -weak_alias(__connect,__libc_connect) #endif +hidden_weak_alias(__libc_connect,__connect) +weak_alias(__libc_connect,connect) #endif #ifdef L_getpeername @@ -106,7 +104,6 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) #ifdef __NR_getsockname #define __NR___getsockname __NR_getsockname attribute_hidden _syscall3(int, __getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); -strong_alias(__getsockname,getsockname) #elif defined(__NR_socketcall) int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { @@ -117,8 +114,8 @@ int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t args[2] = (unsigned long) paddrlen; return __socketcall(SYS_GETSOCKNAME, args); } -strong_alias(__getsockname,getsockname) #endif +strong_alias(__getsockname,getsockname) #endif #ifdef L_getsockopt @@ -172,14 +169,14 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) args[3] = flags; return (__socketcall(SYS_RECV, args)); } -weak_alias(__libc_recv, recv); #elif defined(__NR_recvfrom) ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) { - return (recvfrom(sockfd, buffer, len, flags, NULL, NULL)); + return (__recvfrom(sockfd, buffer, len, flags, NULL, NULL)); } -weak_alias(__libc_recv, recv); #endif +hidden_weak_alias(__libc_recv,__recv) +weak_alias(__libc_recv,recv) #endif #ifdef L_recvfrom @@ -203,7 +200,8 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, return (__socketcall(SYS_RECVFROM, args)); } #endif -weak_alias(__libc_recvfrom, recvfrom); +hidden_weak_alias(__libc_recvfrom,__recvfrom) +weak_alias(__libc_recvfrom,recvfrom) #endif #ifdef L_recvmsg @@ -221,7 +219,8 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) return (__socketcall(SYS_RECVMSG, args)); } #endif -weak_alias(__libc_recvmsg, recvmsg); +hidden_weak_alias(__libc_recvmsg,__recvmsg) +weak_alias(__libc_recvmsg,recvmsg) #endif #ifdef L_send @@ -241,14 +240,14 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) args[3] = flags; return (__socketcall(SYS_SEND, args)); } -weak_alias(__libc_send, send); #elif defined(__NR_sendto) ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) { return (sendto(sockfd, buffer, len, flags, NULL, 0)); } -weak_alias(__libc_send, send); #endif +hidden_weak_alias(__libc_send,__send) +weak_alias(__libc_send,send) #endif #ifdef L_sendmsg @@ -266,7 +265,8 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) return (__socketcall(SYS_SENDMSG, args)); } #endif -weak_alias(__libc_sendmsg, sendmsg); +hidden_weak_alias(__libc_sendmsg,__sendmsg) +weak_alias(__libc_sendmsg,sendmsg) #endif #ifdef L_sendto @@ -290,14 +290,14 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, return (__socketcall(SYS_SENDTO, args)); } #endif -weak_alias(__libc_sendto, sendto); +hidden_weak_alias(__libc_sendto,__sendto) +weak_alias(__libc_sendto,sendto) #endif #ifdef L_setsockopt #ifdef __NR_setsockopt #define __NR___setsockopt __NR_setsockopt attribute_hidden _syscall5(int, __setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); -strong_alias(__setsockopt,setsockopt) #elif defined(__NR_socketcall) /* [sg]etsockoptions by bir7@leland.stanford.edu */ int attribute_hidden __setsockopt(int fd, int level, int optname, const void *optval, @@ -312,8 +312,8 @@ int attribute_hidden __setsockopt(int fd, int level, int optname, const void *op args[4] = optlen; return (__socketcall(SYS_SETSOCKOPT, args)); } -strong_alias(__setsockopt,setsockopt) #endif +strong_alias(__setsockopt,setsockopt) #endif #ifdef L_shutdown @@ -334,9 +334,10 @@ int shutdown(int sockfd, int how) #ifdef L_socket #ifdef __NR_socket -_syscall3(int, socket, int, family, int, type, int, protocol); +#define __NR___socket __NR_socket +attribute_hidden _syscall3(int, __socket, int, family, int, type, int, protocol); #elif defined(__NR_socketcall) -int socket(int family, int type, int protocol) +int attribute_hidden __socket(int family, int type, int protocol) { unsigned long args[3]; @@ -346,6 +347,7 @@ int socket(int family, int type, int protocol) return __socketcall(SYS_SOCKET, args); } #endif +strong_alias(__socket,socket) #endif #ifdef L_socketpair @@ -364,4 +366,3 @@ int socketpair(int family, int type, int protocol, int sockvec[2]) } #endif #endif - -- cgit v1.2.3