diff options
Diffstat (limited to 'libc')
144 files changed, 554 insertions, 442 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c index a03b7575b..f46d54a8f 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -16,7 +16,6 @@ * Changed to use _int10tostr. */ -#define _uintmaxtostr __libc__uintmaxtostr /* for some reason this does not work here */ #define memmove __memmove diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index d2d0e151e..c467fed69 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -44,8 +44,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ -/* strdupa is using these */ +#define getservbyname_r __getservbyname_r #if 0 +#define stpcpy __stpcpy +/* strdupa is using these */ #define memcpy __memcpy #define strlen __strlen #endif @@ -246,7 +248,7 @@ gaih_local (const char *name, const struct gaih_service *service, sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; - __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); + stpcpy (stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); } } else diff --git a/libc/inet/getnetbyad.c b/libc/inet/getnetbyad.c index 0776ed7cf..a257a1bd7 100644 --- a/libc/inet/getnetbyad.c +++ b/libc/inet/getnetbyad.c @@ -15,6 +15,10 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#define setnetent __setnetent +#define getnetent __getnetent +#define endnetent __endnetent + #define __FORCE_GLIBC #include <features.h> #include <netdb.h> diff --git a/libc/inet/getnetbynm.c b/libc/inet/getnetbynm.c index 5479c654b..f4e9b817e 100644 --- a/libc/inet/getnetbynm.c +++ b/libc/inet/getnetbynm.c @@ -15,6 +15,10 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#define setnetent __setnetent +#define getnetent __getnetent +#define endnetent __endnetent + #define __FORCE_GLIBC #include <features.h> #include <netdb.h> diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c index 181c5adfe..476fa6b0e 100644 --- a/libc/inet/getnetent.c +++ b/libc/inet/getnetent.c @@ -24,14 +24,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) @@ -44,7 +41,7 @@ static char *net_aliases[MAXALIASES]; int _net_stayopen; -void setnetent(int f) +void attribute_hidden __setnetent(int f) { LOCK; if (netf == NULL) @@ -55,8 +52,9 @@ void setnetent(int f) UNLOCK; return; } +strong_alias(__setnetent,setnetent) -void endnetent(void) +void attribute_hidden __endnetent(void) { LOCK; if (netf) { @@ -66,6 +64,7 @@ void endnetent(void) _net_stayopen = 0; UNLOCK; } +strong_alias(__endnetent,endnetent) static char * any(register char *cp, char *match) { @@ -80,7 +79,7 @@ static char * any(register char *cp, char *match) return ((char *)0); } -struct netent * getnetent(void) +struct netent attribute_hidden * __getnetent(void) { char *p; register char *cp, **q; @@ -139,4 +138,4 @@ again: UNLOCK; return (&net); } - +strong_alias(__getnetent,getnetent) diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index e7221f3a2..a5ebcb3e9 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -64,15 +64,13 @@ #include <string.h> #include <errno.h> + #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index d5402ba3e..4040dc9b6 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -67,16 +67,12 @@ #include <errno.h> - #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) @@ -98,7 +94,7 @@ static void __initbuf(void) } } -void setservent(int f) +extern void attribute_hidden __setservent(int f) { LOCK; if (servf == NULL) @@ -108,8 +104,9 @@ void setservent(int f) serv_stayopen |= f; UNLOCK; } +strong_alias(__setservent,setservent) -void endservent(void) +extern void attribute_hidden __endservent(void) { LOCK; if (servf) { @@ -119,37 +116,9 @@ void endservent(void) serv_stayopen = 0; UNLOCK; } +strong_alias(__endservent,endservent) -struct servent * getservent(void) -{ - struct servent *result; - - __initbuf(); - getservent_r(&serv, servbuf, SBUFSIZE, &result); - return result; -} - - -struct servent *getservbyname(const char *name, const char *proto) -{ - struct servent *result; - - __initbuf(); - getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); - return result; -} - - -struct servent * getservbyport(int port, const char *proto) -{ - struct servent *result; - - __initbuf(); - getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); - return result; -} - -int getservent_r(struct servent * result_buf, +extern int attribute_hidden __getservent_r(struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -228,8 +197,18 @@ again: UNLOCK; return 0; } +strong_alias(__getservent_r,getservent_r) -int getservbyname_r(const char *name, const char *proto, +struct servent * getservent(void) +{ + struct servent *result; + + __initbuf(); + __getservent_r(&serv, servbuf, SBUFSIZE, &result); + return result; +} + +extern int attribute_hidden __getservbyname_r(const char *name, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -237,8 +216,8 @@ int getservbyname_r(const char *name, const char *proto, int ret; LOCK; - setservent(serv_stayopen); - while (!(ret=getservent_r(result_buf, buf, buflen, result))) { + __setservent(serv_stayopen); + while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { if (__strcmp(name, result_buf->s_name) == 0) goto gotname; for (cp = result_buf->s_aliases; *cp; cp++) @@ -250,27 +229,49 @@ gotname: break; } if (!serv_stayopen) - endservent(); + __endservent(); UNLOCK; return *result?0:ret; } +strong_alias(__getservbyname_r,getservbyname_r) + +struct servent *getservbyname(const char *name, const char *proto) +{ + struct servent *result; -int getservbyport_r(int port, const char *proto, + __initbuf(); + __getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); + return result; +} + + +extern int attribute_hidden __getservbyport_r(int port, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { int ret; LOCK; - setservent(serv_stayopen); - while (!(ret=getservent_r(result_buf, buf, buflen, result))) { + __setservent(serv_stayopen); + while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { if (result_buf->s_port != port) continue; if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) - endservent(); + __endservent(); UNLOCK; return *result?0:ret; } +strong_alias(__getservbyport_r,getservbyport_r) + +struct servent attribute_hidden * __getservbyport(int port, const char *proto) +{ + struct servent *result; + + __initbuf(); + __getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); + return result; +} +strong_alias(__getservbyport,getservbyport) diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c index be3bacb96..1a3e05113 100644 --- a/libc/inet/hostid.c +++ b/libc/inet/hostid.c @@ -1,3 +1,6 @@ +#define geteuid __geteuid +#define getuid __getuid + #define __FORCE_GLIBC #include <features.h> #include <stdio.h> diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c index e7b7aba53..9d1d42d03 100644 --- a/libc/inet/rpc/auth_none.c +++ b/libc/inet/rpc/auth_none.c @@ -35,6 +35,8 @@ * credentials and verifiers to remote systems. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #include <features.h> #include "rpc_private.h" diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index c02cc309b..9c16774fd 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -40,6 +40,8 @@ #define sysconf __sysconf #define getegid __getegid +#define geteuid __geteuid +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 98ce691ee..1fb80d701 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -69,7 +69,7 @@ bindresvport (int sd, struct sockaddr_in *sin) if (port == 0) { - port = (getpid () % NPORTS) + STARTPORT; + port = (__getpid () % NPORTS) + STARTPORT; } res = -1; __set_errno (EADDRINUSE); diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c index 595ddde9a..6561e2631 100644 --- a/libc/inet/rpc/clnt_perror.c +++ b/libc/inet/rpc/clnt_perror.c @@ -302,8 +302,8 @@ clnt_perrno (enum clnt_stat num) } -char * -clnt_spcreateerror (const char *msg) +char attribute_hidden * +__clnt_spcreateerror (const char *msg) { char chrbuf[1024]; char *str = _buf (); @@ -345,16 +345,17 @@ clnt_spcreateerror (const char *msg) *++cp = '\0'; return str; } +strong_alias(__clnt_spcreateerror,clnt_spcreateerror) void clnt_pcreateerror (const char *msg) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", clnt_spcreateerror (msg)); + (void) __fwprintf (stderr, L"%s", __clnt_spcreateerror (msg)); else #endif - (void) fputs (clnt_spcreateerror (msg), stderr); + (void) fputs (__clnt_spcreateerror (msg), stderr); } struct auth_errtab diff --git a/libc/inet/rpc/clnt_raw.c b/libc/inet/rpc/clnt_raw.c index e21f40252..41143496a 100644 --- a/libc/inet/rpc/clnt_raw.c +++ b/libc/inet/rpc/clnt_raw.c @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro"; */ #define authnone_create __authnone_create +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index ad2797a9e..c04265d8f 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -52,6 +52,8 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrmem_create __xdrmem_create +#define pmap_getport __pmap_getport #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index 5a7e35e80..4aba505b2 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -38,9 +38,12 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; */ /* CMSG_NXTHDR is using it */ -#define __cmsg_nxthdr __libc_cmsg_nxthdr +#define __cmsg_nxthdr __cmsg_nxthdr_internal #define authnone_create __authnone_create +#define xdrmem_create __xdrmem_create + +#define pmap_getport __pmap_getport #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index 93ea42afd..3af68d9c8 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -48,7 +48,9 @@ #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrmem_create __xdrmem_create #define getegid __getegid +#define geteuid __geteuid #define __FORCE_GLIBC #include <features.h> @@ -506,7 +508,7 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = getpid (); + cred.pid = __getpid (); cred.uid = geteuid (); cred.gid = getegid (); diff --git a/libc/inet/rpc/create_xid.c b/libc/inet/rpc/create_xid.c index 8a6dacad3..3dbf7af61 100644 --- a/libc/inet/rpc/create_xid.c +++ b/libc/inet/rpc/create_xid.c @@ -17,6 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define lrand48_r __lrand48_r +#define srand48_r __srand48_r + #define __FORCE_GLIBC #include <features.h> @@ -28,14 +31,11 @@ /* The RPC code is not threadsafe, but new code should be threadsafe. */ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t createxid_lock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&createxid_lock) -# define UNLOCK __pthread_mutex_unlock(&createxid_lock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&createxid_lock) +#define UNLOCK __pthread_mutex_unlock(&createxid_lock) static int is_initialized; static struct drand48_data __rpc_lrand48_data; diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index c261dfb3b..47a0b0c13 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -257,12 +257,9 @@ static struct rpcent *interpret(register struct rpcdata *d) #if defined(__UCLIBC_HAS_THREADS__) # include <pthread.h> static pthread_mutex_t rpcdata_lock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&rpcdata_lock) -# define UNLOCK __pthread_mutex_unlock(&rpcdata_lock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&rpcdata_lock) +#define UNLOCK __pthread_mutex_unlock(&rpcdata_lock) static int __copy_rpcent(struct rpcent *r, struct rpcent *result_buf, char *buffer, size_t buflen, struct rpcent **result) diff --git a/libc/inet/rpc/getrpcport.c b/libc/inet/rpc/getrpcport.c index 5470fbff6..518d190f8 100644 --- a/libc/inet/rpc/getrpcport.c +++ b/libc/inet/rpc/getrpcport.c @@ -35,6 +35,8 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; * Copyright (c) 1985 by Sun Microsystems, Inc. */ +#define pmap_getport __pmap_getport + #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 5bbc81564..39d846f3b 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -112,8 +112,8 @@ static const struct timeval tottimeout = {60, 0}; * Set a mapping between program,version and port. * Calls the pmap service remotely to do the mapping. */ -bool_t -pmap_set (u_long program, u_long version, int protocol, u_short port) +bool_t attribute_hidden +__pmap_set (u_long program, u_long version, int protocol, u_short port) { struct sockaddr_in myaddress; int socket = -1; @@ -142,6 +142,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port) /* (void)__close(socket); CLNT_DESTROY closes it */ return rslt; } +strong_alias(__pmap_set,pmap_set) /* * Remove the mapping between program,version and port. diff --git a/libc/inet/rpc/pmap_getport.c b/libc/inet/rpc/pmap_getport.c index 45ed4eae8..79492747b 100644 --- a/libc/inet/rpc/pmap_getport.c +++ b/libc/inet/rpc/pmap_getport.c @@ -53,12 +53,8 @@ static const struct timeval tottimeout = * Calls the pmap service remotely to do the lookup. * Returns 0 if no map exists. */ -u_short -pmap_getport (address, program, version, protocol) - struct sockaddr_in *address; - u_long program; - u_long version; - u_int protocol; +u_short attribute_hidden +__pmap_getport (struct sockaddr_in *address, u_long program, u_long version, u_int protocol) { u_short port = 0; int socket = -1; @@ -92,3 +88,4 @@ pmap_getport (address, program, version, protocol) address->sin_port = 0; return port; } +strong_alias(__pmap_getport,pmap_getport) diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index db875e987..5a78ba2c9 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; */ #define authunix_create_default __authunix_create_default +#define xdrmem_create __xdrmem_create #define inet_makeaddr __inet_makeaddr #define __FORCE_GLIBC diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index a51d09fcd..43fe44cc2 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -37,6 +37,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define bcopy __bcopy #define sysconf __sysconf +#define getline __getline +#define geteuid __geteuid #define __FORCE_GLIBC #include <features.h> @@ -88,7 +90,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) int s, lport, timo; char c; - pid = getpid(); + pid = __getpid(); #ifdef __UCLIBC_HAS_REENTRANT_RPC__ hstbuflen = 1024; diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index 00e68ff6b..b93cf7644 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -47,15 +47,10 @@ extern int __libc_sa_len (sa_family_t __af) __THROW attribute_hidden; int rexecoptions; char ahostbuf[NI_MAXHOST]; -extern int ruserpass(const char *host, const char **aname, const char **apass); +extern int __ruserpass(const char *host, const char **aname, const char **apass) attribute_hidden; -int -rexec_af(ahost, rport, name, pass, cmd, fd2p, af) - char **ahost; - int rport; - const char *name, *pass, *cmd; - int *fd2p; - sa_family_t af; +int attribute_hidden +__rexec_af(char **ahost, int rport, const char *name, const char *pass, const char *cmd, int *fd2p, sa_family_t af) { struct sockaddr_storage sa2, from; struct addrinfo hints, *res0; @@ -88,7 +83,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af) else{ *ahost = NULL; } - ruserpass(res0->ai_canonname, &name, &pass); + __ruserpass(res0->ai_canonname, &name, &pass); retry: s = socket(res0->ai_family, res0->ai_socktype, 0); if (s < 0) { @@ -179,6 +174,7 @@ bad: freeaddrinfo(res0); return (-1); } +strong_alias(__rexec_af,rexec_af) int rexec(ahost, rport, name, pass, cmd, fd2p) @@ -187,5 +183,5 @@ rexec(ahost, rport, name, pass, cmd, fd2p) const char *name, *pass, *cmd; int *fd2p; { - return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); + return __rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); } diff --git a/libc/inet/rpc/rpc_dtablesize.c b/libc/inet/rpc/rpc_dtablesize.c index b520b1b48..ede7120b3 100644 --- a/libc/inet/rpc/rpc_dtablesize.c +++ b/libc/inet/rpc/rpc_dtablesize.c @@ -31,6 +31,8 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #endif +#define getdtablesize __getdtablesize + #define __FORCE_GLIBC #define __USE_BSD #include <features.h> @@ -43,7 +45,7 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; * expensive system call every time. */ int attribute_hidden -__libc__rpc_dtablesize (void) +_rpc_dtablesize_internal (void) { static int size; @@ -52,4 +54,4 @@ __libc__rpc_dtablesize (void) return size; } -strong_alias(__libc__rpc_dtablesize,_rpc_dtablesize) +strong_alias(_rpc_dtablesize_internal,_rpc_dtablesize) diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c index fa63b1650..02c9c76fa 100644 --- a/libc/inet/rpc/rpc_thread.c +++ b/libc/inet/rpc/rpc_thread.c @@ -41,6 +41,7 @@ __rpc_thread_destroy (void) } +/* XXX: maybe turn this into a normal __pthread_once() via pthreads/weaks.c ? */ extern int weak_function __pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)); @@ -104,7 +105,7 @@ __rpc_thread_variables (void) #undef svc_max_pollfd fd_set attribute_hidden * -__libc_rpc_thread_svc_fdset (void) +__rpc_thread_svc_fdset_internal (void) { struct rpc_thread_variables *tvp; @@ -113,7 +114,7 @@ __libc_rpc_thread_svc_fdset (void) return &svc_fdset; return &tvp->svc_fdset_s; } -strong_alias(__libc_rpc_thread_svc_fdset,__rpc_thread_svc_fdset) +strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset) struct rpc_createerr * __rpc_thread_createerr (void) @@ -127,7 +128,7 @@ __rpc_thread_createerr (void) } struct pollfd attribute_hidden ** -__libc_rpc_thread_svc_pollfd (void) +__rpc_thread_svc_pollfd_internal (void) { struct rpc_thread_variables *tvp; @@ -136,10 +137,10 @@ __libc_rpc_thread_svc_pollfd (void) return &svc_pollfd; return &tvp->svc_pollfd_s; } -strong_alias(__libc_rpc_thread_svc_pollfd,__rpc_thread_svc_pollfd) +strong_alias(__rpc_thread_svc_pollfd_internal,__rpc_thread_svc_pollfd) int attribute_hidden * -__libc_rpc_thread_svc_max_pollfd (void) +__rpc_thread_svc_max_pollfd_internal (void) { struct rpc_thread_variables *tvp; @@ -148,7 +149,7 @@ __libc_rpc_thread_svc_max_pollfd (void) return &svc_max_pollfd; return &tvp->svc_max_pollfd_s; } -strong_alias(__libc_rpc_thread_svc_max_pollfd,__rpc_thread_svc_max_pollfd) +strong_alias(__rpc_thread_svc_max_pollfd_internal,__rpc_thread_svc_max_pollfd) #else #undef svc_fdset @@ -156,12 +157,12 @@ strong_alias(__libc_rpc_thread_svc_max_pollfd,__rpc_thread_svc_max_pollfd) #undef svc_pollfd #undef svc_max_pollfd -fd_set attribute_hidden * __libc_rpc_thread_svc_fdset (void) +fd_set attribute_hidden * __rpc_thread_svc_fdset_internal (void) { extern fd_set svc_fdset; return &(svc_fdset); } -strong_alias(__libc_rpc_thread_svc_fdset,__rpc_thread_svc_fdset) +strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset) struct rpc_createerr * __rpc_thread_createerr (void) { @@ -169,19 +170,19 @@ struct rpc_createerr * __rpc_thread_createerr (void) return &(rpc_createerr); } -struct pollfd attribute_hidden ** __libc_rpc_thread_svc_pollfd (void) +struct pollfd attribute_hidden ** __rpc_thread_svc_pollfd_internal (void) { extern struct pollfd *svc_pollfd; return &(svc_pollfd); } -strong_alias(__libc_rpc_thread_svc_pollfd,__rpc_thread_svc_pollfd) +strong_alias(__rpc_thread_svc_pollfd_internal,__rpc_thread_svc_pollfd) -int attribute_hidden * __libc_rpc_thread_svc_max_pollfd (void) +int attribute_hidden * __rpc_thread_svc_max_pollfd_internal (void) { extern int svc_max_pollfd; return &(svc_max_pollfd); } -strong_alias(__libc_rpc_thread_svc_max_pollfd,__rpc_thread_svc_max_pollfd) +strong_alias(__rpc_thread_svc_max_pollfd_internal,__rpc_thread_svc_max_pollfd) #endif /* __UCLIBC_HAS_THREADS__ */ diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index 116a34276..b6fd482c5 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -27,9 +27,11 @@ * SUCH DAMAGE. */ -#define __fsetlocking __libc_fsetlocking +#define __fsetlocking __fsetlocking_internal #define getgid __getgid +#define getuid __getuid #define getegid __getegid +#define geteuid __geteuid #define __FORCE_GLIBC #include <features.h> @@ -95,7 +97,7 @@ static const struct toktab { -int ruserpass(const char *host, const char **aname, const char **apass) +int attribute_hidden __ruserpass(const char *host, const char **aname, const char **apass) { char *hdir, *buf, *tmp; char myname[1024], *mydomain; @@ -105,7 +107,7 @@ int ruserpass(const char *host, const char **aname, const char **apass) /* Give up when running a setuid or setgid app. */ if ((getuid() != geteuid()) || getgid() != getegid()) return -1; - hdir = getenv("HOME"); + hdir = __getenv("HOME"); if (hdir == NULL) { /* If we can't get HOME, fail instead of trying ".", which is no improvement. */ @@ -292,6 +294,7 @@ bad: (void) fclose(cfile); return (-1); } +strong_alias(__ruserpass,ruserpass) static int token() diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index a32c68bbc..faccab58e 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -36,15 +36,17 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define _authenticate __libc__authenticate -#define _rpc_dtablesize __libc__rpc_dtablesize +#define pmap_set __pmap_set + +#define _authenticate _authenticate_internal +#define _rpc_dtablesize _rpc_dtablesize_internal /* used by svc_[max_]pollfd */ -#define __rpc_thread_svc_pollfd __libc_rpc_thread_svc_pollfd -#define __rpc_thread_svc_max_pollfd __libc_rpc_thread_svc_max_pollfd +#define __rpc_thread_svc_pollfd __rpc_thread_svc_pollfd_internal +#define __rpc_thread_svc_max_pollfd __rpc_thread_svc_max_pollfd_internal /* used by svc_fdset */ -#define __rpc_thread_svc_fdset __libc_rpc_thread_svc_fdset +#define __rpc_thread_svc_fdset __rpc_thread_svc_fdset_internal #define __FORCE_GLIBC #define _GNU_SOURCE @@ -228,8 +230,8 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers) /* ******************* REPLY GENERATION ROUTINES ************ */ /* Send a reply to an rpc request */ -bool_t -svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, +bool_t attribute_hidden +__svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, caddr_t xdr_location) { struct rpc_msg rply; @@ -242,6 +244,7 @@ svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, rply.acpted_rply.ar_results.proc = xdr_results; return SVC_REPLY (xprt, &rply); } +strong_alias(__svc_sendreply,svc_sendreply) /* No procedure error reply */ void @@ -283,8 +286,8 @@ svcerr_systemerr (register SVCXPRT *xprt) } /* Authentication error reply */ -void -svcerr_auth (SVCXPRT *xprt, enum auth_stat why) +void attribute_hidden +__svcerr_auth (SVCXPRT *xprt, enum auth_stat why) { struct rpc_msg rply; @@ -294,12 +297,13 @@ svcerr_auth (SVCXPRT *xprt, enum auth_stat why) rply.rjcted_rply.rj_why = why; SVC_REPLY (xprt, &rply); } +strong_alias(__svcerr_auth,svcerr_auth) /* Auth too weak error reply */ void svcerr_weakauth (SVCXPRT *xprt) { - svcerr_auth (xprt, AUTH_TOOWEAK); + __svcerr_auth (xprt, AUTH_TOOWEAK); } /* Program unavailable error reply */ @@ -444,7 +448,7 @@ svc_getreq_common (const int fd) } else if ((why = _authenticate (&r, &msg)) != AUTH_OK) { - svcerr_auth (xprt, why); + __svcerr_auth (xprt, why); goto call_done; } diff --git a/libc/inet/rpc/svc_auth.c b/libc/inet/rpc/svc_auth.c index 80c4f7955..bcead0608 100644 --- a/libc/inet/rpc/svc_auth.c +++ b/libc/inet/rpc/svc_auth.c @@ -102,7 +102,7 @@ svcauthsw[] = * invalid. */ enum auth_stat attribute_hidden -__libc__authenticate (register struct svc_req *rqst, struct rpc_msg *msg) +_authenticate_internal (register struct svc_req *rqst, struct rpc_msg *msg) { register int cred_flavor; @@ -115,7 +115,7 @@ __libc__authenticate (register struct svc_req *rqst, struct rpc_msg *msg) return AUTH_REJECTEDCRED; } -strong_alias(__libc__authenticate,_authenticate) +strong_alias(_authenticate_internal,_authenticate) static enum auth_stat _svcauth_null (struct svc_req *rqst, struct rpc_msg *msg) diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index 256a42154..c84c42725 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -38,6 +38,8 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> diff --git a/libc/inet/rpc/svc_raw.c b/libc/inet/rpc/svc_raw.c index 05bf3109c..b55f0864f 100644 --- a/libc/inet/rpc/svc_raw.c +++ b/libc/inet/rpc/svc_raw.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdrmem_create __xdrmem_create + #define __FORCE_GLIBC #include <features.h> #include "rpc_private.h" diff --git a/libc/inet/rpc/svc_run.c b/libc/inet/rpc/svc_run.c index 218bfd969..c0d3b34f0 100644 --- a/libc/inet/rpc/svc_run.c +++ b/libc/inet/rpc/svc_run.c @@ -32,8 +32,8 @@ */ /* used by svc_[max_]pollfd */ -#define __rpc_thread_svc_pollfd __libc_rpc_thread_svc_pollfd -#define __rpc_thread_svc_max_pollfd __libc_rpc_thread_svc_max_pollfd +#define __rpc_thread_svc_pollfd __rpc_thread_svc_pollfd_internal +#define __rpc_thread_svc_max_pollfd __rpc_thread_svc_max_pollfd_internal #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c index da3c71211..e9a43b97a 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -37,6 +37,9 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; * * Copyright (C) 1984, Sun Microsystems, Inc. */ + +#define svc_sendreply __svc_sendreply + #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index a37552a4b..ab6f96ee1 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; */ #define xprt_register __xprt_register +#define xdrmem_create __xdrmem_create #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index d1568e4a7..bc4cb2c20 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -40,6 +40,7 @@ #define xdrrec_create __xdrrec_create #define xprt_register __xprt_register #define getegid __getegid +#define geteuid __geteuid #define __FORCE_GLIBC #include <features.h> @@ -376,7 +377,7 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = getpid (); + cred.pid = __getpid (); cred.uid = geteuid (); cred.gid = getegid (); diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c index 7d69022dc..46e214431 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -220,8 +220,8 @@ xdr_u_long (XDR *xdrs, u_long *ulp) * XDR hyper integers * same as xdr_u_hyper - open coded to save a proc call! */ -bool_t -xdr_hyper (XDR *xdrs, quad_t *llp) +bool_t attribute_hidden +__xdr_hyper (XDR *xdrs, quad_t *llp) { long t1; unsigned long int t2; @@ -247,14 +247,15 @@ xdr_hyper (XDR *xdrs, quad_t *llp) return FALSE; } +strong_alias(__xdr_hyper,xdr_hyper) /* * XDR hyper integers * same as xdr_hyper - open coded to save a proc call! */ -bool_t -xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) +bool_t attribute_hidden +__xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) { unsigned long t1; unsigned long t2; @@ -280,17 +281,18 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) return FALSE; } +strong_alias(__xdr_u_hyper,xdr_u_hyper) bool_t xdr_longlong_t (XDR *xdrs, quad_t *llp) { - return xdr_hyper (xdrs, llp); + return __xdr_hyper (xdrs, llp); } bool_t xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp) { - return xdr_u_hyper (xdrs, ullp); + return __xdr_u_hyper (xdrs, ullp); } /* diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c index 568d0e54a..56908c434 100644 --- a/libc/inet/rpc/xdr_mem.c +++ b/libc/inet/rpc/xdr_mem.c @@ -75,8 +75,8 @@ static const struct xdr_ops xdrmem_ops = * The procedure xdrmem_create initializes a stream descriptor for a * memory buffer. */ -void -xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) +void attribute_hidden +__xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) { xdrs->x_op = op; /* We have to add the const since the `struct xdr_ops' in `struct XDR' @@ -85,6 +85,7 @@ xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) xdrs->x_private = xdrs->x_base = addr; xdrs->x_handy = size; } +strong_alias(__xdrmem_create,xdrmem_create) /* * Nothing needs to be done for the memory case. The argument is clearly diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 57600ab69..25c424566 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -19,14 +19,10 @@ int closedir(DIR * dir) __set_errno(EBADF); return -1; } -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif fd = dir->dd_fd; dir->dd_fd = -1; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif free(dir->dd_buf); free(dir); return __close(fd); diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 9f5f75e3f..fd14213a5 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -51,8 +51,6 @@ DIR *opendir(const char *name) return NULL; } ptr->dd_buf = buf; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_init(&(ptr->dd_lock), NULL); -#endif return ptr; } diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c index 1f196e1e7..68a465fc8 100644 --- a/libc/misc/dirent/readdir.c +++ b/libc/misc/dirent/readdir.c @@ -16,9 +16,7 @@ struct dirent *readdir(DIR * dir) return NULL; } -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif do { if (dir->dd_size <= dir->dd_nextloc) { @@ -44,8 +42,6 @@ struct dirent *readdir(DIR * dir) } while (de->d_ino == 0); all_done: -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif return de; } diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c index f798c6fbb..8d22a314e 100644 --- a/libc/misc/dirent/readdir64.c +++ b/libc/misc/dirent/readdir64.c @@ -31,9 +31,7 @@ struct dirent64 *readdir64(DIR * dir) return NULL; } -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif do { if (dir->dd_size <= dir->dd_nextloc) { @@ -59,9 +57,7 @@ struct dirent64 *readdir64(DIR * dir) } while (de->d_ino == 0); all_done: -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif return de; } diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index 1daae5116..7daf890dd 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -32,9 +32,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) } de = NULL; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif do { if (dir->dd_size <= dir->dd_nextloc) { @@ -68,9 +66,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) all_done: -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif return((de != NULL)? 0 : ret); } #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c index 1c8eeadce..25cb80b63 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/libc/misc/dirent/readdir_r.c @@ -5,7 +5,6 @@ #include <dirent.h> #include "dirstream.h" - int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) { int ret; @@ -18,9 +17,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) } de = NULL; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif do { if (dir->dd_size <= dir->dd_nextloc) { @@ -54,8 +51,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) all_done: -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif - return((de != NULL)? 0 : ret); + + return((de != NULL)? 0 : ret); } diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c index 60ef71da7..f41ecc389 100644 --- a/libc/misc/dirent/rewinddir.c +++ b/libc/misc/dirent/rewinddir.c @@ -11,12 +11,8 @@ void rewinddir(DIR * dir) __set_errno(EBADF); return; } -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif lseek(dir->dd_fd, 0, SEEK_SET); dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif } diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index 8b08e4884..e80df58dc 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -20,6 +20,8 @@ /* Modified for uClibc by Erik Andersen */ +#define qsort __qsort + #include <dirent.h> #include <stdio.h> #include <string.h> diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index 2916285eb..46b6d5cef 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -20,6 +20,8 @@ /* Modified for uClibc by Erik Andersen */ +#define qsort __qsort + #include <features.h> #ifdef __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c index 139f1e1e5..507131097 100644 --- a/libc/misc/dirent/seekdir.c +++ b/libc/misc/dirent/seekdir.c @@ -3,19 +3,14 @@ #include <unistd.h> #include "dirstream.h" - void seekdir(DIR * dir, long int offset) { if (!dir) { __set_errno(EBADF); return; } -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_lock(&(dir->dd_lock)); -#endif dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET); dir->dd_size = dir->dd_nextloc = 0; -#ifdef __UCLIBC_HAS_THREADS__ __pthread_mutex_unlock(&(dir->dd_lock)); -#endif } diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index 0962031da..29c91482a 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -43,7 +43,7 @@ int lockf (int fd, int cmd, off_t len) fl.l_type = F_RDLCK; if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) return 0; __set_errno(EACCES); return -1; diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index eb70e8ddd..63c2ddfbe 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -77,7 +77,7 @@ int lockf64 (int fd, int cmd, off64_t len64) fl.l_type = F_RDLCK; if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) return 0; __set_errno(EACCES); return -1; diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index c36ae45b6..6bd36d749 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -22,7 +22,10 @@ #define strlen __strlen #define mempcpy __mempcpy +#define stpcpy __stpcpy #define tsearch __tsearch +#define tdestroy __tdestroy +#define fchdir __fchdir #define _GNU_SOURCE #include <features.h> diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 22f1874ab..3fc20dbc2 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -17,6 +17,7 @@ Cambridge, MA 02139, USA. */ #define strrchr __strrchr #define strcoll __strcoll +#define qsort __qsort #include <features.h> #include <stdlib.h> diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 360c76879..99a8ac0d8 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -146,7 +146,7 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) uint32_t high, low, rh; static uint64_t value; gettimeofday(&tv, NULL); - value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid(); + value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid(); low = value & UINT32_MAX; high = value >> 32; for (i = 0; i < len; ++i) { diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 77d3f1e5d..b73ffa3dd 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -46,6 +46,7 @@ * locale support had (8-bit codesets only). */ +#define stpcpy __stpcpy #define strtok_r __strtok_r #define _GNU_SOURCE @@ -1241,7 +1242,7 @@ __locale_t __newlocale(int category_mask, const char *locale, __locale_t base) j = 0; do { p = envstr[j]; - } while ((++j < 4) && (!(p = getenv(p)) || !*p)); + } while ((++j < 4) && (!(p = __getenv(p)) || !*p)); /* The user set something... is it valid? */ diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 1af5a6b67..35767280e 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -7,14 +7,11 @@ #include <mntent.h> #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) /* Reentrant version of getmntent. */ struct mntent *getmntent_r (FILE *filep, diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index d367211c5..bf8958a66 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -53,6 +53,10 @@ extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #define strcmp __strcmp #define strlen __strlen #define strncpy __strncpy +#define getenv __getenv + +extern void *__mempcpy (void *__restrict __dest, + __const void *__restrict __src, size_t __n) /*attribute_hidden*/; #endif /* Make sure noone compiles this code with a C++ compiler. */ diff --git a/libc/misc/search/hsearch.c b/libc/misc/search/hsearch.c index 067e4973b..a9400f3ca 100644 --- a/libc/misc/search/hsearch.c +++ b/libc/misc/search/hsearch.c @@ -17,6 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define hdestroy_r __hdestroy_r +#define hsearch_r __hsearch_r +#define hcreate_r __hcreate_r + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c index 0f96180b1..d297b3280 100644 --- a/libc/misc/search/hsearch_r.c +++ b/libc/misc/search/hsearch_r.c @@ -67,7 +67,7 @@ static int isprime (unsigned int number) indexing as explained in the comment for the hsearch function. The contents of the table is zeroed, especially the field used becomes zero. */ -int hcreate_r (size_t nel, struct hsearch_data *htab) +int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -96,13 +96,13 @@ int hcreate_r (size_t nel, struct hsearch_data *htab) /* everything went alright */ return 1; } -/* libc_hidden_def (hcreate_r) */ +strong_alias(__hcreate_r,hcreate_r) #endif #ifdef L_hdestroy_r /* After using the hash table it has to be destroyed. The used memory can be freed and the local static variable can be marked as not used. */ -void hdestroy_r (struct hsearch_data *htab) +void attribute_hidden __hdestroy_r (struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -118,7 +118,7 @@ void hdestroy_r (struct hsearch_data *htab) /* the sign for an existing table is an value != NULL in htable */ htab->table = NULL; } -/* libc_hidden_def (hdestroy_r) */ +strong_alias(__hdestroy_r,hdestroy_r) #endif #ifdef L_hsearch_r @@ -135,7 +135,7 @@ void hdestroy_r (struct hsearch_data *htab) means used. The used field can be used as a first fast comparison for equality of the stored and the parameter value. This helps to prevent unnecessary expensive calls of strcmp. */ -int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, +int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab) { unsigned int hval; @@ -224,5 +224,5 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, *retval = NULL; return 0; } -/* libc_hidden_def (hsearch_r) */ +strong_alias(__hsearch_r,hsearch_r) #endif diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c index 1da6b571e..93a2c678f 100644 --- a/libc/misc/search/tsearch.c +++ b/libc/misc/search/tsearch.c @@ -205,13 +205,14 @@ tdestroy_recurse (node *root, __free_fn_t freefct) free (root); } -void tdestroy (void *vroot, __free_fn_t freefct) +void attribute_hidden __tdestroy (void *vroot, __free_fn_t freefct) { node *root = (node *) vroot; if (root != NULL) { tdestroy_recurse (root, freefct); } } +strong_alias(__tdestroy,tdestroy) #endif /* tsearch.c ends here */ diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 69ff0b38b..5605aecf1 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,6 +31,10 @@ * SUCH DAMAGE. */ +#define time __time +#define ctime __ctime +#define sigaction __sigaction_internal + #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -82,14 +86,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) static int LogFile = -1; /* fd for log */ @@ -136,18 +137,8 @@ sigpipe_handler (int sig) * syslog, vsyslog -- * print message on log file; output is intended for syslogd(8). */ -void -syslog(int pri, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vsyslog(pri, fmt, ap); - va_end(ap); -} - -void -vsyslog( int pri, const char *fmt, va_list ap ) +void attribute_hidden +__vsyslog( int pri, const char *fmt, va_list ap ) { register char *p; char *last_chr, *head_end, *end, *stdp; @@ -190,7 +181,7 @@ vsyslog( int pri, const char *fmt, va_list ap ) p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); } if (LogStat & LOG_PID) - p += sprintf(p, "[%d]", getpid()); + p += sprintf(p, "[%d]", __getpid()); if (LogTag) { *p++ = ':'; *p++ = ' '; @@ -267,12 +258,24 @@ getout: sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); } +strong_alias(__vsyslog,vsyslog) + +void attribute_hidden +__syslog(int pri, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + __vsyslog(pri, fmt, ap); + va_end(ap); +} +strong_alias(__syslog,syslog) /* * OPENLOG -- open system log */ -void -openlog( const char *ident, int logstat, int logfac ) +void attribute_hidden +__openlog( const char *ident, int logstat, int logfac ) { int logType = SOCK_DGRAM; @@ -319,15 +322,17 @@ retry: UNLOCK; } +strong_alias(__openlog,openlog) /* * CLOSELOG -- close the system log */ -void -closelog( void ) +void attribute_hidden +__closelog( void ) { closelog_intern(1); } +strong_alias(__closelog,closelog) /* setlogmask -- set the log mask level */ int setlogmask(int pmask) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 9c6f019bf..20e28d3b1 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -17,8 +17,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* SHMLBA is using it */ -#define __getpagesize __libc_getpagesize +/* SHMLBA uses it */ +#define __getpagesize __getpagesize_internal #include <stdlib.h> #include <errno.h> diff --git a/libc/misc/time/adjtime.c b/libc/misc/time/adjtime.c index 2049bc896..fd33ff60d 100644 --- a/libc/misc/time/adjtime.c +++ b/libc/misc/time/adjtime.c @@ -1,3 +1,5 @@ +#define adjtimex __adjtimex + #include <limits.h> #include <sys/time.h> #include <sys/timex.h> @@ -49,4 +51,3 @@ adjtime(const struct timeval * itv, struct timeval * otv) } return 0; } - diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 4d3c43492..65b925cf6 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -129,7 +129,6 @@ * differs (intentionally) from glibc's behavior. */ -#define _uintmaxtostr __libc__uintmaxtostr #define strnlen __strnlen #define _GNU_SOURCE @@ -184,6 +183,11 @@ extern struct tm __time_tm; +extern struct tm *__localtime_r (__const time_t *__restrict __timer, + struct tm *__restrict __tp) attribute_hidden; + +extern struct tm *__localtime (__const time_t *__timer) attribute_hidden; + typedef struct { long gmt_offset; long dst_offset; @@ -195,21 +199,12 @@ typedef struct { } rule_struct; #ifdef __UCLIBC_HAS_THREADS__ - -#include <pthread.h> - +# include <pthread.h> extern pthread_mutex_t _time_tzlock; - +#endif #define TZLOCK __pthread_mutex_lock(&_time_tzlock) #define TZUNLOCK __pthread_mutex_unlock(&_time_tzlock) -#else - -#define TZLOCK ((void) 0) -#define TZUNLOCK ((void) 0) - -#endif - extern rule_struct _time_tzinfo[2]; extern struct tm *_time_t2tm(const time_t *__restrict timer, @@ -386,6 +381,8 @@ strong_alias(__asctime_r,asctime_r) /**********************************************************************/ #ifdef L_clock +#define times __times + #include <sys/times.h> #ifndef __BCC__ @@ -452,12 +449,12 @@ clock_t clock(void) /**********************************************************************/ #ifdef L_ctime -char *ctime(const time_t *clock) +char attribute_hidden *__ctime(const time_t *clock) { /* ANSI/ISO/SUSv3 say that ctime is equivalent to the following. */ - return __asctime(localtime(clock)); + return __asctime(__localtime(clock)); } - +strong_alias(__ctime,ctime) #endif /**********************************************************************/ #ifdef L_ctime_r @@ -466,7 +463,7 @@ char *ctime_r(const time_t *clock, char *buf) { struct tm xtm; - return __asctime_r(localtime_r(clock, &xtm), buf); + return __asctime_r(__localtime_r(clock, &xtm), buf); } #endif @@ -534,22 +531,23 @@ struct tm *gmtime_r(const time_t *__restrict timer, /**********************************************************************/ #ifdef L_localtime -struct tm *localtime(const time_t *timer) +struct tm attribute_hidden *__localtime(const time_t *timer) { register struct tm *ptm = &__time_tm; /* In this implementation, tzset() is called by localtime_r(). */ - localtime_r(timer, ptm); /* Can return NULL... */ + __localtime_r(timer, ptm); /* Can return NULL... */ return ptm; } +strong_alias(__localtime,localtime) #endif /**********************************************************************/ #ifdef L_localtime_r -struct tm *localtime_r(register const time_t *__restrict timer, +struct tm attribute_hidden *__localtime_r(register const time_t *__restrict timer, register struct tm *__restrict result) { TZLOCK; @@ -562,6 +560,7 @@ struct tm *localtime_r(register const time_t *__restrict timer, return result; } +strong_alias(__localtime_r,localtime_r) #endif /**********************************************************************/ @@ -1542,7 +1541,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, buf = o; if (!code) { /* s */ - localtime_r(&t, tm); /* TODO: check for failure? */ + __localtime_r(&t, tm); /* TODO: check for failure? */ i = 0; do { /* Now copy values from tm to fields. */ fields[i] = ((int *) tm)[i]; @@ -1806,7 +1805,7 @@ void tzset(void) TZLOCK; - e = getenv(TZ); /* TZ env var always takes precedence. */ + e = __getenv(TZ); /* TZ env var always takes precedence. */ #if defined(__UCLIBC_HAS_TZ_FILE__) && !defined(__UCLIBC_HAS_TZ_FILE_READ_MANY__) /* Put this inside the lock to prevent the possiblity of two different diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index c15228a24..04f511921 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ -#define __fsetlocking __libc_fsetlocking +#define __fsetlocking __fsetlocking_internal #define _GNU_SOURCE #include <features.h> @@ -46,19 +46,6 @@ static FILE *tf; static struct ttyent tty; -struct ttyent * getttynam(const char *tty) -{ - register struct ttyent *t; - - setttyent(); - while ((t = getttyent())) - if (!__strcmp(tty, t->ty_name)) - break; - endttyent(); - return (t); -} - - /* Skip over the current field, removing quotes, and return * a pointer to the next field. */ @@ -101,13 +88,30 @@ static char * value(register char *p) return ((p = __strchr(p, '=')) ? ++p : NULL); } -struct ttyent * getttyent(void) +int attribute_hidden __setttyent(void) +{ + + if (tf) { + rewind(tf); + return (1); + } else if ((tf = fopen(_PATH_TTYS, "r"))) { + /* We do the locking ourselves. */ +#ifdef __UCLIBC_HAS_THREADS__ + __fsetlocking (tf, FSETLOCKING_BYCALLER); +#endif + return (1); + } + return (0); +} +strong_alias(__setttyent,setttyent) + +struct ttyent attribute_hidden * __getttyent(void) { register int c; register char *p; static char *line = NULL; - if (!tf && !setttyent()) + if (!tf && !__setttyent()) return (NULL); if (!line) { @@ -177,24 +181,9 @@ struct ttyent * getttyent(void) *p = '\0'; return (&tty); } +strong_alias(__getttyent,getttyent) -int setttyent(void) -{ - - if (tf) { - rewind(tf); - return (1); - } else if ((tf = fopen(_PATH_TTYS, "r"))) { - /* We do the locking ourselves. */ -#ifdef __UCLIBC_HAS_THREADS__ - __fsetlocking (tf, FSETLOCKING_BYCALLER); -#endif - return (1); - } - return (0); -} - -int endttyent(void) +int attribute_hidden __endttyent(void) { int rval; @@ -205,3 +194,16 @@ int endttyent(void) } return (1); } +strong_alias(__endttyent,endttyent) + +struct ttyent * getttynam(const char *tty) +{ + register struct ttyent *t; + + __setttyent(); + while ((t = __getttyent())) + if (!__strcmp(tty, t->ty_name)) + break; + __endttyent(); + return (t); +} diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index c3d9ab620..e03d4528f 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -23,14 +23,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t utmplock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&utmplock) -# define UNLOCK __pthread_mutex_unlock(&utmplock) -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&utmplock) +#define UNLOCK __pthread_mutex_unlock(&utmplock) diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index bb5244878..0900ef379 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -34,7 +34,7 @@ void logwtmp (const char *line, const char *name, const char *host) __memset (&(lutmp), 0, sizeof (struct utmp)); lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS; - lutmp.ut_pid = getpid(); + lutmp.ut_pid = __getpid(); __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 5e9133c83..9cdeaf162 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -20,9 +20,14 @@ Boston, MA 02111-1307, USA. */ #define mempcpy __mempcpy +#define stpcpy __stpcpy #define strndup __strndup #define strspn __strspn #define unsetenv __unsetenv +#define waitpid __waitpid +#define kill __kill +#define getuid __getuid +#define execve __execve #define _GNU_SOURCE #include <sys/cdefs.h> @@ -283,7 +288,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length, results are unspecified. We do a lookup on the uid if HOME is unset. */ - home = getenv("HOME"); + home = __getenv("HOME"); if (home != NULL) { *word = w_addstr(*word, word_length, max_length, home); if (*word == NULL) @@ -1328,7 +1333,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Is it `$$'? */ if (*env == '$') { buffer[20] = '\0'; - value = _itoa(getpid(), &buffer[20]); + value = _itoa(__getpid(), &buffer[20]); } /* Is it `${#*}' or `${#@}'? */ else if ((*env == '*' || *env == '@') && seen_hash) { @@ -1395,7 +1400,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, } } } else - value = getenv(env); + value = __getenv(env); if (value == NULL && (flags & WRDE_UNDEF)) { /* Variable not defined. */ @@ -2067,7 +2072,7 @@ int wordexp(const char *words, wordexp_t * we, int flags) /* Find out what the field separators are. * There are two types: whitespace and non-whitespace. */ - ifs = getenv("IFS"); + ifs = __getenv("IFS"); if (!ifs) /* IFS unset - use <space><tab><newline>. */ diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index bac807e6f..2b3fa7596 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -19,6 +19,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define sigfillset __sigfillset_internal +#define sigaction __sigaction_internal + #include <features.h> #include <fcntl.h> #include <signal.h> @@ -28,14 +31,11 @@ #include <paths.h> #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK -#endif +#endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) /* How long to wait for getting the lock before returning with an error. */ diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 3baa0ad33..601568599 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -402,15 +402,12 @@ int getpw(uid_t uid, char *buf) #endif /**********************************************************************/ #if defined(L_getpwent_r) || defined(L_getgrent_r) || defined(L_getspent_r) - #ifdef __UCLIBC_HAS_THREADS__ +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK ((void) 0) -# define UNLOCK ((void) 0) #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) #endif #ifdef L_getpwent_r diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 07e4a208c..83a052abe 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -18,6 +18,8 @@ Cambridge, MA 02139, USA. */ /* Hacked up for uClibc by Erik Andersen */ +#define sigaction __sigaction_internal + #define _GNU_SOURCE #include <features.h> #include <signal.h> @@ -73,12 +75,9 @@ static int been_there_done_that = 0; #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock) -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) extern int __raise (int __sig) __THROW attribute_hidden; diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index a01fb29e2..fcf85391a 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -45,14 +45,11 @@ #include <atomic.h> #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> extern pthread_mutex_t mylock; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) typedef void (*aefuncp) (void); /* atexit function pointer */ diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c index d18ff3f08..fc66816c1 100644 --- a/libc/stdlib/drand48.c +++ b/libc/stdlib/drand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define erand48_r __erand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/drand48_r.c b/libc/stdlib/drand48_r.c index b6c055c1f..14235e6e0 100644 --- a/libc/stdlib/drand48_r.c +++ b/libc/stdlib/drand48_r.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define erand48_r __erand48_r + #include <errno.h> #include <math.h> #include <stdlib.h> diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c index 6d4c72683..96a8ad115 100644 --- a/libc/stdlib/erand48.c +++ b/libc/stdlib/erand48.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define erand48_r __erand48_r #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c index 159eb83a6..0a69266a7 100644 --- a/libc/stdlib/erand48_r.c +++ b/libc/stdlib/erand48_r.c @@ -24,11 +24,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; - -int erand48_r (xsubi, buffer, result) - unsigned short int xsubi[3]; - struct drand48_data *buffer; - double *result; +int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) { union ieee754_double temp; @@ -49,3 +45,4 @@ int erand48_r (xsubi, buffer, result) return 0; } +strong_alias(__erand48_r,erand48_r) diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c index 9dfc0d132..6cbdc3e65 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -22,7 +22,7 @@ /* IEEE Std 1003.1-2001 says getenv need not be thread safe, so * don't bother locking access to __environ */ -char *getenv(const char *var) +char attribute_hidden *__getenv(const char *var) { int len; char **ep; @@ -39,3 +39,4 @@ char *getenv(const char *var) return NULL; } +strong_alias(__getenv,getenv) diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c index 1106f1f9f..44b32487f 100644 --- a/libc/stdlib/jrand48.c +++ b/libc/stdlib/jrand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define jrand48_r __jrand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c index d8c37cdbc..a21bda080 100644 --- a/libc/stdlib/jrand48_r.c +++ b/libc/stdlib/jrand48_r.c @@ -22,10 +22,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int jrand48_r (xsubi, buffer, result) - unsigned short int xsubi[3]; - struct drand48_data *buffer; - long int *result; +int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ if (__drand48_iterate (xsubi, buffer) < 0) @@ -36,3 +33,4 @@ int jrand48_r (xsubi, buffer, result) return 0; } +strong_alias(__jrand48_r,jrand48_r) diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c index c6396c047..88301d70f 100644 --- a/libc/stdlib/lrand48.c +++ b/libc/stdlib/lrand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define nrand48_r __nrand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/lrand48_r.c b/libc/stdlib/lrand48_r.c index c2851efd7..0ff1ef25e 100644 --- a/libc/stdlib/lrand48_r.c +++ b/libc/stdlib/lrand48_r.c @@ -17,9 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define nrand48_r __nrand48_r + #include <stdlib.h> -int lrand48_r (struct drand48_data *buffer, long int *result) +int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result) { /* Be generous for the arguments, detect some errors. */ if (buffer == NULL) @@ -27,3 +29,4 @@ int lrand48_r (struct drand48_data *buffer, long int *result) return nrand48_r (buffer->__x, buffer, result); } +strong_alias(__lrand48_r,lrand48_r) diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 7f0a91f0b..d20768738 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -6,6 +6,8 @@ * Parts of the memalign code were stolen from malloc-930716. */ +#define munmap __munmap + #define _GNU_SOURCE #include <features.h> #include <unistd.h> @@ -109,14 +111,11 @@ void free(void *ptr) #ifdef L_memalign #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> pthread_mutex_t __malloc_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -# define LOCK __pthread_mutex_lock(&__malloc_lock) -# define UNLOCK __pthread_mutex_unlock(&__malloc_lock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&__malloc_lock) +#define UNLOCK __pthread_mutex_unlock(&__malloc_lock) /* List of blocks allocated with memalign or valloc */ struct alignlist diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c index 94e1d65b1..aa8edec97 100644 --- a/libc/stdlib/malloc-standard/free.c +++ b/libc/stdlib/malloc-standard/free.c @@ -14,6 +14,8 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ +#define munmap __munmap + #include "malloc.h" diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index dbac0c9d2..0e8aed363 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -26,14 +26,11 @@ #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> extern pthread_mutex_t __malloc_lock; -# define LOCK __pthread_mutex_lock(&__malloc_lock) -# define UNLOCK __pthread_mutex_unlock(&__malloc_lock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&__malloc_lock) +#define UNLOCK __pthread_mutex_unlock(&__malloc_lock) diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c index 88684e6df..eb35e78ee 100644 --- a/libc/stdlib/malloc/free.c +++ b/libc/stdlib/malloc/free.c @@ -11,6 +11,8 @@ * Written by Miles Bader <miles@gnu.org> */ +#define munmap __munmap + #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 0210d9098..ab1a73896 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -135,14 +135,8 @@ extern void __heap_dump (struct heap *heap, const char *str); extern void __heap_check (struct heap *heap, const char *str); -#ifdef HEAP_USE_LOCKING -# define __heap_lock(heap) __pthread_mutex_lock (&(heap)->lock) -# define __heap_unlock(heap) __pthread_mutex_unlock (&(heap)->lock) -#else /* !__UCLIBC_HAS_THREADS__ */ -/* Without threads, mutex operations are a nop. */ -# define __heap_lock(heap) (void)0 -# define __heap_unlock(heap) (void)0 -#endif /* HEAP_USE_LOCKING */ +#define __heap_lock(heap) __pthread_mutex_lock (&(heap)->lock) +#define __heap_unlock(heap) __pthread_mutex_unlock (&(heap)->lock) /* Delete the free-area FA from HEAP. */ diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index d231fa7b6..b93b1eac6 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -55,7 +55,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) void __malloc_debug_init (void) { - char *ev = getenv ("MALLOC_DEBUG"); + char *ev = __getenv ("MALLOC_DEBUG"); if (ev) { int val = atoi (ev); diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c index a732603e5..e9d5353ad 100644 --- a/libc/stdlib/mrand48.c +++ b/libc/stdlib/mrand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define jrand48_r __jrand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/mrand48_r.c b/libc/stdlib/mrand48_r.c index 74351a059..f79e5f887 100644 --- a/libc/stdlib/mrand48_r.c +++ b/libc/stdlib/mrand48_r.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define jrand48_r __jrand48_r + #include <stdlib.h> int mrand48_r (struct drand48_data *buffer, long int *result) diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c index 585bfe7fd..6cdf4ebad 100644 --- a/libc/stdlib/nrand48.c +++ b/libc/stdlib/nrand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define nrand48_r __nrand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c index 89f098e75..f72c07030 100644 --- a/libc/stdlib/nrand48_r.c +++ b/libc/stdlib/nrand48_r.c @@ -22,10 +22,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int nrand48_r (xsubi, buffer, result) - unsigned short int xsubi[3]; - struct drand48_data *buffer; - long int *result; +int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ if (__drand48_iterate (xsubi, buffer) < 0) @@ -39,3 +36,4 @@ int nrand48_r (xsubi, buffer, result) return 0; } +strong_alias(__nrand48_r,nrand48_r) diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 539cbcae2..d4e99a035 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,8 +17,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define _uintmaxtostr __libc__uintmaxtostr - #define _ISOC99_SOURCE #include <stdio.h> #include <errno.h> diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c index 3ffa50690..d40420740 100644 --- a/libc/stdlib/random.c +++ b/libc/stdlib/random.c @@ -24,21 +24,20 @@ #define random_r __random_r #define srandom_r __srandom_r +#define setstate_r __setstate_r #define _GNU_SOURCE #include <features.h> #include <limits.h> #include <stddef.h> #include <stdlib.h> + #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> /* POSIX.1c requires that there is mutual exclusion for the `rand' and `srand' functions to prevent concurrent calls from modifying common data. */ static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -#else -#define __pthread_mutex_lock(x) -#define __pthread_mutex_unlock(x) #endif /* An improved random number generation package. In addition to the standard diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c index 9e203f0d5..0733bf900 100644 --- a/libc/stdlib/random_r.c +++ b/libc/stdlib/random_r.c @@ -319,7 +319,7 @@ fail: to the order in which things are done, it is OK to call setstate with the same state as the current state Returns a pointer to the old state information. */ -int setstate_r (char *arg_state, struct random_data *buf) +int attribute_hidden __setstate_r (char *arg_state, struct random_data *buf) { int32_t *new_state = 1 + (int32_t *) arg_state; int type; @@ -362,3 +362,4 @@ fail: __set_errno (EINVAL); return -1; } +strong_alias(__setstate_r,setstate_r) diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 8704717a7..07af88465 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -29,14 +29,11 @@ #include <unistd.h> #ifdef __UCLIBC_HAS_THREADS__ -#include <pthread.h> +# include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; -# define LOCK __pthread_mutex_lock(&mylock) -# define UNLOCK __pthread_mutex_unlock(&mylock); -#else -# define LOCK -# define UNLOCK #endif +#define LOCK __pthread_mutex_lock(&mylock) +#define UNLOCK __pthread_mutex_unlock(&mylock) extern int __unsetenv (__const char *__name) attribute_hidden; diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c index a172d07a1..1dcdc14a7 100644 --- a/libc/stdlib/srand48.c +++ b/libc/stdlib/srand48.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define srand48_r __srand48_r + #include <stdlib.h> /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ diff --git a/libc/stdlib/srand48_r.c b/libc/stdlib/srand48_r.c index c0fa38e90..d2f959c79 100644 --- a/libc/stdlib/srand48_r.c +++ b/libc/stdlib/srand48_r.c @@ -20,9 +20,7 @@ #include <stdlib.h> #include <limits.h> -int srand48_r (seedval, buffer) - long int seedval; - struct drand48_data *buffer; +int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer) { /* The standards say we only have 32 bits. */ if (sizeof (long int) > 4) @@ -38,3 +36,4 @@ int srand48_r (seedval, buffer) return 0; } +strong_alias(__srand48_r,srand48_r) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index fb8ce186b..04c85d32f 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -750,7 +750,7 @@ void *bsearch(const void *key, const void *base, size_t /* nmemb */ high, * calculation, as well as to reduce the generated code size with * bcc and gcc. */ -void qsort (void *base, +void attribute_hidden __qsort (void *base, size_t nel, size_t width, int (*comp)(const void *, const void *)) @@ -795,6 +795,7 @@ void qsort (void *base, } while (wgap); } } +strong_alias(__qsort,qsort) /* ---------- original snippets version below ---------- */ diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index b365ef82e..e268bf5ef 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -1,3 +1,6 @@ +#define wait4 __wait4 +#define execl __execl + #include <stdio.h> #include <stddef.h> #include <signal.h> diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 5d21ec9f8..1f1c4df5c 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -19,7 +19,9 @@ #define memchr __memchr #define getgid __getgid +#define getuid __getuid #define setrlimit __setrlimit +#define waitpid __waitpid #include <assert.h> #include <errno.h> diff --git a/libc/stdlib/valloc.c b/libc/stdlib/valloc.c index c1d6d29a5..d4f21d121 100644 --- a/libc/stdlib/valloc.c +++ b/libc/stdlib/valloc.c @@ -20,7 +20,7 @@ Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ -#define getpagesize __libc_getpagesize +#define getpagesize __getpagesize_internal #include <stdlib.h> #include <unistd.h> diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 91d30116f..f2c860107 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -9,7 +9,7 @@ #undef mempcpy -void *__mempcpy (void *dstpp, const void *srcpp, size_t len) +void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len) { __memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index 822fd0d97..e2da4f87c 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -25,11 +25,6 @@ #include <sys/syscall.h> #include <bits/kernel_sigaction.h> -extern int __syscall_sigaction (int, const struct old_kernel_sigaction *__unbounded, - struct old_kernel_sigaction *__unbounded); -extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded, - struct kernel_sigaction *__unbounded, size_t); - #define SA_RESTORER 0x04000000 extern void __default_sa_restorer(void); extern void __default_rt_sa_restorer(void); @@ -51,7 +46,7 @@ extern void __default_rt_sa_restorer(void); /* If ACT is not NULL, change the action for SIG to *ACT. 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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; @@ -99,7 +94,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa /* If ACT is not NULL, change the action for SIG to *ACT. 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 __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -132,5 +127,6 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa } #endif -weak_alias(__libc_sigaction, sigaction) +strong_alias(__sigaction_internal,__libc_sigaction) +weak_alias(__sigaction_internal, sigaction) diff --git a/libc/sysdeps/linux/common/__syscall_sigaction.c b/libc/sysdeps/linux/common/__syscall_sigaction.c index 6c33b2802..4333a6a1a 100644 --- a/libc/sysdeps/linux/common/__syscall_sigaction.c +++ b/libc/sysdeps/linux/common/__syscall_sigaction.c @@ -13,7 +13,7 @@ #define __NR___syscall_sigaction __NR_sigaction #include <signal.h> #undef sigaction -_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *, +attribute_hidden _syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *, act, struct sigaction *, oldact); #endif diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c index 28ad442e8..ef33051e8 100644 --- a/libc/sysdeps/linux/common/adjtimex.c +++ b/libc/sysdeps/linux/common/adjtimex.c @@ -9,7 +9,9 @@ #include "syscalls.h" #include <sys/timex.h> -_syscall1(int, adjtimex, struct timex *, buf); -weak_alias(adjtimex, __adjtimex); -weak_alias(adjtimex, ntp_adjtime); +#define __NR___adjtimex __NR_adjtimex +attribute_hidden _syscall1(int, __adjtimex, struct timex *, buf); + +strong_alias(__adjtimex, adjtimex) +weak_alias(__adjtimex, ntp_adjtime) diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index 7e554fcbf..eec941d07 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -7,6 +7,8 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define setitimer __setitimer + #include "syscalls.h" #include <unistd.h> #ifdef __NR_alarm diff --git a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h index 726558ad8..92633ffa6 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h +++ b/libc/sysdeps/linux/common/bits/uClibc_uintmaxtostr.h @@ -100,7 +100,7 @@ typedef enum { * Otherwise, you could overflow your buffer. */ extern char *_uintmaxtostr(char * __restrict bufend, uintmax_t uval, - int base, __UIM_CASE alphacase); + int base, __UIM_CASE alphacase) attribute_hidden; /* TODO -- make this either a (possibly inline) function? */ #ifndef __BCC__ diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c index 40dadc78d..e2ec03f78 100644 --- a/libc/sysdeps/linux/common/clock_settime.c +++ b/libc/sysdeps/linux/common/clock_settime.c @@ -19,6 +19,8 @@ * */ +#define settimeofday __settimeofday + #define _GNU_SOURCE #include "syscalls.h" #include <time.h> diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c index cc17c28f5..771f5172b 100644 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c @@ -21,9 +21,8 @@ #include <features.h> #include <sys/socket.h> - struct cmsghdr attribute_hidden * -__libc_cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg) +__cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg) { if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ @@ -39,4 +38,4 @@ __libc_cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg) return NULL; return cmsg; } -strong_alias(__libc_cmsg_nxthdr,__cmsg_nxthdr) +strong_alias(__cmsg_nxthdr_internal,__cmsg_nxthdr) diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c index cb5e86da7..8a95746ee 100644 --- a/libc/sysdeps/linux/common/execve.c +++ b/libc/sysdeps/linux/common/execve.c @@ -16,7 +16,8 @@ static inline _syscall3(int, __syscall_execve, const char *, filename, char *const *, argv, char *const *, envp); -int execve(const char * filename, char *const * argv, char *const * envp) +int attribute_hidden __execve(const char * filename, char *const * argv, char *const * envp) { return __syscall_execve(filename, argv, envp); } +strong_alias(__execve,execve) diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c index 55ee3a2a8..f4692cc2c 100644 --- a/libc/sysdeps/linux/common/fchdir.c +++ b/libc/sysdeps/linux/common/fchdir.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <unistd.h> -_syscall1(int, fchdir, int, fd); +#define __NR___fchdir __NR_fchdir +attribute_hidden _syscall1(int, __fchdir, int, fd); +strong_alias(__fchdir,fchdir) diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 24ce2c8ba..25b77fe39 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -28,8 +28,9 @@ #include <sys/types.h> #include <sys/syscall.h> -#undef offsetof +#ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif struct kernel_dirent { diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index a475c948a..d6410262d 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -31,8 +31,9 @@ #if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 -#undef offsetof +#ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif struct kernel_dirent64 { diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index d0865fba5..486ee9335 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -37,7 +37,7 @@ get_current_dir_name (void) struct stat dotstat, pwdstat; #endif - pwd = getenv ("PWD"); + pwd = __getenv ("PWD"); if (pwd != NULL #if defined __UCLIBC_HAS_LFS__ && stat64 (".", &dotstat) == 0 diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c index 8cbcebdce..de3af63d7 100644 --- a/libc/sysdeps/linux/common/getdtablesize.c +++ b/libc/sysdeps/linux/common/getdtablesize.c @@ -27,7 +27,7 @@ /* Return the maximum number of file descriptors the current process could possibly have. */ -int getdtablesize (void) +int attribute_hidden __getdtablesize (void) { struct rlimit ru; @@ -36,4 +36,4 @@ int getdtablesize (void) returns -1. */ return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur; } - +strong_alias(__getdtablesize,getdtablesize) diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c index 10bcce735..3936739b3 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -7,19 +7,22 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define getuid __getuid + #include "syscalls.h" #include <unistd.h> #ifdef __NR_geteuid #define __NR___syscall_geteuid __NR_geteuid static inline _syscall0(int, __syscall_geteuid); -uid_t geteuid(void) +uid_t attribute_hidden __geteuid(void) { return (__syscall_geteuid()); } #else -uid_t geteuid(void) +uid_t attribute_hidden __geteuid(void) { return (getuid()); } #endif +strong_alias(__geteuid,geteuid) diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c index 8469cbb76..669cdb075 100644 --- a/libc/sysdeps/linux/common/getpagesize.c +++ b/libc/sysdeps/linux/common/getpagesize.c @@ -22,7 +22,8 @@ extern size_t __pagesize; /* Return the system page size. */ -int attribute_hidden __libc_getpagesize(void) +/* couldn't make __getpagesize hidden, because shm.h uses it in a macro */ +int attribute_hidden __getpagesize_internal(void) { if (__pagesize != 0) return __pagesize; @@ -40,6 +41,6 @@ int attribute_hidden __libc_getpagesize(void) #endif /* NBPG. */ #endif /* EXEC_PAGESIZE. */ } -strong_alias(__libc_getpagesize, __getpagesize) -weak_alias(__getpagesize, getpagesize) +strong_alias(__getpagesize_internal, __getpagesize) +weak_alias(__getpagesize_internal, getpagesize) diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c index efd542863..b2944e5e0 100644 --- a/libc/sysdeps/linux/common/getppid.c +++ b/libc/sysdeps/linux/common/getppid.c @@ -14,6 +14,6 @@ _syscall0(pid_t, getppid); # else pid_t getppid(void) { - return (getpid()); + return (__getpid()); } # endif diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 88f7f9999..478a4e84d 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -13,4 +13,3 @@ #define __NR___gettimeofday __NR_gettimeofday attribute_hidden _syscall2(int, __gettimeofday, struct timeval *, tv, struct timezone *, tz); strong_alias(__gettimeofday,gettimeofday) -weak_alias(__gettimeofday,__libc_gettimeofday) diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index 40d20f2dd..7c81ccf48 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -17,7 +17,8 @@ static inline _syscall0(int, __syscall_getuid); -uid_t getuid(void) +uid_t attribute_hidden __getuid(void) { return (__syscall_getuid()); } +strong_alias(__getuid,getuid) diff --git a/libc/sysdeps/linux/common/kill.c b/libc/sysdeps/linux/common/kill.c index d8033fabc..2d1d9ae8a 100644 --- a/libc/sysdeps/linux/common/kill.c +++ b/libc/sysdeps/linux/common/kill.c @@ -14,7 +14,8 @@ #define __NR___syscall_kill __NR_kill static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig); -int kill(pid_t pid, int sig) +int attribute_hidden __kill(pid_t pid, int sig) { return (__syscall_kill(pid, sig)); } +strong_alias(__kill,kill) diff --git a/libc/sysdeps/linux/common/munmap.c b/libc/sysdeps/linux/common/munmap.c index ff94f2235..be631060a 100644 --- a/libc/sysdeps/linux/common/munmap.c +++ b/libc/sysdeps/linux/common/munmap.c @@ -10,4 +10,6 @@ #include "syscalls.h" #include <unistd.h> #include <sys/mman.h> -_syscall2(int, munmap, void *, start, size_t, length); +#define __NR___munmap __NR_munmap +attribute_hidden _syscall2(int, __munmap, void *, start, size_t, length); +strong_alias(__munmap,munmap) diff --git a/libc/sysdeps/linux/common/ntp_gettime.c b/libc/sysdeps/linux/common/ntp_gettime.c index 07f380402..0c4d1549f 100644 --- a/libc/sysdeps/linux/common/ntp_gettime.c +++ b/libc/sysdeps/linux/common/ntp_gettime.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define adjtimex __adjtimex + #include <sys/timex.h> int ntp_gettime(struct ntptimeval *ntv) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 87d0dbb27..f021e0269 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define getdtablesize __getdtablesize + #include "syscalls.h" #include <sys/poll.h> diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c index 981f1a158..be51cb5c5 100644 --- a/libc/sysdeps/linux/common/setitimer.c +++ b/libc/sysdeps/linux/common/setitimer.c @@ -9,5 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -_syscall3(int, setitimer, __itimer_which_t, which, +#define __NR___setitimer __NR_setitimer +attribute_hidden _syscall3(int, __setitimer, __itimer_which_t, which, const struct itimerval *, new, struct itimerval *, old); +strong_alias(__setitimer,setitimer) diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c index b63c421c7..4e88b3edb 100644 --- a/libc/sysdeps/linux/common/settimeofday.c +++ b/libc/sysdeps/linux/common/settimeofday.c @@ -9,5 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -_syscall2(int, settimeofday, const struct timeval *, tv, +#define __NR___settimeofday __NR_settimeofday +attribute_hidden _syscall2(int, __settimeofday, const struct timeval *, tv, const struct timezone *, tz); +strong_alias(__settimeofday,settimeofday) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 4c52d070f..7a977f56a 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -16,12 +16,29 @@ * Mike Frysinger <vapier[@]gentoo.org> */ +#if defined __SSP__ || defined __SSP_ALL__ +#error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector" +#endif + +#ifdef __PROPOLICE_BLOCK_SEGV__ +# define SSP_SIGTYPE SIGSEGV +#else +# define SSP_SIGTYPE SIGABRT +#endif + +#define openlog __openlog +#define syslog __syslog +#define closelog __closelog +#define sigfillset __sigfillset_internal +#define sigdelset __sigdelset_internal +#define sigaction __sigaction_internal +#define kill __kill + #include <string.h> #include <unistd.h> +#include <signal.h> #include <sys/syslog.h> -#include <ssp-internal.h> - static __always_inline void block_signals(void) { struct sigaction sa; @@ -37,7 +54,7 @@ static __always_inline void block_signals(void) sigfillset(&sa.sa_mask); /* Block all signals */ sa.sa_flags = 0; sa.sa_handler = SIG_DFL; - SIGACTION(SSP_SIGTYPE, &sa, NULL); + sigaction(SSP_SIGTYPE, &sa, NULL); } static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) @@ -46,15 +63,15 @@ static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2 __write(fd, msg2, __strlen(msg2)); __write(fd, msg3, __strlen(msg3)); __write(fd, "()\n", 3); - openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); - syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); - closelog(); + __openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); + __syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); + __closelog(); } -static __always_inline void terminate(void) +static __always_inline attribute_noreturn void terminate(void) { - (void) KILL(GETPID(), SSP_SIGTYPE); - EXIT(127); + (void) kill(__getpid(), SSP_SIGTYPE); + _exit(127); } void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused))); diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c index 586088695..bfb7682d0 100644 --- a/libc/sysdeps/linux/common/stime.c +++ b/libc/sysdeps/linux/common/stime.c @@ -7,6 +7,8 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define settimeofday __settimeofday + #include "syscalls.h" #include <time.h> #include <sys/time.h> diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index 0c37c375c..506850ff9 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -11,9 +11,10 @@ #include <time.h> #include <sys/time.h> #ifdef __NR_time -_syscall1(time_t, time, time_t *, t); +#define __NR___time __NR_time +attribute_hidden _syscall1(time_t, __time, time_t *, t); #else -time_t time(time_t * t) +time_t attribute_hidden __time(time_t * t) { time_t result; struct timeval tv; @@ -29,3 +30,4 @@ time_t time(time_t * t) return result; } #endif +strong_alias(__time,time) diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c index beb07fb35..0fefdca10 100644 --- a/libc/sysdeps/linux/common/times.c +++ b/libc/sysdeps/linux/common/times.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <sys/times.h> -_syscall1(clock_t, times, struct tms *, buf); +#define __NR___times __NR_times +attribute_hidden _syscall1(clock_t, __times, struct tms *, buf); +strong_alias(__times,times) diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c index d7a71d690..5515488cd 100644 --- a/libc/sysdeps/linux/common/utime.c +++ b/libc/sysdeps/linux/common/utime.c @@ -7,14 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define utimes __utimes + #include "syscalls.h" #include <utime.h> #ifdef __NR_utime -_syscall2(int, utime, const char *, file, const struct utimbuf *, times); +#define __NR___utime __NR_utime +attribute_hidden _syscall2(int, __utime, const char *, file, const struct utimbuf *, times); #else #include <stdlib.h> #include <sys/time.h> -int utime(const char *file, const struct utimbuf *times) +int attribute_hidden __utime(const char *file, const struct utimbuf *times) { struct timeval timevals[2]; @@ -32,3 +35,4 @@ int utime(const char *file, const struct utimbuf *times) return utimes(file, timevals); } #endif +strong_alias(__utime,utime) diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c index ef0fffe11..ca45204c7 100644 --- a/libc/sysdeps/linux/common/utimes.c +++ b/libc/sysdeps/linux/common/utimes.c @@ -7,14 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define utime __utime + #include "syscalls.h" #include <utime.h> #ifdef __NR_utimes -_syscall2(int, utimes, const char *, file, const struct timeval *, tvp); +#define __NR___utimes __NR_utimes +attribute_hidden _syscall2(int, __utimes, const char *, file, const struct timeval *, tvp); #else #include <stdlib.h> #include <sys/time.h> -int utimes(const char *file, const struct timeval tvp[2]) +int attribute_hidden __utimes(const char *file, const struct timeval tvp[2]) { struct utimbuf buf, *times; @@ -28,3 +31,4 @@ int utimes(const char *file, const struct timeval tvp[2]) return utime(file, times); } #endif +strong_alias(__utimes,utimes) diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index 6c46d0caa..b2a6d2295 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -1,3 +1,5 @@ +#define wait4 __wait4 + #include <stdlib.h> #include <syscall.h> #include <sys/types.h> @@ -6,8 +8,8 @@ /* 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); + return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); } -weak_alias(__libc_wait, wait) +weak_alias(wait,__libc_wait) diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c index 6a8bc77fc..4b4d6aef1 100644 --- a/libc/sysdeps/linux/common/wait3.c +++ b/libc/sysdeps/linux/common/wait3.c @@ -1,3 +1,5 @@ +#define wait4 __wait4 + #include <syscall.h> #include <sys/types.h> #include <sys/wait.h> diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c index 5434a009e..b5a2c5933 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -14,7 +14,8 @@ static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid, int *, status, int, opts, struct rusage *, rusage); -pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage) +pid_t attribute_hidden __wait4(pid_t pid, int *status, int opts, struct rusage *rusage) { return (__syscall_wait4(pid, status, opts, rusage)); } +strong_alias(__wait4,wait4) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index fef93173b..612917fcf 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -1,11 +1,14 @@ +#define wait4 __wait4 + #include <stdlib.h> #include <sys/types.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/resource.h> -__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) +__pid_t attribute_hidden __waitpid(__pid_t pid, int *wait_stat, int options) { - return wait4(pid, wait_stat, options, NULL); + return __wait4(pid, wait_stat, options, NULL); } -weak_alias(__libc_waitpid, waitpid) +strong_alias(__waitpid,waitpid) +weak_alias(__waitpid,__libc_waitpid) diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index 0875796cf..d7898c598 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -34,7 +34,7 @@ extern void restore (void) asm ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. 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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; @@ -76,7 +76,7 @@ extern void restore (void) asm ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. 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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -119,7 +119,8 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa } #endif -weak_alias (__libc_sigaction, sigaction) +strong_alias(__sigaction_internal,__libc_sigaction) +weak_alias(__sigaction_internal, sigaction) @@ -162,4 +163,3 @@ asm \ ); RESTORE (restore, __NR_sigreturn) - diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index ac10bc5aa..32b13c064 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -44,8 +44,10 @@ extern void restore (void) asm ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. 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) +/* psm: couldn't use __sigaction, if building w/ disabled hidden, + * it will conflict w/ the one in libpthread */ +int attribute_hidden +__sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; @@ -77,8 +79,8 @@ extern void restore (void) asm ("__restore") attribute_hidden; /* If ACT is not NULL, change the action for SIG to *ACT. 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 attribute_hidden +__sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -117,8 +119,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return result; } #endif - -weak_alias (__libc_sigaction, sigaction) +strong_alias(__sigaction_internal,__libc_sigaction) +weak_alias(__sigaction_internal,sigaction) /* NOTE: Please think twice before making any changes to the bits of code below. GDB needs some intimate knowledge about it to diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 7bf58289b..9793d9ad4 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -30,6 +30,9 @@ * to free the storage allocated for the copy. Better ideas anyone? */ +#define munmap __munmap +#define execve __execve + #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -91,7 +94,7 @@ void __exec_free(void *ptr, size_t size) /**********************************************************************/ #ifdef L_execl -int execl(const char *path, const char *arg, ...) +int attribute_hidden __execl(const char *path, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ int n; @@ -122,6 +125,7 @@ int execl(const char *path, const char *arg, ...) return n; } +strong_alias(__execl,execl) #endif /**********************************************************************/ @@ -174,6 +178,8 @@ int execle(const char *path, const char *arg, ...) /**********************************************************************/ #ifdef L_execlp +extern int __execvp(const char *path, char *const argv[]) attribute_hidden; + int execlp(const char *file, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ @@ -215,7 +221,7 @@ int execlp(const char *file, const char *arg, ...) * /bin, and then /usr/bin. */ static const char default_path[] = ":/bin:/usr/bin"; -int execvp(const char *path, char *const argv[]) +int attribute_hidden __execvp(const char *path, char *const argv[]) { char *buf = NULL; char *p; @@ -250,7 +256,7 @@ int execvp(const char *path, char *const argv[]) EXEC_FREE(nargv, size2); } } else { - if ((p = getenv("PATH")) != NULL) { + if ((p = __getenv("PATH")) != NULL) { if (!*p) { goto BAD; } @@ -312,6 +318,7 @@ int execvp(const char *path, char *const argv[]) return -1; } +strong_alias(__execvp,execvp) #endif /**********************************************************************/ diff --git a/libc/unistd/getlogin.c b/libc/unistd/getlogin.c index e1685692c..0747a49f6 100644 --- a/libc/unistd/getlogin.c +++ b/libc/unistd/getlogin.c @@ -29,14 +29,15 @@ * the user specify whatever they want via the LOGNAME environment * variable, or we return NULL if getenv() fails to find anything */ -char * getlogin(void) +extern char attribute_hidden * __getlogin(void) { - return (getenv("LOGNAME")); + return (__getenv("LOGNAME")); } +strong_alias(__getlogin,getlogin) int getlogin_r(char *name, size_t len) { - char * foo = getenv("LOGNAME"); + char * foo = __getenv("LOGNAME"); if (! foo) return -1; @@ -48,7 +49,7 @@ int getlogin_r(char *name, size_t len) char *cuserid(char *s) { - char *name = getlogin(); + char *name = __getlogin(); if (s) { return(__strcpy(s, name ? name : "")); } diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 216e0575a..fc3a013c2 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -247,7 +247,7 @@ static const char *_getopt_initialize (int argc, char *const * argv, const char ordering = REQUIRE_ORDER; ++optstring; } - else if (getenv ("POSIXLY_CORRECT") != NULL) + else if (__getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 5dc6f5cf1..2af8f00a1 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -16,6 +16,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define setvbuf __setvbuf + #include <stdio.h> #include <string.h> #include <termios.h> diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 01a9b641b..b704cd905 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -18,6 +18,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define sigaction __sigaction_internal + #include <errno.h> #include <time.h> #include <signal.h> diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index 2346ad831..c80a9e94e 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -16,7 +16,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define getpagesize __libc_getpagesize +#define getpagesize __getpagesize_internal +#define getdtablesize __getdtablesize #define _XOPEN_SOURCE 500 #include <features.h> diff --git a/libc/unistd/ualarm.c b/libc/unistd/ualarm.c index 207a47298..3bcb8e463 100644 --- a/libc/unistd/ualarm.c +++ b/libc/unistd/ualarm.c @@ -1,3 +1,5 @@ +#define setitimer __setitimer + #define _GNU_SOURCE #include <time.h> #include <sys/time.h> diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index 323ed6a55..40c8b9e24 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -30,7 +30,7 @@ * November 2002, Erik Andersen <andersen@codepoet.org> */ -#define __fsetlocking __libc_fsetlocking +#define __fsetlocking __fsetlocking_internal #define _GNU_SOURCE #include <sys/param.h> |