diff options
Diffstat (limited to 'libc/inet/socketcalls.c')
-rw-r--r-- | libc/inet/socketcalls.c | 98 |
1 files changed, 53 insertions, 45 deletions
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 983045cf7..e003d700c 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -1,6 +1,8 @@ -#ifdef L_recv -#define recvfrom __recvfrom -#endif +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define __FORCE_GLIBC #include <features.h> @@ -47,16 +49,16 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) return __socketcall(SYS_ACCEPT, args); } #endif -hidden_weak_alias(__libc_accept,__accept) -weak_alias(__libc_accept,accept) +strong_alias(__libc_accept,accept) +libc_hidden_proto(accept) +libc_hidden_def(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); +_syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); #elif defined(__NR_socketcall) -int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) +int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) { unsigned long args[3]; @@ -66,7 +68,8 @@ int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t return __socketcall(SYS_BIND, args); } #endif -strong_alias(__bind,bind) +libc_hidden_proto(bind) +libc_hidden_def(bind) #endif #ifdef L_connect @@ -84,8 +87,9 @@ int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) return __socketcall(SYS_CONNECT, args); } #endif -hidden_weak_alias(__libc_connect,__connect) -weak_alias(__libc_connect,connect) +strong_alias(__libc_connect,connect) +libc_hidden_proto(connect) +libc_hidden_def(connect) #endif #ifdef L_getpeername @@ -106,10 +110,9 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) #ifdef L_getsockname #ifdef __NR_getsockname -#define __NR___getsockname __NR_getsockname -attribute_hidden _syscall3(int, __getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); +_syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); #elif defined(__NR_socketcall) -int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) +int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { unsigned long args[3]; @@ -119,7 +122,8 @@ int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t return __socketcall(SYS_GETSOCKNAME, args); } #endif -strong_alias(__getsockname,getsockname) +libc_hidden_proto(getsockname) +libc_hidden_def(getsockname) #endif #ifdef L_getsockopt @@ -143,10 +147,9 @@ int getsockopt(int fd, int level, int optname, __ptr_t optval, #ifdef L_listen #ifdef __NR_listen -#define __NR___listen __NR_listen -attribute_hidden _syscall2(int, __listen, int, sockfd, int, backlog); +_syscall2(int, listen, int, sockfd, int, backlog); #elif defined(__NR_socketcall) -int attribute_hidden __listen(int sockfd, int backlog) +int listen(int sockfd, int backlog) { unsigned long args[2]; @@ -155,7 +158,8 @@ int attribute_hidden __listen(int sockfd, int backlog) return __socketcall(SYS_LISTEN, args); } #endif -strong_alias(__listen,listen) +libc_hidden_proto(listen) +libc_hidden_def(listen) #endif #ifdef L_recv @@ -175,13 +179,15 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) return (__socketcall(SYS_RECV, args)); } #elif defined(__NR_recvfrom) +libc_hidden_proto(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)); } #endif -hidden_weak_alias(__libc_recv,__recv) -weak_alias(__libc_recv,recv) +strong_alias(__libc_recv,recv) +libc_hidden_proto(recv) +libc_hidden_def(recv) #endif #ifdef L_recvfrom @@ -205,8 +211,9 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, return (__socketcall(SYS_RECVFROM, args)); } #endif -hidden_weak_alias(__libc_recvfrom,__recvfrom) -weak_alias(__libc_recvfrom,recvfrom) +strong_alias(__libc_recvfrom,recvfrom) +libc_hidden_proto(recvfrom) +libc_hidden_def(recvfrom) #endif #ifdef L_recvmsg @@ -224,8 +231,9 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) return (__socketcall(SYS_RECVMSG, args)); } #endif -hidden_weak_alias(__libc_recvmsg,__recvmsg) -weak_alias(__libc_recvmsg,recvmsg) +strong_alias(__libc_recvmsg,recvmsg) +libc_hidden_proto(recvmsg) +libc_hidden_def(recvmsg) #endif #ifdef L_send @@ -245,17 +253,15 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) return (__socketcall(SYS_SEND, args)); } #elif defined(__NR_sendto) -extern ssize_t __sendto (int __fd, __const void *__buf, size_t __n, - int __flags, __CONST_SOCKADDR_ARG __addr, - socklen_t __addr_len) attribute_hidden; - +libc_hidden_proto(sendto) ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) { - return (__sendto(sockfd, buffer, len, flags, NULL, 0)); + return (sendto(sockfd, buffer, len, flags, NULL, 0)); } #endif -hidden_weak_alias(__libc_send,__send) -weak_alias(__libc_send,send) +strong_alias(__libc_send,send) +libc_hidden_proto(send) +libc_hidden_def(send) #endif #ifdef L_sendmsg @@ -273,8 +279,9 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) return (__socketcall(SYS_SENDMSG, args)); } #endif -hidden_weak_alias(__libc_sendmsg,__sendmsg) -weak_alias(__libc_sendmsg,sendmsg) +strong_alias(__libc_sendmsg,sendmsg) +libc_hidden_proto(sendmsg) +libc_hidden_def(sendmsg) #endif #ifdef L_sendto @@ -298,17 +305,17 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, return (__socketcall(SYS_SENDTO, args)); } #endif -hidden_weak_alias(__libc_sendto,__sendto) -weak_alias(__libc_sendto,sendto) +strong_alias(__libc_sendto,sendto) +libc_hidden_proto(sendto) +libc_hidden_def(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); +_syscall5(int, setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); #elif defined(__NR_socketcall) /* [sg]etsockoptions by bir7@leland.stanford.edu */ -int attribute_hidden __setsockopt(int fd, int level, int optname, const void *optval, +int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) { unsigned long args[5]; @@ -321,7 +328,8 @@ int attribute_hidden __setsockopt(int fd, int level, int optname, const void *op return (__socketcall(SYS_SETSOCKOPT, args)); } #endif -strong_alias(__setsockopt,setsockopt) +libc_hidden_proto(setsockopt) +libc_hidden_def(setsockopt) #endif #ifdef L_shutdown @@ -342,10 +350,9 @@ int shutdown(int sockfd, int how) #ifdef L_socket #ifdef __NR_socket -#define __NR___socket __NR_socket -attribute_hidden _syscall3(int, __socket, int, family, int, type, int, protocol); +_syscall3(int, socket, int, family, int, type, int, protocol); #elif defined(__NR_socketcall) -int attribute_hidden __socket(int family, int type, int protocol) +int socket(int family, int type, int protocol) { unsigned long args[3]; @@ -355,7 +362,8 @@ int attribute_hidden __socket(int family, int type, int protocol) return __socketcall(SYS_SOCKET, args); } #endif -strong_alias(__socket,socket) +libc_hidden_proto(socket) +libc_hidden_def(socket) #endif #ifdef L_socketpair |