diff options
Diffstat (limited to 'libc')
151 files changed, 788 insertions, 482 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c index f46d54a8f..da40dea0c 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -28,8 +28,6 @@ #include <netinet/in.h> #include <bits/uClibc_uintmaxtostr.h> -int inet_aton(const char *cp, struct in_addr *addrptr); - #ifdef L_inet_aton /* * More undocumented inet_aton features. @@ -47,9 +45,7 @@ int inet_aton(const char *cp, struct in_addr *addrptr); * leading 0 -> octal * all else -> decimal */ -int inet_aton(cp, addrptr) -const char *cp; -struct in_addr *addrptr; +int attribute_hidden __inet_aton(const char *cp, struct in_addr *addrptr) { in_addr_t addr; int value; @@ -95,25 +91,29 @@ struct in_addr *addrptr; return 1; } +strong_alias(__inet_aton,inet_aton) #endif #ifdef L_inet_addr -in_addr_t inet_addr(const char *cp) +extern int __inet_aton (__const char *__cp, struct in_addr *__inp) __THROW attribute_hidden; + +in_addr_t attribute_hidden __inet_addr(const char *cp) { struct in_addr a; - if (!inet_aton(cp, &a)) + if (!__inet_aton(cp, &a)) return INADDR_NONE; else return a.s_addr; } +strong_alias(__inet_addr,inet_addr) #endif #ifdef L_inet_ntoa #define INET_NTOA_MAX_LEN 16 /* max 12 digits + 3 '.'s + 1 nul */ -char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN]) +char attribute_hidden *__inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN]) { in_addr_t addr = ntohl(in.s_addr); int i; @@ -132,12 +132,14 @@ char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN]) return p+1; } +strong_alias(__inet_ntoa_r,inet_ntoa_r) -char *inet_ntoa(struct in_addr in) +char attribute_hidden *__inet_ntoa(struct in_addr in) { static char buf[INET_NTOA_MAX_LEN]; - return(inet_ntoa_r(in, buf)); + return(__inet_ntoa_r(in, buf)); } +strong_alias(__inet_ntoa,inet_ntoa) #endif #ifdef L_inet_makeaddr @@ -189,8 +191,8 @@ in_addr_t inet_lnaof(struct in_addr in) * Return the network number from an internet * address; handles class a/b/c network #'s. */ -in_addr_t -inet_netof(struct in_addr in) +in_addr_t attribute_hidden +__inet_netof(struct in_addr in) { in_addr_t i = ntohl(in.s_addr); @@ -201,5 +203,6 @@ inet_netof(struct in_addr in) else return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); } +strong_alias(__inet_netof,inet_netof) #endif diff --git a/libc/inet/ether_addr.c b/libc/inet/ether_addr.c index fb58e148d..0a1e2aede 100644 --- a/libc/inet/ether_addr.c +++ b/libc/inet/ether_addr.c @@ -32,14 +32,7 @@ #include <netinet/ether.h> #include <netinet/if_ether.h> -struct ether_addr *ether_aton(const char *asc) -{ - static struct ether_addr result; - - return ether_aton_r(asc, &result); -} - -struct ether_addr *ether_aton_r(const char *asc, struct ether_addr *addr) +struct ether_addr attribute_hidden *__ether_aton_r(const char *asc, struct ether_addr *addr) { size_t cnt; @@ -75,19 +68,28 @@ struct ether_addr *ether_aton_r(const char *asc, struct ether_addr *addr) return addr; } +strong_alias(__ether_aton_r,ether_aton_r) -char *ether_ntoa(const struct ether_addr *addr) +struct ether_addr *ether_aton(const char *asc) { - static char asc[18]; + static struct ether_addr result; - return ether_ntoa_r(addr, asc); + return __ether_aton_r(asc, &result); } -char *ether_ntoa_r(const struct ether_addr *addr, char *buf) +char attribute_hidden *__ether_ntoa_r(const struct ether_addr *addr, char *buf) { - sprintf(buf, "%x:%x:%x:%x:%x:%x", + __sprintf(buf, "%x:%x:%x:%x:%x:%x", addr->ether_addr_octet[0], addr->ether_addr_octet[1], addr->ether_addr_octet[2], addr->ether_addr_octet[3], addr->ether_addr_octet[4], addr->ether_addr_octet[5]); return buf; } +strong_alias(__ether_ntoa_r,ether_ntoa_r) + +char *ether_ntoa(const struct ether_addr *addr) +{ + static char asc[18]; + + return __ether_ntoa_r(addr, asc); +} diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index e896e3449..a85e2ff5e 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -48,6 +48,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define gethostbyname_r __gethostbyname_r #define gethostbyname2_r __gethostbyname2_r #define gethostbyaddr_r __gethostbyaddr_r +#define inet_pton __inet_pton +#define inet_ntop __inet_ntop +#define strtoul __strtoul #if 0 #define uname __uname #define stpcpy __stpcpy @@ -156,7 +159,7 @@ static int addrconfig (sa_family_t af) int s; int ret; int saved_errno = errno; - s = socket(af, SOCK_DGRAM, 0); + s = __socket(af, SOCK_DGRAM, 0); if (s < 0) ret = (errno == EMFILE) ? 1 : 0; else @@ -771,6 +774,20 @@ static struct gaih gaih[] = { PF_UNSPEC, NULL } }; +void attribute_hidden +__freeaddrinfo (struct addrinfo *ai) +{ + struct addrinfo *p; + + while (ai != NULL) + { + p = ai; + ai = ai->ai_next; + free (p); + } +} +strong_alias(__freeaddrinfo,freeaddrinfo) + int attribute_hidden __getaddrinfo (const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) @@ -842,7 +859,7 @@ __getaddrinfo (const char *name, const char *service, continue; if (p) - freeaddrinfo (p); + __freeaddrinfo (p); return -(i & GAIH_EAI); } @@ -866,21 +883,8 @@ __getaddrinfo (const char *name, const char *service, return 0; if (p) - freeaddrinfo (p); + __freeaddrinfo (p); return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } strong_alias(__getaddrinfo,getaddrinfo) - -void -freeaddrinfo (struct addrinfo *ai) -{ - struct addrinfo *p; - - while (ai != NULL) - { - p = ai; - ai = ai->ai_next; - free (p); - } -} diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c index 476fa6b0e..edbae55b0 100644 --- a/libc/inet/getnetent.c +++ b/libc/inet/getnetent.c @@ -15,6 +15,9 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#define inet_network __inet_network +#define rewind __rewind + #define __FORCE_GLIBC #include <features.h> #include <stdio.h> diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index adb83a5ca..0c0e2c468 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -52,6 +52,8 @@ */ #define strpbrk __strpbrk +#define atoi __atoi +#define rewind __rewind #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index 4040dc9b6..79cdf7434 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -52,6 +52,8 @@ */ #define strpbrk __strpbrk +#define atoi __atoi +#define rewind __rewind #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/herror.c b/libc/inet/herror.c index 79b84084f..2f0797b91 100644 --- a/libc/inet/herror.c +++ b/libc/inet/herror.c @@ -36,7 +36,7 @@ static const int h_nerr = { sizeof(h_errlist)/sizeof(h_errlist[0]) }; /* * herror -- print the error indicated by the h_errno value. */ -void herror(const char *s) +void attribute_hidden __herror(const char *s) { static const char colon_space[] = ": "; const char *p; @@ -52,6 +52,7 @@ void herror(const char *s) } fprintf(stderr, "%s%s%s\n", s, c, p); } +strong_alias(__herror,herror) const char *hstrerror(int err) diff --git a/libc/inet/if_nametoindex.c b/libc/inet/if_nametoindex.c index 0e556dba8..f3803e56b 100644 --- a/libc/inet/if_nametoindex.c +++ b/libc/inet/if_nametoindex.c @@ -32,10 +32,10 @@ static int __opensock(void) { int fd; #ifdef __UCLIBC_HAS_IPV6__ - fd=socket(AF_INET6,SOCK_DGRAM,0); + fd=__socket(AF_INET6,SOCK_DGRAM,0); if (fd<0) #endif /* __UCLIBC_HAS_IPV6__ */ - fd=socket(AF_INET,SOCK_DGRAM,0); + fd=__socket(AF_INET,SOCK_DGRAM,0); return(fd); } @@ -52,7 +52,7 @@ unsigned int if_nametoindex(const char* ifname) if (fd < 0) return 0; __strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); - if (ioctl(fd,SIOCGIFINDEX,&ifr) < 0) { + if (__ioctl(fd,SIOCGIFINDEX,&ifr) < 0) { int saved_errno = errno; __close(fd); if (saved_errno == EINVAL) @@ -102,7 +102,7 @@ struct if_nameindex * if_nameindex (void) /* Read all the interfaces out of the kernel. */ do { ifc.ifc_buf = realloc(ifc.ifc_buf, ifc.ifc_len = rq_len); - if (ifc.ifc_buf == NULL || ioctl(fd, SIOCGIFCONF, &ifc) < 0) { + if (ifc.ifc_buf == NULL || __ioctl(fd, SIOCGIFCONF, &ifc) < 0) { __close(fd); return NULL; } @@ -121,7 +121,7 @@ struct if_nameindex * if_nameindex (void) for (i = 0; i < nifs; ++i) { struct ifreq *ifr = &ifc.ifc_req[i]; idx[i].if_name = __strdup (ifr->ifr_name); - if (idx[i].if_name == NULL || ioctl(fd,SIOCGIFINDEX,ifr) < 0) { + if (idx[i].if_name == NULL || __ioctl(fd,SIOCGIFINDEX,ifr) < 0) { int saved_errno = errno; unsigned int j; for (j = 0; j < i; ++j) @@ -159,7 +159,7 @@ char * if_indextoname (unsigned int ifindex, char *ifname) return NULL; ifr.ifr_ifindex = ifindex; - if (ioctl (fd, SIOCGIFNAME, &ifr) < 0) { + if (__ioctl (fd, SIOCGIFNAME, &ifr) < 0) { saved_errno = errno; __close (fd); __set_errno (saved_errno); diff --git a/libc/inet/inet_net.c b/libc/inet/inet_net.c index 74fa390ac..a7d1844a7 100644 --- a/libc/inet/inet_net.c +++ b/libc/inet/inet_net.c @@ -42,13 +42,13 @@ * The library routines call this routine to interpret * network numbers. */ -in_addr_t -inet_network(const char *cp) +in_addr_t attribute_hidden +__inet_network(const char *cp) { register in_addr_t val, base, n; register char c; in_addr_t parts[4], *pp = parts; - register int i; + register unsigned int i; again: /* @@ -98,3 +98,4 @@ again: } return (val); } +strong_alias(__inet_network,inet_network) diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c index 65ff1842b..91fa2b899 100644 --- a/libc/inet/ntop.c +++ b/libc/inet/ntop.c @@ -163,7 +163,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) tp += __strlen(tp); break; } - tp += sprintf(tp, "%x", words[i]); + tp += __sprintf(tp, "%x", words[i]); } /* Was it a trailing run of 0x00's? */ if (best.base != -1 && (best.base + best.len) == 8) @@ -349,12 +349,8 @@ inet_pton6(const char *src, u_char *dst) * author: * Paul Vixie, 1996. */ -extern const char * -inet_ntop(af, src, dst, size) - int af; - const void *src; - char *dst; - socklen_t size; +const char attribute_hidden * +__inet_ntop(int af, const void *src, char *dst, socklen_t size) { switch (af) { case AF_INET: @@ -369,6 +365,7 @@ inet_ntop(af, src, dst, size) } /* NOTREACHED */ } +strong_alias(__inet_ntop,inet_ntop) /* int @@ -382,11 +379,8 @@ inet_ntop(af, src, dst, size) * author: * Paul Vixie, 1996. */ -extern int -inet_pton(af, src, dst) - int af; - const char *src; - void *dst; +int attribute_hidden +__inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: @@ -401,4 +395,4 @@ inet_pton(af, src, dst) } /* NOTREACHED */ } - +strong_alias(__inet_pton,inet_pton) diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index 87852f36e..85fb98a63 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -46,6 +46,7 @@ #define xdrmem_create __xdrmem_create #define xdr_authunix_parms __xdr_authunix_parms #define xdr_opaque_auth __xdr_opaque_auth +#define gettimeofday __gettimeofday #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 1fb80d701..530df52b3 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -30,6 +30,8 @@ * Copyright (c) 1987 by Sun Microsystems, Inc. */ +#define bind __bind + #define __FORCE_GLIBC #include <features.h> @@ -43,8 +45,8 @@ /* * Bind a socket to a privileged IP port */ -int -bindresvport (int sd, struct sockaddr_in *sin) +int attribute_hidden +__bindresvport (int sd, struct sockaddr_in *sin) { int res; static short port; @@ -86,3 +88,4 @@ bindresvport (int sd, struct sockaddr_in *sin) return res; } +strong_alias(__bindresvport,bindresvport) diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c index 9173f17af..611ca998c 100644 --- a/libc/inet/rpc/clnt_perror.c +++ b/libc/inet/rpc/clnt_perror.c @@ -220,7 +220,7 @@ __clnt_sperror (CLIENT * rpch, const char *msg) return NULL; CLNT_GETERR (rpch, &e); - len = sprintf (str, "%s: ", msg); + len = __sprintf (str, "%s: ", msg); str += len; (void) __strcpy(str, __clnt_sperrno(e.re_status)); @@ -246,12 +246,12 @@ __clnt_sperror (CLIENT * rpch, const char *msg) case RPC_CANTSEND: case RPC_CANTRECV: strerror_r (e.re_errno, chrbuf, sizeof chrbuf); - len = sprintf (str, "; errno = %s", chrbuf); + len = __sprintf (str, "; errno = %s", chrbuf); str += len; break; case RPC_VERSMISMATCH: - len= sprintf (str, _("; low version = %lu, high version = %lu"), + len= __sprintf (str, _("; low version = %lu, high version = %lu"), e.re_vers.low, e.re_vers.high); str += len; break; @@ -268,20 +268,20 @@ __clnt_sperror (CLIENT * rpch, const char *msg) } else { - len = sprintf (str, _("(unknown authentication error - %d)"), + len = __sprintf (str, _("(unknown authentication error - %d)"), (int) e.re_why); str += len; } break; case RPC_PROGVERSMISMATCH: - len = sprintf (str, _("; low version = %lu, high version = %lu"), + len = __sprintf (str, _("; low version = %lu, high version = %lu"), e.re_vers.low, e.re_vers.high); str += len; break; default: /* unknown */ - len = sprintf (str, "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2); + len = __sprintf (str, "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2); str += len; break; } @@ -315,7 +315,7 @@ __clnt_spcreateerror (const char *msg) if (str == NULL) return NULL; ce = &get_rpc_createerr (); - len = sprintf (str, "%s: ", msg); + len = __sprintf (str, "%s: ", msg); cp = str + len; (void) __strcpy(cp, __clnt_sperrno (ce->cf_stat)); cp += __strlen(cp); diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index f006c3383..c415a447d 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -60,6 +60,9 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #define xdrmem_create __xdrmem_create #define pmap_getport __pmap_getport #define _seterr_reply __seterr_reply +#define connect __connect +#define bindresvport __bindresvport +#define poll __poll #define __FORCE_GLIBC #include <features.h> @@ -173,7 +176,7 @@ __clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, */ if (*sockp < 0) { - *sockp = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); + *sockp = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); (void) bindresvport (*sockp, (struct sockaddr_in *) 0); if ((*sockp < 0) || (connect (*sockp, (struct sockaddr *) raddr, diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index c59a119b9..2a9f7b135 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -47,6 +47,12 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #define xdr_opaque_auth __xdr_opaque_auth #define pmap_getport __pmap_getport #define _seterr_reply __seterr_reply +#define setsockopt __setsockopt +#define bindresvport __bindresvport +#define recvfrom __recvfrom +#define sendto __sendto +#define recvmsg __recvmsg +#define poll __poll #define __FORCE_GLIBC #include <features.h> @@ -195,7 +201,7 @@ __clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, { int dontblock = 1; - *sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); + *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (*sockp < 0) { struct rpc_createerr *ce = &get_rpc_createerr (); @@ -206,7 +212,7 @@ __clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, /* attempt to bind to prov port */ (void) bindresvport (*sockp, (struct sockaddr_in *) 0); /* the sockets rpc controls are non-blocking */ - (void) ioctl (*sockp, FIONBIO, (char *) &dontblock); + (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock); #ifdef IP_RECVERR { int on = 1; @@ -250,13 +256,13 @@ is_network_up (int sock) ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ioctl(sock, SIOCGIFCONF, (char *) &ifc) == 0) + if (__ioctl(sock, SIOCGIFCONF, (char *) &ifc) == 0) { ifr = ifc.ifc_req; for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++) { ifreq = *ifr; - if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) + if (__ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) break; if ((ifreq.ifr_flags & IFF_UP) diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index efdd39005..c97edba42 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -57,6 +57,11 @@ #define getegid __getegid #define geteuid __geteuid #define _seterr_reply __seterr_reply +#define setsockopt __setsockopt +#define connect __connect +#define recvmsg __recvmsg +#define sendmsg __sendmsg +#define poll __poll #define __FORCE_GLIBC #include <features.h> @@ -156,7 +161,7 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, */ if (*sockp < 0) { - *sockp = socket (AF_UNIX, SOCK_STREAM, 0); + *sockp = __socket (AF_UNIX, SOCK_STREAM, 0); len = __strlen (raddr->sun_path) + sizeof (raddr->sun_family) + 1; if (*sockp < 0 || connect (*sockp, (struct sockaddr *) raddr, len) < 0) diff --git a/libc/inet/rpc/create_xid.c b/libc/inet/rpc/create_xid.c index 3dbf7af61..69b83ff59 100644 --- a/libc/inet/rpc/create_xid.c +++ b/libc/inet/rpc/create_xid.c @@ -19,6 +19,7 @@ #define lrand48_r __lrand48_r #define srand48_r __srand48_r +#define gettimeofday __gettimeofday #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c index 684e4d7ec..bdbafa44d 100644 --- a/libc/inet/rpc/get_myaddress.c +++ b/libc/inet/rpc/get_myaddress.c @@ -65,14 +65,14 @@ get_myaddress (struct sockaddr_in *addr) struct ifreq ifreq, *ifr; int len, loopback = 0; - if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0) + if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0) { __perror ("get_myaddress: socket"); exit (1); } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) + if (__ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) { __perror (_("get_myaddress: ioctl (get interface configuration)")); exit (1); @@ -83,7 +83,7 @@ get_myaddress (struct sockaddr_in *addr) for (len = ifc.ifc_len; len; len -= sizeof ifreq) { ifreq = *ifr; - if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) + if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) { __perror ("get_myaddress: ioctl"); exit (1); diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index bc6ab7057..c2e101510 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -1,6 +1,4 @@ /* @(#)getrpcent.c 2.2 88/07/29 4.0 RPCSRC */ -#define __FORCE_GLIBC -#include <features.h> /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -35,6 +33,11 @@ * Copyright (c) 1985 by Sun Microsystems, Inc. */ +#define atoi __atoi +#define rewind __rewind + +#define __FORCE_GLIBC +#include <features.h> #include <stdio.h> #include <string.h> #include <sys/types.h> diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index dbd3e3198..49cd93f4b 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -66,14 +66,14 @@ __get_myaddress (struct sockaddr_in *addr) struct ifreq ifreq, *ifr; int len, loopback = 1; - if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0) + if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0) { __perror ("__get_myaddress: socket"); exit (1); } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) + if (__ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) { __perror (_("__get_myaddress: ioctl (get interface configuration)")); exit (1); @@ -84,7 +84,7 @@ __get_myaddress (struct sockaddr_in *addr) for (len = ifc.ifc_len; len; len -= sizeof ifreq) { ifreq = *ifr; - if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) + if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) { __perror ("__get_myaddress: ioctl"); exit (1); diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 8a42d78ee..dbba18378 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -46,7 +46,12 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; #define xdr_reference __xdr_reference #define xdr_u_long __xdr_u_long #define inet_makeaddr __inet_makeaddr +#define inet_netof __inet_netof #define clntudp_create __clntudp_create +#define setsockopt __setsockopt +#define recvfrom __recvfrom +#define sendto __sendto +#define poll __poll #define __FORCE_GLIBC #include <features.h> @@ -193,7 +198,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf) ifc.ifc_len = UDPMSGSIZE; ifc.ifc_buf = buf; - if (ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0) + if (__ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0) { __perror (_("broadcast: ioctl (get interface configuration)")); return (0); @@ -202,7 +207,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf) for (i = 0, n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++) { ifreq = *ifr; - if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) + if (__ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) { __perror (_("broadcast: ioctl (get interface flags)")); continue; @@ -213,7 +218,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf) { sin = (struct sockaddr_in *) &ifr->ifr_addr; #ifdef SIOCGIFBRDADDR /* 4.3BSD */ - if (ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0) + if (__ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0) { addrs[i++] = inet_makeaddr (inet_netof /* Changed to pass struct instead of s_addr member @@ -272,7 +277,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) * initialization: create a socket, a broadcast address, and * preserialize the arguments into a send buffer. */ - if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) + if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { __perror (_("Cannot create socket for broadcast rpc")); stat = RPC_CANTSEND; diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index bbcc7b354..c2eed87d4 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -43,6 +43,19 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define getpwnam_r __getpwnam_r #define gethostbyname __gethostbyname #define gethostbyname_r __gethostbyname_r +#define fileno __fileno +#define sleep __sleep +#define inet_addr __inet_addr +#define inet_ntoa __inet_ntoa +#define herror __herror +#define bind __bind +#define connect __connect +#define sigblock __sigblock +#define snprintf __snprintf +#define poll __poll +#define accept __accept +#define listen __listen +#define sigsetmask __sigsetmask #define __FORCE_GLIBC #include <features.h> @@ -67,6 +80,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include <arpa/inet.h> +extern int __rresvport(int *alport) attribute_hidden; + /* some forward declarations */ static int __ivaliduser2(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser, const char *rhost); @@ -144,7 +159,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) *ahost = hp->h_name; oldmask = sigblock(sigmask(SIGURG)); /* __sigblock */ for (timo = 1, lport = IPPORT_RESERVED - 1;;) { - s = rresvport(&lport); + s = __rresvport(&lport); if (s < 0) { if (errno == EAGAIN) (void)fprintf(stderr, @@ -195,7 +210,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) lport = 0; } else { char num[8]; - int s2 = rresvport(&lport), s3; + int s2 = __rresvport(&lport), s3; socklen_t len = sizeof(from); if (s2 < 0) @@ -264,14 +279,14 @@ bad: return -1; } -int rresvport(int *alport) +int attribute_hidden __rresvport(int *alport) { struct sockaddr_in sin; int s; sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; - s = socket(AF_INET, SOCK_STREAM, 0); + s = __socket(AF_INET, SOCK_STREAM, 0); if (s < 0) return -1; for (;;) { @@ -292,6 +307,7 @@ int rresvport(int *alport) return -1; } +strong_alias(__rresvport,rresvport) int __check_rhosts_file = 1; char *__rcmd_errstr; diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index 98a8bf32e..239e87fb0 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -27,9 +27,16 @@ * SUCH DAMAGE. */ +#define getsockname __getsockname #define getnameinfo __getnameinfo #define getaddrinfo __getaddrinfo -#define getsockname __getsockname +#define freeaddrinfo __freeaddrinfo +#define sleep __sleep +#define atoi __atoi +#define connect __connect +#define snprintf __snprintf +#define accept __accept +#define listen __listen #define __FORCE_GLIBC #include <features.h> @@ -89,7 +96,7 @@ __rexec_af(char **ahost, int rport, const char *name, const char *pass, const ch } __ruserpass(res0->ai_canonname, &name, &pass); retry: - s = socket(res0->ai_family, res0->ai_socktype, 0); + s = __socket(res0->ai_family, res0->ai_socktype, 0); if (s < 0) { __perror("rexec: socket"); return (-1); @@ -111,7 +118,7 @@ retry: char num[32]; int s2, sa2len; - s2 = socket(res0->ai_family, res0->ai_socktype, 0); + s2 = __socket(res0->ai_family, res0->ai_socktype, 0); if (s2 < 0) { (void) __close(s); return (-1); @@ -132,7 +139,7 @@ retry: NULL, 0, servbuff, sizeof(servbuff), NI_NUMERICSERV)) port = atoi(servbuff); - (void) sprintf(num, "%u", port); + (void) __sprintf(num, "%u", port); (void) __write(s, num, __strlen(num)+1); { socklen_t len = sizeof (from); s3 = accept(s2, (struct sockaddr *)&from, &len); diff --git a/libc/inet/rpc/rtime.c b/libc/inet/rpc/rtime.c index 554ad69eb..b4bbca19c 100644 --- a/libc/inet/rpc/rtime.c +++ b/libc/inet/rpc/rtime.c @@ -42,6 +42,12 @@ static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 S * subtract seconds before Jan 1, 1970 to get * what unix uses. */ + +#define connect __connect +#define recvfrom __recvfrom +#define sendto __sendto +#define poll __poll + #define __FORCE_GLIBC #include <features.h> @@ -90,7 +96,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep, else type = SOCK_DGRAM; - s = socket (AF_INET, type, 0); + s = __socket (AF_INET, type, 0); if (s < 0) return (-1); diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index 3c48122ac..b7bc36864 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -33,6 +33,7 @@ #define getegid __getegid #define geteuid __geteuid #define gethostname __gethostname +#define fileno __fileno #define __FORCE_GLIBC #include <features.h> @@ -121,7 +122,7 @@ int attribute_hidden __ruserpass(const char *host, const char **aname, const cha cfile = fopen(buf, "r"); if (cfile == NULL) { if (errno != ENOENT) - printf("%s", buf); + __printf("%s", buf); return (0); } /* No threads use this stream. */ @@ -169,7 +170,7 @@ next: newp = malloc((unsigned) __strlen(tokval) + 1); if (newp == NULL) { - printf(_("out of memory")); + __printf(_("out of memory")); goto bad; } *aname = __strcpy(newp, tokval); @@ -183,8 +184,8 @@ next: if (__strcmp(*aname, "anonymous") && fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { - printf(_("Error: .netrc file is readable by others.")); - printf(_("Remove password or make file unreadable by others.")); + __printf(_("Error: .netrc file is readable by others.")); + __printf(_("Remove password or make file unreadable by others.")); goto bad; } if (token() && *apass == 0) { @@ -192,7 +193,7 @@ next: newp = malloc((unsigned) __strlen(tokval) + 1); if (newp == NULL) { - printf(_("out of memory")); + __printf(_("out of memory")); goto bad; } *apass = __strcpy(newp, tokval); @@ -202,8 +203,8 @@ next: #if 0 if (fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { - printf("Error: .netrc file is readable by others."); - printf("Remove account or make file unreadable by others."); + __printf("Error: .netrc file is readable by others."); + __printf("Remove account or make file unreadable by others."); goto bad; } if (token() && *aacct == 0) { @@ -221,11 +222,11 @@ next: while ((c=getc_unlocked(cfile)) != EOF && c == ' ' || c == '\t'); if (c == EOF || c == '\n') { - printf("Missing macdef name argument.\n"); + __printf("Missing macdef name argument.\n"); goto bad; } if (macnum == 16) { - printf("Limit of 16 macros have already been defined\n"); + __printf("Limit of 16 macros have already been defined\n"); goto bad; } tmp = macros[macnum].mac_name; @@ -235,7 +236,7 @@ next: *tmp++ = c; } if (c == EOF) { - printf("Macro definition missing null line terminator.\n"); + __printf("Macro definition missing null line terminator.\n"); goto bad; } *tmp = '\0'; @@ -244,7 +245,7 @@ next: && c != '\n'); } if (c == EOF) { - printf("Macro definition missing null line terminator.\n"); + __printf("Macro definition missing null line terminator.\n"); goto bad; } if (macnum == 0) { @@ -256,7 +257,7 @@ next: tmp = macros[macnum].mac_start; while (tmp != macbuf + 4096) { if ((c=getc_unlocked(cfile)) == EOF) { - printf("Macro definition missing null line terminator.\n"); + __printf("Macro definition missing null line terminator.\n"); goto bad; } *tmp = c; @@ -270,13 +271,13 @@ next: tmp++; } if (tmp == macbuf + 4096) { - printf("4K macro buffer exceeded\n"); + __printf("4K macro buffer exceeded\n"); goto bad; } #endif break; default: - printf(_("Unknown .netrc keyword %s"), tokval); + __printf(_("Unknown .netrc keyword %s"), tokval); break; } goto done; diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 727abcbd8..168c6e406 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -36,16 +36,14 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define ffs __ffs #define pmap_set __pmap_set #define pmap_unset __pmap_unset - #define _authenticate _authenticate_internal #define _rpc_dtablesize _rpc_dtablesize_internal - /* used by 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 __rpc_thread_svc_fdset_internal @@ -131,8 +129,8 @@ __xprt_register (SVCXPRT *xprt) strong_alias(__xprt_register,xprt_register) /* De-activate a transport handle. */ -void -xprt_unregister (SVCXPRT *xprt) +void attribute_hidden +__xprt_unregister (SVCXPRT *xprt) { register int sock = xprt->xp_sock; register int i; @@ -149,6 +147,7 @@ xprt_unregister (SVCXPRT *xprt) svc_pollfd[i].fd = -1; } } +strong_alias(__xprt_unregister,xprt_unregister) /* ********************** CALLOUT list related stuff ************* */ @@ -494,7 +493,7 @@ __svc_getreq_poll (struct pollfd *pfdp, int pollretval) ++fds_found; if (p->revents & POLLNVAL) - xprt_unregister (xports[p->fd]); + __xprt_unregister (xports[p->fd]); else __svc_getreq_common (p->fd); } diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index 6c0f44f7d..0562a42fe 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -110,7 +110,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg) */ if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) { - (void) printf ("bad auth_len gid %d str %d auth %d\n", + (void) __printf ("bad auth_len gid %d str %d auth %d\n", gid_len, str_len, auth_len); stat = AUTH_BADCRED; goto done; diff --git a/libc/inet/rpc/svc_run.c b/libc/inet/rpc/svc_run.c index b46320871..d2c06b895 100644 --- a/libc/inet/rpc/svc_run.c +++ b/libc/inet/rpc/svc_run.c @@ -32,6 +32,7 @@ */ #define svc_getreq_poll __svc_getreq_poll +#define poll __poll /* used by svc_[max_]pollfd */ #define __rpc_thread_svc_pollfd __rpc_thread_svc_pollfd_internal diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c index e0509be70..6b8fe7103 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; #define svcerr_decode __svcerr_decode #define svcudp_create __svcudp_create #define pmap_unset __pmap_unset +#define asprintf __asprintf #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index 32b3cc995..1972bcf99 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -48,7 +48,13 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; #define xdr_callmsg __xdr_callmsg #define xdr_replymsg __xdr_replymsg #define xprt_register __xprt_register +#define xprt_unregister __xprt_unregister #define getsockname __getsockname +#define bind __bind +#define bindresvport __bindresvport +#define poll __poll +#define accept __accept +#define listen __listen #define __FORCE_GLIBC #define _GNU_SOURCE @@ -163,7 +169,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) if (sock == RPC_ANYSOCK) { - if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + if ((sock = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { __perror (_("svc_tcp.c - tcp socket creation problem")); return (SVCXPRT *) NULL; diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index 197084144..62719ee33 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -40,10 +40,18 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; */ #define xprt_register __xprt_register +#define xprt_unregister __xprt_unregister #define xdrmem_create __xdrmem_create #define xdr_callmsg __xdr_callmsg #define xdr_replymsg __xdr_replymsg #define getsockname __getsockname +#define setsockopt __setsockopt +#define bind __bind +#define bindresvport __bindresvport +#define recvfrom __recvfrom +#define sendto __sendto +#define recvmsg __recvmsg +#define sendmsg __sendmsg #define __FORCE_GLIBC #define _GNU_SOURCE @@ -131,7 +139,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) if (sock == RPC_ANYSOCK) { - if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) + if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { __perror (_("svcudp_create: socket creation problem")); return (SVCXPRT *) NULL; diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index 79c27ac5f..95a65ad1f 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -44,9 +44,17 @@ #define xdr_callmsg __xdr_callmsg #define xdr_replymsg __xdr_replymsg #define xprt_register __xprt_register +#define xprt_unregister __xprt_unregister #define getegid __getegid #define geteuid __geteuid #define getsockname __getsockname +#define setsockopt __setsockopt +#define bind __bind +#define recvmsg __recvmsg +#define sendmsg __sendmsg +#define poll __poll +#define accept __accept +#define listen __listen #define __FORCE_GLIBC #include <features.h> @@ -158,7 +166,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) if (sock == RPC_ANYSOCK) { - if ((sock = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + if ((sock = __socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { __perror (_("svc_unix.c - AF_UNIX socket creation problem")); return (SVCXPRT *) NULL; diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c index 3d36c4021..12315fdb5 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -728,6 +728,7 @@ __xdr_string (XDR *xdrs, char **cpp, u_int maxsize) } return FALSE; } +strong_alias(__xdr_string,xdr_string) /* * Wrapper for xdr_string that can be called directly from diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c index 411cf17da..bd9ee4f1b 100644 --- a/libc/inet/rpc/xdr_stdio.c +++ b/libc/inet/rpc/xdr_stdio.c @@ -37,6 +37,9 @@ * from the stream. */ +#define fread __fread +#define fwrite __fwrite + #include <rpc/types.h> #include <stdio.h> #include <rpc/xdr.h> diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 1dbffa3d1..d6ec86e94 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -43,14 +43,16 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) return __socketcall(SYS_ACCEPT, args); } #endif -weak_alias(__libc_accept, accept); +hidden_weak_alias(__libc_accept,__accept) +weak_alias(__libc_accept,accept) #endif #ifdef L_bind #ifdef __NR_bind -_syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); +#define __NR___bind __NR_bind +attribute_hidden _syscall3(int, __bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); #elif defined(__NR_socketcall) -int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) +int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) { unsigned long args[3]; @@ -60,6 +62,7 @@ int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) return __socketcall(SYS_BIND, args); } #endif +strong_alias(__bind,bind) #endif #ifdef L_connect @@ -77,7 +80,8 @@ int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) return __socketcall(SYS_CONNECT, args); } #endif -weak_alias(__libc_connect, connect); +hidden_weak_alias(__libc_connect,__connect) +weak_alias(__libc_connect,connect) #endif #ifdef L_getpeername @@ -100,7 +104,6 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) #ifdef __NR_getsockname #define __NR___getsockname __NR_getsockname attribute_hidden _syscall3(int, __getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); -strong_alias(__getsockname,getsockname) #elif defined(__NR_socketcall) int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { @@ -111,8 +114,8 @@ int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t args[2] = (unsigned long) paddrlen; return __socketcall(SYS_GETSOCKNAME, args); } -strong_alias(__getsockname,getsockname) #endif +strong_alias(__getsockname,getsockname) #endif #ifdef L_getsockopt @@ -136,9 +139,10 @@ int getsockopt(int fd, int level, int optname, __ptr_t optval, #ifdef L_listen #ifdef __NR_listen -_syscall2(int, listen, int, sockfd, int, backlog); +#define __NR___listen __NR_listen +attribute_hidden _syscall2(int, __listen, int, sockfd, int, backlog); #elif defined(__NR_socketcall) -int listen(int sockfd, int backlog) +int attribute_hidden __listen(int sockfd, int backlog) { unsigned long args[2]; @@ -147,6 +151,7 @@ int listen(int sockfd, int backlog) return __socketcall(SYS_LISTEN, args); } #endif +strong_alias(__listen,listen) #endif #ifdef L_recv @@ -166,14 +171,14 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) args[3] = flags; return (__socketcall(SYS_RECV, args)); } -weak_alias(__libc_recv, recv); #elif defined(__NR_recvfrom) ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) { - return (recvfrom(sockfd, buffer, len, flags, NULL, NULL)); + return (__recvfrom(sockfd, buffer, len, flags, NULL, NULL)); } -weak_alias(__libc_recv, recv); #endif +hidden_weak_alias(__libc_recv,__recv) +weak_alias(__libc_recv,recv) #endif #ifdef L_recvfrom @@ -197,7 +202,8 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, return (__socketcall(SYS_RECVFROM, args)); } #endif -weak_alias(__libc_recvfrom, recvfrom); +hidden_weak_alias(__libc_recvfrom,__recvfrom) +weak_alias(__libc_recvfrom,recvfrom) #endif #ifdef L_recvmsg @@ -215,14 +221,14 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) return (__socketcall(SYS_RECVMSG, args)); } #endif -weak_alias(__libc_recvmsg, recvmsg); +hidden_weak_alias(__libc_recvmsg,__recvmsg) +weak_alias(__libc_recvmsg,recvmsg) #endif #ifdef L_send #ifdef __NR_send #define __NR___libc_send __NR_send _syscall4(ssize_t, __libc_send, int, sockfd, const void *, buffer, size_t, len, int, flags); -weak_alias(__libc_send, send); #elif defined(__NR_socketcall) /* send, sendto added by bir7@leland.stanford.edu */ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) @@ -235,14 +241,18 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) args[3] = flags; return (__socketcall(SYS_SEND, args)); } -weak_alias(__libc_send, send); #elif defined(__NR_sendto) +extern ssize_t __sendto (int __fd, __const void *__buf, size_t __n, + int __flags, __CONST_SOCKADDR_ARG __addr, + socklen_t __addr_len) attribute_hidden; + ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) { - return (sendto(sockfd, buffer, len, flags, NULL, 0)); + return (__sendto(sockfd, buffer, len, flags, NULL, 0)); } -weak_alias(__libc_send, send); #endif +hidden_weak_alias(__libc_send,__send) +weak_alias(__libc_send,send) #endif #ifdef L_sendmsg @@ -260,7 +270,8 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) return (__socketcall(SYS_SENDMSG, args)); } #endif -weak_alias(__libc_sendmsg, sendmsg); +hidden_weak_alias(__libc_sendmsg,__sendmsg) +weak_alias(__libc_sendmsg,sendmsg) #endif #ifdef L_sendto @@ -284,15 +295,17 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, return (__socketcall(SYS_SENDTO, args)); } #endif -weak_alias(__libc_sendto, sendto); +hidden_weak_alias(__libc_sendto,__sendto) +weak_alias(__libc_sendto,sendto) #endif #ifdef L_setsockopt #ifdef __NR_setsockopt -_syscall5(int, setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); +#define __NR___setsockopt __NR_setsockopt +attribute_hidden _syscall5(int, __setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); #elif defined(__NR_socketcall) /* [sg]etsockoptions by bir7@leland.stanford.edu */ -int setsockopt(int fd, int level, int optname, const void *optval, +int attribute_hidden __setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) { unsigned long args[5]; @@ -305,6 +318,7 @@ int setsockopt(int fd, int level, int optname, const void *optval, return (__socketcall(SYS_SETSOCKOPT, args)); } #endif +strong_alias(__setsockopt,setsockopt) #endif #ifdef L_shutdown @@ -325,9 +339,10 @@ int shutdown(int sockfd, int how) #ifdef L_socket #ifdef __NR_socket -_syscall3(int, socket, int, family, int, type, int, protocol); +#define __NR___socket __NR_socket +attribute_hidden _syscall3(int, __socket, int, family, int, type, int, protocol); #elif defined(__NR_socketcall) -int socket(int family, int type, int protocol) +int attribute_hidden __socket(int family, int type, int protocol) { unsigned long args[3]; @@ -337,6 +352,7 @@ int socket(int family, int type, int protocol) return __socketcall(SYS_SOCKET, args); } #endif +strong_alias(__socket,socket) #endif #ifdef L_socketpair @@ -355,4 +371,3 @@ int socketpair(int family, int type, int protocol, int sockvec[2]) } #endif #endif - diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 25c424566..8066b5861 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -4,8 +4,7 @@ #include <unistd.h> #include "dirstream.h" - -int closedir(DIR * dir) +int attribute_hidden __closedir(DIR * dir) { int fd; @@ -27,3 +26,4 @@ int closedir(DIR * dir) free(dir); return __close(fd); } +strong_alias(__closedir,closedir) diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c index b658b5a9c..48e955450 100644 --- a/libc/misc/dirent/dirfd.c +++ b/libc/misc/dirent/dirfd.c @@ -2,7 +2,7 @@ #include <errno.h> #include "dirstream.h" -int dirfd(DIR * dir) +int attribute_hidden __dirfd(DIR * dir) { if (!dir || dir->dd_fd == -1) { __set_errno(EBADF); @@ -11,3 +11,4 @@ int dirfd(DIR * dir) return dir->dd_fd; } +strong_alias(__dirfd,dirfd) diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index fd14213a5..5c9762f85 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -11,7 +11,7 @@ /* opendir just makes an open() call - it return NULL if it fails * (open sets errno), otherwise it returns a DIR * pointer. */ -DIR *opendir(const char *name) +DIR attribute_hidden *__opendir(const char *name) { int fd; struct stat statbuf; @@ -54,3 +54,4 @@ DIR *opendir(const char *name) __pthread_mutex_init(&(ptr->dd_lock), NULL); return ptr; } +strong_alias(__opendir,opendir) diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index e80df58dc..cc76bed5e 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -21,6 +21,8 @@ */ #define qsort __qsort +#define opendir __opendir +#define closedir __closedir #include <dirent.h> #include <stdio.h> diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index 46b6d5cef..377f55fe6 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -21,6 +21,8 @@ */ #define qsort __qsort +#define opendir __opendir +#define closedir __closedir #include <features.h> #ifdef __UCLIBC_HAS_LFS__ diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index 0d0637148..922cd8aba 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vfprintf __vfprintf + #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -34,7 +36,7 @@ static void vwarn_work(const char *format, va_list args, int showerr) f = fmt + 11; /* At 11. */ if (showerr) { f -= 4; /* At 7. */ - __xpg_strerror_r(errno, buf, sizeof(buf)); + __xpg_strerror_r_internal(errno, buf, sizeof(buf)); } __STDIO_AUTO_THREADLOCK(stderr); @@ -49,62 +51,70 @@ static void vwarn_work(const char *format, va_list args, int showerr) __STDIO_AUTO_THREADUNLOCK(stderr); } -extern void warn(const char *format, ...) +void attribute_hidden __vwarn(const char *format, va_list args) +{ + vwarn_work(format, args, 1); +} +strong_alias(__vwarn,vwarn) + +void warn(const char *format, ...) { va_list args; va_start(args, format); - vwarn(format, args); + __vwarn(format, args); va_end(args); } -extern void vwarn(const char *format, va_list args) +void attribute_hidden __vwarnx(const char *format, va_list args) { - vwarn_work(format, args, 1); + vwarn_work(format, args, 0); } +strong_alias(__vwarnx,vwarnx) -extern void warnx(const char *format, ...) +void warnx(const char *format, ...) { va_list args; va_start(args, format); - vwarnx(format, args); + __vwarnx(format, args); va_end(args); } -extern void vwarnx(const char *format, va_list args) +void attribute_hidden __verr(int status, const char *format, va_list args) { - vwarn_work(format, args, 0); + __vwarn(format, args); + exit(status); } +strong_alias(__verr,verr) -extern void err(int status, const char *format, ...) +void attribute_noreturn err(int status, const char *format, ...) { va_list args; va_start(args, format); - verr(status, format, args); + __verr(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } -extern void verr(int status, const char *format, va_list args) +void attribute_hidden __verrx(int status, const char *format, va_list args) { - vwarn(format, args); + __vwarnx(format, args); exit(status); } +strong_alias(__verrx,verrx) -extern void errx(int status, const char *format, ...) +void attribute_noreturn errx(int status, const char *format, ...) { va_list args; va_start(args, format); - verrx(status, format, args); + __verrx(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); -} - -extern void verrx(int status, const char *format, va_list args) -{ - vwarnx(format, args); - exit(status); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 0a19e3923..5427e9568 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -23,6 +23,7 @@ /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */ #define strerror __strerror +#define vfprintf __vfprintf #include <stdio.h> #include <stdarg.h> diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index 11bb3a112..e0d9daa87 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -49,16 +49,9 @@ Cambridge, MA 02139, USA. */ # define ISUPPER(c) (ISASCII (c) && isupper (c)) -# ifndef errno -extern int errno; -# endif - /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ -int fnmatch(pattern, string, flags) -const char *pattern; -const char *string; -int flags; +int attribute_hidden __fnmatch(const char *pattern, const char *string, int flags) { register const char *p = pattern, *n = string; register char c; @@ -124,7 +117,7 @@ int flags; c1 = FOLD(c1); for (--p; *n != '\0'; ++n) if ((c == '[' || FOLD(*n) == c1) && - fnmatch(p, n, flags & ~FNM_PERIOD) == 0) + __fnmatch(p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; } @@ -228,5 +221,5 @@ int flags; # undef FOLD } - +strong_alias(__fnmatch,fnmatch) #endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 09a87e4be..30009def9 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -25,8 +25,13 @@ #define stpcpy __stpcpy #define tsearch __tsearch #define tdestroy __tdestroy +#define tfind __tfind #define fchdir __fchdir +#define chdir __chdir +#define dirfd __dirfd #define getcwd __getcwd +#define opendir __opendir +#define closedir __closedir #define _GNU_SOURCE #include <features.h> diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 3fc20dbc2..d4a0b67ca 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -18,6 +18,7 @@ Cambridge, MA 02139, USA. */ #define strrchr __strrchr #define strcoll __strcoll #define qsort __qsort +#define fnmatch __fnmatch #include <features.h> #include <stdlib.h> @@ -32,6 +33,9 @@ Cambridge, MA 02139, USA. */ #define _GNU_SOURCE #include <glob.h> +extern DIR *__opendir (__const char *__name) __nonnull ((1)) attribute_hidden; +extern int __closedir (DIR *__dirp) __nonnull ((1)) attribute_hidden; + extern __ptr_t (*__glob_opendir_hook) __P ((const char *directory)); extern void (*__glob_closedir_hook) __P ((__ptr_t stream)); extern const char *(*__glob_readdir_hook) __P ((__ptr_t stream)); @@ -397,7 +401,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) int meta; stream = (__glob_opendir_hook ? (*__glob_opendir_hook) (directory) - : (__ptr_t) opendir (directory)); + : (__ptr_t) __opendir (directory)); if (stream == NULL) { if ((errfunc != NULL && (*errfunc) (directory, errno)) || @@ -497,7 +501,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (__glob_closedir_hook) (*__glob_closedir_hook) (stream); else - (void) closedir ((DIR *) stream); + (void) __closedir ((DIR *) stream); errno = save; } return nfound == 0 ? GLOB_NOMATCH : 0; @@ -508,7 +512,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (__glob_closedir_hook) (*__glob_closedir_hook) (stream); else - (void) closedir ((DIR *) stream); + (void) __closedir ((DIR *) stream); errno = save; } while (names != NULL) diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index cd3b1b061..618fad74c 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -236,19 +236,6 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, aux_dat += 2; } -#if !defined(SHARED) && defined(__UCLIBC_HAS_THREADS_NATIVE__) - { - extern void _dl_aux_init (ElfW(auxv_t) *av); - - /* - * Before we can make any pthread calls, we have to do some - * some TLS setup. This call may do more in the future. - */ - if (likely(_dl_aux_init != NULL)) - _dl_aux_init(auxvt); - } -#endif - /* We need to initialize uClibc. If we are dynamically linked this * may have already been completed by the shared lib loader. We call * __uClibc_init() regardless, to be sure the right thing happens. */ diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c index 05acb7ea9..f2424eae0 100644 --- a/libc/misc/internals/errno.c +++ b/libc/misc/internals/errno.c @@ -1,15 +1,14 @@ #include <features.h> #undef errno -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include <tls.h> -extern int errno; -extern __thread int _h_errno; -int _errno = 0; -__thread int _h_errno; -#else extern int errno; extern int h_errno; + +#if 0 +/* Unfortunately, this doesn't work... */ +int h_errno __attribute__ ((section (".bss"))) = 0; +int errno __attribute__ ((section (".bss"))) = 0; +#else int _errno = 0; int _h_errno = 0; #endif diff --git a/libc/misc/internals/static.c b/libc/misc/internals/static.c deleted file mode 100644 index cd39ffdd7..000000000 --- a/libc/misc/internals/static.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <stddef.h> - -/* Force static libraries to know about ... */ -void *__libc_stack_end=NULL; diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 99a8ac0d8..fae3687ad 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -32,6 +32,8 @@ */ #define open64 __open64 +#define mkdir __mkdir +#define gettimeofday __gettimeofday #include <stddef.h> #include <stdint.h> @@ -61,8 +63,8 @@ static int direxists (const char *dir) for use with mk[s]temp. Will fail (-1) if DIR is non-null and doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ -int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir, - const char *pfx, int try_tmpdir) +int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *dir, + const char *pfx /*, int try_tmpdir*/) { //const char *d; size_t dlen, plen; @@ -116,7 +118,7 @@ int attribute_hidden __path_search (char *tmpl, size_t tmpl_len, const char *dir return -1; } - sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); + __sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); return 0; } @@ -141,7 +143,7 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len) static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) { - int i, k; + unsigned int i, k; struct timeval tv; uint32_t high, low, rh; static uint64_t value; @@ -180,8 +182,8 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) int attribute_hidden __gen_tempname (char *tmpl, int kind) { char *XXXXXX; - unsigned int k; - int len, i, count, fd, save_errno = errno; + unsigned int i, k; + int len, count, fd, save_errno = errno; unsigned char randomness[6]; len = __strlen (tmpl); diff --git a/libc/misc/internals/tempname.h b/libc/misc/internals/tempname.h index dfe9399ca..80a6cf7c1 100644 --- a/libc/misc/internals/tempname.h +++ b/libc/misc/internals/tempname.h @@ -3,8 +3,12 @@ #define __need_size_t #include <stddef.h> -extern int __path_search (char *tmpl, size_t tmpl_len, const char *dir, - const char *pfx, int try_tmpdir) attribute_hidden; + +/* Disable support for $TMPDIR */ +extern int ___path_search (char *tmpl, size_t tmpl_len, const char *dir, + const char *pfx /*, int try_tmpdir */) attribute_hidden; +#define __path_search(tmpl, tmpl_len, dir, pfx, try_tmpdir) ___path_search(tmpl, tmpl_len, dir, pfx) + extern int __gen_tempname (char *__tmpl, int __kind) attribute_hidden; /* The __kind argument to __gen_tempname may be one of: */ diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index b73ffa3dd..bf0628ee1 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1002,7 +1002,7 @@ static const unsigned char nl_data[C_LC_ALL + 1 + 90 + 320] = { ']', '\x00', '^', '[', 'n', 'N', ']', '\x00', }; -char *nl_langinfo(nl_item item) +char attribute_hidden *__nl_langinfo(nl_item item) { unsigned int c; unsigned int i; @@ -1015,21 +1015,25 @@ char *nl_langinfo(nl_item item) } return (char *) cat_start; /* Conveniently, this is the empty string. */ } +strong_alias(__nl_langinfo,nl_langinfo) #else /* __LOCALE_C_ONLY */ #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -char *nl_langinfo(nl_item item) +extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; + +char attribute_hidden *__nl_langinfo(nl_item item) { return __nl_langinfo_l(item, __UCLIBC_CURLOCALE); } +strong_alias(__nl_langinfo,nl_langinfo) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ static const char empty[] = ""; -char *__XL(nl_langinfo)(nl_item item __LOCALE_PARAM ) +char attribute_hidden *__UCXL(nl_langinfo)(nl_item item __LOCALE_PARAM ) { unsigned int c = _NL_ITEM_CATEGORY(item); unsigned int i = _NL_ITEM_INDEX(item); @@ -1041,6 +1045,7 @@ char *__XL(nl_langinfo)(nl_item item __LOCALE_PARAM ) return (char *) empty; } +__UCXL_ALIAS(nl_langinfo) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 81575a679..7e9febb1f 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -1,5 +1,6 @@ #define strtok_r __strtok_r #define strstr __strstr +#define atoi __atoi #include <stdio.h> #include <stdlib.h> diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 1f9d37780..6bb319acd 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -31,8 +31,10 @@ #define mbrtowc __mbrtowc #define wcrtomb __wcrtomb #define wcscoll __wcscoll +#define wctype __wctype #define iswctype __iswctype #define iswalnum __iswalnum +#define printf __printf /* To exclude some unwanted junk.... */ #undef _LIBC @@ -5166,7 +5168,7 @@ PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range, wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL; /* We need the size of wchar_t buffers correspond to csize1, csize2. */ int wcs_size1 = 0, wcs_size2 = 0; - /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + /* offset buffer for optimization. See convert_mbs_to_wc. */ int *mbs_offset1 = NULL, *mbs_offset2 = NULL; /* They hold whether each wchar_t is binary data or not. */ char *is_binary = NULL; @@ -5696,7 +5698,7 @@ wcs_re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos, wchar_t *string1, *string2; /* We need the size of wchar_t buffers correspond to csize1, csize2. */ int size1, size2; - /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + /* offset buffer for optimization. See convert_mbs_to_wc. */ int *mbs_offset1, *mbs_offset2; #else /* BYTE */ static int diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c index ab654f705..e8e2946b4 100644 --- a/libc/misc/regex/regexec.c +++ b/libc/misc/regex/regexec.c @@ -385,7 +385,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, if (BE (s == NULL, 0)) return -2; -#ifdef _LIBC +#if defined _LIBC || defined __UCLIBC__ memcpy (__mempcpy (s, string1, length1), string2, length2); #else memcpy (s, string1, length1); diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c index 4bc45ca36..4071cf1ab 100644 --- a/libc/misc/search/lsearch.c +++ b/libc/misc/search/lsearch.c @@ -14,7 +14,7 @@ #ifdef L_lfind -void *lfind(const void *key, const void *base, size_t *nmemb, +void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb, size_t size, int (*compar)(const void *, const void *)) { register int n = *nmemb; @@ -26,17 +26,21 @@ void *lfind(const void *key, const void *base, size_t *nmemb, } return (NULL); } +strong_alias(__lfind,lfind) #endif #ifdef L_lsearch +extern void *__lfind (__const void *__key, __const void *__base, + size_t *__nmemb, size_t __size, __compar_fn_t __compar) attribute_hidden; + void *lsearch(const void *key, void *base, size_t *nmemb, size_t size, int (*compar)(const void *, const void *)) { register char *p; - if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { + if ((p = __lfind(key, base, nmemb, size, compar)) == NULL) { p = __memcpy((base + (size * (*nmemb))), key, size); ++(*nmemb); } diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c index 93a2c678f..58f16ab79 100644 --- a/libc/misc/search/tsearch.c +++ b/libc/misc/search/tsearch.c @@ -81,7 +81,7 @@ strong_alias(__tsearch,tsearch) #endif #ifdef L_tfind -void *tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) +void attribute_hidden *__tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) { register node **rootp = (node **) vrootp; @@ -99,6 +99,7 @@ void *tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) } return NULL; } +strong_alias(__tfind,tfind) #endif #ifdef L_tdelete diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h index c1d4e76c5..105232fea 100644 --- a/libc/misc/sysvipc/ipc.h +++ b/libc/misc/sysvipc/ipc.h @@ -8,7 +8,7 @@ /* The actual system call: all functions are multiplexed by this. */ extern int __syscall_ipc __P((unsigned int __call, int __first, int __second, - int __third, void *__ptr)); + int __third, void *__ptr)) attribute_hidden; /* The codes for the functions to use the multiplexer `__syscall_ipc'. */ diff --git a/libc/misc/time/ftime.c b/libc/misc/time/ftime.c index 24789c9eb..904763241 100644 --- a/libc/misc/time/ftime.c +++ b/libc/misc/time/ftime.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define gettimeofday __gettimeofday + #include <sys/timeb.h> #include <sys/time.h> diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 59b3ef641..fac85638e 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -130,6 +130,7 @@ */ #define strnlen __strnlen +#define gettimeofday __gettimeofday #define _GNU_SOURCE #include <stdio.h> @@ -147,8 +148,17 @@ extern void __tzset (void) __THROW attribute_hidden; +extern long int __strtol (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur attribute_hidden; + +extern char *__nl_langinfo (nl_item __item) __THROW attribute_hidden; + #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> +extern long int __strtol_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __THROW __nonnull ((1, 4)) __wur attribute_hidden; extern int __strncasecmp_l (__const char *__s1, __const char *__s2, size_t __n, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 4)) attribute_hidden; @@ -160,6 +170,8 @@ extern size_t __strftime_l (char *__restrict __s, size_t __maxsize, extern char *__strptime_l (__const char *__restrict __s, __const char *__restrict __fmt, struct tm *__tp, __locale_t __loc) __THROW attribute_hidden; + +extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; #endif #ifndef __isleap @@ -266,7 +278,7 @@ strong_alias(__asctime,asctime) * }; * static char result[26]; * - * sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", + * __sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", * wday_name[timeptr->tm_wday], * mon_name[timeptr->tm_mon], * timeptr->tm_mday, timeptr->tm_hour, @@ -1044,7 +1056,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, + (code & 7); #ifdef ENABLE_ERA_CODE if ((mod & NO_E_MOD) /* Actually, this means E modifier present. */ - && (*(o = __XL(nl_langinfo)(_NL_ITEM(LC_TIME, + && (*(o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(((unsigned char *)p)[4])) __LOCALE_ARG ))) @@ -1053,7 +1065,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, goto LOOP; } #endif - p = __XL(nl_langinfo)(_NL_ITEM(LC_TIME, + p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(*((unsigned char *)p))) __LOCALE_ARG ); @@ -1230,7 +1242,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, if ((code & MASK_SPEC) == STRING_SPEC) { o_count = SIZE_MAX; field_val += spec[STRINGS_NL_ITEM_START + (code & 0xf)]; - o = __XL(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG ); + o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG ); } else { o_count = ((i >> 1) & 3) + 1; o = buf + o_count; @@ -1491,7 +1503,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * + (code & 7); #ifdef ENABLE_ERA_CODE if ((mod & NO_E_MOD) /* Actually, this means E modifier present. */ - && (*(o = __XL(nl_langinfo)(_NL_ITEM(LC_TIME, + && (*(o = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(((unsigned char *)p)[4])) __LOCALE_ARG ))) @@ -1500,7 +1512,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * goto LOOP; } #endif - p = __XL(nl_langinfo)(_NL_ITEM(LC_TIME, + p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(*((unsigned char *)p))) __LOCALE_ARG ); goto LOOP; @@ -1515,7 +1527,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * /* Go backwards to check full names before abreviations. */ do { --j; - o = __XL(nl_langinfo)(i+j __LOCALE_ARG); + o = __UCXL(nl_langinfo)(i+j __LOCALE_ARG); if (!__UCXL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { do { /* Found a match. */ ++buf; @@ -1544,9 +1556,9 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * __set_errno(0); if (!ISSPACE(*buf)) { /* Signal an error if whitespace. */ #ifdef TIME_T_IS_UNSIGNED - t = __XL(strtoul)(buf, &o, 10 __LOCALE_ARG); + t = __UCXL(strtoul)(buf, &o, 10 __LOCALE_ARG); #else - t = __XL(strtol)(buf, &o, 10 __LOCALE_ARG); + t = __UCXL(strtol)(buf, &o, 10 __LOCALE_ARG); #endif } if ((o == buf) || errno) { /* Not a number or overflow. */ diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 04f511921..8e104733c 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -28,6 +28,7 @@ */ #define __fsetlocking __fsetlocking_internal +#define rewind __rewind #define _GNU_SOURCE #include <features.h> diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index 0900ef379..bfedeaa70 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -17,6 +17,8 @@ * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. */ +#define gettimeofday __gettimeofday + #include <string.h> #include <sys/time.h> #include <time.h> diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 1a16fc9d6..0d7d8371a 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -98,6 +98,10 @@ * Manuel */ +#define vfprintf __vfprintf +#define fread __fread +#define fwrite __fwrite + #define _GNU_SOURCE #define _ISOC99_SOURCE #include <errno.h> diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index 77d7572da..8ef373205 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -48,7 +48,7 @@ extern wctype_t __wctype (__const char *__property) attribute_hidden; #include <xlocale.h> extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW; extern wint_t __towupper_l(wint_t __wc, __locale_t __locale) __THROW; -//extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW attribute_hidden; +extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW attribute_hidden; extern wint_t __towctrans_l(wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW; #endif /* __UCLIBC_HAS_XLOCALE__ */ diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index d8bf785d3..e76d6a63a 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -31,6 +31,13 @@ #define getpwuid_r __getpwuid_r #define execve __execve #define dup2 __dup2 +#define atoi __atoi +#define fnmatch __fnmatch +#define pipe __pipe +#if 0 +#define glob __glob +#define globfree __globfree +#endif #define _GNU_SOURCE #include <sys/cdefs.h> @@ -503,7 +510,7 @@ static int eval_expr(char *expr, long int *result); static char *_itoa(unsigned long long int value, char *buflim) { - sprintf(buflim, "%llu", value); + __sprintf(buflim, "%llu", value); return buflim; } diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index ced5051f8..82c99360a 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -19,6 +19,8 @@ */ #define setgroups __setgroups +#define strtoul __strtoul +#define rewind __rewind #define _GNU_SOURCE #include <features.h> @@ -433,7 +435,7 @@ int getpw(uid_t uid, char *buf) if (!buf) { __set_errno(EINVAL); } else if (!__getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) { - if (sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n", + if (__sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n", resultbuf.pw_name, resultbuf.pw_passwd, (unsigned long)(resultbuf.pw_uid), (unsigned long)(resultbuf.pw_gid), @@ -842,7 +844,7 @@ int putspent(const struct spwd *p, FILE *stream) static const char ld_format[] = "%ld:"; const char *f; long int x; - int i; + size_t i; int rv = -1; __STDIO_AUTO_THREADLOCK_VAR; @@ -1124,7 +1126,7 @@ int attribute_hidden __parsespent(void *data, char * line) int attribute_hidden __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, char *__restrict line_buff, size_t buflen, FILE *f) { - int line_len; + size_t line_len; int skip; int rv = ERANGE; __STDIO_AUTO_THREADLOCK_VAR; diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index f4df3f2de..6c2ef81f3 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define isatty __isatty + #include "_stdio.h" /* diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 2024caca1..99fc9a9dd 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -694,12 +694,12 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info cnt += num_groups * tslen; /* Adjust count now for sep chars. */ -/* printf("\n"); */ +/* __printf("\n"); */ do { if (!blk) { /* Initial group could be 0 digits long! */ blk = nblk2; } else if (len >= blk) { /* Enough digits for a group. */ -/* printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ +/* __printf("norm: len=%d blk=%d \"%.*s\"\n", len, blk, blk, gp); */ if (fp_outfunc(fp, *ppc, blk, (intptr_t) gp) != blk) { return -1; } @@ -709,9 +709,9 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } len -= blk; } else { /* Transition to 0s. */ -/* printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ +/* __printf("trans: len=%d blk=%d \"%.*s\"\n", len, blk, len, gp); */ if (len) { -/* printf("len\n"); */ +/* __printf("len\n"); */ if (fp_outfunc(fp, *ppc, len, (intptr_t) gp) != len) { return -1; } @@ -719,7 +719,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } if (ppc[3] == FPO_ZERO_PAD) { /* Need to group 0s */ -/* printf("zeropad\n"); */ +/* __printf("zeropad\n"); */ cnt += ppc[1]; ppc += 3; gp = (const char *) ppc[2]; @@ -742,7 +742,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info } blk = nblk2; -/* printf("num_groups=%d blk=%d\n", num_groups, blk); */ +/* __printf("num_groups=%d blk=%d\n", num_groups, blk); */ } while (1); } else diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index db4b48400..d0c221361 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define isatty __isatty + #include "_stdio.h" /* This is pretty much straight from uClibc, but with one important @@ -173,7 +175,7 @@ int _stdio_openlist_delflag = 0; int _stdio_user_locking = 2; #ifndef __USE_STDIO_FUTEXES__ -void __stdio_init_mutex(pthread_mutex_t *m) +void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) { static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 858f2716b..4d45a5448 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -19,8 +19,35 @@ #include <string.h> #include <unistd.h> +extern int __vfprintf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vsnprintf (char *__restrict __s, size_t __maxlen, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__printf__, 3, 0))) attribute_hidden; + +extern int __vfscanf (FILE *__restrict __s, __const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden; + +extern int __vsscanf (__const char *__restrict __s, + __const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__scanf__, 2, 0))) attribute_hidden; + #ifdef __UCLIBC_HAS_WCHAR__ #include <wchar.h> + +extern int __vfwprintf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vfwscanf (__FILE *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) attribute_hidden; + +extern int __vswscanf (__const wchar_t *__restrict __s, + __const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW attribute_hidden; #endif #ifdef __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c index 36ed807a4..207b35a3c 100644 --- a/libc/stdio/asprintf.c +++ b/libc/stdio/asprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vasprintf __vasprintf + #include "_stdio.h" #include <stdarg.h> @@ -12,7 +14,7 @@ #warning Skipping asprintf and __asprintf since no vsnprintf! #else -int __asprintf(char **__restrict buf, const char * __restrict format, ...) +int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict format, ...) { va_list arg; int rv; @@ -24,6 +26,6 @@ int __asprintf(char **__restrict buf, const char * __restrict format, ...) return rv; } -weak_alias(__asprintf,asprintf) +strong_alias(__asprintf,asprintf) #endif diff --git a/libc/stdio/dprintf.c b/libc/stdio/dprintf.c index dfdd4977d..1fc46c722 100644 --- a/libc/stdio/dprintf.c +++ b/libc/stdio/dprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vdprintf __vdprintf + #include "_stdio.h" #include <stdarg.h> diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c index 4df2e4229..4f5e479fe 100644 --- a/libc/stdio/fclose.c +++ b/libc/stdio/fclose.c @@ -7,7 +7,8 @@ #include "_stdio.h" -int fclose(register FILE *stream) +#undef fclose +int attribute_hidden __fclose(register FILE *stream) { int rv = 0; __STDIO_AUTO_THREADLOCK_VAR; @@ -84,3 +85,4 @@ int fclose(register FILE *stream) return rv; } +strong_alias(__fclose,fclose) diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c index fa08c976d..9b08b4b71 100644 --- a/libc/stdio/fdopen.c +++ b/libc/stdio/fdopen.c @@ -7,7 +7,7 @@ #include "_stdio.h" -FILE *fdopen(int filedes, const char *mode) +FILE attribute_hidden *__fdopen(int filedes, const char *mode) { intptr_t cur_mode; @@ -15,3 +15,4 @@ FILE *fdopen(int filedes, const char *mode) ? _stdio_fopen(cur_mode, mode, NULL, filedes) : NULL; } +strong_alias(__fdopen,fdopen) diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c index 4ea21d748..526a4eb9f 100644 --- a/libc/stdio/fileno.c +++ b/libc/stdio/fileno.c @@ -23,12 +23,13 @@ int attribute_hidden __fileno_unlocked(register FILE *stream) weak_alias(__fileno_unlocked,fileno_unlocked); #ifndef __UCLIBC_HAS_THREADS__ +hidden_weak_alias(__fileno_unlocked,__fileno); weak_alias(__fileno_unlocked,fileno); #endif #elif defined __UCLIBC_HAS_THREADS__ -int fileno(register FILE *stream) +int attribute_hidden __fileno(register FILE *stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; @@ -41,5 +42,5 @@ int fileno(register FILE *stream) return retval; } - +strong_alias(__fileno,fileno) #endif diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index 7febe1a6e..fc7870258 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define fopencookie __fopencookie + #include "_stdio.h" #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ diff --git a/libc/stdio/fopencookie.c b/libc/stdio/fopencookie.c index 73a5a028a..a70e17b80 100644 --- a/libc/stdio/fopencookie.c +++ b/libc/stdio/fopencookie.c @@ -28,7 +28,7 @@ /* Currently no real reentrancy issues other than a possible double close(). */ #ifndef __BCC__ -FILE *fopencookie(void * __restrict cookie, const char * __restrict mode, +FILE attribute_hidden *__fopencookie(void * __restrict cookie, const char * __restrict mode, cookie_io_functions_t io_functions) #else FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, @@ -57,3 +57,6 @@ FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, return stream; } +#ifndef __BCC__ +strong_alias(__fopencookie,fopencookie) +#endif diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c index 388eb0c3b..ee19c85a5 100644 --- a/libc/stdio/fprintf.c +++ b/libc/stdio/fprintf.c @@ -8,14 +8,16 @@ #include "_stdio.h" #include <stdarg.h> -int fprintf(FILE * __restrict stream, const char * __restrict format, ...) +#undef fprintf +int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfprintf(stream, format, arg); + rv = __vfprintf(stream, format, arg); va_end(arg); return rv; } +strong_alias(__fprintf,fprintf) diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 42a29b067..0defb36a0 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -83,14 +83,15 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz return 0; } -weak_alias(__fread_unlocked,fread_unlocked); +weak_alias(__fread_unlocked,fread_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fread_unlocked,fread); +hidden_strong_alias(__fread_unlocked,__fread) +weak_alias(__fread_unlocked,fread) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t fread(void * __restrict ptr, size_t size, size_t nmemb, +size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -104,5 +105,6 @@ size_t fread(void * __restrict ptr, size_t size, size_t nmemb, return retval; } +strong_alias(__fread,fread) #endif diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index fa5a6bdf6..c81d40482 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -15,7 +15,7 @@ int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwprintf(stream, format, arg); + rv = __vfwprintf(stream, format, arg); va_end(arg); return rv; diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c index 50af8f7a5..abe24fbb7 100644 --- a/libc/stdio/fwrite.c +++ b/libc/stdio/fwrite.c @@ -34,14 +34,15 @@ size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t si return 0; } -weak_alias(__fwrite_unlocked,fwrite_unlocked); +weak_alias(__fwrite_unlocked,fwrite_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fwrite_unlocked,fwrite); +hidden_strong_alias(__fwrite_unlocked,__fwrite) +weak_alias(__fwrite_unlocked,fwrite) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t fwrite(const void * __restrict ptr, size_t size, +size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -55,5 +56,6 @@ size_t fwrite(const void * __restrict ptr, size_t size, return retval; } +strong_alias(__fwrite,fwrite) #endif diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index aafc4a1ed..8b54ca849 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -341,7 +341,7 @@ static const char u_spec[] = "%nbopxXudics"; /* u_radix[i] <-> u_spec[i+2] for unsigned entries only */ static const char u_radix[] = "\x02\x08\x10\x10\x10\x0a"; -int vfprintf(FILE * __restrict op, register const char * __restrict fmt, +int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt, va_list ap) { union { @@ -450,7 +450,7 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt, if (*fmt == 'm') { flag[FLAG_PLUS] = '\0'; flag[FLAG_0_PAD] = ' '; - p = __glibc_strerror_r(errno, tmp, sizeof(tmp)); + p = __glibc_strerror_r_internal(errno, tmp, sizeof(tmp)); goto print; } #endif @@ -711,3 +711,4 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt, return i; } +strong_alias(__vfprintf,vfprintf) diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index 5799005d9..f750cd11c 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define fopencookie __fopencookie + #include "_stdio.h" #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c index d69ccd5c3..9edcf4efb 100644 --- a/libc/stdio/perror.c +++ b/libc/stdio/perror.c @@ -30,7 +30,7 @@ void attribute_hidden __perror(register const char *s) { char buf[64]; fprintf(stderr, "%s%s%s\n", s, sep, - __glibc_strerror_r(errno, buf, sizeof(buf))); + __glibc_strerror_r_internal(errno, buf, sizeof(buf))); } #endif } diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index 00c2d7bb1..c3ee09381 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -17,6 +17,8 @@ #define waitpid __waitpid #define execl __execl #define dup2 __dup2 +#define fdopen __fdopen +#define pipe __pipe #include <stdio.h> #include <stdlib.h> diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 67db4b384..82326a9c3 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -8,14 +8,15 @@ #include "_stdio.h" #include <stdarg.h> -int printf(const char * __restrict format, ...) +int attribute_hidden __printf(const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfprintf(stdout, format, arg); + rv = __vfprintf(stdout, format, arg); va_end(arg); return rv; } +strong_alias(__printf,printf) diff --git a/libc/stdio/remove.c b/libc/stdio/remove.c index aaef3342b..d471ae291 100644 --- a/libc/stdio/remove.c +++ b/libc/stdio/remove.c @@ -5,6 +5,9 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define rmdir __rmdir +#define unlink __unlink + #include "_stdio.h" #include <unistd.h> diff --git a/libc/stdio/rewind.c b/libc/stdio/rewind.c index 7f36a77ff..aa4534aa7 100644 --- a/libc/stdio/rewind.c +++ b/libc/stdio/rewind.c @@ -7,7 +7,7 @@ #include "_stdio.h" -void rewind(register FILE *stream) +void attribute_hidden __rewind(register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; @@ -18,3 +18,4 @@ void rewind(register FILE *stream) __STDIO_AUTO_THREADUNLOCK(stream); } +strong_alias(__rewind,rewind) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index c70cae4a1..3132026bb 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -48,6 +48,7 @@ #define mbrtowc __mbrtowc #define ungetc __ungetc #define ungetwc __ungetwc +#define iswspace __iswspace #define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ @@ -146,17 +147,18 @@ _stdlib_strto_l(register const char * __restrict str, /**********************************************************************/ #ifdef L_fscanf -int fscanf(FILE * __restrict stream, const char * __restrict format, ...) +int attribute_hidden __fscanf(FILE * __restrict stream, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vfscanf(stream, format, arg); + rv = __vfscanf(stream, format, arg); va_end(arg); return rv; } +strong_alias(__fscanf,fscanf) #endif /**********************************************************************/ @@ -168,7 +170,7 @@ int scanf(const char * __restrict format, ...) int rv; va_start(arg, format); - rv = vfscanf(stdin, format, arg); + rv = __vfscanf(stdin, format, arg); va_end(arg); return rv; @@ -180,17 +182,18 @@ int scanf(const char * __restrict format, ...) #ifdef __STDIO_HAS_VSSCANF -int sscanf(const char * __restrict str, const char * __restrict format, ...) +int attribute_hidden __sscanf(const char * __restrict str, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsscanf(str, format, arg); + rv = __vsscanf(str, format, arg); va_end(arg); return rv; } +strong_alias(__sscanf,sscanf) #else /* __STDIO_HAS_VSSCANF */ #warning Skipping sscanf since no vsscanf! @@ -200,10 +203,11 @@ int sscanf(const char * __restrict str, const char * __restrict format, ...) /**********************************************************************/ #ifdef L_vscanf -int vscanf(const char * __restrict format, va_list arg) +int attribute_hidden __vscanf(const char * __restrict format, va_list arg) { - return vfscanf(stdin, format, arg); + return __vfscanf(stdin, format, arg); } +strong_alias(__vscanf,vscanf) #endif /**********************************************************************/ @@ -215,7 +219,7 @@ int vscanf(const char * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { FILE f; @@ -257,12 +261,13 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); - return vfscanf(&f, fmt, ap); + return __vfscanf(&f, fmt, ap); } +strong_alias(__vsscanf,vsscanf) #elif !defined(__UCLIBC_HAS_WCHAR__) -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { __FILE_vsscanf f; @@ -299,23 +304,25 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) #endif f.f.__nextopen = NULL; - return vfscanf(&f.f, fmt, ap); + return __vfscanf(&f.f, fmt, ap); } +strong_alias(__vsscanf,vsscanf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) -int vsscanf(__const char *sp, __const char *fmt, va_list ap) +int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) { FILE *f; int rv = EOF; if ((f = fmemopen((char *)sp, __strlen(sp), "r")) != NULL) { - rv = vfscanf(f, fmt, ap); + rv = __vfscanf(f, fmt, ap); fclose(f); } return rv; } +strong_alias(__vsscanf,vsscanf) #else #warning Skipping vsscanf since no buffering, no custom streams, and wchar enabled! @@ -334,7 +341,7 @@ int fwscanf(FILE * __restrict stream, const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwscanf(stream, format, arg); + rv = __vfwscanf(stream, format, arg); va_end(arg); return rv; @@ -350,7 +357,7 @@ int wscanf(const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwscanf(stdin, format, arg); + rv = __vfwscanf(stdin, format, arg); va_end(arg); return rv; @@ -369,7 +376,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, int rv; va_start(arg, format); - rv = vswscanf(str, format, arg); + rv = __vswscanf(str, format, arg); va_end(arg); return rv; @@ -384,7 +391,7 @@ int swscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, int vwscanf(const wchar_t * __restrict format, va_list arg) { - return vfwscanf(stdin, format, arg); + return __vfwscanf(stdin, format, arg); } #endif @@ -393,7 +400,7 @@ int vwscanf(const wchar_t * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS -int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, +int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -434,8 +441,9 @@ int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, #endif f.__nextopen = NULL; - return vfwscanf(&f, format, arg); + return __vfwscanf(&f, format, arg); } +strong_alias(__vswscanf,vswscanf) #else /* __STDIO_BUFFERS */ #warning Skipping vswscanf since no buffering! #endif /* __STDIO_BUFFERS */ @@ -584,6 +592,7 @@ enum { #define Wchar wchar_t #define Wuchar __uwchar_t #define ISSPACE(C) iswspace((C)) +#define HIDDEN_VFSCANF __vfwscanf #define VFSCANF vfwscanf #define GETC(SC) (SC)->sc_getc((SC)) #else @@ -593,6 +602,7 @@ typedef unsigned char __uchar_t; #define Wchar char #define Wuchar __uchar_t #define ISSPACE(C) isspace((C)) +#define HIDDEN_VFSCANF __vfscanf #define VFSCANF vfscanf #ifdef __UCLIBC_HAS_WCHAR__ #define GETC(SC) (SC)->sc_getc((SC)) @@ -1150,7 +1160,7 @@ static const char fake_thousands_sep_str[] = ","; #endif /* L_vfwscanf */ -int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) +int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) { const Wuchar *fmt; unsigned char *b; @@ -1754,6 +1764,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) return psfs.cnt; } +strong_alias(HIDDEN_VFSCANF,VFSCANF) #endif /**********************************************************************/ #ifdef L___psfs_do_numeric diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c index a827971ba..a1ea79fc0 100644 --- a/libc/stdio/snprintf.c +++ b/libc/stdio/snprintf.c @@ -12,16 +12,17 @@ #warning Skipping snprintf since no vsnprintf! #else -int snprintf(char *__restrict buf, size_t size, +int attribute_hidden __snprintf(char *__restrict buf, size_t size, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsnprintf(buf, size, format, arg); + rv = __vsnprintf(buf, size, format, arg); va_end(arg); return rv; } +strong_alias(__snprintf,snprintf) #endif diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c index eb83f424a..5778c011d 100644 --- a/libc/stdio/sprintf.c +++ b/libc/stdio/sprintf.c @@ -12,16 +12,17 @@ #warning Skipping sprintf since no vsnprintf! #else -int sprintf(char *__restrict buf, const char * __restrict format, ...) +int attribute_hidden __sprintf(char *__restrict buf, const char * __restrict format, ...) { va_list arg; int rv; va_start(arg, format); - rv = vsnprintf(buf, SIZE_MAX, format, arg); + rv = __vsnprintf(buf, SIZE_MAX, format, arg); va_end(arg); return rv; } +strong_alias(__sprintf,sprintf) #endif diff --git a/libc/stdio/swprintf.c b/libc/stdio/swprintf.c index bdb092403..b373df8bd 100644 --- a/libc/stdio/swprintf.c +++ b/libc/stdio/swprintf.c @@ -5,6 +5,8 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ +#define vswprintf __vswprintf + #include "_stdio.h" #include <stdarg.h> #include <wchar.h> diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 488ddd763..fa9bd5019 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -16,6 +16,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define fdopen __fdopen + #include <features.h> #include <stdio.h> #include <unistd.h> diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c index 512317c51..ca110cbd1 100644 --- a/libc/stdio/vasprintf.c +++ b/libc/stdio/vasprintf.c @@ -20,7 +20,7 @@ #warning Skipping vasprintf since no vsnprintf! #else -int vasprintf(char **__restrict buf, const char * __restrict format, +int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict format, va_list arg) { #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -32,7 +32,7 @@ int vasprintf(char **__restrict buf, const char * __restrict format, *buf = NULL; if ((f = open_memstream(buf, &size)) != NULL) { - rv = vfprintf(f, format, arg); + rv = __vfprintf(f, format, arg); fclose(f); if (rv < 0) { free(*buf); @@ -54,14 +54,14 @@ int vasprintf(char **__restrict buf, const char * __restrict format, int rv; va_copy(arg2, arg); - rv = vsnprintf(NULL, 0, format, arg2); + rv = __vsnprintf(NULL, 0, format, arg2); va_end(arg2); *buf = NULL; if (rv >= 0) { if ((*buf = malloc(++rv)) != NULL) { - if ((rv = vsnprintf(*buf, rv, format, arg)) < 0) { + if ((rv = __vsnprintf(*buf, rv, format, arg)) < 0) { free(*buf); *buf = NULL; } @@ -74,5 +74,6 @@ int vasprintf(char **__restrict buf, const char * __restrict format, #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */ } +strong_alias(__vasprintf,vasprintf) #endif diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 6d8c91e90..4e066f169 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -8,7 +8,7 @@ #include "_stdio.h" #include <stdarg.h> -int vdprintf(int filedes, const char * __restrict format, va_list arg) +int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_list arg) { FILE f; int rv; @@ -51,7 +51,7 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) #endif f.__nextopen = NULL; - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); #ifdef __STDIO_BUFFERS /* If not buffering, then fflush is unnecessary. */ @@ -64,3 +64,4 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) return rv; } +strong_alias(__vdprintf,vdprintf) diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 5275f53f7..11fe926a0 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -1195,6 +1195,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad); #ifdef L_vfprintf +#define HIDDEN_VFPRINTF __vfprintf #define VFPRINTF vfprintf #define FMT_TYPE char #define OUTNSTR _outnstr @@ -1227,6 +1228,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf #else /* L_vfprintf */ +#define HIDDEN_VFPRINTF __vfwprintf #define VFPRINTF vfwprintf #define FMT_TYPE wchar_t #define OUTNSTR _outnwcs @@ -1736,7 +1738,7 @@ static int _do_one_spec(FILE * __restrict stream, #ifdef __UCLIBC_HAS_PRINTF_M_SPEC__ } else if (ppfs->conv_num == CONV_m) { - s = __glibc_strerror_r(errno, buf, sizeof(buf)); + s = __glibc_strerror_r_internal(errno, buf, sizeof(buf)); goto SET_STRING_LEN; #endif } else { @@ -1844,7 +1846,7 @@ static int _do_one_spec(FILE * __restrict stream, return 0; } -int VFPRINTF (FILE * __restrict stream, +int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream, register const FMT_TYPE * __restrict format, va_list arg) { @@ -1921,5 +1923,6 @@ int VFPRINTF (FILE * __restrict stream, return count; } +strong_alias(HIDDEN_VFPRINTF,VFPRINTF) #endif /**********************************************************************/ diff --git a/libc/stdio/vprintf.c b/libc/stdio/vprintf.c index 45d580faa..9c0e07514 100644 --- a/libc/stdio/vprintf.c +++ b/libc/stdio/vprintf.c @@ -10,5 +10,5 @@ int vprintf(const char * __restrict format, va_list arg) { - return vfprintf(stdout, format, arg); + return __vfprintf(stdout, format, arg); } diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c index b8bdbaaa1..c926b2ad7 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -14,7 +14,7 @@ #ifdef __STDIO_BUFFERS -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -61,7 +61,7 @@ int vsnprintf(char *__restrict buf, size_t size, __STDIO_STREAM_DISABLE_GETC(&f); __STDIO_STREAM_ENABLE_PUTC(&f); - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); if (size) { if (f.__bufpos == f.__bufend) { --f.__bufpos; @@ -70,6 +70,7 @@ int vsnprintf(char *__restrict buf, size_t size, } return rv; } +strong_alias(__vsnprintf,vsnprintf) #elif defined(__USE_OLD_VFPRINTF__) @@ -79,7 +80,7 @@ typedef struct { unsigned char *bufpos; } __FILE_vsnprintf; -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { __FILE_vsnprintf f; @@ -121,7 +122,7 @@ int vsnprintf(char *__restrict buf, size_t size, #endif f.f.__nextopen = NULL; - rv = vfprintf((FILE *) &f, format, arg); + rv = __vfprintf((FILE *) &f, format, arg); if (size) { if (f.bufpos == f.bufend) { --f.bufpos; @@ -130,6 +131,7 @@ int vsnprintf(char *__restrict buf, size_t size, } return rv; } +strong_alias(__vsnprintf,vsnprintf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) @@ -171,7 +173,7 @@ static ssize_t snpf_write(register void *cookie, const char *buf, #undef COOKIE -int vsnprintf(char *__restrict buf, size_t size, +int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -209,10 +211,11 @@ int vsnprintf(char *__restrict buf, size_t size, #endif f.__nextopen = NULL; - rv = vfprintf(&f, format, arg); + rv = __vfprintf(&f, format, arg); return rv; } +strong_alias(__vsnprintf,vsnprintf) #else #warning Skipping vsnprintf since no buffering, no custom streams, and not old vfprintf! diff --git a/libc/stdio/vsprintf.c b/libc/stdio/vsprintf.c index 81d3961ad..a7d5e08f5 100644 --- a/libc/stdio/vsprintf.c +++ b/libc/stdio/vsprintf.c @@ -15,7 +15,7 @@ int vsprintf(char *__restrict buf, const char * __restrict format, va_list arg) { - return vsnprintf(buf, SIZE_MAX, format, arg); + return __vsnprintf(buf, SIZE_MAX, format, arg); } #endif diff --git a/libc/stdio/vswprintf.c b/libc/stdio/vswprintf.c index aab847dfd..d23ba123f 100644 --- a/libc/stdio/vswprintf.c +++ b/libc/stdio/vswprintf.c @@ -13,7 +13,7 @@ #warning Skipping vswprintf since no buffering! #else /* __STDIO_BUFFERS */ -int vswprintf(wchar_t *__restrict buf, size_t size, +int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -38,12 +38,8 @@ int vswprintf(wchar_t *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __USE_STDIO_FUTEXES__ - _IO_lock_init (f._lock); -#else __stdio_init_mutex(&f.__lock); #endif -#endif f.__nextopen = NULL; if (size > ((SIZE_MAX - (size_t) buf)/sizeof(wchar_t))) { @@ -56,7 +52,7 @@ int vswprintf(wchar_t *__restrict buf, size_t size, __STDIO_STREAM_DISABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); - rv = vfwprintf(&f, format, arg); + rv = __vfwprintf(&f, format, arg); /* NOTE: Return behaviour differs from snprintf... */ if (f.__bufpos == f.__bufend) { @@ -70,5 +66,6 @@ int vswprintf(wchar_t *__restrict buf, size_t size, } return rv; } +strong_alias(__vswprintf,vswprintf) #endif /* __STDIO_BUFFERS */ diff --git a/libc/stdio/vwprintf.c b/libc/stdio/vwprintf.c index 2ad6bbdfd..8c3401846 100644 --- a/libc/stdio/vwprintf.c +++ b/libc/stdio/vwprintf.c @@ -11,5 +11,5 @@ int vwprintf(const wchar_t * __restrict format, va_list arg) { - return vfwprintf(stdout, format, arg); + return __vfwprintf(stdout, format, arg); } diff --git a/libc/stdio/wprintf.c b/libc/stdio/wprintf.c index c64fc086a..00f5ef514 100644 --- a/libc/stdio/wprintf.c +++ b/libc/stdio/wprintf.c @@ -15,7 +15,7 @@ int wprintf(const wchar_t * __restrict format, ...) int rv; va_start(arg, format); - rv = vfwprintf(stdout, format, arg); + rv = __vfwprintf(stdout, format, arg); va_end(arg); return rv; diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 78b57fbd3..d24d1a94c 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 + #define _GNU_SOURCE #include <features.h> #include <signal.h> @@ -32,6 +34,8 @@ Cambridge, MA 02139, USA. */ /* Our last ditch effort to commit suicide */ #if defined(__alpha__) #define ABORT_INSTRUCTION asm ("call_pal 0") +#elif defined(__arm__) +#define ABORT_INSTRUCTION asm ("bl abort") #elif defined(__hppa__) #define ABORT_INSTRUCTION asm ("iitlbp %r0,(%r0)") #elif defined(__i386__) diff --git a/libc/stdlib/bsd_getpt.c b/libc/stdlib/bsd_getpt.c index f219afd29..aec0ca4bc 100644 --- a/libc/stdlib/bsd_getpt.c +++ b/libc/stdlib/bsd_getpt.c @@ -1,21 +1,21 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #include <errno.h> #include <fcntl.h> @@ -31,13 +31,13 @@ #ifndef PTYNAME1 #define PTYNAME1 "pqrsPQRS" #endif -const char _ptyname1[] = PTYNAME1; +const char __libc_ptyname1[] attribute_hidden = PTYNAME1; /* Letters indicating the position within a series. */ #ifndef PTYNAME2 #define PTYNAME2 "0123456789abcdefghijklmnopqrstuv"; #endif -const char _ptyname2[] = PTYNAME2; +const char __libc_ptyname2[] attribute_hidden = PTYNAME2; /* Open a master pseudo terminal and return its file descriptor. */ @@ -48,17 +48,15 @@ __getpt (void) const char *p, *q; char *s; - __memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY)); - s = buf + __strlen (buf); - + s = __mempcpy (buf, _PATH_PTY, sizeof (_PATH_PTY) - 1); /* s[0] and s[1] will be filled in the loop. */ s[2] = '\0'; - for (p = _ptyname1; *p != '\0'; ++p) + for (p = __libc_ptyname1; *p != '\0'; ++p) { s[0] = *p; - for (q = _ptyname2; *q != '\0'; ++q) + for (q = __libc_ptyname2; *q != '\0'; ++q) { int fd; @@ -73,6 +71,6 @@ __getpt (void) } } - errno = ENOENT; + __set_errno (ENOENT); return -1; } diff --git a/libc/stdlib/gcvt.c b/libc/stdlib/gcvt.c index 71bfcec80..75e3bbe70 100644 --- a/libc/stdlib/gcvt.c +++ b/libc/stdlib/gcvt.c @@ -5,7 +5,7 @@ #define MAX_NDIGIT 17 char *gcvt (double number, int ndigit, char *buf) { - sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number); + __sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number); return buf; } #endif diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index c219adb24..4bd082823 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -1,21 +1,21 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #include <errno.h> #include <fcntl.h> @@ -39,7 +39,7 @@ #if !defined __UNIX98PTY_ONLY__ /* Prototype for function that opens BSD-style master pseudo-terminals. */ -int __bsd_getpt (void); +extern int __bsd_getpt (void) attribute_hidden; #endif /* Open a master pseudo terminal and return its file descriptor. */ diff --git a/libc/stdlib/grantpt.c b/libc/stdlib/grantpt.c index 5b4427a0c..2c59cd678 100644 --- a/libc/stdlib/grantpt.c +++ b/libc/stdlib/grantpt.c @@ -45,15 +45,15 @@ static int pts_name (int fd, char **pts, size_t buf_len); terminal associated with the master pseudo terminal specified by FD. */ int +#if !defined __ASSUME_DEVPTS__ grantpt (int fd) +#else +grantpt (attribute_unused int fd) +#endif { #if !defined __ASSUME_DEVPTS__ struct statfs fsbuf; -# ifdef PATH_MAX char _buf[PATH_MAX]; -# else - char _buf[512]; -# endif char *buf = _buf; if (pts_name (fd, &buf, sizeof (_buf))) diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index d20768738..5a208bf28 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -6,6 +6,7 @@ * Parts of the memalign code were stolen from malloc-930716. */ +#define mmap __mmap #define munmap __munmap #define _GNU_SOURCE diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c index 51ac423fe..f6c2a9104 100644 --- a/libc/stdlib/malloc-standard/mallinfo.c +++ b/libc/stdlib/malloc-standard/mallinfo.c @@ -18,7 +18,7 @@ /* ------------------------------ mallinfo ------------------------------ */ -struct mallinfo mallinfo(void) +struct mallinfo attribute_hidden __mallinfo(void) { mstate av; struct mallinfo mi; @@ -78,6 +78,7 @@ struct mallinfo mallinfo(void) UNLOCK; return mi; } +strong_alias(__mallinfo,mallinfo) void malloc_stats(FILE *file) { @@ -87,7 +88,7 @@ void malloc_stats(FILE *file) file = stderr; } - mi = mallinfo(); + mi = __mallinfo(); fprintf(file, "total bytes allocated = %10u\n", (unsigned int)(mi.arena + mi.hblkhd)); fprintf(file, "total bytes in use bytes = %10u\n", (unsigned int)(mi.uordblks + mi.hblkhd)); fprintf(file, "total non-mmapped bytes allocated = %10d\n", mi.arena); diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 0e8aed363..338edeabf 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -14,6 +14,7 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ +#define mmap __mmap #define sysconf __sysconf #include <features.h> diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index 3d77442af..36bfe4d99 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -14,6 +14,8 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ +#define mremap __mremap + #include "malloc.h" diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index c1a127317..4804ba9ee 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/libc/stdlib/malloc/heap_debug.c @@ -11,6 +11,8 @@ * Written by Miles Bader <miles@gnu.org> */ +#define vfprintf __vfprintf + #include <stdlib.h> #include <stdio.h> #include <stdarg.h> diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c index e4523adb2..44eb2c66f 100644 --- a/libc/stdlib/malloc/malloc.c +++ b/libc/stdlib/malloc/malloc.c @@ -11,6 +11,8 @@ * Written by Miles Bader <miles@gnu.org> */ +#define mmap __mmap + #include <stdlib.h> #include <unistd.h> #include <errno.h> diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index b93b1eac6..e8711ff77 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -11,6 +11,9 @@ * Written by Miles Bader <miles@gnu.org> */ +#define atoi __atoi +#define vfprintf __vfprintf + #include <stdlib.h> #include <stdio.h> #include <unistd.h> diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 8cac95783..769944ba2 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -1,21 +1,23 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define isatty __isatty #define _ISOC99_SOURCE #include <stdio.h> @@ -39,7 +41,7 @@ || (major ((Dev)) == 4 && minor ((Dev)) >= 128 && minor ((Dev)) < 192) \ || (major ((Dev)) >= 128 && major ((Dev)) < 136)) -/* Check if DEV corresponds to a master pseudo terminal device. */ +/* Check if DEV corresponds to a slave pseudo terminal device. */ #define SLAVE_P(Dev) \ (major ((Dev)) == 3 \ || (major ((Dev)) == 4 && minor ((Dev)) >= 192 && minor ((Dev)) < 256) \ @@ -51,8 +53,8 @@ and 3 (slaves). */ /* The are declared in getpt.c. */ -extern const char _ptyname1[]; -extern const char _ptyname2[]; +extern const char __libc_ptyname1[] attribute_hidden; +extern const char __libc_ptyname2[] attribute_hidden; #endif @@ -86,7 +88,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) # error "__UNIX98PTY_ONLY__ enabled but TIOCGPTN ioctl not supported by your kernel." #endif #ifdef TIOCGPTN - if (ioctl (fd, TIOCGPTN, &ptyno) == 0) + if (__ioctl (fd, TIOCGPTN, &ptyno) == 0) { /* Buffer we use to print the number in. */ char numbuf[__BUFLEN_INT10TOSTR]; @@ -95,7 +97,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) p = _int10tostr(&numbuf[sizeof numbuf - 1], ptyno); - if (buflen < sizeof devpts + &numbuf[sizeof numbuf - 1] - p) + if (buflen < sizeof(devpts) + (size_t)(&numbuf[sizeof(numbuf) - 1] - p)) { errno = ERANGE; return ERANGE; diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c index d40420740..eb146098a 100644 --- a/libc/stdlib/random.c +++ b/libc/stdlib/random.c @@ -25,6 +25,7 @@ #define random_r __random_r #define srandom_r __srandom_r #define setstate_r __setstate_r +#define initstate_r __initstate_r #define _GNU_SOURCE #include <features.h> diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c index 0733bf900..b10f29519 100644 --- a/libc/stdlib/random_r.c +++ b/libc/stdlib/random_r.c @@ -258,11 +258,7 @@ strong_alias(__srandom_r,srandom_r) Note: The first thing we do is save the current state, if any, just like setstate so that it doesn't matter when initstate is called. Returns a pointer to the old state. */ -int initstate_r (seed, arg_state, n, buf) - unsigned int seed; - char *arg_state; - size_t n; - struct random_data *buf; +int attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf) { int type; int degree; @@ -310,6 +306,7 @@ fail: __set_errno (EINVAL); return -1; } +strong_alias(__initstate_r,initstate_r) /* Restore the state from the given state array. Note: It is important that we also remember the locations of the pointers diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 09524d013..3b7d37ccb 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -36,6 +36,8 @@ #define mbsrtowcs __mbsrtowcs #define mbrtowc __mbrtowc #define mbrlen __mbrlen +#define iswspace __iswspace +#define iswspace_l __iswspace_l #define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for ULLONG primarily... */ @@ -71,6 +73,14 @@ #include <stdlib.h> #include <locale.h> +extern long int __strtol (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur attribute_hidden; +__extension__ +extern long long int __strtoll (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur attribute_hidden; + #ifdef __UCLIBC_HAS_WCHAR__ #include <wchar.h> @@ -191,9 +201,13 @@ _stdlib_wcsto_ll(register const wchar_t * __restrict str, /**********************************************************************/ #ifdef L_atof +extern double __strtod (__const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)) __wur attribute_hidden; + double atof(const char *nptr) { - return strtod(nptr, (char **) NULL); + return __strtod(nptr, (char **) NULL); } #endif @@ -253,10 +267,11 @@ strong_alias(llabs,imaxabs) #if INT_MAX < LONG_MAX -int atoi(const char *nptr) +int attribute_hidden __atoi(const char *nptr) { - return (int) strtol(nptr, (char **) NULL, 10); + return (int) __strtol(nptr, (char **) NULL, 10); } +strong_alias(__atoi,atoi) #endif /* INT_MAX < LONG_MAX */ @@ -264,17 +279,19 @@ int atoi(const char *nptr) /**********************************************************************/ #ifdef L_atol -long atol(const char *nptr) +long attribute_hidden __atol(const char *nptr) { - return strtol(nptr, (char **) NULL, 10); + return __strtol(nptr, (char **) NULL, 10); } +strong_alias(__atol,atol) #if UINT_MAX == ULONG_MAX -strong_alias(atol,atoi) +hidden_strong_alias(__atol,__atoi) +strong_alias(__atol,atoi) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(atol,atoll) +strong_alias(__atol,atoll) #endif #endif @@ -285,7 +302,7 @@ strong_alias(atol,atoll) long long atoll(const char *nptr) { - return strtoll(nptr, (char **) NULL, 10); + return __strtoll(nptr, (char **) NULL, 10); } #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ @@ -294,12 +311,14 @@ long long atoll(const char *nptr) /**********************************************************************/ #if defined(L_strtol) || defined(L_strtol_l) -long __XL(strtol)(const char * __restrict str, char ** __restrict endptr, +long attribute_hidden __UCXL(strtol)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 1 __LOCALE_ARG ); } +__UCXL_ALIAS(strtol) + #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtol_l) strong_alias(strtol,strtoimax) #endif @@ -308,15 +327,13 @@ strong_alias(strtol,strtoimax) strong_alias(__XL(strtol),__XL(strtoll)) #endif -__XL_ALIAS(strtol) - #endif /**********************************************************************/ #if defined(L_strtoll) || defined(L_strtoll_l) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -long long __XL(strtoll)(const char * __restrict str, +long long attribute_hidden __UCXL(strtoll)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM ) { @@ -324,6 +341,8 @@ long long __XL(strtoll)(const char * __restrict str, __LOCALE_ARG ); } +__UCXL_ALIAS(strtoll) + #if !defined(L_strtoll_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(strtoll,strtoimax) @@ -331,21 +350,21 @@ strong_alias(strtoll,strtoimax) strong_alias(strtoll,strtoq) #endif -__XL_ALIAS(strtoll) - #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif /**********************************************************************/ #if defined(L_strtoul) || defined(L_strtoul_l) -unsigned long __XL(strtoul)(const char * __restrict str, +unsigned long attribute_hidden __UCXL(strtoul)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_strto_l)(str, endptr, base, 0 __LOCALE_ARG ); } +__UCXL_ALIAS(strtoul) + #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtoul_l) strong_alias(strtoul,strtoumax) #endif @@ -354,7 +373,6 @@ strong_alias(strtoul,strtoumax) strong_alias(__XL(strtoul),__XL(strtoull)) #endif -__XL_ALIAS(strtoul) #endif /**********************************************************************/ @@ -362,13 +380,15 @@ __XL_ALIAS(strtoul) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -unsigned long long __XL(strtoull)(const char * __restrict str, +unsigned long long attribute_hidden __UCXL(strtoull)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG ); } +__UCXL_ALIAS(strtoull) + #if !defined(L_strtoull_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(strtoull,strtoumax) @@ -376,8 +396,6 @@ strong_alias(strtoull,strtoumax) strong_alias(strtoull,strtouq) #endif -__XL_ALIAS(strtoull) - #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif @@ -435,7 +453,7 @@ __XL_ALIAS(strtoull) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -unsigned long _stdlib_strto_l(register const Wchar * __restrict str, +unsigned long attribute_hidden _stdlib_strto_l(register const Wchar * __restrict str, Wchar ** __restrict endptr, int base, int sflag) { @@ -448,7 +466,7 @@ unsigned long _stdlib_strto_l(register const Wchar * __restrict str, /* This is the main work fuction which handles both strtol (sflag = 1) and * strtoul (sflag = 0). */ -unsigned long __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str, +unsigned long attribute_hidden __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str, Wchar ** __restrict endptr, int base, int sflag __LOCALE_PARAM ) { @@ -580,7 +598,7 @@ unsigned long __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str, #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -unsigned long long _stdlib_strto_ll(register const Wchar * __restrict str, +unsigned long long attribute_hidden _stdlib_strto_ll(register const Wchar * __restrict str, Wchar ** __restrict endptr, int base, int sflag) { @@ -593,7 +611,7 @@ unsigned long long _stdlib_strto_ll(register const Wchar * __restrict str, /* This is the main work fuction which handles both strtoll (sflag = 1) and * strtoull (sflag = 0). */ -unsigned long long __XL_NPP(_stdlib_strto_ll)(register const Wchar * __restrict str, +unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wchar * __restrict str, Wchar ** __restrict endptr, int base, int sflag __LOCALE_PARAM ) { @@ -964,12 +982,14 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) /**********************************************************************/ #if defined(L_wcstol) || defined(L_wcstol_l) -long __XL(wcstol)(const wchar_t * __restrict str, +long __UCXL(wcstol)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG ); } +__UCXL_ALIAS(wcstol) + #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l) strong_alias(wcstol,wcstoimax) #endif @@ -978,15 +998,13 @@ strong_alias(wcstol,wcstoimax) strong_alias(__XL(wcstol),__XL(wcstoll)) #endif -__XL_ALIAS(wcstol) - #endif /**********************************************************************/ #if defined(L_wcstoll) || defined(L_wcstoll_l) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -long long __XL(wcstoll)(const wchar_t * __restrict str, +long long attribute_hidden __UCXL(wcstoll)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM ) { @@ -994,6 +1012,8 @@ long long __XL(wcstoll)(const wchar_t * __restrict str, __LOCALE_ARG ); } +__UCXL_ALIAS(wcstoll) + #if !defined(L_wcstoll_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(wcstoll,wcstoimax) @@ -1001,21 +1021,21 @@ strong_alias(wcstoll,wcstoimax) strong_alias(wcstoll,wcstoq) #endif -__XL_ALIAS(wcstoll) - #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif /**********************************************************************/ #if defined(L_wcstoul) || defined(L_wcstoul_l) -unsigned long __XL(wcstoul)(const wchar_t * __restrict str, +unsigned long attribute_hidden __UCXL(wcstoul)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG ); } +__UCXL_ALIAS(wcstoul) + #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l) strong_alias(wcstoul,wcstoumax) #endif @@ -1024,21 +1044,21 @@ strong_alias(wcstoul,wcstoumax) strong_alias(__XL(wcstoul),__XL(wcstoull)) #endif -__XL_ALIAS(wcstoul) - #endif /**********************************************************************/ #if defined(L_wcstoull) || defined(L_wcstoull_l) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -unsigned long long __XL(wcstoull)(const wchar_t * __restrict str, +unsigned long long attribute_hidden __UCXL(wcstoull)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM ) { return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG ); } +__UCXL_ALIAS(wcstoull) + #if !defined(L_wcstoull_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(wcstoull,wcstoumax) @@ -1046,10 +1066,7 @@ strong_alias(wcstoull,wcstoumax) strong_alias(wcstoull,wcstouq) #endif -__XL_ALIAS(wcstoull) - #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */ #endif /**********************************************************************/ - diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c index 47f809f3e..3a5adcd4e 100644 --- a/libc/stdlib/strtod.c +++ b/libc/stdlib/strtod.c @@ -95,6 +95,9 @@ /**********************************************************************/ +#define iswspace __iswspace +#define iswspace_l __iswspace_l + #define _ISOC99_SOURCE 1 #define _GNU_SOURCE #include <stdlib.h> @@ -203,14 +206,14 @@ extern void __fp_range_check(__fpmax_t y, __fpmax_t x) attribute_hidden; #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -__fpmax_t __strtofpmax(const Wchar *str, Wchar **endptr, int exponent_power) +__fpmax_t attribute_hidden __strtofpmax(const Wchar *str, Wchar **endptr, int exponent_power) { return __strtofpmax_l(str, endptr, exponent_power, __UCLIBC_CURLOCALE); } #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -__fpmax_t __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_power +__fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_power __LOCALE_PARAM ) { __fpmax_t number; @@ -520,7 +523,7 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x) #endif -float __XL(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) +float attribute_hidden __UCXL(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 1 return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); @@ -537,7 +540,7 @@ float __XL(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) #endif } -__XL_ALIAS(strtof) +__UCXL_ALIAS(strtof) #endif #endif @@ -557,7 +560,7 @@ __XL_ALIAS(strtof) #define Wchar char #endif -double __XL(strtod)(const Wchar *__restrict str, +double attribute_hidden __UCXL(strtod)(const Wchar *__restrict str, Wchar **__restrict endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 2 @@ -575,7 +578,7 @@ double __XL(strtod)(const Wchar *__restrict str, #endif } -__XL_ALIAS(strtod) +__UCXL_ALIAS(strtod) #endif #endif @@ -595,7 +598,7 @@ __XL_ALIAS(strtod) #define Wchar char #endif -long double __XL(strtold)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) +long double attribute_hidden __UCXL(strtold)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 3 return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); @@ -612,7 +615,7 @@ long double __XL(strtold)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) #endif } -__XL_ALIAS(strtold) +__UCXL_ALIAS(strtold) #endif #endif diff --git a/libc/stdlib/strtof.c b/libc/stdlib/strtof.c index a5180677c..d25a67d05 100644 --- a/libc/stdlib/strtof.c +++ b/libc/stdlib/strtof.c @@ -23,6 +23,8 @@ * to an internal conversion from a double to a float, thereby wasting a bunch * of precision. But this is small, and works for now... */ +#define strtod __strtod + #include <stdlib.h> float strtof (const char *str, char **endptr) diff --git a/libc/stdlib/strtold.c b/libc/stdlib/strtold.c index 3848b782a..3ef1fc491 100644 --- a/libc/stdlib/strtold.c +++ b/libc/stdlib/strtold.c @@ -23,6 +23,8 @@ * to an internal conversion from a double to a long double, thereby losing * tons of precision. But this is small, and works for now... */ +#define strtod __strtod + #include <stdlib.h> long double strtold (const char *str, char **endptr) diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index e268bf5ef..616d2dda6 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -1,5 +1,6 @@ #define wait4 __wait4 #define execl __execl +#define signal __signal #include <stdio.h> #include <stddef.h> @@ -44,7 +45,7 @@ int __libc_system(char *command) signal(SIGINT, SIG_IGN); #if 0 - printf("Waiting for child %d\n", pid); + __printf("Waiting for child %d\n", pid); #endif if (wait4(pid, &wait_val, 0, 0) == -1) diff --git a/libc/stdlib/unlockpt.c b/libc/stdlib/unlockpt.c index 5dfea15d7..3f99c1c0b 100644 --- a/libc/stdlib/unlockpt.c +++ b/libc/stdlib/unlockpt.c @@ -32,7 +32,7 @@ unlockpt (int fd) int save_errno = errno; int unlock = 0; - if (ioctl (fd, TIOCSPTLCK, &unlock)) + if (__ioctl (fd, TIOCSPTLCK, &unlock)) { if (errno == EINVAL) { diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c index e42ba9763..f12424243 100644 --- a/libc/string/generic/strcmp.c +++ b/libc/string/generic/strcmp.c @@ -47,6 +47,6 @@ int attribute_hidden __strcmp (const char *p1, const char *p2) strong_alias(__strcmp, strcmp) #ifdef __LOCALE_C_ONLY -weak_alias(__strcmp, __strcoll) -strong_alias(__strcoll, strcoll) +hidden_strong_alias(__strcmp, __strcoll) +strong_alias(__strcmp, strcoll) #endif /* __LOCALE_C_ONLY */ diff --git a/libc/string/strcmp.c b/libc/string/strcmp.c index 5cdbe6f73..fbcd6380c 100644 --- a/libc/string/strcmp.c +++ b/libc/string/strcmp.c @@ -12,8 +12,8 @@ strong_alias(__strcmp, strcmp) #ifdef __LOCALE_C_ONLY -weak_alias(__strcmp, __strcoll) -weak_alias(__strcmp, strcoll) +hidden_strong_alias(__strcmp, __strcoll) +strong_alias(__strcmp, strcoll) #endif #undef L_strcmp diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 24786c31a..e8a435bce 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -12,8 +12,8 @@ strong_alias(__strlcpy, strlcpy) #ifdef __LOCALE_C_ONLY -weak_alias(__strlcpy, __strxfrm) -strong_alias(__strxfrm, strxfrm) +hidden_strong_alias(__strlcpy, __strxfrm) +strong_alias(__strlcpy, strxfrm) #endif #undef L_strlcpy diff --git a/libc/string/wcscmp.c b/libc/string/wcscmp.c index 505148140..b2f2916bc 100644 --- a/libc/string/wcscmp.c +++ b/libc/string/wcscmp.c @@ -13,8 +13,8 @@ strong_alias(__wcscmp, wcscmp) #ifdef __LOCALE_C_ONLY -weak_alias(__wcscmp, __wcscoll) -weak_alias(__wcscmp, wcscoll) +hidden_strong_alias(__wcscmp, __wcscoll) +strong_alias(__wcscmp, wcscoll) #endif #undef L_strcmp diff --git a/libc/string/wstring.c b/libc/string/wstring.c index b7c0d0124..c3ac10667 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -1483,7 +1483,7 @@ char attribute_hidden *__strerror(int errnum) { static char buf[_STRERROR_BUFSIZE]; - __xpg_strerror_r(errnum, buf, sizeof(buf)); + __xpg_strerror_r_internal(errnum, buf, sizeof(buf)); return buf; } @@ -1636,7 +1636,8 @@ static const unsigned char estridx[] = { #endif -int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) +/* __xpg_strerror_r is used in header */ +int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) { register char *s; int i, retval; @@ -1714,7 +1715,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) #else /* __UCLIBC_HAS_ERRNO_MESSAGES__ */ -int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) +int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) { register char *s; int i, retval; @@ -1750,6 +1751,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) } #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */ +strong_alias(__xpg_strerror_r_internal,__xpg_strerror_r) #endif /**********************************************************************/ @@ -1757,14 +1759,15 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) /**********************************************************************/ #ifdef L___glibc_strerror_r -char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen) +char attribute_hidden *__glibc_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) { - __xpg_strerror_r(errnum, strerrbuf, buflen); + __xpg_strerror_r_internal(errnum, strerrbuf, buflen); return strerrbuf; } -weak_alias(__glibc_strerror_r, __strerror_r) +strong_alias(__glibc_strerror_r_internal,__glibc_strerror_r) +weak_alias(__glibc_strerror_r_internal, __strerror_r) #endif /**********************************************************************/ #ifdef L_memmem diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index d69d475d6..837de8adf 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -34,6 +34,9 @@ enable all the ports all of the time. */ #define readlink __readlink +#define mmap __mmap +#define sscanf __sscanf +#define fscanf __fscanf #include <errno.h> #include <fcntl.h> diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index 63b02f9df..dd6f3c477 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -52,11 +52,7 @@ mmap64: mov r0, ip @ first arg was clobbered teq r5, $0 ldmeqfd sp!, {r4, r5, lr} -#ifdef __PIC__ - beq mmap(PLT) -#else - beq mmap -#endif + beq __mmap .Linval: mov r0, $-EINVAL ldmfd sp!, {r4, r5, lr} diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c index e2da4f87c..a2d27eb5a 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -46,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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; @@ -94,7 +94,7 @@ int attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, /* 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 __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -127,6 +127,6 @@ int __sigaction_internal (int sig, const struct sigaction *act, struct sigaction } #endif -strong_alias(__sigaction_internal,__libc_sigaction) -weak_alias(__sigaction_internal, sigaction) +hidden_weak_alias(__libc_sigaction,__sigaction) +weak_alias(__libc_sigaction,sigaction) diff --git a/libc/sysdeps/linux/frv/mmap.c b/libc/sysdeps/linux/frv/mmap.c index b3fd7c3d8..fa801bb5f 100644 --- a/libc/sysdeps/linux/frv/mmap.c +++ b/libc/sysdeps/linux/frv/mmap.c @@ -38,7 +38,7 @@ static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, # define MMAP2_PAGE_SHIFT 12 # endif -__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) +__ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) { if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { __set_errno (EINVAL); @@ -46,3 +46,4 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offs } return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } +strong_alias(__mmap,mmap) diff --git a/libc/sysdeps/linux/i386/mmap.S b/libc/sysdeps/linux/i386/mmap.S index 5dde939bf..4c4723dff 100644 --- a/libc/sysdeps/linux/i386/mmap.S +++ b/libc/sysdeps/linux/i386/mmap.S @@ -21,10 +21,13 @@ #include <bits/errno.h> #include <sys/syscall.h> -.text .global mmap -.type mmap,%function -mmap: +.set mmap,__mmap +.text +.global __mmap +.hidden __mmap +.type __mmap,%function +__mmap: /* Save registers. */ movl %ebx, %edx @@ -46,4 +49,4 @@ mmap: /* Successful; return the syscall's value. */ ret -.size mmap,.-mmap +.size __mmap,.-__mmap diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index d7898c598..2e50284b2 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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) +int __libc_sigaction (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 attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -119,8 +119,8 @@ int attribute_hidden __sigaction_internal (int sig, const struct sigaction *act, } #endif -strong_alias(__sigaction_internal,__libc_sigaction) -weak_alias(__sigaction_internal, sigaction) +hidden_weak_alias(__libc_sigaction,__sigaction) +weak_alias(__libc_sigaction,sigaction) diff --git a/libc/sysdeps/linux/mips/mmap.c b/libc/sysdeps/linux/mips/mmap.c index c6af2efd2..25a3ef5bd 100644 --- a/libc/sysdeps/linux/mips/mmap.c +++ b/libc/sysdeps/linux/mips/mmap.c @@ -14,5 +14,7 @@ #endif #endif -_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, +#define __NR___mmap __NR_mmap +attribute_hidden _syscall6 (__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +strong_alias(__mmap,mmap) diff --git a/libc/sysdeps/linux/powerpc/ioctl.c b/libc/sysdeps/linux/powerpc/ioctl.c index a522ff6d4..bb8842bb6 100644 --- a/libc/sysdeps/linux/powerpc/ioctl.c +++ b/libc/sysdeps/linux/powerpc/ioctl.c @@ -29,10 +29,11 @@ using the new-style struct termios, and translate them to old-style. */ #define __NR___syscall_ioctl __NR_ioctl +static inline _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg); -int ioctl (int fd, unsigned long int request, ...) +int attribute_hidden __ioctl (int fd, unsigned long int request, ...) { void *arg; va_list ap; @@ -68,3 +69,4 @@ int ioctl (int fd, unsigned long int request, ...) return result; } +strong_alias(__ioctl,ioctl) diff --git a/libc/sysdeps/linux/powerpc/mmap.c b/libc/sysdeps/linux/powerpc/mmap.c index ec4bfd1f9..cac08ba65 100644 --- a/libc/sysdeps/linux/powerpc/mmap.c +++ b/libc/sysdeps/linux/powerpc/mmap.c @@ -10,7 +10,7 @@ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret -void * mmap(void *start, size_t length, int prot, int flags, int fd, +void attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { unsigned long __sc_ret, __sc_err; @@ -45,4 +45,4 @@ void * mmap(void *start, size_t length, int prot, int flags, int fd, __syscall_return (void *); } - +strong_alias(__mmap,mmap) diff --git a/libc/sysdeps/linux/sh/mmap.c b/libc/sysdeps/linux/sh/mmap.c index 622857764..5424942b6 100644 --- a/libc/sysdeps/linux/sh/mmap.c +++ b/libc/sysdeps/linux/sh/mmap.c @@ -31,4 +31,6 @@ #include <sys/syscall.h> -_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +#define __NR___mmap __NR_mmap +attribute_hidden _syscall6(__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +strong_alias(__mmap,mmap) diff --git a/libc/sysdeps/linux/sh/pipe.c b/libc/sysdeps/linux/sh/pipe.c index b07f42d31..a15034599 100644 --- a/libc/sysdeps/linux/sh/pipe.c +++ b/libc/sysdeps/linux/sh/pipe.c @@ -5,7 +5,7 @@ #include <unistd.h> #include <syscall.h> -int pipe(int *fd) +int attribute_hidden __pipe(int *fd) { long __res, __res2; __asm__ __volatile__ ( @@ -27,5 +27,4 @@ int pipe(int *fd) fd[1] = __res2; return(0); } - - +strong_alias(__pipe,pipe) diff --git a/libc/sysdeps/linux/x86_64/mmap.c b/libc/sysdeps/linux/x86_64/mmap.c index 117d93ddc..f14f1b6f9 100644 --- a/libc/sysdeps/linux/x86_64/mmap.c +++ b/libc/sysdeps/linux/x86_64/mmap.c @@ -13,5 +13,7 @@ #include <sys/mman.h> #include <sys/syscall.h> -_syscall6(void *, mmap, void *, start, size_t, length, int, prot, +#define __NR___mmap __NR_mmap +attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); +strong_alias(__mmap,mmap) diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index 32b13c064..41f9a8c8e 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -46,8 +46,8 @@ extern void restore (void) asm ("__restore") attribute_hidden; If OACT is not NULL, put the old action for SIG in *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 +__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct kernel_sigaction kact, koact; @@ -79,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 attribute_hidden -__sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oact) +int +__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; struct old_kernel_sigaction kact, koact; @@ -119,8 +119,8 @@ __sigaction_internal (int sig, const struct sigaction *act, struct sigaction *oa return result; } #endif -strong_alias(__sigaction_internal,__libc_sigaction) -weak_alias(__sigaction_internal,sigaction) +hidden_weak_alias(__libc_sigaction,__sigaction) +weak_alias(__libc_sigaction,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/termios/tcgetattr.c b/libc/termios/tcgetattr.c index 8a9448bd7..3fd6d29d6 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -37,7 +37,7 @@ int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) struct __kernel_termios k_termios; int retval; - retval = ioctl (fd, TCGETS, &k_termios); + retval = __ioctl (fd, TCGETS, &k_termios); termios_p->c_iflag = k_termios.c_iflag; termios_p->c_oflag = k_termios.c_oflag; diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c index 54d317724..e4ba87ac5 100644 --- a/libc/termios/tcgetsid.c +++ b/libc/termios/tcgetsid.c @@ -40,7 +40,7 @@ pid_t tcgetsid (int fd) int serrno = errno; int sid; - if (ioctl (fd, TIOCGSID, &sid) < 0) + if (__ioctl (fd, TIOCGSID, &sid) < 0) { if (errno == EINVAL) { diff --git a/libc/termios/tcsetattr.c b/libc/termios/tcsetattr.c index 2bf2d2a29..3afa1012c 100644 --- a/libc/termios/tcsetattr.c +++ b/libc/termios/tcsetattr.c @@ -83,14 +83,14 @@ int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct ter __memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); - retval = ioctl (fd, cmd, &k_termios); + retval = __ioctl (fd, cmd, &k_termios); if (retval == 0 && cmd == TCSETS) { /* The Linux kernel has a bug which silently ignore the invalid c_cflag on pty. We have to check it here. */ int save = errno; - retval = ioctl (fd, TCGETS, &k_termios); + retval = __ioctl (fd, TCGETS, &k_termios); if (retval) { /* We cannot verify if the setting is ok. We don't return diff --git a/libc/termios/termios.c b/libc/termios/termios.c index dc0372fa3..680796e16 100644 --- a/libc/termios/termios.c +++ b/libc/termios/termios.c @@ -35,11 +35,12 @@ #ifdef L_isatty /* Return 1 if FD is a terminal, 0 if not. */ -int isatty(int fd) +int attribute_hidden __isatty(int fd) { struct termios term; return (tcgetattr (fd, &term) == 0); } +strong_alias(__isatty,isatty) #endif #ifdef L_tcdrain @@ -47,7 +48,7 @@ int isatty(int fd) int __libc_tcdrain (int fd) { /* With an argument of 1, TCSBRK waits for the output to drain. */ - return ioctl(fd, TCSBRK, 1); + return __ioctl(fd, TCSBRK, 1); } weak_alias(__libc_tcdrain, tcdrain) #endif @@ -56,7 +57,7 @@ weak_alias(__libc_tcdrain, tcdrain) /* Suspend or restart transmission on FD. */ int tcflow ( int fd, int action) { - return ioctl(fd, TCXONC, action); + return __ioctl(fd, TCXONC, action); } #endif @@ -64,7 +65,7 @@ int tcflow ( int fd, int action) /* Flush pending data on FD. */ int tcflush ( int fd, int queue_selector) { - return ioctl(fd, TCFLSH, queue_selector); + return __ioctl(fd, TCFLSH, queue_selector); } #endif @@ -76,12 +77,12 @@ int tcsendbreak( int fd, int duration) and an implementation-defined period if DURATION is nonzero. We define a positive DURATION to be number of milliseconds to break. */ if (duration <= 0) - return ioctl(fd, TCSBRK, 0); + return __ioctl(fd, TCSBRK, 0); #ifdef TCSBRKP /* Probably Linux-specific: a positive third TCSBRKP ioctl argument is defined to be the number of 100ms units to break. */ - return ioctl(fd, TCSBRKP, (duration + 99) / 100); + return __ioctl(fd, TCSBRKP, (duration + 99) / 100); #else /* ioctl can't send a break of any other duration for us. This could be changed to use trickery (e.g. lower speed and @@ -96,7 +97,7 @@ int tcsendbreak( int fd, int duration) /* Set the foreground process group ID of FD set PGRP_ID. */ int tcsetpgrp ( int fd, pid_t pgrp_id) { - return ioctl (fd, TIOCSPGRP, &pgrp_id); + return __ioctl (fd, TIOCSPGRP, &pgrp_id); } #endif @@ -106,7 +107,7 @@ pid_t attribute_hidden __tcgetpgrp ( int fd) { int pgrp; - if (ioctl (fd, TIOCGPGRP, &pgrp) < 0) + if (__ioctl (fd, TIOCGPGRP, &pgrp) < 0) return (pid_t) -1; return (pid_t) pgrp; } diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index 43005a63a..aa796c892 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -1,3 +1,7 @@ +#define opendir __opendir +#define closedir __closedir +#define isatty __isatty + #include <string.h> #include <errno.h> #include <assert.h> @@ -43,7 +47,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) char *s; DIR *fp; int rv; - int len; + size_t len; char buf[TTYNAME_BUFLEN]; if (fstat(fd, &st) < 0) { diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index cd8a9de9c..233dbbac4 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -25,6 +25,7 @@ #define dup2 __dup2 #define setsid __setsid +#define chdir __chdir #include <stdio.h> #include <features.h> diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 9793d9ad4..e61ff1988 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -30,6 +30,7 @@ * to free the storage allocated for the copy. Better ideas anyone? */ +#define mmap __mmap #define munmap __munmap #define execve __execve @@ -205,7 +206,7 @@ int execlp(const char *file, const char *arg, ...) } while (--n); va_end(args); - n = execvp(file, (char *const *) argv); + n = __execvp(file, (char *const *) argv); EXEC_FREE(argv, size); diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index fc3a013c2..2cf5dbb73 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -225,7 +225,7 @@ static void exchange (char **argv) /* Initialize the internal data when the first call is made. */ -static const char *_getopt_initialize (int argc, char *const * argv, const char *optstring) +static const char *_getopt_initialize (attribute_unused int argc, attribute_unused char *const * argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 2b2d252c2..8a23c99bf 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -19,6 +19,7 @@ #define setvbuf __setvbuf #define tcsetattr __tcsetattr #define tcgetattr __tcgetattr +#define fileno __fileno #include <stdio.h> #include <string.h> diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index 40c8b9e24..2e1f75d38 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -31,6 +31,7 @@ */ #define __fsetlocking __fsetlocking_internal +#define fileno __fileno #define _GNU_SOURCE #include <sys/param.h> diff --git a/libc/unistd/usleep.c b/libc/unistd/usleep.c index 55e8f3fb7..db8b8710c 100644 --- a/libc/unistd/usleep.c +++ b/libc/unistd/usleep.c @@ -1,3 +1,5 @@ +#define nanosleep __nanosleep + #include <time.h> #include <sys/time.h> #include <sys/types.h> |