diff options
Diffstat (limited to 'libc')
666 files changed, 6433 insertions, 5295 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 6be41f81d..7c73e2a88 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -42,7 +42,7 @@ * leading 0 -> octal * all else -> decimal */ -int attribute_hidden __inet_aton(const char *cp, struct in_addr *addrptr) +int inet_aton(const char *cp, struct in_addr *addrptr) { in_addr_t addr; int value; @@ -88,29 +88,32 @@ int attribute_hidden __inet_aton(const char *cp, struct in_addr *addrptr) return 1; } -strong_alias(__inet_aton,inet_aton) +libc_hidden_proto(inet_aton) +libc_hidden_def(inet_aton) #endif #ifdef L_inet_addr -extern int __inet_aton (__const char *__cp, struct in_addr *__inp) __THROW attribute_hidden; +#include <arpa/inet.h> +libc_hidden_proto(inet_aton) -in_addr_t attribute_hidden __inet_addr(const char *cp) +in_addr_t 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) +libc_hidden_proto(inet_addr) +libc_hidden_def(inet_addr) #endif #ifdef L_inet_ntoa #define INET_NTOA_MAX_LEN 16 /* max 12 digits + 3 '.'s + 1 nul */ -char attribute_hidden *__inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN]) +char *inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_LEN]) { in_addr_t addr = ntohl(in.s_addr); int i; @@ -129,22 +132,28 @@ char attribute_hidden *__inet_ntoa_r(struct in_addr in, char buf[INET_NTOA_MAX_L return p+1; } -strong_alias(__inet_ntoa_r,inet_ntoa_r) +libc_hidden_proto(inet_ntoa_r) +libc_hidden_def(inet_ntoa_r) -char attribute_hidden *__inet_ntoa(struct in_addr in) +char *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) +libc_hidden_proto(inet_ntoa) +libc_hidden_def(inet_ntoa) #endif #ifdef L_inet_makeaddr + +/* for some reason it does not remove the jump relocation */ +libc_hidden_proto(memmove) + /* * Formulate an Internet address from network + host. Used in * building addresses stored in the ifnet structure. */ -struct in_addr attribute_hidden __inet_makeaddr(in_addr_t net, in_addr_t host) +struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host) { in_addr_t addr; @@ -159,8 +168,8 @@ struct in_addr attribute_hidden __inet_makeaddr(in_addr_t net, in_addr_t host) addr = htonl(addr); return (*(struct in_addr *)&addr); } -strong_alias(__inet_makeaddr,inet_makeaddr) - +libc_hidden_proto(inet_makeaddr) +libc_hidden_def(inet_makeaddr) #endif #ifdef L_inet_lnaof @@ -188,8 +197,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 attribute_hidden -__inet_netof(struct in_addr in) +in_addr_t +inet_netof(struct in_addr in) { in_addr_t i = ntohl(in.s_addr); @@ -200,6 +209,6 @@ __inet_netof(struct in_addr in) else return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); } -strong_alias(__inet_netof,inet_netof) - +libc_hidden_proto(inet_netof) +libc_hidden_def(inet_netof) #endif diff --git a/libc/inet/ether_addr.c b/libc/inet/ether_addr.c index 0a1e2aede..8be160a0d 100644 --- a/libc/inet/ether_addr.c +++ b/libc/inet/ether_addr.c @@ -23,7 +23,6 @@ * - initial uClibc port */ - #define __FORCE_GLIBC #include <features.h> #include <ctype.h> @@ -32,7 +31,11 @@ #include <netinet/ether.h> #include <netinet/if_ether.h> -struct ether_addr attribute_hidden *__ether_aton_r(const char *asc, struct ether_addr *addr) +libc_hidden_proto(ether_aton_r) +libc_hidden_proto(ether_ntoa_r) +libc_hidden_proto(sprintf) + +struct ether_addr *ether_aton_r(const char *asc, struct ether_addr *addr) { size_t cnt; @@ -68,28 +71,28 @@ struct ether_addr attribute_hidden *__ether_aton_r(const char *asc, struct ether return addr; } -strong_alias(__ether_aton_r,ether_aton_r) +libc_hidden_def(ether_aton_r) struct ether_addr *ether_aton(const char *asc) { static struct ether_addr result; - return __ether_aton_r(asc, &result); + return ether_aton_r(asc, &result); } -char attribute_hidden *__ether_ntoa_r(const struct ether_addr *addr, char *buf) +char *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) +libc_hidden_def(ether_ntoa_r) char *ether_ntoa(const struct ether_addr *addr) { static char asc[18]; - return __ether_ntoa_r(addr, asc); + return ether_ntoa_r(addr, asc); } diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index cc348661a..225bc75c6 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -1,3 +1,10 @@ +/* + * Copyright 1996 by Craig Metz + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + /* $USAGI: getaddrinfo.c,v 1.16 2001/10/04 09:52:03 sekiya Exp $ */ /* The Inner Net License, Version 2.00 @@ -42,24 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If these license terms cause you a real problem, contact the author. */ -/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ - -#define getservbyname_r __getservbyname_r -#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 -#define if_nametoindex __if_nametoindex -#if 0 -#define uname __uname -#define stpcpy __stpcpy -/* strdupa is using these */ -#define memcpy __memcpy -#define strlen __strlen -#endif - #define _GNU_SOURCE #define __FORCE_GLIBC #include <features.h> @@ -79,6 +68,28 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sys/utsname.h> #include <net/if.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +/* libc_hidden_proto(strcmp) */ +/* libc_hidden_proto(stpcpy) */ +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(getservbyname_r) +libc_hidden_proto(gethostbyname_r) +libc_hidden_proto(gethostbyname2_r) +libc_hidden_proto(gethostbyaddr_r) +libc_hidden_proto(inet_pton) +libc_hidden_proto(inet_ntop) +libc_hidden_proto(strtoul) +libc_hidden_proto(if_nametoindex) +/* libc_hidden_proto(uname) */ +#ifdef __UCLIBC_HAS_IPV6__ +libc_hidden_proto(in6addr_loopback) +#endif + /* The following declarations and definitions have been removed from * the public header since we don't want people to use them. */ #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ @@ -160,12 +171,12 @@ 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 { - __close(s); + close(s); ret = 1; } __set_errno (saved_errno); @@ -189,10 +200,10 @@ gaih_local (const char *name, const struct gaih_service *service, if (name != NULL) { - if (__strcmp(name, "localhost") && - __strcmp(name, "local") && - __strcmp(name, "unix") && - __strcmp(name, utsname.nodename)) + if (strcmp(name, "localhost") && + strcmp(name, "local") && + strcmp(name, "unix") && + strcmp(name, utsname.nodename)) return GAIH_OKIFUNSPEC | -EAI_NONAME; } @@ -219,7 +230,7 @@ gaih_local (const char *name, const struct gaih_service *service, *pai = malloc (sizeof (struct addrinfo) + sizeof (struct sockaddr_un) + ((req->ai_flags & AI_CANONNAME) - ? (__strlen(utsname.nodename) + 1): 0)); + ? (strlen(utsname.nodename) + 1): 0)); if (*pai == NULL) return -EAI_MEMORY; @@ -237,22 +248,22 @@ gaih_local (const char *name, const struct gaih_service *service, #endif /* SALEN */ ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL; - __memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); + memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); if (service) { struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; - if (__strchr (service->name, '/') != NULL) + if (strchr (service->name, '/') != NULL) { - if (__strlen (service->name) >= sizeof (sunp->sun_path)) + if (strlen (service->name) >= sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; - __strcpy (sunp->sun_path, service->name); + strcpy (sunp->sun_path, service->name); } else { - if (__strlen (P_tmpdir "/") + 1 + __strlen (service->name) >= + if (strlen (P_tmpdir "/") + 1 + strlen (service->name) >= sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; @@ -274,7 +285,7 @@ gaih_local (const char *name, const struct gaih_service *service, } if (req->ai_flags & AI_CANONNAME) - (*pai)->ai_canonname = __strcpy ((char *) *pai + sizeof (struct addrinfo) + (*pai)->ai_canonname = strcpy ((char *) *pai + sizeof (struct addrinfo) + sizeof (struct sockaddr_un), utsname.nodename); else @@ -354,7 +365,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp, } \ (*pat)->next = NULL; \ (*pat)->family = _family; \ - __memcpy ((*pat)->addr, h->h_addr_list[i], \ + memcpy ((*pat)->addr, h->h_addr_list[i], \ sizeof(_type)); \ pat = &((*pat)->next); \ } \ @@ -505,7 +516,7 @@ gaih_inet (const char *name, const struct gaih_service *service, char *namebuf = strdupa (name); char *scope_delim; - scope_delim = __strchr (namebuf, SCOPE_DELIMITER); + scope_delim = strchr (namebuf, SCOPE_DELIMITER); if (scope_delim != NULL) *scope_delim = '\0'; @@ -588,21 +599,20 @@ gaih_inet (const char *name, const struct gaih_service *service, { struct gaih_addrtuple *atr; atr = at = alloca (sizeof (struct gaih_addrtuple)); - __memset (at, '\0', sizeof (struct gaih_addrtuple)); + memset (at, '\0', sizeof (struct gaih_addrtuple)); if (req->ai_family == 0) { at->next = alloca (sizeof (struct gaih_addrtuple)); - __memset (at->next, '\0', sizeof (struct gaih_addrtuple)); + memset (at->next, '\0', sizeof (struct gaih_addrtuple)); } #if __UCLIBC_HAS_IPV6__ if (req->ai_family == 0 || req->ai_family == AF_INET6) { - extern const struct in6_addr __in6addr_loopback attribute_hidden; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) - __memcpy (at->addr, &__in6addr_loopback, sizeof (struct in6_addr)); + memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr)); atr = at->next; } #endif @@ -674,7 +684,7 @@ gaih_inet (const char *name, const struct gaih_service *service, if (c == NULL) return GAIH_OKIFUNSPEC | -EAI_NONAME; - namelen = __strlen (c) + 1; + namelen = strlen (c) + 1; } else namelen = 0; @@ -718,7 +728,7 @@ gaih_inet (const char *name, const struct gaih_service *service, sin6p->sin6_flowinfo = 0; if (at2->family == AF_INET6) { - __memcpy (&sin6p->sin6_addr, + memcpy (&sin6p->sin6_addr, at2->addr, sizeof (struct in6_addr)); } else @@ -726,7 +736,7 @@ gaih_inet (const char *name, const struct gaih_service *service, sin6p->sin6_addr.s6_addr32[0] = 0; sin6p->sin6_addr.s6_addr32[1] = 0; sin6p->sin6_addr.s6_addr32[2] = htonl(0x0000ffff); - __memcpy(&sin6p->sin6_addr.s6_addr32[3], + memcpy(&sin6p->sin6_addr.s6_addr32[3], at2->addr, sizeof (sin6p->sin6_addr.s6_addr32[3])); } sin6p->sin6_port = st2->port; @@ -738,17 +748,17 @@ gaih_inet (const char *name, const struct gaih_service *service, struct sockaddr_in *sinp = (struct sockaddr_in *) (*pai)->ai_addr; - __memcpy (&sinp->sin_addr, + memcpy (&sinp->sin_addr, at2->addr, sizeof (struct in_addr)); sinp->sin_port = st2->port; - __memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero)); + memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero)); } if (c) { (*pai)->ai_canonname = ((void *) (*pai) + sizeof (struct addrinfo) + socklen); - __strcpy ((*pai)->ai_canonname, c); + strcpy ((*pai)->ai_canonname, c); } else (*pai)->ai_canonname = NULL; @@ -775,8 +785,8 @@ static struct gaih gaih[] = { PF_UNSPEC, NULL } }; -void attribute_hidden -__freeaddrinfo (struct addrinfo *ai) +void +freeaddrinfo (struct addrinfo *ai) { struct addrinfo *p; @@ -787,10 +797,11 @@ __freeaddrinfo (struct addrinfo *ai) free (p); } } -strong_alias(__freeaddrinfo,freeaddrinfo) +libc_hidden_proto(freeaddrinfo) +libc_hidden_def(freeaddrinfo) -int attribute_hidden -__getaddrinfo (const char *name, const char *service, +int +getaddrinfo (const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) { int i = 0, j = 0, last_i = 0; @@ -860,7 +871,7 @@ __getaddrinfo (const char *name, const char *service, continue; if (p) - __freeaddrinfo (p); + freeaddrinfo (p); return -(i & GAIH_EAI); } @@ -884,8 +895,9 @@ __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) +libc_hidden_proto(getaddrinfo) +libc_hidden_def(getaddrinfo) diff --git a/libc/inet/getnetbyad.c b/libc/inet/getnetbyad.c index f0c661faa..e353f245b 100644 --- a/libc/inet/getnetbyad.c +++ b/libc/inet/getnetbyad.c @@ -15,14 +15,14 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define setnetent __setnetent -#define getnetent __getnetent -#define endnetent __endnetent - #define __FORCE_GLIBC #include <features.h> #include <netdb.h> +libc_hidden_proto(setnetent) +libc_hidden_proto(getnetent) +libc_hidden_proto(endnetent) + extern int _net_stayopen attribute_hidden; struct netent *getnetbyaddr (uint32_t net, int type) diff --git a/libc/inet/getnetbynm.c b/libc/inet/getnetbynm.c index ef3d06137..97d5cb85f 100644 --- a/libc/inet/getnetbynm.c +++ b/libc/inet/getnetbynm.c @@ -15,15 +15,16 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define setnetent __setnetent -#define getnetent __getnetent -#define endnetent __endnetent - #define __FORCE_GLIBC #include <features.h> #include <netdb.h> #include <string.h> +libc_hidden_proto(strcmp) +libc_hidden_proto(setnetent) +libc_hidden_proto(getnetent) +libc_hidden_proto(endnetent) + extern int _net_stayopen attribute_hidden; struct netent * @@ -34,10 +35,10 @@ getnetbyname(const char *name) setnetent(_net_stayopen); while ((p = getnetent())) { - if (__strcmp(p->n_name, name) == 0) + if (strcmp(p->n_name, name) == 0) break; for (cp = p->n_aliases; *cp != 0; cp++) - if (__strcmp(*cp, name) == 0) + if (strcmp(*cp, name) == 0) goto found; } found: diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c index 77ecc4275..4413811a3 100644 --- a/libc/inet/getnetent.c +++ b/libc/inet/getnetent.c @@ -15,10 +15,6 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define inet_network __inet_network -#define rewind __rewind -#define fgets __fgets - #define __FORCE_GLIBC #include <features.h> #include <stdio.h> @@ -26,6 +22,12 @@ #include <netdb.h> #include <arpa/inet.h> +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(inet_network) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets) +libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -45,7 +47,7 @@ static char *net_aliases[MAXALIASES]; int _net_stayopen attribute_hidden; -void attribute_hidden __setnetent(int f) +void setnetent(int f) { LOCK; if (netf == NULL) @@ -56,9 +58,10 @@ void attribute_hidden __setnetent(int f) UNLOCK; return; } -strong_alias(__setnetent,setnetent) +libc_hidden_proto(setnetent) +libc_hidden_def(setnetent) -void attribute_hidden __endnetent(void) +void endnetent(void) { LOCK; if (netf) { @@ -68,7 +71,8 @@ void attribute_hidden __endnetent(void) _net_stayopen = 0; UNLOCK; } -strong_alias(__endnetent,endnetent) +libc_hidden_proto(endnetent) +libc_hidden_def(endnetent) static char * any(register char *cp, char *match) { @@ -83,7 +87,7 @@ static char * any(register char *cp, char *match) return ((char *)0); } -struct netent attribute_hidden * __getnetent(void) +struct netent *getnetent(void) { char *p; register char *cp, **q; @@ -142,4 +146,5 @@ again: UNLOCK; return (&net); } -strong_alias(__getnetent,getnetent) +libc_hidden_proto(getnetent) +libc_hidden_def(getnetent) diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index 008b0d606..e5a11d2c7 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -51,11 +51,6 @@ ** SUCH DAMAGE. */ -#define strpbrk __strpbrk -#define atoi __atoi -#define rewind __rewind -#define fgets __fgets - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -67,6 +62,14 @@ #include <string.h> #include <errno.h> +libc_hidden_proto(fopen) +libc_hidden_proto(strcmp) +libc_hidden_proto(strpbrk) +libc_hidden_proto(atoi) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets) +libc_hidden_proto(fclose) +libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -94,7 +97,7 @@ static void __initbuf(void) } } -void attribute_hidden __setprotoent(int f) +void setprotoent(int f) { LOCK; if (protof == NULL) @@ -104,9 +107,10 @@ void attribute_hidden __setprotoent(int f) proto_stayopen |= f; UNLOCK; } -strong_alias(__setprotoent,setprotoent) +libc_hidden_proto(setprotoent) +libc_hidden_def(setprotoent) -void attribute_hidden __endprotoent(void) +void endprotoent(void) { LOCK; if (protof) { @@ -116,9 +120,10 @@ void attribute_hidden __endprotoent(void) proto_stayopen = 0; UNLOCK; } -strong_alias(__endprotoent,endprotoent) +libc_hidden_proto(endprotoent) +libc_hidden_def(endprotoent) -int attribute_hidden __getprotoent_r(struct protoent *result_buf, +int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) { @@ -194,19 +199,20 @@ again: UNLOCK; return 0; } -strong_alias(__getprotoent_r,getprotoent_r) +libc_hidden_proto(getprotoent_r) +libc_hidden_def(getprotoent_r) struct protoent * getprotoent(void) { struct protoent *result; __initbuf(); - __getprotoent_r(&proto, static_aliases, SBUFSIZE, &result); + getprotoent_r(&proto, static_aliases, SBUFSIZE, &result); return result; } -int attribute_hidden __getprotobyname_r(const char *name, +int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) @@ -215,21 +221,22 @@ int attribute_hidden __getprotobyname_r(const char *name, int ret; LOCK; - __setprotoent(proto_stayopen); - while (!(ret=__getprotoent_r(result_buf, buf, buflen, result))) { - if (__strcmp(result_buf->p_name, name) == 0) + setprotoent(proto_stayopen); + while (!(ret=getprotoent_r(result_buf, buf, buflen, result))) { + if (strcmp(result_buf->p_name, name) == 0) break; for (cp = result_buf->p_aliases; *cp != 0; cp++) - if (__strcmp(*cp, name) == 0) + if (strcmp(*cp, name) == 0) goto found; } found: if (!proto_stayopen) - __endprotoent(); + endprotoent(); UNLOCK; return *result?0:ret; } -strong_alias(__getprotobyname_r,getprotobyname_r) +libc_hidden_proto(getprotobyname_r) +libc_hidden_def(getprotobyname_r) struct protoent * getprotobyname(const char *name) @@ -237,12 +244,12 @@ struct protoent * getprotobyname(const char *name) struct protoent *result; __initbuf(); - __getprotobyname_r(name, &proto, static_aliases, SBUFSIZE, &result); + getprotobyname_r(name, &proto, static_aliases, SBUFSIZE, &result); return result; } -int attribute_hidden __getprotobynumber_r (int proto_num, +int getprotobynumber_r (int proto_num, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) @@ -250,23 +257,24 @@ int attribute_hidden __getprotobynumber_r (int proto_num, int ret; LOCK; - __setprotoent(proto_stayopen); - while (!(ret=__getprotoent_r(result_buf, buf, buflen, result))) + setprotoent(proto_stayopen); + while (!(ret=getprotoent_r(result_buf, buf, buflen, result))) if (result_buf->p_proto == proto_num) break; if (!proto_stayopen) - __endprotoent(); + endprotoent(); UNLOCK; return *result?0:ret; } -strong_alias(__getprotobynumber_r,getprotobynumber_r) +libc_hidden_proto(getprotobynumber_r) +libc_hidden_def(getprotobynumber_r) struct protoent * getprotobynumber(int proto_num) { struct protoent *result; __initbuf(); - __getprotobynumber_r(proto_num, &proto, static_aliases, + getprotobynumber_r(proto_num, &proto, static_aliases, SBUFSIZE, &result); return result; } diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index f3916de86..254f638f2 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -51,11 +51,6 @@ ** SUCH DAMAGE. */ -#define strpbrk __strpbrk -#define atoi __atoi -#define rewind __rewind -#define fgets __fgets - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -69,6 +64,14 @@ #include <arpa/inet.h> #include <errno.h> +libc_hidden_proto(strcmp) +libc_hidden_proto(strpbrk) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(atoi) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets) +libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -97,7 +100,7 @@ static void __initbuf(void) } } -extern void attribute_hidden __setservent(int f) +void setservent(int f) { LOCK; if (servf == NULL) @@ -107,9 +110,10 @@ extern void attribute_hidden __setservent(int f) serv_stayopen |= f; UNLOCK; } -strong_alias(__setservent,setservent) +libc_hidden_proto(setservent) +libc_hidden_def(setservent) -extern void attribute_hidden __endservent(void) +void endservent(void) { LOCK; if (servf) { @@ -119,9 +123,10 @@ extern void attribute_hidden __endservent(void) serv_stayopen = 0; UNLOCK; } -strong_alias(__endservent,endservent) +libc_hidden_proto(endservent) +libc_hidden_def(endservent) -extern int attribute_hidden __getservent_r(struct servent * result_buf, +int getservent_r(struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -200,18 +205,19 @@ again: UNLOCK; return 0; } -strong_alias(__getservent_r,getservent_r) +libc_hidden_proto(getservent_r) +libc_hidden_def(getservent_r) struct servent * getservent(void) { struct servent *result; __initbuf(); - __getservent_r(&serv, servbuf, SBUFSIZE, &result); + getservent_r(&serv, servbuf, SBUFSIZE, &result); return result; } -extern int attribute_hidden __getservbyname_r(const char *name, const char *proto, +int getservbyname_r(const char *name, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { @@ -219,62 +225,65 @@ extern int attribute_hidden __getservbyname_r(const char *name, const char *prot int ret; LOCK; - __setservent(serv_stayopen); - while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { - if (__strcmp(name, result_buf->s_name) == 0) + setservent(serv_stayopen); + while (!(ret=getservent_r(result_buf, buf, buflen, result))) { + if (strcmp(name, result_buf->s_name) == 0) goto gotname; for (cp = result_buf->s_aliases; *cp; cp++) - if (__strcmp(name, *cp) == 0) + if (strcmp(name, *cp) == 0) goto gotname; continue; gotname: - if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) + if (proto == 0 || strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) - __endservent(); + endservent(); UNLOCK; return *result?0:ret; } -strong_alias(__getservbyname_r,getservbyname_r) +libc_hidden_proto(getservbyname_r) +libc_hidden_def(getservbyname_r) struct servent *getservbyname(const char *name, const char *proto) { struct servent *result; __initbuf(); - __getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); + getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result); return result; } -extern int attribute_hidden __getservbyport_r(int port, const char *proto, +int getservbyport_r(int port, const char *proto, struct servent * result_buf, char * buf, size_t buflen, struct servent ** result) { int ret; LOCK; - __setservent(serv_stayopen); - while (!(ret=__getservent_r(result_buf, buf, buflen, result))) { + setservent(serv_stayopen); + while (!(ret=getservent_r(result_buf, buf, buflen, result))) { if (result_buf->s_port != port) continue; - if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0) + if (proto == 0 || strcmp(result_buf->s_proto, proto) == 0) break; } if (!serv_stayopen) - __endservent(); + endservent(); UNLOCK; return *result?0:ret; } -strong_alias(__getservbyport_r,getservbyport_r) +libc_hidden_proto(getservbyport_r) +libc_hidden_def(getservbyport_r) -struct servent attribute_hidden * __getservbyport(int port, const char *proto) +struct servent * getservbyport(int port, const char *proto) { struct servent *result; __initbuf(); - __getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); + getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result); return result; } -strong_alias(__getservbyport,getservbyport) +libc_hidden_proto(getservbyport) +libc_hidden_def(getservbyport) diff --git a/libc/inet/herror.c b/libc/inet/herror.c index 2f0797b91..6efbc2f93 100644 --- a/libc/inet/herror.c +++ b/libc/inet/herror.c @@ -23,6 +23,8 @@ #include <string.h> #include <netdb.h> +libc_hidden_proto(fprintf) + static const char *error_msg = "Resolver error"; static const char *const h_errlist[] = { "Error 0", @@ -36,7 +38,7 @@ static const int h_nerr = { sizeof(h_errlist)/sizeof(h_errlist[0]) }; /* * herror -- print the error indicated by the h_errno value. */ -void attribute_hidden __herror(const char *s) +void herror(const char *s) { static const char colon_space[] = ": "; const char *p; @@ -52,7 +54,8 @@ void attribute_hidden __herror(const char *s) } fprintf(stderr, "%s%s%s\n", s, c, p); } -strong_alias(__herror,herror) +libc_hidden_proto(herror) +libc_hidden_def(herror) const char *hstrerror(int err) diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c index bc9576e74..4ac4a811f 100644 --- a/libc/inet/hostid.c +++ b/libc/inet/hostid.c @@ -1,7 +1,8 @@ -#define geteuid __geteuid -#define getuid __getuid -#define gethostbyname __gethostbyname -#define gethostname __gethostname +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define __FORCE_GLIBC #include <features.h> @@ -14,6 +15,15 @@ #include <fcntl.h> #include <unistd.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(open) +libc_hidden_proto(close) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(getuid) +libc_hidden_proto(geteuid) +libc_hidden_proto(gethostbyname) +libc_hidden_proto(gethostname) #define HOSTID "/etc/hostid" @@ -23,10 +33,10 @@ int sethostid(long int new_id) int ret; if (geteuid() || getuid()) return __set_errno(EPERM); - if ((fd=__open(HOSTID,O_CREAT|O_WRONLY,0644))<0) return -1; - ret = __write(fd,(void *)&new_id,sizeof(new_id)) == sizeof(new_id) + if ((fd=open(HOSTID,O_CREAT|O_WRONLY,0644))<0) return -1; + ret = write(fd,(void *)&new_id,sizeof(new_id)) == sizeof(new_id) ? 0 : -1; - __close (fd); + close (fd); return ret; } @@ -39,12 +49,12 @@ long int gethostid(void) * It is not an error if we cannot read this file. It is not even an * error if we cannot read all the bytes, we just carry on trying... */ - if ((fd=__open(HOSTID,O_RDONLY))>=0 && __read(fd,(void *)&id,sizeof(id))) + if ((fd=open(HOSTID,O_RDONLY))>=0 && read(fd,(void *)&id,sizeof(id))) { - __close (fd); + close (fd); return id; } - if (fd >= 0) __close (fd); + if (fd >= 0) close (fd); /* Try some methods of returning a unique 32 bit id. Clearly IP * numbers, if on the internet, will have a unique address. If they @@ -70,7 +80,7 @@ long int gethostid(void) */ return 0; else { - __memcpy((char *) &in, (char *) hp->h_addr, hp->h_length); + memcpy((char *) &in, (char *) hp->h_addr, hp->h_length); /* Just so it doesn't look exactly like the IP addr */ return(in.s_addr<<16|in.s_addr>>16); diff --git a/libc/inet/if_index.c b/libc/inet/if_index.c index 40e46d538..fd0b901a1 100644 --- a/libc/inet/if_index.c +++ b/libc/inet/if_index.c @@ -20,8 +20,6 @@ Reworked Dec 2002 by Erik Andersen <andersen@codepoet.org> */ -#define strndup __strndup - #define __FORCE_GLIBC #include <features.h> #define __USE_GNU @@ -38,6 +36,12 @@ #include "netlinkaccess.h" +libc_hidden_proto(strndup) +libc_hidden_proto(strncpy) +libc_hidden_proto(strdup) +libc_hidden_proto(ioctl) +libc_hidden_proto(close) + extern int __opensock(void) attribute_hidden; unsigned int @@ -53,21 +57,22 @@ 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) + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (ioctl (fd, SIOCGIFINDEX, &ifr) < 0) { int saved_errno = errno; - __close(fd); + close(fd); if (saved_errno == EINVAL) __set_errno(ENOSYS); return 0; } - __close(fd); + close(fd); return ifr.ifr_ifindex; #endif } -hidden_strong_alias(if_nametoindex,__if_nametoindex) +libc_hidden_proto(if_nametoindex) +libc_hidden_def(if_nametoindex) void if_freenameindex (struct if_nameindex *ifn) @@ -80,7 +85,8 @@ if_freenameindex (struct if_nameindex *ifn) } free (ifn); } -hidden_strong_alias(if_freenameindex,__if_freenameindex) +libc_hidden_proto(if_freenameindex) +libc_hidden_def(if_freenameindex) #if !__ASSUME_NETLINK_SUPPORT struct if_nameindex * @@ -112,9 +118,9 @@ if_nameindex (void) ifc.ifc_buf = extend_alloca (ifc.ifc_buf, rq_len, 2 * rq_len); ifc.ifc_len = rq_len; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0) + if (ioctl (fd, SIOCGIFCONF, &ifc) < 0) { - __close (fd); + close (fd); return NULL; } } @@ -125,7 +131,7 @@ if_nameindex (void) idx = malloc ((nifs + 1) * sizeof (struct if_nameindex)); if (idx == NULL) { - __close(fd); + close(fd); __set_errno(ENOBUFS); return NULL; } @@ -133,9 +139,9 @@ if_nameindex (void) for (i = 0; i < nifs; ++i) { struct ifreq *ifr = &ifc.ifc_req[i]; - idx[i].if_name = __strdup (ifr->ifr_name); + idx[i].if_name = strdup (ifr->ifr_name); if (idx[i].if_name == NULL - || __ioctl (fd, SIOCGIFINDEX, ifr) < 0) + || ioctl (fd, SIOCGIFINDEX, ifr) < 0) { int saved_errno = errno; unsigned int j; @@ -143,7 +149,7 @@ if_nameindex (void) for (j = 0; j < i; ++j) free (idx[j].if_name); free(idx); - __close(fd); + close(fd); if (saved_errno == EINVAL) saved_errno = ENOSYS; else if (saved_errno == ENOMEM) @@ -157,7 +163,7 @@ if_nameindex (void) idx[i].if_index = 0; idx[i].if_name = NULL; - __close(fd); + close(fd); return idx; #endif } @@ -248,11 +254,11 @@ if_nameindex (void) if (rta->rta_type == IFLA_IFNAME) { - idx[nifs].if_name = __strndup (rta_data, rta_payload); + idx[nifs].if_name = strndup (rta_data, rta_payload); if (idx[nifs].if_name == NULL) { idx[nifs].if_index = 0; - __if_freenameindex (idx); + if_freenameindex (idx); idx = NULL; goto nomem; } @@ -277,7 +283,8 @@ if_nameindex (void) return idx; } #endif -hidden_strong_alias(if_nameindex,__if_nameindex) +libc_hidden_proto(if_nameindex) +libc_hidden_def(if_nameindex) #if 0 struct if_nameindex * @@ -305,36 +312,36 @@ 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) { int serrno = errno; - __close (fd); + close (fd); if (serrno == ENODEV) /* POSIX requires ENXIO. */ serrno = ENXIO; __set_errno (serrno); return NULL; } - __close (fd); + close (fd); - return __strncpy (ifname, ifr.ifr_name, IFNAMSIZ); + return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); # else struct if_nameindex *idx; struct if_nameindex *p; char *result = NULL; - idx = __if_nameindex(); + idx = if_nameindex(); if (idx != NULL) { for (p = idx; p->if_index || p->if_name; ++p) if (p->if_index == ifindex) { - result = __strncpy (ifname, p->if_name, IFNAMSIZ); + result = strncpy (ifname, p->if_name, IFNAMSIZ); break; } - __if_freenameindex (idx); + if_freenameindex (idx); if (result == NULL) __set_errno (ENXIO); diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c index 74f3622f8..d2d0cb8ce 100644 --- a/libc/inet/ifaddrs.c +++ b/libc/inet/ifaddrs.c @@ -17,13 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define time __time -#define sendto __sendto -#define recvmsg __recvmsg -#define bind __bind -#define mempcpy __mempcpy -#define getsockname __getsockname - #define __FORCE_GLIBC #include <features.h> #define __USE_GNU @@ -37,6 +30,7 @@ #include <stdbool.h> #include <stdint.h> #include <stdlib.h> +#include <stdio.h> #include <string.h> #include <sys/ioctl.h> #include <sys/socket.h> @@ -46,6 +40,17 @@ #include "netlinkaccess.h" +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(time) +libc_hidden_proto(sendto) +libc_hidden_proto(recvmsg) +libc_hidden_proto(bind) +libc_hidden_proto(memset) +libc_hidden_proto(mempcpy) +libc_hidden_proto(getsockname) +libc_hidden_proto(fclose) +libc_hidden_proto(abort) #ifndef __libc_use_alloca # define __libc_use_alloca(x) (x < __MAX_ALLOCA_CUTOFF) @@ -116,7 +121,7 @@ __netlink_sendreq (struct netlink_handle *h, int type) memset (&nladdr, '\0', sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; - return TEMP_FAILURE_RETRY (__sendto (h->fd, (void *) &req, sizeof (req), 0, + return TEMP_FAILURE_RETRY (sendto (h->fd, (void *) &req, sizeof (req), 0, (struct sockaddr *) &nladdr, sizeof (nladdr))); } @@ -167,7 +172,7 @@ __netlink_request (struct netlink_handle *h, int type) 0 }; - read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0)); + read_len = TEMP_FAILURE_RETRY (recvmsg (h->fd, &msg, 0)); if (read_len < 0) goto out_fail; @@ -282,7 +287,7 @@ __netlink_close (struct netlink_handle *h) { /* Don't modify errno. */ int serrno = errno; - __close(h->fd); + close(h->fd); __set_errno(serrno); } @@ -293,13 +298,13 @@ __netlink_open (struct netlink_handle *h) { struct sockaddr_nl nladdr; - h->fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + h->fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (h->fd < 0) goto out; memset (&nladdr, '\0', sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; - if (__bind (h->fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0) + if (bind (h->fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) < 0) { close_and_out: __netlink_close (h); @@ -313,7 +318,7 @@ __netlink_open (struct netlink_handle *h) It is not necessarily the PID if there is more than one socket open. */ socklen_t addr_len = sizeof (nladdr); - if (__getsockname (h->fd, (struct sockaddr *) &nladdr, &addr_len) < 0) + if (getsockname (h->fd, (struct sockaddr *) &nladdr, &addr_len) < 0) goto close_and_out; h->pid = nladdr.nl_pid; return 0; diff --git a/libc/inet/in6_addr.c b/libc/inet/in6_addr.c index 006f6a48b..9e9edf41b 100644 --- a/libc/inet/in6_addr.c +++ b/libc/inet/in6_addr.c @@ -24,10 +24,12 @@ #ifdef __UCLIBC_HAS_IPV6__ const struct in6_addr in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; -hidden_weak_alias (in6addr_any, __in6addr_any) +//libc_hidden_proto(in6addr_any) +//libc_hidden_def(in6addr_any) const struct in6_addr in6addr_loopback = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; -hidden_weak_alias(in6addr_loopback, __in6addr_loopback) +libc_hidden_proto(in6addr_loopback) +libc_hidden_def(in6addr_loopback) #endif /* __UCLIBC_HAS_IPV6__ */ diff --git a/libc/inet/inet_net.c b/libc/inet/inet_net.c index a7d1844a7..29226c01a 100644 --- a/libc/inet/inet_net.c +++ b/libc/inet/inet_net.c @@ -42,8 +42,8 @@ * The library routines call this routine to interpret * network numbers. */ -in_addr_t attribute_hidden -__inet_network(const char *cp) +in_addr_t +inet_network(const char *cp) { register in_addr_t val, base, n; register char c; @@ -98,4 +98,5 @@ again: } return (val); } -strong_alias(__inet_network,inet_network) +libc_hidden_proto(inet_network) +libc_hidden_def(inet_network) diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c index 6f3a8ccec..fd5feb10e 100644 --- a/libc/inet/ntop.c +++ b/libc/inet/ntop.c @@ -30,6 +30,11 @@ #include <string.h> #include <ctype.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) /* * WARNING: Don't even consider trying to compile this on a system where @@ -76,12 +81,12 @@ inet_ntop4(const u_char *src, char *dst, size_t size) } tmp[i - 1] = '\0'; - if (__strlen (tmp) > size) { + if (strlen (tmp) > size) { __set_errno (ENOSPC); return (NULL); } - return __strcpy(dst, tmp); + return strcpy(dst, tmp); } @@ -114,7 +119,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) * Copy the input (bytewise) array into a wordwise array. * Find the longest run of 0x00's in src[] for :: shorthanding. */ - __memset(words, '\0', sizeof words); + memset(words, '\0', sizeof words); for (i = 0; i < 16; i += 2) words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; @@ -160,7 +165,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) return (NULL); - tp += __strlen(tp); + tp += strlen(tp); break; } tp += __sprintf(tp, "%x", words[i]); @@ -177,7 +182,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) __set_errno (ENOSPC); return (NULL); } - return __strcpy(dst, tmp); + return strcpy(dst, tmp); } #endif /* __UCLIBC_HAS_IPV6__ */ @@ -224,7 +229,7 @@ inet_pton4(const char *src, u_char *dst) } if (octets < 4) return (0); - __memcpy(dst, tmp, 4); + memcpy(dst, tmp, 4); return (1); } @@ -261,7 +266,7 @@ inet_pton6(const char *src, u_char *dst) u_int val; - tp = __memset(tmp, '\0', 16); + tp = memset(tmp, '\0', 16); endp = tp + 16; colonp = NULL; /* Leading :: requires some special handling. */ @@ -274,7 +279,7 @@ inet_pton6(const char *src, u_char *dst) while ((ch = __tolower (*src++)) != '\0') { const char *pch; - pch = __strchr(xdigits, ch); + pch = strchr(xdigits, ch); if (pch != NULL) { val <<= 4; val |= (pch - xdigits); @@ -333,7 +338,7 @@ inet_pton6(const char *src, u_char *dst) } if (tp != endp) return (0); - __memcpy(dst, tmp, 16); + memcpy(dst, tmp, 16); return (1); } @@ -349,8 +354,8 @@ inet_pton6(const char *src, u_char *dst) * author: * Paul Vixie, 1996. */ -const char attribute_hidden * -__inet_ntop(int af, const void *src, char *dst, socklen_t size) +const char * +inet_ntop(int af, const void *src, char *dst, socklen_t size) { switch (af) { case AF_INET: @@ -365,7 +370,8 @@ __inet_ntop(int af, const void *src, char *dst, socklen_t size) } /* NOTREACHED */ } -strong_alias(__inet_ntop,inet_ntop) +libc_hidden_proto(inet_ntop) +libc_hidden_def(inet_ntop) /* int @@ -379,8 +385,8 @@ strong_alias(__inet_ntop,inet_ntop) * author: * Paul Vixie, 1996. */ -int attribute_hidden -__inet_pton(int af, const char *src, void *dst) +int +inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: @@ -395,4 +401,5 @@ __inet_pton(int af, const char *src, void *dst) } /* NOTREACHED */ } -strong_alias(__inet_pton,inet_pton) +libc_hidden_proto(inet_pton) +libc_hidden_def(inet_pton) diff --git a/libc/inet/opensock.c b/libc/inet/opensock.c index a27141a16..4db86bd7b 100644 --- a/libc/inet/opensock.c +++ b/libc/inet/opensock.c @@ -25,6 +25,8 @@ #include <features.h> #include <libc-internal.h> +libc_hidden_proto(socket) + /* Return a socket of any type. The socket can be used in subsequent ioctl calls to talk to the kernel. */ int attribute_hidden @@ -32,9 +34,9 @@ __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); } diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 6fedcf7e2..1e0392059 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -133,24 +133,6 @@ * */ -#define strnlen __strnlen -#define strncat __strncat -#define strstr __strstr -#define random __random -#define getservbyport __getservbyport -#define getdomainname __getdomainname -#define uname __uname -#define inet_addr __inet_addr -#define inet_aton __inet_aton -#define inet_pton __inet_pton -#define inet_ntop __inet_ntop -#define connect __connect -#define select __select -#define recv __recv -#define send __send -#define snprintf __snprintf -#define fgets __fgets - #define __FORCE_GLIBC #include <features.h> #include <string.h> @@ -171,14 +153,53 @@ #include <sys/utsname.h> #include <sys/un.h> -extern int __gethostbyname_r (__const char *__restrict __name, - struct hostent *__restrict __result_buf, - char *__restrict __buf, size_t __buflen, - struct hostent **__restrict __result, - int *__restrict __h_errnop) attribute_hidden; +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(memmove) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strdup) +libc_hidden_proto(strlen) +libc_hidden_proto(strncat) +libc_hidden_proto(strncpy) +/* libc_hidden_proto(strnlen) */ +libc_hidden_proto(strstr) +libc_hidden_proto(strcasecmp) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(random) +libc_hidden_proto(getservbyport) +libc_hidden_proto(getdomainname) +libc_hidden_proto(uname) +libc_hidden_proto(inet_addr) +libc_hidden_proto(inet_aton) +libc_hidden_proto(inet_pton) +libc_hidden_proto(inet_ntop) +libc_hidden_proto(connect) +libc_hidden_proto(select) +libc_hidden_proto(recv) +libc_hidden_proto(send) +libc_hidden_proto(printf) +libc_hidden_proto(sprintf) +libc_hidden_proto(snprintf) +libc_hidden_proto(fgets) +libc_hidden_proto(gethostbyname) +libc_hidden_proto(gethostbyname_r) +libc_hidden_proto(gethostbyname2_r) +libc_hidden_proto(gethostbyaddr) +libc_hidden_proto(gethostbyaddr_r) +libc_hidden_proto(ns_name_uncompress) +libc_hidden_proto(ns_name_unpack) +libc_hidden_proto(ns_name_ntop) +libc_hidden_proto(res_init) +libc_hidden_proto(res_query) +libc_hidden_proto(res_querydomain) +libc_hidden_proto(gethostent_r) +libc_hidden_proto(fprintf) -extern struct hostent *__gethostbyaddr (__const void *__addr, __socklen_t __len, - int __type) attribute_hidden; #define MAX_RECURSE 5 #define REPLY_TIMEOUT 10 #define MAX_RETRIES 3 @@ -281,7 +302,7 @@ extern int __decode_header(unsigned char * data, struct resolv_header * h) attri extern int __encode_question(struct resolv_question * q, unsigned char * dest, int maxlen) attribute_hidden; extern int __decode_question(unsigned char * message, int offset, - struct resolv_question * q); + struct resolv_question * q) attribute_hidden; extern int __encode_answer(struct resolv_answer * a, unsigned char * dest, int maxlen) attribute_hidden; extern int __decode_answer(unsigned char * message, int offset, @@ -291,17 +312,6 @@ extern int __open_nameservers(void) attribute_hidden; extern void __close_nameservers(void) attribute_hidden; extern int __dn_expand(const u_char *, const u_char *, const u_char *, char *, int); -extern int __ns_name_uncompress_internal(const u_char *, const u_char *, - const u_char *, char *, size_t) attribute_hidden; -extern int __ns_name_ntop_internal(const u_char *, char *, size_t) attribute_hidden; -extern int __ns_name_unpack_internal(const u_char *, const u_char *, const u_char *, - u_char *, size_t) attribute_hidden; - - -extern int __gethostent_r (struct hostent *__restrict __result_buf, - char *__restrict __buf, size_t __buflen, - struct hostent **__restrict __result, - int *__restrict __h_errnop) attribute_hidden; #ifdef L_encodeh int attribute_hidden __encode_header(struct resolv_header *h, unsigned char *dest, int maxlen) @@ -360,14 +370,14 @@ int attribute_hidden __encode_dotted(const char *dotted, unsigned char *dest, in int used = 0; while (dotted && *dotted) { - char *c = __strchr(dotted, '.'); - int l = c ? c - dotted : __strlen(dotted); + char *c = strchr(dotted, '.'); + int l = c ? c - dotted : strlen(dotted); if (l >= (maxlen - used - 1)) return -1; dest[used++] = l; - __memcpy(dest + used, dotted, l); + memcpy(dest + used, dotted, l); used += l; if (c) @@ -415,7 +425,7 @@ int attribute_hidden __decode_dotted(const unsigned char *data, int offset, if ((used + l + 1) >= maxlen) return -1; - __memcpy(dest + used, data + offset, l); + memcpy(dest + used, data + offset, l); offset += l; used += l; if (measure) @@ -439,7 +449,6 @@ int attribute_hidden __decode_dotted(const unsigned char *data, int offset, #endif #ifdef L_lengthd - int attribute_hidden __length_dotted(const unsigned char *data, int offset) { int orig_offset = offset; @@ -488,7 +497,7 @@ int attribute_hidden __encode_question(struct resolv_question *q, #endif #ifdef L_decodeq -int __decode_question(unsigned char *message, int offset, +int attribute_hidden __decode_question(unsigned char *message, int offset, struct resolv_question *q) { char temp[256]; @@ -500,7 +509,7 @@ int __decode_question(unsigned char *message, int offset, offset += i; - q->dotted = __strdup(temp); + q->dotted = strdup(temp); q->qtype = (message[offset + 0] << 8) | message[offset + 1]; q->qclass = (message[offset + 2] << 8) | message[offset + 3]; @@ -546,7 +555,7 @@ int attribute_hidden __encode_answer(struct resolv_answer *a, unsigned char *des *dest++ = (a->ttl & 0x000000ff) >> 0; *dest++ = (a->rdlength & 0xff00) >> 8; *dest++ = (a->rdlength & 0x00ff) >> 0; - __memcpy(dest, a->rdata, a->rdlength); + memcpy(dest, a->rdata, a->rdlength); return i + RRFIXEDSZ + a->rdlength; } @@ -565,7 +574,7 @@ int attribute_hidden __decode_answer(unsigned char *message, int offset, message += offset + i; - a->dotted = __strdup(temp); + a->dotted = strdup(temp); a->atype = (message[0] << 8) | message[1]; message += 2; a->aclass = (message[0] << 8) | message[1]; @@ -585,7 +594,7 @@ int attribute_hidden __decode_answer(unsigned char *message, int offset, #endif #ifdef L_encodep -int __encode_packet(struct resolv_header *h, +int attribute_hidden __encode_packet(struct resolv_header *h, struct resolv_question **q, struct resolv_answer **an, struct resolv_answer **ns, @@ -642,7 +651,7 @@ int __encode_packet(struct resolv_header *h, #endif #ifdef L_decodep -int __decode_packet(unsigned char *data, struct resolv_header *h) +int attribute_hidden __decode_packet(unsigned char *data, struct resolv_header *h) { return __decode_header(data, h); } @@ -656,7 +665,7 @@ int __form_query(int id, const char *name, int type, unsigned char *packet, struct resolv_question q; int i, j; - __memset(&h, 0, sizeof(h)); + memset(&h, 0, sizeof(h)); h.id = id; h.qdcount = 1; @@ -729,11 +738,11 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char while (retries < MAX_RETRIES) { if (fd != -1) - __close(fd); + close(fd); - __memset(packet, 0, PACKETSZ); + memset(packet, 0, PACKETSZ); - __memset(&h, 0, sizeof(h)); + memset(&h, 0, sizeof(h)); ++local_id; local_id &= 0xffff; @@ -749,7 +758,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char if (i < 0) goto fail; - __strncpy(lookup,name,MAXDNAME); + strncpy(lookup,name,MAXDNAME); if (variant >= 0) { BIGLOCK; if (variant < __searchdomains) { @@ -774,9 +783,9 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char #ifdef __UCLIBC_HAS_IPV6__ v6 = inet_pton(AF_INET6, dns, &sa6.sin6_addr) > 0; - fd = __socket(v6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP); + fd = socket(v6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP); #else - fd = __socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); #endif if (fd < 0) { retries++; @@ -880,7 +889,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char ma.buf = a->buf; ma.buflen = a->buflen; ma.add_count = a->add_count; - __memcpy(a, &ma, sizeof(ma)); + memcpy(a, &ma, sizeof(ma)); if (a->atype != T_SIG && (0 == a->buf || (type != T_A && type != T_AAAA))) { break; @@ -912,7 +921,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char ma.rdlength, a->rdlength); goto again; } - __memcpy(a->buf + (a->add_count * ma.rdlength), ma.rdata, ma.rdlength); + memcpy(a->buf + (a->add_count * ma.rdlength), ma.rdata, ma.rdlength); ++a->add_count; } } @@ -920,7 +929,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char DPRINTF("Answer name = |%s|\n", a->dotted); DPRINTF("Answer type = |%d|\n", a->atype); - __close(fd); + close(fd); if (outpacket) *outpacket = packet; @@ -972,7 +981,7 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char fail: if (fd != -1) - __close(fd); + close(fd); if (lookup) free(lookup); if (packet) @@ -1038,21 +1047,21 @@ int attribute_hidden __open_nameservers() *p++ = '\0'; } - if (__strcmp(argv[0], "nameserver") == 0) { + if (strcmp(argv[0], "nameserver") == 0) { for (i = 1; i < argc && __nameservers < MAX_SERVERS; i++) { - __nameserver[__nameservers++] = __strdup(argv[i]); + __nameserver[__nameservers++] = strdup(argv[i]); DPRINTF("adding nameserver %s\n", argv[i]); } } /* domain and search are mutually exclusive, the last one wins */ - if (__strcmp(argv[0],"domain")==0 || __strcmp(argv[0],"search")==0) { + if (strcmp(argv[0],"domain")==0 || strcmp(argv[0],"search")==0) { while (__searchdomains > 0) { free(__searchdomain[--__searchdomains]); __searchdomain[__searchdomains] = NULL; } for (i=1; i < argc && __searchdomains < MAX_SEARCH; i++) { - __searchdomain[__searchdomains++] = __strdup(argv[i]); + __searchdomain[__searchdomains++] = strdup(argv[i]); DPRINTF("adding search %s\n", argv[i]); } } @@ -1089,7 +1098,7 @@ void attribute_hidden __close_nameservers(void) #ifdef L_gethostbyname -struct hostent attribute_hidden *__gethostbyname(const char *name) +struct hostent *gethostbyname(const char *name) { static struct hostent h; static char buf[sizeof(struct in_addr) + @@ -1097,29 +1106,19 @@ struct hostent attribute_hidden *__gethostbyname(const char *name) sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - __gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno); + gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno); return hp; } -strong_alias(__gethostbyname,gethostbyname) +libc_hidden_def(gethostbyname) #endif #ifdef L_gethostbyname2 -#ifndef __UCLIBC_HAS_IPV6__ -extern struct hostent *__gethostbyname (__const char *__name) attribute_hidden; -#else -extern int __gethostbyname2_r (__const char *__restrict __name, int __af, - struct hostent *__restrict __result_buf, - char *__restrict __buf, size_t __buflen, - struct hostent **__restrict __result, - int *__restrict __h_errnop) attribute_hidden; -#endif - struct hostent *gethostbyname2(const char *name, int family) { #ifndef __UCLIBC_HAS_IPV6__ - return family == AF_INET ? __gethostbyname(name) : (struct hostent*)0; + return family == AF_INET ? gethostbyname(name) : (struct hostent*)0; #else /* __UCLIBC_HAS_IPV6__ */ static struct hostent h; static char buf[sizeof(struct in6_addr) + @@ -1127,7 +1126,7 @@ struct hostent *gethostbyname2(const char *name, int family) sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - __gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno); + gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno); return hp; #endif /* __UCLIBC_HAS_IPV6__ */ @@ -1139,7 +1138,7 @@ struct hostent *gethostbyname2(const char *name, int family) #ifdef L_res_init struct __res_state _res; -int attribute_hidden __res_init_internal(void) +int res_init(void) { struct __res_state *rp = &(_res); @@ -1184,7 +1183,7 @@ int attribute_hidden __res_init_internal(void) return(0); } -strong_alias(__res_init_internal,res_init) +libc_hidden_def(res_init) void res_close( void ) { @@ -1200,11 +1199,7 @@ void res_close( void ) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #endif -int __res_init_internal (void) __THROW attribute_hidden; -int __res_querydomain_internal (const char *, const char *, int, int, - u_char *, int) __THROW attribute_hidden; - -int attribute_hidden __res_query_internal(const char *dname, int class, int type, +int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen) { int i; @@ -1219,7 +1214,7 @@ int attribute_hidden __res_query_internal(const char *dname, int class, int type return(-1); } - __memset((char *) &a, '\0', sizeof(a)); + memset((char *) &a, '\0', sizeof(a)); BIGLOCK; __nameserversXX=__nameservers; @@ -1236,7 +1231,7 @@ int attribute_hidden __res_query_internal(const char *dname, int class, int type if (a.atype == type) { /* CNAME*/ int len = MIN(anslen, i); - __memcpy(answer, packet, len); + memcpy(answer, packet, len); if (packet) free(packet); return(len); @@ -1245,7 +1240,7 @@ int attribute_hidden __res_query_internal(const char *dname, int class, int type free(packet); return i; } -strong_alias(__res_query_internal,res_query) +libc_hidden_def(res_query) /* * Formulate a normal query, send, and retrieve answer in supplied buffer. @@ -1265,7 +1260,7 @@ int res_search(name, class, type, answer, anslen) int trailing_dot, ret, saved_herrno; int got_nodata = 0, got_servfail = 0, tried_as_is = 0; - if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && __res_init_internal() == -1)) { + if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && res_init() == -1)) { h_errno = NETDB_INTERNAL; return (-1); } @@ -1285,7 +1280,7 @@ int res_search(name, class, type, answer, anslen) */ saved_herrno = -1; if (dots >= _res.ndots) { - ret = __res_querydomain_internal(name, NULL, class, type, answer, anslen); + ret = res_querydomain(name, NULL, class, type, answer, anslen); if (ret > 0) return (ret); saved_herrno = h_errno; @@ -1306,7 +1301,7 @@ int res_search(name, class, type, answer, anslen) *domain && !done; domain++) { - ret = __res_querydomain_internal(name, *domain, class, type, + ret = res_querydomain(name, *domain, class, type, answer, anslen); if (ret > 0) return (ret); @@ -1362,7 +1357,7 @@ int res_search(name, class, type, answer, anslen) * name or whether it ends with a dot. */ if (!tried_as_is) { - ret = __res_querydomain_internal(name, NULL, class, type, answer, anslen); + ret = res_querydomain(name, NULL, class, type, answer, anslen); if (ret > 0) return (ret); } @@ -1388,7 +1383,7 @@ int res_search(name, class, type, answer, anslen) * Perform a call on res_query on the concatenation of name and domain, * removing a trailing dot from name if domain is NULL. */ -int attribute_hidden __res_querydomain_internal(name, domain, class, type, answer, anslen) +int res_querydomain(name, domain, class, type, answer, anslen) const char *name, *domain; int class, type; /* class and type of query */ u_char *answer; /* buffer to put answer */ @@ -1398,14 +1393,14 @@ int attribute_hidden __res_querydomain_internal(name, domain, class, type, answe const char *longname = nbuf; size_t n, d; - if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && __res_init_internal() == -1)) { + if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && res_init() == -1)) { h_errno = NETDB_INTERNAL; return (-1); } #ifdef DEBUG if (_res.options & RES_DEBUG) - __printf(";; res_querydomain(%s, %s, %d, %d)\n", + printf(";; res_querydomain(%s, %s, %d, %d)\n", name, domain?domain:"<Nil>", class, type); #endif if (domain == NULL) { @@ -1413,28 +1408,28 @@ int attribute_hidden __res_querydomain_internal(name, domain, class, type, answe * Check for trailing '.'; * copy without '.' if present. */ - n = __strlen(name); + n = strlen(name); if (n + 1 > sizeof(nbuf)) { h_errno = NO_RECOVERY; return (-1); } if (n > 0 && name[--n] == '.') { - __strncpy(nbuf, name, n); + strncpy(nbuf, name, n); nbuf[n] = '\0'; } else longname = name; } else { - n = __strlen(name); - d = __strlen(domain); + n = strlen(name); + d = strlen(domain); if (n + 1 + d + 1 > sizeof(nbuf)) { h_errno = NO_RECOVERY; return (-1); } snprintf(nbuf, sizeof(nbuf), "%s.%s", name, domain); } - return (__res_query_internal(longname, class, type, answer, anslen)); + return (res_query(longname, class, type, answer, anslen)); } -strong_alias(__res_querydomain_internal,res_querydomain) +libc_hidden_def(res_querydomain) /* res_mkquery */ /* res_send */ @@ -1443,14 +1438,7 @@ strong_alias(__res_querydomain_internal,res_querydomain) #endif #ifdef L_gethostbyaddr -extern int __gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len, - int __type, - struct hostent *__restrict __result_buf, - char *__restrict __buf, size_t __buflen, - struct hostent **__restrict __result, - int *__restrict __h_errnop) attribute_hidden; - -struct hostent attribute_hidden *__gethostbyaddr (const void *addr, socklen_t len, int type) +struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type) { static struct hostent h; static char buf[ @@ -1462,11 +1450,11 @@ struct hostent attribute_hidden *__gethostbyaddr (const void *addr, socklen_t le sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - __gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno); + gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno); return hp; } -strong_alias(__gethostbyaddr,gethostbyaddr) +libc_hidden_def(gethostbyaddr) #endif @@ -1551,7 +1539,7 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type, *h_errnop=HOST_NOT_FOUND; while (fgets(buf, buflen, fp)) { - if ((cp = __strchr(buf, '#'))) + if ((cp = strchr(buf, '#'))) *cp = '\0'; DPRINTF("Looking at: %s\n", buf); aliases = 0; @@ -1576,12 +1564,12 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type, /* Return whatever the next entry happens to be. */ break; } else if (action==GET_HOSTS_BYADDR) { - if (__strcmp(name, alias[0]) != 0) + if (strcmp(name, alias[0]) != 0) continue; } else { /* GET_HOSTS_BYNAME */ for (i = 1; i < aliases; i++) - if (__strcasecmp(name, alias[i]) == 0) + if (strcasecmp(name, alias[i]) == 0) break; if (i >= aliases) continue; @@ -1652,7 +1640,7 @@ void sethostent (int stay_open) UNLOCK; } -int attribute_hidden __gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, +int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, struct hostent **result, int *h_errnop) { int ret; @@ -1675,7 +1663,7 @@ int attribute_hidden __gethostent_r(struct hostent *result_buf, char *buf, size_ UNLOCK; return(ret); } -strong_alias(__gethostent_r,gethostent_r) +libc_hidden_def(gethostent_r) struct hostent *gethostent (void) { @@ -1691,7 +1679,7 @@ struct hostent *gethostent (void) struct hostent *host; LOCK; - __gethostent_r(&h, buf, sizeof(buf), &host, &h_errno); + gethostent_r(&h, buf, sizeof(buf), &host, &h_errno); UNLOCK; return(host); } @@ -1752,7 +1740,7 @@ int attribute_hidden __get_hosts_byaddr_r(const char * addr, int len, int type, # define min(x,y) (((x) > (y)) ? (y) : (x)) #endif /* min */ -int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, +int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) { @@ -1793,12 +1781,12 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen if (!(flags & NI_NUMERICHOST)) { #ifdef __UCLIBC_HAS_IPV6__ if (sa->sa_family == AF_INET6) - h = __gethostbyaddr ((const void *) + h = gethostbyaddr ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), sizeof(struct in6_addr), AF_INET6); else #endif /* __UCLIBC_HAS_IPV6__ */ - h = __gethostbyaddr ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), + h = gethostbyaddr ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), sizeof(struct in_addr), AF_INET); if (h) { @@ -1807,12 +1795,12 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen && (getdomainname (domain, sizeof(domain)) == 0) && (c = strstr (h->h_name, domain)) && (c != h->h_name) && (*(--c) == '.')) { - __strncpy (host, h->h_name, + strncpy (host, h->h_name, min(hostlen, (size_t) (c - h->h_name))); host[min(hostlen - 1, (size_t) (c - h->h_name))] = '\0'; ok = 1; } else { - __strncpy (host, h->h_name, hostlen); + strncpy (host, h->h_name, hostlen); ok = 1; } } @@ -1841,7 +1829,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen char scopebuf[IFNAMSIZ + 1]; char *scopeptr; int ni_numericscope = 0; - size_t real_hostlen = __strnlen (host, hostlen); + size_t real_hostlen = strnlen (host, hostlen); size_t scopelen = 0; scopebuf[0] = SCOPE_DELIMITER; @@ -1853,7 +1841,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen if (if_indextoname (scopeid, scopeptr) == NULL) ++ni_numericscope; else - scopelen = __strlen (scopebuf); + scopelen = strlen (scopebuf); } else { ++ni_numericscope; } @@ -1867,7 +1855,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen if (real_hostlen + scopelen + 1 > hostlen) return EAI_SYSTEM; - __memcpy (host + real_hostlen, scopebuf, scopelen + 1); + memcpy (host + real_hostlen, scopebuf, scopelen + 1); } #endif } else @@ -1890,7 +1878,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen struct utsname utsname; if (!uname (&utsname)) { - __strncpy (host, utsname.nodename, hostlen); + strncpy (host, utsname.nodename, hostlen); break; }; }; @@ -1900,7 +1888,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen return EAI_NONAME; } - __strncpy (host, "localhost", hostlen); + strncpy (host, "localhost", hostlen); break; default: @@ -1918,7 +1906,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen s = getservbyport (((const struct sockaddr_in *) sa)->sin_port, ((flags & NI_DGRAM) ? "udp" : "tcp")); if (s) { - __strncpy (serv, s->s_name, servlen); + strncpy (serv, s->s_name, servlen); break; } } @@ -1927,7 +1915,7 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen break; case AF_LOCAL: - __strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen); + strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen); break; } } @@ -1938,13 +1926,14 @@ int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen errno = serrno; return 0; } -strong_alias(__getnameinfo,getnameinfo) +libc_hidden_proto(getnameinfo) +libc_hidden_def(getnameinfo) #endif #ifdef L_gethostbyname_r -int attribute_hidden __gethostbyname_r(const char * name, +int gethostbyname_r(const char * name, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, @@ -2013,7 +2002,7 @@ int attribute_hidden __gethostbyname_r(const char * name, if (buflen<256) return ERANGE; - __strncpy(buf, name, buflen); + strncpy(buf, name, buflen); alias[0] = buf; alias[1] = NULL; @@ -2057,7 +2046,7 @@ int attribute_hidden __gethostbyname_r(const char * name, } else if(a.add_count > 0) { - __memmove(buf - sizeof(struct in_addr*)*2, buf, a.add_count * a.rdlength); + memmove(buf - sizeof(struct in_addr*)*2, buf, a.add_count * a.rdlength); addr_list = (struct in_addr**)(buf + a.add_count * a.rdlength); addr_list[0] = in; for (i = a.add_count-1; i>=0; --i) @@ -2067,11 +2056,11 @@ int attribute_hidden __gethostbyname_r(const char * name, buf = (char*)&addr_list[a.add_count + 2]; } - __strncpy(buf, a.dotted, buflen); + strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_A) { /* ADDRESS */ - __memcpy(in, a.rdata, sizeof(*in)); + memcpy(in, a.rdata, sizeof(*in)); result_buf->h_name = buf; result_buf->h_addrtype = AF_INET; result_buf->h_length = sizeof(*in); @@ -2093,19 +2082,19 @@ int attribute_hidden __gethostbyname_r(const char * name, *h_errnop = NETDB_SUCCESS; return NETDB_SUCCESS; } -strong_alias(__gethostbyname_r,gethostbyname_r) +libc_hidden_def(gethostbyname_r) #endif #ifdef L_gethostbyname2_r -int attribute_hidden __gethostbyname2_r(const char *name, int family, +int gethostbyname2_r(const char *name, int family, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, int * h_errnop) { #ifndef __UCLIBC_HAS_IPV6__ - return family == (AF_INET)? __gethostbyname_r(name, result_buf, + return family == (AF_INET)? gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop) : HOST_NOT_FOUND; #else /* __UCLIBC_HAS_IPV6__ */ struct in6_addr *in; @@ -2118,7 +2107,7 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, char ** __nameserverXX; if (family == AF_INET) - return __gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop); + return gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop); if (family != AF_INET6) return EINVAL; @@ -2171,7 +2160,7 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, if (buflen<256) return ERANGE; - __strncpy(buf, name, buflen); + strncpy(buf, name, buflen); /* First check if this is already an address */ if (inet_pton(AF_INET6, name, in)) { @@ -2184,7 +2173,7 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, return NETDB_SUCCESS; } - __memset((char *) &a, '\0', sizeof(a)); + memset((char *) &a, '\0', sizeof(a)); for (;;) { BIGLOCK; @@ -2199,7 +2188,7 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, return TRY_AGAIN; } - __strncpy(buf, a.dotted, buflen); + strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_CNAME) { /* CNAME */ @@ -2217,7 +2206,7 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, } continue; } else if (a.atype == T_AAAA) { /* ADDRESS */ - __memcpy(in, a.rdata, sizeof(*in)); + memcpy(in, a.rdata, sizeof(*in)); result_buf->h_name = buf; result_buf->h_addrtype = AF_INET6; result_buf->h_length = sizeof(*in); @@ -2236,11 +2225,11 @@ int attribute_hidden __gethostbyname2_r(const char *name, int family, return NETDB_SUCCESS; #endif /* __UCLIBC_HAS_IPV6__ */ } -strong_alias(__gethostbyname2_r,gethostbyname2_r) +libc_hidden_def(gethostbyname2_r) #endif #ifdef L_gethostbyaddr_r -int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int type, +int gethostbyaddr_r (const void *addr, socklen_t len, int type, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, @@ -2266,7 +2255,7 @@ int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int typ if (!addr) return EINVAL; - __memset((char *) &a, '\0', sizeof(a)); + memset((char *) &a, '\0', sizeof(a)); switch (type) { case AF_INET: @@ -2340,24 +2329,24 @@ int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int typ if(type == AF_INET) { unsigned char *tmp_addr = (unsigned char *)addr; - __memcpy(&in->s_addr, addr, len); + memcpy(&in->s_addr, addr, len); addr_list[0] = in; - __sprintf(buf, "%u.%u.%u.%u.in-addr.arpa", + sprintf(buf, "%u.%u.%u.%u.in-addr.arpa", tmp_addr[3], tmp_addr[2], tmp_addr[1], tmp_addr[0]); #ifdef __UCLIBC_HAS_IPV6__ } else { - __memcpy(in6->s6_addr, addr, len); + memcpy(in6->s6_addr, addr, len); addr_list6[0] = in6; qp = buf; for (i = len - 1; i >= 0; i--) { - qp += __sprintf(qp, "%x.%x.", in6->s6_addr[i] & 0xf, + qp += sprintf(qp, "%x.%x.", in6->s6_addr[i] & 0xf, (in6->s6_addr[i] >> 4) & 0xf); } - __strcpy(qp, "ip6.int"); + strcpy(qp, "ip6.int"); #endif /* __UCLIBC_HAS_IPV6__ */ } @@ -2376,7 +2365,7 @@ int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int typ return TRY_AGAIN; } - __strncpy(buf, a.dotted, buflen); + strncpy(buf, a.dotted, buflen); free(a.dotted); if (a.atype == T_CNAME) { /* CNAME */ @@ -2421,7 +2410,7 @@ int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int typ *h_errnop = NETDB_SUCCESS; return NETDB_SUCCESS; } -strong_alias(__gethostbyaddr_r,gethostbyaddr_r) +libc_hidden_def(gethostbyaddr_r) #endif #ifdef L_res_comp @@ -2435,7 +2424,7 @@ strong_alias(__gethostbyaddr_r,gethostbyaddr_r) int __dn_expand(const u_char *msg, const u_char *eom, const u_char *src, char *dst, int dstsiz) { - int n = __ns_name_uncompress_internal(msg, eom, src, dst, (size_t)dstsiz); + int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz); if (n > 0 && dst[0] == '.') dst[0] = '\0'; @@ -2487,19 +2476,19 @@ static int special(int ch) * note: * Root domain returns as "." not "". */ -int attribute_hidden __ns_name_uncompress_internal(const u_char *msg, const u_char *eom, +int ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, char *dst, size_t dstsiz) { u_char tmp[NS_MAXCDNAME]; int n; - if ((n = __ns_name_unpack_internal(msg, eom, src, tmp, sizeof tmp)) == -1) + if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1) return (-1); - if (__ns_name_ntop_internal(tmp, dst, dstsiz) == -1) + if (ns_name_ntop(tmp, dst, dstsiz) == -1) return (-1); return (n); } -strong_alias(__ns_name_uncompress_internal,__ns_name_uncompress) +libc_hidden_def(ns_name_uncompress) /* @@ -2511,7 +2500,7 @@ strong_alias(__ns_name_uncompress_internal,__ns_name_uncompress) * The root is returned as "." * All other domains are returned in non absolute form */ -int attribute_hidden __ns_name_ntop_internal(const u_char *src, char *dst, size_t dstsiz) { +int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { const u_char *cp; char *dn, *eom; u_char c; @@ -2580,7 +2569,7 @@ int attribute_hidden __ns_name_ntop_internal(const u_char *src, char *dst, size_ *dn++ = '\0'; return (dn - dst); } -strong_alias(__ns_name_ntop_internal,__ns_name_ntop) +libc_hidden_def(ns_name_ntop) /* * ns_name_unpack(msg, eom, src, dst, dstsiz) @@ -2588,7 +2577,7 @@ strong_alias(__ns_name_ntop_internal,__ns_name_ntop) * return: * -1 if it fails, or consumed octets if it succeeds. */ -int attribute_hidden __ns_name_unpack_internal(const u_char *msg, const u_char *eom, const u_char *src, +int ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, u_char *dst, size_t dstsiz) { const u_char *srcp, *dstlim; @@ -2616,7 +2605,7 @@ int attribute_hidden __ns_name_unpack_internal(const u_char *msg, const u_char * } checked += n + 1; *dstp++ = n; - __memcpy(dstp, srcp, n); + memcpy(dstp, srcp, n); dstp += n; srcp += n; break; @@ -2655,5 +2644,5 @@ int attribute_hidden __ns_name_unpack_internal(const u_char *msg, const u_char * len = srcp - src; return (len); } -strong_alias(__ns_name_unpack_internal,__ns_name_unpack) +libc_hidden_def(ns_name_unpack) #endif /* L_ns_name */ diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c index cb30c40a7..06f65904a 100644 --- a/libc/inet/rpc/auth_none.c +++ b/libc/inet/rpc/auth_none.c @@ -35,13 +35,13 @@ * credentials and verifiers to remote systems. */ -#define xdrmem_create __xdrmem_create -#define xdr_opaque_auth __xdr_opaque_auth - #define __FORCE_GLIBC #include <features.h> #include "rpc_private.h" +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_opaque_auth) + #define MAX_MARSHEL_SIZE 20 /* @@ -72,8 +72,8 @@ struct authnone_private_s { static struct authnone_private_s *authnone_private; #endif -AUTH attribute_hidden * -__authnone_create (void) +AUTH * +authnone_create (void) { struct authnone_private_s *ap; XDR xdr_stream; @@ -101,7 +101,8 @@ __authnone_create (void) } return (&ap->no_client); } -strong_alias(__authnone_create,authnone_create) +libc_hidden_proto(authnone_create) +libc_hidden_def(authnone_create) /*ARGSUSED */ static bool_t diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index bb14df068..dffdc6fad 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -38,17 +38,6 @@ * for the credentials. */ -#define sysconf __sysconf -#define getegid __getegid -#define geteuid __geteuid -#define getgroups __getgroups -#define gethostname __gethostname -#define xdrmem_create __xdrmem_create -#define xdr_authunix_parms __xdr_authunix_parms -#define xdr_opaque_auth __xdr_opaque_auth -#define gettimeofday __gettimeofday -#define fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -67,6 +56,23 @@ # include <wchar.h> #endif +libc_hidden_proto(memcpy) +libc_hidden_proto(sysconf) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(getgroups) +libc_hidden_proto(gethostname) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_authunix_parms) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_proto(gettimeofday) +libc_hidden_proto(fputs) +libc_hidden_proto(perror) +libc_hidden_proto(abort) +#ifdef USE_IN_LIBIO +libc_hidden_proto(fwprintf) +#endif + /* * Unix authenticator operations vector */ @@ -103,8 +109,8 @@ static bool_t marshal_new_auth (AUTH *) internal_function; * Create a unix style authenticator. * Returns an auth handle with the given stuff in it. */ -AUTH attribute_hidden * -__authunix_create (char *machname, uid_t uid, gid_t gid, int len, +AUTH * +authunix_create (char *machname, uid_t uid, gid_t gid, int len, gid_t *aup_gids) { struct authunix_parms aup; @@ -124,7 +130,7 @@ __authunix_create (char *machname, uid_t uid, gid_t gid, int len, no_memory: #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("authunix_create: out of memory\n")); else #endif @@ -160,7 +166,7 @@ no_memory: au->au_origcred.oa_base = mem_alloc ((u_int) len); if (au->au_origcred.oa_base == NULL) goto no_memory; - __memcpy(au->au_origcred.oa_base, mymem, (u_int) len); + memcpy(au->au_origcred.oa_base, mymem, (u_int) len); /* * set auth handle to reflect new cred. @@ -169,14 +175,15 @@ no_memory: marshal_new_auth (auth); return auth; } -strong_alias(__authunix_create,authunix_create) +libc_hidden_proto(authunix_create) +libc_hidden_def(authunix_create) /* * Returns an auth handle with parameters determined by doing lots of * syscalls. */ -AUTH attribute_hidden * -__authunix_create_default (void) +AUTH * +authunix_create_default (void) { int len; char machname[MAX_MACHINE_NAME + 1]; @@ -203,12 +210,13 @@ __authunix_create_default (void) /* This braindamaged Sun code forces us here to truncate the list of groups to NGRPS members since the code in authuxprot.c transforms a fixed array. Grrr. */ - ret_auth = __authunix_create (machname, uid, gid, MIN (NGRPS, len), gids); + ret_auth = authunix_create (machname, uid, gid, MIN (NGRPS, len), gids); if (gids) free (gids); return ret_auth; } -strong_alias(__authunix_create_default,authunix_create_default) +libc_hidden_proto(authunix_create_default) +libc_hidden_def(authunix_create_default) /* * authunix operations @@ -338,7 +346,7 @@ marshal_new_auth (AUTH *auth) xdrmem_create (xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE); if ((!xdr_opaque_auth (xdrs, &(auth->ah_cred))) || (!xdr_opaque_auth (xdrs, &(auth->ah_verf)))) - __perror (_("auth_none.c - Fatal marshalling problem")); + perror (_("auth_none.c - Fatal marshalling problem")); else au->au_mpos = XDR_GETPOS (xdrs); diff --git a/libc/inet/rpc/authunix_prot.c b/libc/inet/rpc/authunix_prot.c index 32da3256d..1587b5688 100644 --- a/libc/inet/rpc/authunix_prot.c +++ b/libc/inet/rpc/authunix_prot.c @@ -34,22 +34,23 @@ * XDR for UNIX style authentication parameters for RPC */ -#define xdr_string __xdr_string -#define xdr_u_int __xdr_u_int -#define xdr_array __xdr_array -#define xdr_u_long __xdr_u_long - #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/auth.h> #include <rpc/auth_unix.h> +libc_hidden_proto(xdr_string) +libc_hidden_def(xdr_string) +libc_hidden_proto(xdr_u_int) +libc_hidden_proto(xdr_array) +libc_hidden_proto(xdr_u_long) + /* * XDR for unix authentication parameters. * Unfortunately, none of these can be declared const. */ -bool_t attribute_hidden -__xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) +bool_t +xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) { if (xdr_u_long (xdrs, &(p->aup_time)) && xdr_string (xdrs, &(p->aup_machname), MAX_MACHINE_NAME) @@ -68,4 +69,5 @@ __xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) } return FALSE; } -strong_alias(__xdr_authunix_parms,xdr_authunix_parms) +libc_hidden_proto(xdr_authunix_parms) +libc_hidden_def(xdr_authunix_parms) diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 530df52b3..68b44d26a 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -30,8 +30,6 @@ * Copyright (c) 1987 by Sun Microsystems, Inc. */ -#define bind __bind - #define __FORCE_GLIBC #include <features.h> @@ -42,11 +40,15 @@ #include <sys/socket.h> #include <netinet/in.h> +libc_hidden_proto(memset) +libc_hidden_proto(bind) +libc_hidden_proto(getpid) + /* * Bind a socket to a privileged IP port */ -int attribute_hidden -__bindresvport (int sd, struct sockaddr_in *sin) +int +bindresvport (int sd, struct sockaddr_in *sin) { int res; static short port; @@ -60,7 +62,7 @@ __bindresvport (int sd, struct sockaddr_in *sin) if (sin == (struct sockaddr_in *) 0) { sin = &myaddr; - __memset (sin, 0, sizeof (*sin)); + memset (sin, 0, sizeof (*sin)); sin->sin_family = AF_INET; } else if (sin->sin_family != AF_INET) @@ -71,7 +73,7 @@ __bindresvport (int sd, struct sockaddr_in *sin) if (port == 0) { - port = (__getpid () % NPORTS) + STARTPORT; + port = (getpid () % NPORTS) + STARTPORT; } res = -1; __set_errno (EADDRINUSE); @@ -88,4 +90,5 @@ __bindresvport (int sd, struct sockaddr_in *sin) return res; } -strong_alias(__bindresvport,bindresvport) +libc_hidden_proto(bindresvport) +libc_hidden_def(bindresvport) diff --git a/libc/inet/rpc/clnt_generic.c b/libc/inet/rpc/clnt_generic.c index cfd357f63..899a9dd0e 100644 --- a/libc/inet/rpc/clnt_generic.c +++ b/libc/inet/rpc/clnt_generic.c @@ -30,12 +30,6 @@ * Copyright (C) 1987, Sun Microsystems, Inc. */ -#define clnttcp_create __clnttcp_create -#define clntudp_create __clntudp_create -#define clntunix_create __clntunix_create -#define getprotobyname_r __getprotobyname_r -#define gethostbyname_r __gethostbyname_r - #define __FORCE_GLIBC #include <features.h> @@ -46,10 +40,16 @@ #include <sys/socket.h> #include <netdb.h> -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(clnttcp_create) +libc_hidden_proto(clntudp_create) +libc_hidden_proto(clntunix_create) +libc_hidden_proto(getprotobyname_r) +libc_hidden_proto(gethostbyname_r) +libc_hidden_proto(__rpc_thread_createerr) /* * Generic client creation: takes (hostname, program-number, protocol) and @@ -73,11 +73,11 @@ clnt_create (const char *hostname, u_long prog, u_long vers, CLIENT *client; int herr; - if (__strcmp (proto, "unix") == 0) + if (strcmp (proto, "unix") == 0) { - __memset ((char *)&sun, 0, sizeof (sun)); + memset ((char *)&sun, 0, sizeof (sun)); sun.sun_family = AF_UNIX; - __strcpy (sun.sun_path, hostname); + strcpy (sun.sun_path, hostname); sock = RPC_ANYSOCK; client = clntunix_create (&sun, prog, vers, &sock, 0, 0); if (client == NULL) @@ -122,8 +122,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers, } sin.sin_family = h->h_addrtype; sin.sin_port = 0; - __memset (sin.sin_zero, 0, sizeof (sin.sin_zero)); - __memcpy ((char *) &sin.sin_addr, h->h_addr, h->h_length); + memset (sin.sin_zero, 0, sizeof (sin.sin_zero)); + memcpy ((char *) &sin.sin_addr, h->h_addr, h->h_length); prtbuflen = 1024; prttmpbuf = alloca (prtbuflen); diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c index eba539c95..c01390598 100644 --- a/libc/inet/rpc/clnt_perror.c +++ b/libc/inet/rpc/clnt_perror.c @@ -38,8 +38,6 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; * */ -#define fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -53,6 +51,15 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; # define fputs(s, f) _IO_fputs (s, f) #endif +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(sprintf) +libc_hidden_proto(__glibc_strerror_r) +libc_hidden_proto(fputs) +#ifdef USE_IN_LIBIO +libc_hidden_proto(fwprintf) +#endif + static char *auth_errmsg (enum auth_stat stat) internal_function; #ifdef __UCLIBC_HAS_THREADS__ @@ -179,8 +186,8 @@ static const struct rpc_errtab rpc_errlist[] = /* * This interface for use by clntrpc */ -char attribute_hidden * -__clnt_sperrno (enum clnt_stat stat) +char * +clnt_sperrno (enum clnt_stat stat) { size_t i; @@ -193,24 +200,25 @@ __clnt_sperrno (enum clnt_stat stat) } return _("RPC: (unknown error code)"); } -strong_alias(__clnt_sperrno,clnt_sperrno) +libc_hidden_proto(clnt_sperrno) +libc_hidden_def(clnt_sperrno) void clnt_perrno (enum clnt_stat num) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", __clnt_sperrno (num)); + (void) fwprintf (stderr, L"%s", clnt_sperrno (num)); else #endif - (void) fputs (__clnt_sperrno (num), stderr); + (void) fputs (clnt_sperrno (num), stderr); } /* * Print reply error info */ -char attribute_hidden * -__clnt_sperror (CLIENT * rpch, const char *msg) +char * +clnt_sperror (CLIENT * rpch, const char *msg) { char chrbuf[1024]; struct rpc_err e; @@ -223,11 +231,11 @@ __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)); - str += __strlen(str); + (void) strcpy(str, clnt_sperrno(e.re_status)); + str += strlen(str); switch (e.re_status) { @@ -248,43 +256,43 @@ __clnt_sperror (CLIENT * rpch, const char *msg) case RPC_CANTSEND: case RPC_CANTRECV: - __glibc_strerror_r_internal (e.re_errno, chrbuf, sizeof chrbuf); - len = __sprintf (str, "; errno = %s", chrbuf); + __glibc_strerror_r (e.re_errno, chrbuf, sizeof 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; case RPC_AUTHERROR: err = auth_errmsg (e.re_why); - (void) __strcpy(str, _("; why = ")); - str += __strlen(str); + (void) strcpy(str, _("; why = ")); + str += strlen(str); if (err != NULL) { - (void) __strcpy(str, err); - str += __strlen(str); + (void) strcpy(str, err); + str += strlen(str); } 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; } @@ -292,22 +300,24 @@ __clnt_sperror (CLIENT * rpch, const char *msg) *++str = '\0'; return (strstart); } -strong_alias(__clnt_sperror,clnt_sperror) +libc_hidden_proto(clnt_sperror) +libc_hidden_def(clnt_sperror) -void attribute_hidden -__clnt_perror (CLIENT * rpch, const char *msg) +void +clnt_perror (CLIENT * rpch, const char *msg) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", __clnt_sperror (rpch, msg)); + (void) fwprintf (stderr, L"%s", clnt_sperror (rpch, msg)); else #endif - (void) fputs (__clnt_sperror (rpch, msg), stderr); + (void) fputs (clnt_sperror (rpch, msg), stderr); } -strong_alias(__clnt_perror,clnt_perror) +libc_hidden_proto(clnt_perror) +libc_hidden_def(clnt_perror) -char attribute_hidden * -__clnt_spcreateerror (const char *msg) +char * +clnt_spcreateerror (const char *msg) { char chrbuf[1024]; char *str = _buf (); @@ -318,29 +328,29 @@ __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); + (void) strcpy(cp, clnt_sperrno (ce->cf_stat)); + cp += strlen(cp); switch (ce->cf_stat) { case RPC_PMAPFAILURE: - (void) __strcpy(cp, " - "); - cp += __strlen(cp); + (void) strcpy(cp, " - "); + cp += strlen(cp); - (void) __strcpy(cp, __clnt_sperrno (ce->cf_error.re_status)); - cp += __strlen(cp); + (void) strcpy(cp, clnt_sperrno (ce->cf_error.re_status)); + cp += strlen(cp); break; case RPC_SYSTEMERROR: - (void) __strcpy(cp, " - "); - cp += __strlen(cp); + (void) strcpy(cp, " - "); + cp += strlen(cp); - __glibc_strerror_r_internal (ce->cf_error.re_errno, chrbuf, sizeof chrbuf); - (void) __strcpy(cp, chrbuf); - cp += __strlen(cp); + __glibc_strerror_r (ce->cf_error.re_errno, chrbuf, sizeof chrbuf); + (void) strcpy(cp, chrbuf); + cp += strlen(cp); break; default: break; @@ -349,17 +359,18 @@ __clnt_spcreateerror (const char *msg) *++cp = '\0'; return str; } -strong_alias(__clnt_spcreateerror,clnt_spcreateerror) +libc_hidden_proto(clnt_spcreateerror) +libc_hidden_def(clnt_spcreateerror) void clnt_pcreateerror (const char *msg) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", __clnt_spcreateerror (msg)); + (void) fwprintf (stderr, L"%s", clnt_spcreateerror (msg)); else #endif - (void) fputs (__clnt_spcreateerror (msg), stderr); + (void) fputs (clnt_spcreateerror (msg), stderr); } struct auth_errtab diff --git a/libc/inet/rpc/clnt_raw.c b/libc/inet/rpc/clnt_raw.c index 37b99ecb1..b44bd38b8 100644 --- a/libc/inet/rpc/clnt_raw.c +++ b/libc/inet/rpc/clnt_raw.c @@ -42,20 +42,21 @@ static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro"; * any interference from the kernel. */ -#define authnone_create __authnone_create -#define xdrmem_create __xdrmem_create -#define xdr_callhdr __xdr_callhdr -#define xdr_replymsg __xdr_replymsg -#define xdr_opaque_auth __xdr_opaque_auth -#define svc_getreq __svc_getreq -#define _seterr_reply __seterr_reply - #define __FORCE_GLIBC #include <features.h> #include "rpc_private.h" #include <rpc/svc.h> #include <rpc/xdr.h> +libc_hidden_proto(perror) +libc_hidden_proto(authnone_create) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_callhdr) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_proto(svc_getreq) +libc_hidden_proto(_seterr_reply) + #define MCALL_MSG_SIZE 24 /* @@ -121,7 +122,7 @@ clntraw_create (u_long prog, u_long vers) xdrmem_create (xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); if (!xdr_callhdr (xdrs, &call_msg)) { - __perror (_ ("clnt_raw.c - Fatal header serialization error.")); + perror (_ ("clnt_raw.c - Fatal header serialization error.")); } clp->mcnt = XDR_GETPOS (xdrs); XDR_DESTROY (xdrs); diff --git a/libc/inet/rpc/clnt_simple.c b/libc/inet/rpc/clnt_simple.c index 7c17dc1f1..f9f18f3d4 100644 --- a/libc/inet/rpc/clnt_simple.c +++ b/libc/inet/rpc/clnt_simple.c @@ -38,9 +38,6 @@ static char sccsid[] = "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define clntudp_create __clntudp_create -#define gethostbyname_r __gethostbyname_r - #define __FORCE_GLIBC #include <features.h> @@ -53,6 +50,13 @@ static char sccsid[] = "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro"; #include <netdb.h> #include <string.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(strcmp) +libc_hidden_proto(strncpy) +libc_hidden_proto(close) +libc_hidden_proto(clntudp_create) +libc_hidden_proto(gethostbyname_r) + struct callrpc_private_s { CLIENT *client; @@ -90,7 +94,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->socket = RPC_ANYSOCK; } if (crp->valid && crp->oldprognum == prognum && crp->oldversnum == versnum - && __strcmp (crp->oldhost, host) == 0) + && strcmp (crp->oldhost, host) == 0) { /* reuse old client */ } @@ -103,7 +107,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->valid = 0; if (crp->socket != RPC_ANYSOCK) { - (void) __close (crp->socket); + (void) close (crp->socket); crp->socket = RPC_ANYSOCK; } if (crp->client) @@ -128,7 +132,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, timeout.tv_usec = 0; timeout.tv_sec = 5; - __memcpy ((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length); + memcpy ((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length); server_addr.sin_family = AF_INET; server_addr.sin_port = 0; if ((crp->client = clntudp_create (&server_addr, (u_long) prognum, @@ -137,7 +141,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, crp->valid = 1; crp->oldprognum = prognum; crp->oldversnum = versnum; - (void) __strncpy (crp->oldhost, host, 255); + (void) strncpy (crp->oldhost, host, 255); crp->oldhost[255] = '\0'; } tottimeout.tv_sec = 25; diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index 8dcb4682a..8837062c9 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -50,21 +50,6 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; * Now go hang yourself. */ -#define authnone_create __authnone_create -#define xdrrec_create __xdrrec_create -#define xdrrec_endofrecord __xdrrec_endofrecord -#define xdrrec_skiprecord __xdrrec_skiprecord -#define xdr_callhdr __xdr_callhdr -#define xdr_replymsg __xdr_replymsg -#define xdr_opaque_auth __xdr_opaque_auth -#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 fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -80,12 +65,30 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; # include <wchar.h> #endif -extern u_long _create_xid (void) attribute_hidden; +libc_hidden_proto(socket) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(close) +libc_hidden_proto(authnone_create) +libc_hidden_proto(xdrrec_create) +libc_hidden_proto(xdrrec_endofrecord) +libc_hidden_proto(xdrrec_skiprecord) +libc_hidden_proto(xdr_callhdr) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(pmap_getport) +libc_hidden_proto(_seterr_reply) +libc_hidden_proto(connect) +libc_hidden_proto(bindresvport) +libc_hidden_proto(poll) +libc_hidden_proto(fputs) +#ifdef USE_IN_LIBIO +libc_hidden_proto(fwprintf) +#endif +libc_hidden_proto(__rpc_thread_createerr) -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +extern u_long _create_xid (void) attribute_hidden; #define MCALL_MSG_SIZE 24 @@ -137,8 +140,8 @@ static struct clnt_ops tcp_ops = * NB: The rpch->cl_auth is set null authentication. Caller may wish to set this * something more useful. */ -CLIENT attribute_hidden * -__clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, +CLIENT * +clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp, u_int sendsz, u_int recvsz) { CLIENT *h; @@ -152,7 +155,7 @@ __clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, struct rpc_createerr *ce = &get_rpc_createerr (); #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("clnttcp_create: out of memory\n")); else #endif @@ -182,7 +185,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, @@ -192,7 +195,7 @@ __clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, ce->cf_stat = RPC_SYSTEMERROR; ce->cf_error.re_errno = errno; if (*sockp >= 0) - (void) __close (*sockp); + (void) close (*sockp); goto fooy; } ct->ct_closeit = TRUE; @@ -228,7 +231,7 @@ __clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, { if (ct->ct_closeit) { - (void) __close (*sockp); + (void) close (*sockp); } goto fooy; } @@ -254,7 +257,8 @@ fooy: mem_free ((caddr_t) h, sizeof (CLIENT)); return ((CLIENT *) NULL); } -strong_alias(__clnttcp_create,clnttcp_create) +libc_hidden_proto(clnttcp_create) +libc_hidden_def(clnttcp_create) static enum clnt_stat clnttcp_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) @@ -482,7 +486,7 @@ clnttcp_destroy (CLIENT *h) if (ct->ct_closeit) { - (void) __close (ct->ct_sock); + (void) close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); mem_free ((caddr_t) ct, sizeof (struct ct_data)); @@ -524,7 +528,7 @@ readtcp (char *ctptr, char *buf, int len) } break; } - switch (len = __read (ct->ct_sock, buf, len)) + switch (len = read (ct->ct_sock, buf, len)) { case 0: @@ -550,7 +554,7 @@ writetcp (char *ctptr, char *buf, int len) for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = __write (ct->ct_sock, buf, cnt)) == -1) + if ((i = write (ct->ct_sock, buf, cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index bd93fd022..8f3cad926 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -37,24 +37,6 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -/* CMSG_NXTHDR is using it */ -#define __cmsg_nxthdr __cmsg_nxthdr_internal - -#define authnone_create __authnone_create -#define xdrmem_create __xdrmem_create -#define xdr_callhdr __xdr_callhdr -#define xdr_replymsg __xdr_replymsg -#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 fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -72,6 +54,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include <net/if.h> #ifdef USE_IN_LIBIO # include <wchar.h> +libc_hidden_proto(fwprintf) #endif #ifdef IP_RECVERR @@ -79,12 +62,30 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include <sys/uio.h> #endif -extern u_long _create_xid (void) attribute_hidden; +libc_hidden_proto(memcmp) +libc_hidden_proto(ioctl) +libc_hidden_proto(socket) +libc_hidden_proto(close) +/* CMSG_NXTHDR is using it */ +libc_hidden_proto(__cmsg_nxthdr) + +libc_hidden_proto(authnone_create) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_callhdr) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_proto(pmap_getport) +libc_hidden_proto(_seterr_reply) +libc_hidden_proto(setsockopt) +libc_hidden_proto(bindresvport) +libc_hidden_proto(recvfrom) +libc_hidden_proto(sendto) +libc_hidden_proto(recvmsg) +libc_hidden_proto(poll) +libc_hidden_proto(fputs) +libc_hidden_proto(__rpc_thread_createerr) -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +extern u_long _create_xid (void) attribute_hidden; /* * UDP bases client side rpc operations @@ -143,8 +144,8 @@ struct cu_data * sendsz and recvsz are the maximum allowable packet sizes that can be * sent and received. */ -CLIENT attribute_hidden * -__clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, +CLIENT * +clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, struct timeval wait, int *sockp, u_int sendsz, u_int recvsz) { @@ -161,7 +162,7 @@ __clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, struct rpc_createerr *ce = &get_rpc_createerr (); #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("clntudp_create: out of memory\n")); else #endif @@ -207,7 +208,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 (); @@ -218,7 +219,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; @@ -241,16 +242,18 @@ fooy: mem_free ((caddr_t) cl, sizeof (CLIENT)); return (CLIENT *) NULL; } -strong_alias(__clntudp_bufcreate,clntudp_bufcreate) +libc_hidden_proto(clntudp_bufcreate) +libc_hidden_def(clntudp_bufcreate) -CLIENT attribute_hidden * -__clntudp_create (struct sockaddr_in *raddr, u_long program, u_long version, struct timeval wait, int *sockp) +CLIENT * +clntudp_create (struct sockaddr_in *raddr, u_long program, u_long version, struct timeval wait, int *sockp) { - return __clntudp_bufcreate (raddr, program, version, wait, sockp, + return clntudp_bufcreate (raddr, program, version, wait, sockp, UDPMSGSIZE, UDPMSGSIZE); } -strong_alias(__clntudp_create,clntudp_create) +libc_hidden_proto(clntudp_create) +libc_hidden_def(clntudp_create) static int is_network_up (int sock) @@ -262,13 +265,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) @@ -419,13 +422,13 @@ send_again: msg.msg_controllen = 256; ret = recvmsg (cu->cu_sock, &msg, MSG_ERRQUEUE); if (ret >= 0 - && __memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0 + && memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0 && (msg.msg_flags & MSG_ERRQUEUE) && ((msg.msg_namelen == 0 && ret >= 12) || (msg.msg_namelen == sizeof (err_addr) && err_addr.sin_family == AF_INET - && __memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr, + && memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr, sizeof (err_addr.sin_addr)) == 0 && err_addr.sin_port == cu->cu_raddr.sin_port))) for (cmsg = CMSG_FIRSTHDR (&msg); cmsg; @@ -620,7 +623,7 @@ clntudp_destroy (CLIENT *cl) if (cu->cu_closeit) { - (void) __close (cu->cu_sock); + (void) close (cu->cu_sock); } XDR_DESTROY (&(cu->cu_outxdrs)); mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index e0483b4e2..29944af0f 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -46,24 +46,6 @@ * Now go hang yourself. */ -#define authnone_create __authnone_create -#define xdrrec_create __xdrrec_create -#define xdrrec_endofrecord __xdrrec_endofrecord -#define xdrrec_skiprecord __xdrrec_skiprecord -#define xdr_callhdr __xdr_callhdr -#define xdr_replymsg __xdr_replymsg -#define xdr_opaque_auth __xdr_opaque_auth -#define xdrmem_create __xdrmem_create -#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 fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -78,14 +60,34 @@ #include <rpc/pmap_clnt.h> #ifdef USE_IN_LIBIO # include <wchar.h> +libc_hidden_proto(fwprintf) #endif -extern u_long _create_xid (void) attribute_hidden; +libc_hidden_proto(strlen) +libc_hidden_proto(memcpy) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(getpid) +libc_hidden_proto(authnone_create) +libc_hidden_proto(xdrrec_create) +libc_hidden_proto(xdrrec_endofrecord) +libc_hidden_proto(xdrrec_skiprecord) +libc_hidden_proto(xdr_callhdr) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(_seterr_reply) +libc_hidden_proto(setsockopt) +libc_hidden_proto(connect) +libc_hidden_proto(recvmsg) +libc_hidden_proto(sendmsg) +libc_hidden_proto(poll) +libc_hidden_proto(fputs) +libc_hidden_proto(__rpc_thread_createerr) -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +extern u_long _create_xid (void) attribute_hidden; #define MCALL_MSG_SIZE 24 @@ -137,8 +139,8 @@ static struct clnt_ops unix_ops = * NB: The rpch->cl_auth is set null authentication. Caller may wish to set this * something more useful. */ -CLIENT attribute_hidden * -__clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, +CLIENT * +clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, int *sockp, u_int sendsz, u_int recvsz) { CLIENT *h; @@ -152,7 +154,7 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, struct rpc_createerr *ce = &get_rpc_createerr (); #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("clntunix_create: out of memory\n")); else #endif @@ -167,8 +169,8 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, */ if (*sockp < 0) { - *sockp = __socket (AF_UNIX, SOCK_STREAM, 0); - len = __strlen (raddr->sun_path) + sizeof (raddr->sun_family) + 1; + *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) { @@ -176,7 +178,7 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, ce->cf_stat = RPC_SYSTEMERROR; ce->cf_error.re_errno = errno; if (*sockp != -1) - __close (*sockp); + close (*sockp); goto fooy; } ct->ct_closeit = TRUE; @@ -210,7 +212,7 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, if (!xdr_callhdr (&(ct->ct_xdrs), &call_msg)) { if (ct->ct_closeit) - __close (*sockp); + close (*sockp); goto fooy; } ct->ct_mpos = XDR_GETPOS (&(ct->ct_xdrs)); @@ -235,7 +237,8 @@ fooy: mem_free ((caddr_t) h, sizeof (CLIENT)); return (CLIENT *) NULL; } -strong_alias(__clntunix_create,clntunix_create) +libc_hidden_proto(clntunix_create) +libc_hidden_def(clntunix_create) static enum clnt_stat clntunix_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) @@ -457,7 +460,7 @@ clntunix_destroy (CLIENT *h) if (ct->ct_closeit) { - (void) __close (ct->ct_sock); + (void) close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); mem_free ((caddr_t) ct, sizeof (struct ct_data)); @@ -526,11 +529,11 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = __getpid (); + cred.pid = getpid (); cred.uid = geteuid (); cred.gid = getegid (); - __memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); + memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_CREDENTIALS; cmsg->cmsg_len = sizeof(*cmsg) + sizeof(struct ucred); diff --git a/libc/inet/rpc/create_xid.c b/libc/inet/rpc/create_xid.c index 69b83ff59..3527eef17 100644 --- a/libc/inet/rpc/create_xid.c +++ b/libc/inet/rpc/create_xid.c @@ -17,10 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define lrand48_r __lrand48_r -#define srand48_r __srand48_r -#define gettimeofday __gettimeofday - #define __FORCE_GLIBC #include <features.h> @@ -29,6 +25,10 @@ #include <sys/time.h> #include <rpc/rpc.h> +libc_hidden_proto(lrand48_r) +libc_hidden_proto(srand48_r) +libc_hidden_proto(gettimeofday) + /* The RPC code is not threadsafe, but new code should be threadsafe. */ #ifdef __UCLIBC_HAS_THREADS__ diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c index 45fbe359f..a6ba07811 100644 --- a/libc/inet/rpc/get_myaddress.c +++ b/libc/inet/rpc/get_myaddress.c @@ -50,6 +50,12 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; #include <netinet/in.h> #include <arpa/inet.h> +libc_hidden_proto(ioctl) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(perror) +libc_hidden_proto(exit) + /* * don't use gethostbyname, which would invoke yellow pages * @@ -65,17 +71,17 @@ 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); + 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); + perror (_("get_myaddress: ioctl (get interface configuration)")); + exit (1); } again: @@ -83,10 +89,10 @@ 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); + perror ("get_myaddress: ioctl"); + exit (1); } if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET) && (!(ifreq.ifr_flags & IFF_LOOPBACK) || @@ -94,7 +100,7 @@ get_myaddress (struct sockaddr_in *addr) { *addr = *((struct sockaddr_in *) &ifr->ifr_addr); addr->sin_port = htons (PMAPPORT); - __close (s); + close (s); return; } ifr++; @@ -104,5 +110,5 @@ get_myaddress (struct sockaddr_in *addr) loopback = 1; goto again; } - __close (s); + close (s); } diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index 100469879..83dcc7e78 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -33,10 +33,6 @@ * Copyright (c) 1985 by Sun Microsystems, Inc. */ -#define atoi __atoi -#define rewind __rewind -#define fgets __fgets - #define __FORCE_GLIBC #include <features.h> #include <stdio.h> @@ -48,6 +44,17 @@ #include <arpa/inet.h> #include <errno.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(atoi) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets) + /* * Internet version. */ @@ -77,7 +84,7 @@ static struct rpcdata *_rpcdata(void) return d; } -void attribute_hidden __endrpcent(void) +void endrpcent(void) { register struct rpcdata *d = _rpcdata(); @@ -94,9 +101,10 @@ void attribute_hidden __endrpcent(void) d->rpcf = NULL; } } -strong_alias(__endrpcent,endrpcent) +libc_hidden_proto(endrpcent) +libc_hidden_def(endrpcent) -void attribute_hidden __setrpcent(int f) +void setrpcent(int f) { register struct rpcdata *d = _rpcdata(); @@ -111,7 +119,8 @@ void attribute_hidden __setrpcent(int f) d->current = NULL; d->stayopen |= f; } -strong_alias(__setrpcent,setrpcent) +libc_hidden_proto(setrpcent) +libc_hidden_def(setrpcent) static struct rpcent *interpret(struct rpcdata *); @@ -122,7 +131,7 @@ static struct rpcent *__get_next_rpcent(struct rpcdata *d) return interpret(d); } -struct rpcent attribute_hidden *__getrpcent(void) +struct rpcent *getrpcent(void) { register struct rpcdata *d = _rpcdata(); @@ -132,51 +141,54 @@ struct rpcent attribute_hidden *__getrpcent(void) return NULL; return __get_next_rpcent(d); } -strong_alias(__getrpcent,getrpcent) +libc_hidden_proto(getrpcent) +libc_hidden_def(getrpcent) -struct rpcent attribute_hidden *__getrpcbynumber(register int number) +struct rpcent *getrpcbynumber(register int number) { register struct rpcdata *d = _rpcdata(); register struct rpcent *rpc; if (d == NULL) return NULL; - __setrpcent(0); - while ((rpc = __getrpcent())) { + setrpcent(0); + while ((rpc = getrpcent())) { if (rpc->r_number == number) break; } - __endrpcent(); + endrpcent(); return rpc; } -strong_alias(__getrpcbynumber,getrpcbynumber) +libc_hidden_proto(getrpcbynumber) +libc_hidden_def(getrpcbynumber) -struct rpcent attribute_hidden *__getrpcbyname(const char *name) +struct rpcent *getrpcbyname(const char *name) { struct rpcent *rpc; char **rp; - __setrpcent(0); - while ((rpc = __getrpcent())) { - if (__strcmp(rpc->r_name, name) == 0) + setrpcent(0); + while ((rpc = getrpcent())) { + if (strcmp(rpc->r_name, name) == 0) return rpc; for (rp = rpc->r_aliases; *rp != NULL; rp++) { - if (__strcmp(*rp, name) == 0) + if (strcmp(*rp, name) == 0) return rpc; } } - __endrpcent(); + endrpcent(); return NULL; } -strong_alias(__getrpcbyname,getrpcbyname) +libc_hidden_proto(getrpcbyname) +libc_hidden_def(getrpcbyname) #ifdef __linux__ static char *firstwhite(char *s) { char *s1, *s2; - s1 = __strchr(s, ' '); - s2 = __strchr(s, '\t'); + s1 = strchr(s, ' '); + s2 = strchr(s, '\t'); if (s1) { if (s2) return (s1 < s2) ? s1 : s2; @@ -193,12 +205,12 @@ static struct rpcent *interpret(register struct rpcdata *d) register char *cp, **q; p = d->line; - d->line[__strlen(p)-1] = '\n'; + d->line[strlen(p)-1] = '\n'; if (*p == '#') return __get_next_rpcent(d); - cp = __strchr(p, '#'); + cp = strchr(p, '#'); if (cp == NULL) { - cp = __strchr(p, '\n'); + cp = strchr(p, '\n'); if (cp == NULL) return __get_next_rpcent(d); } @@ -209,9 +221,9 @@ static struct rpcent *interpret(register struct rpcdata *d) else return __get_next_rpcent(d); #else - cp = __strchr(p, ' '); + cp = strchr(p, ' '); if (cp == NULL) { - cp = __strchr(p, '\t'); + cp = strchr(p, '\t'); if (cp == NULL) return __get_next_rpcent(d); } @@ -227,11 +239,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = __strchr(p, ' '); + cp = strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = __strchr(p, '\t'); + cp = strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } @@ -247,11 +259,11 @@ static struct rpcent *interpret(register struct rpcdata *d) if ((cp = firstwhite(cp))) *cp++ = '\0'; #else - cp = __strchr(p, ' '); + cp = strchr(p, ' '); if (cp != NULL) *cp++ = '\0'; else { - cp = __strchr(p, '\t'); + cp = strchr(p, '\t'); if (cp != NULL) *cp++ = '\0'; } @@ -281,8 +293,8 @@ static int __copy_rpcent(struct rpcent *r, struct rpcent *result_buf, char *buff return ENOENT; /* copy the struct from the shared mem */ - __memset(result_buf, 0x00, sizeof(*result_buf)); - __memset(buffer, 0x00, buflen); + memset(result_buf, 0x00, sizeof(*result_buf)); + memset(buffer, 0x00, buflen); result_buf->r_number = r->r_number; @@ -299,21 +311,21 @@ static int __copy_rpcent(struct rpcent *r, struct rpcent *result_buf, char *buff buflen -= s; while (i-- > 0) { - s = __strlen(r->r_aliases[i]) + 1; + s = strlen(r->r_aliases[i]) + 1; if (buflen < s) goto err_out; result_buf->r_aliases[i] = buffer; buffer += s; buflen -= s; - __memcpy(result_buf->r_aliases[i], r->r_aliases[i], s); + memcpy(result_buf->r_aliases[i], r->r_aliases[i], s); } /* copy the name */ - i = __strlen(r->r_name); + i = strlen(r->r_name); if (buflen <= i) goto err_out; result_buf->r_name = buffer; - __memcpy(result_buf->r_name, r->r_name, i); + memcpy(result_buf->r_name, r->r_name, i); /* that was a hoot eh ? */ *result = result_buf; @@ -328,7 +340,7 @@ int getrpcbynumber_r(int number, struct rpcent *result_buf, char *buffer, { int ret; LOCK; - ret = __copy_rpcent(__getrpcbynumber(number), result_buf, buffer, buflen, result); + ret = __copy_rpcent(getrpcbynumber(number), result_buf, buffer, buflen, result); UNLOCK; return ret; } @@ -338,7 +350,7 @@ int getrpcbyname_r(const char *name, struct rpcent *result_buf, char *buffer, { int ret; LOCK; - ret = __copy_rpcent(__getrpcbyname(name), result_buf, buffer, buflen, result); + ret = __copy_rpcent(getrpcbyname(name), result_buf, buffer, buflen, result); UNLOCK; return ret; } @@ -348,7 +360,7 @@ int getrpcent_r(struct rpcent *result_buf, char *buffer, { int ret; LOCK; - ret = __copy_rpcent(__getrpcent(), result_buf, buffer, buflen, result); + ret = __copy_rpcent(getrpcent(), result_buf, buffer, buflen, result); UNLOCK; return ret; } diff --git a/libc/inet/rpc/getrpcport.c b/libc/inet/rpc/getrpcport.c index 48e58d9ab..82fa8d17a 100644 --- a/libc/inet/rpc/getrpcport.c +++ b/libc/inet/rpc/getrpcport.c @@ -35,9 +35,6 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; * Copyright (c) 1985 by Sun Microsystems, Inc. */ -#define pmap_getport __pmap_getport -#define gethostbyname_r __gethostbyname_r - #define __FORCE_GLIBC #include <features.h> @@ -51,6 +48,10 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; #include <rpc/pmap_clnt.h> #include <sys/socket.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(pmap_getport) +libc_hidden_proto(gethostbyname_r) + int getrpcport (const char *host, u_long prognum, u_long versnum, u_int proto) { @@ -73,7 +74,7 @@ getrpcport (const char *host, u_long prognum, u_long versnum, u_int proto) buffer = alloca (buflen); } - __memcpy ((char *) &addr.sin_addr, hp->h_addr, hp->h_length); + memcpy ((char *) &addr.sin_addr, hp->h_addr, hp->h_length); addr.sin_family = AF_INET; addr.sin_port = 0; return pmap_getport (&addr, prognum, versnum, proto); diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 0c233dd19..8fe014186 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -34,10 +34,6 @@ * Client interface to pmap rpc service. */ -#define clnt_perror __clnt_perror -#define clntudp_bufcreate __clntudp_bufcreate -#define xdr_bool __xdr_bool - #define __FORCE_GLIBC #include <features.h> @@ -52,6 +48,15 @@ #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> +libc_hidden_proto(ioctl) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(perror) +libc_hidden_proto(exit) +libc_hidden_proto(clnt_perror) +libc_hidden_proto(clntudp_bufcreate) +libc_hidden_proto(xdr_bool) + /* * Same as get_myaddress, but we try to use the loopback * interface. portmap caches interfaces, and on DHCP clients, @@ -66,17 +71,17 @@ __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); + 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); + perror (_("__get_myaddress: ioctl (get interface configuration)")); + exit (1); } again: @@ -84,17 +89,17 @@ __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); + perror ("__get_myaddress: ioctl"); + exit (1); } if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET) && ((ifreq.ifr_flags & IFF_LOOPBACK) || (loopback == 0))) { *addr = *((struct sockaddr_in *) &ifr->ifr_addr); addr->sin_port = htons (PMAPPORT); - __close (s); + close (s); return TRUE; } ifr++; @@ -104,7 +109,7 @@ __get_myaddress (struct sockaddr_in *addr) loopback = 0; goto again; } - __close (s); + close (s); return FALSE; } @@ -116,8 +121,8 @@ static const struct timeval tottimeout = {60, 0}; * Set a mapping between program,version and port. * Calls the pmap service remotely to do the mapping. */ -bool_t attribute_hidden -__pmap_set (u_long program, u_long version, int protocol, u_short port) +bool_t +pmap_set (u_long program, u_long version, int protocol, u_short port) { struct sockaddr_in myaddress; int socket = -1; @@ -143,17 +148,18 @@ __pmap_set (u_long program, u_long version, int protocol, u_short port) return FALSE; } CLNT_DESTROY (client); - /* (void)__close(socket); CLNT_DESTROY closes it */ + /* (void)close(socket); CLNT_DESTROY closes it */ return rslt; } -strong_alias(__pmap_set,pmap_set) +libc_hidden_proto(pmap_set) +libc_hidden_def(pmap_set) /* * Remove the mapping between program,version and port. * Calls the pmap service remotely to do the un-mapping. */ -bool_t attribute_hidden -__pmap_unset (u_long program, u_long version) +bool_t +pmap_unset (u_long program, u_long version) { struct sockaddr_in myaddress; int socket = -1; @@ -173,7 +179,8 @@ __pmap_unset (u_long program, u_long version) CLNT_CALL (client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, tottimeout); CLNT_DESTROY (client); - /* (void)__close(socket); CLNT_DESTROY already closed it */ + /* (void)close(socket); CLNT_DESTROY already closed it */ return rslt; } -strong_alias(__pmap_unset,pmap_unset) +libc_hidden_proto(pmap_unset) +libc_hidden_def(pmap_unset) diff --git a/libc/inet/rpc/pmap_getmaps.c b/libc/inet/rpc/pmap_getmaps.c index 84736e03e..1ea3052ab 100644 --- a/libc/inet/rpc/pmap_getmaps.c +++ b/libc/inet/rpc/pmap_getmaps.c @@ -39,9 +39,6 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define clnt_perror __clnt_perror -#define clnttcp_create __clnttcp_create - #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> @@ -50,6 +47,9 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro"; #include <stdio.h> #include <errno.h> +libc_hidden_proto(clnt_perror) +libc_hidden_proto(clnttcp_create) + /* * Get a copy of the current port maps. * Calls the pmap service remotely to do get the maps. diff --git a/libc/inet/rpc/pmap_getport.c b/libc/inet/rpc/pmap_getport.c index b47baf35c..c841ee9ef 100644 --- a/libc/inet/rpc/pmap_getport.c +++ b/libc/inet/rpc/pmap_getport.c @@ -38,17 +38,13 @@ static char sccsid[] = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define clntudp_bufcreate __clntudp_bufcreate - #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> #include <sys/socket.h> -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +libc_hidden_proto(clntudp_bufcreate) +libc_hidden_proto(__rpc_thread_createerr) static const struct timeval timeout = {5, 0}; @@ -60,8 +56,8 @@ static const struct timeval tottimeout = * Calls the pmap service remotely to do the lookup. * Returns 0 if no map exists. */ -u_short attribute_hidden -__pmap_getport (struct sockaddr_in *address, u_long program, u_long version, u_int protocol) +u_short +pmap_getport (struct sockaddr_in *address, u_long program, u_long version, u_int protocol) { u_short port = 0; int socket = -1; @@ -95,4 +91,5 @@ __pmap_getport (struct sockaddr_in *address, u_long program, u_long version, u_i address->sin_port = 0; return port; } -strong_alias(__pmap_getport,pmap_getport) +libc_hidden_proto(pmap_getport) +libc_hidden_def(pmap_getport) diff --git a/libc/inet/rpc/pmap_prot.c b/libc/inet/rpc/pmap_prot.c index 388c8aeee..29f142ffa 100644 --- a/libc/inet/rpc/pmap_prot.c +++ b/libc/inet/rpc/pmap_prot.c @@ -38,12 +38,11 @@ static char sccsid[] = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define xdr_u_long __xdr_u_long - #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/pmap_prot.h> +libc_hidden_proto(xdr_u_long) bool_t xdr_pmap (xdrs, regs) diff --git a/libc/inet/rpc/pmap_prot2.c b/libc/inet/rpc/pmap_prot2.c index 655400f0c..187b19e8c 100644 --- a/libc/inet/rpc/pmap_prot2.c +++ b/libc/inet/rpc/pmap_prot2.c @@ -38,13 +38,12 @@ static char sccsid[] = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define xdr_bool __xdr_bool -#define xdr_reference __xdr_reference - #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/pmap_prot.h> +libc_hidden_proto(xdr_bool) +libc_hidden_proto(xdr_reference) /* * What is going on with linked lists? (!) diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index dbba18378..9271bffd7 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -39,20 +39,6 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define authunix_create_default __authunix_create_default -#define xdrmem_create __xdrmem_create -#define xdr_callmsg __xdr_callmsg -#define xdr_replymsg __xdr_replymsg -#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> @@ -73,6 +59,27 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; #include <arpa/inet.h> #define MAX_BROADCAST_SIZE 1400 +libc_hidden_proto(memset) +libc_hidden_proto(ioctl) +libc_hidden_proto(perror) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(authunix_create_default) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_callmsg) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xdr_reference) +libc_hidden_proto(xdr_u_long) +libc_hidden_proto(inet_makeaddr) +libc_hidden_proto(inet_netof) +libc_hidden_proto(clntudp_create) +libc_hidden_proto(setsockopt) +libc_hidden_proto(recvfrom) +libc_hidden_proto(sendto) +libc_hidden_proto(poll) +libc_hidden_proto(fprintf) + + extern u_long _create_xid (void) attribute_hidden; static const struct timeval timeout = {3, 0}; @@ -81,8 +88,8 @@ static const struct timeval timeout = {3, 0}; * XDR remote call arguments * written for XDR_ENCODE direction only */ -bool_t attribute_hidden -__xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) +bool_t +xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) { u_int lenposition, argposition, position; @@ -106,7 +113,8 @@ __xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) } return FALSE; } -strong_alias(__xdr_rmtcall_args,xdr_rmtcall_args) +libc_hidden_proto(xdr_rmtcall_args) +libc_hidden_def(xdr_rmtcall_args) /* * pmapper remote-call-service interface. @@ -142,7 +150,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p r.port_ptr = port_ptr; r.results_ptr = resp; r.xdr_results = xdrres; - stat = CLNT_CALL (client, PMAPPROC_CALLIT, (xdrproc_t)__xdr_rmtcall_args, + stat = CLNT_CALL (client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a, (xdrproc_t)xdr_rmtcallres, (caddr_t)&r, tout); CLNT_DESTROY (client); @@ -151,7 +159,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p { stat = RPC_FAILED; } - /* (void)__close(socket); CLNT_DESTROY already closed it */ + /* (void)close(socket); CLNT_DESTROY already closed it */ addr->sin_port = 0; return stat; } @@ -198,18 +206,18 @@ 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)")); + perror (_("broadcast: ioctl (get interface configuration)")); return (0); } ifr = ifc.ifc_req; 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)")); + perror (_("broadcast: ioctl (get interface flags)")); continue; } if ((ifreq.ifr_flags & IFF_BROADCAST) && @@ -218,7 +226,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 @@ -277,16 +285,16 @@ 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")); + perror (_("Cannot create socket for broadcast rpc")); stat = RPC_CANTSEND; goto done_broad; } #ifdef SO_BROADCAST if (setsockopt (sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) { - __perror (_("Cannot set socket option SO_BROADCAST")); + perror (_("Cannot set socket option SO_BROADCAST")); stat = RPC_CANTSEND; goto done_broad; } @@ -294,7 +302,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) fd.fd = sock; fd.events = POLLIN; nets = getbroadcastnets (addrs, sock, inbuf); - __memset ((char *) &baddr, 0, sizeof (baddr)); + memset ((char *) &baddr, 0, sizeof (baddr)); baddr.sin_family = AF_INET; baddr.sin_port = htons (PMAPPORT); baddr.sin_addr.s_addr = htonl (INADDR_ANY); @@ -317,7 +325,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) r.xdr_results = xresults; r.results_ptr = resultsp; xdrmem_create (xdrs, outbuf, MAX_BROADCAST_SIZE, XDR_ENCODE); - if ((!xdr_callmsg (xdrs, &msg)) || (!__xdr_rmtcall_args (xdrs, &a))) + if ((!xdr_callmsg (xdrs, &msg)) || (!xdr_rmtcall_args (xdrs, &a))) { stat = RPC_CANTENCODEARGS; goto done_broad; @@ -337,7 +345,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) (struct sockaddr *) &baddr, sizeof (struct sockaddr)) != outlen) { - __perror (_("Cannot send broadcast packet")); + perror (_("Cannot send broadcast packet")); stat = RPC_CANTSEND; goto done_broad; } @@ -362,7 +370,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) case -1: /* some kind of error */ if (errno == EINTR) goto recv_again; - __perror (_("Broadcast poll problem")); + perror (_("Broadcast poll problem")); stat = RPC_CANTRECV; goto done_broad; @@ -375,7 +383,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) { if (errno == EINTR) goto try_again; - __perror (_("Cannot receive reply to broadcast")); + perror (_("Cannot receive reply to broadcast")); stat = RPC_CANTRECV; goto done_broad; } @@ -422,7 +430,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) } } done_broad: - (void) __close (sock); + (void) close (sock); AUTH_DESTROY (unix_auth); return stat; } diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index c76cf1ca7..4bdc8b3bc 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -35,28 +35,6 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #endif /* LIBC_SCCS and not lint */ -#define bcopy __bcopy -#define sysconf __sysconf -#define getline __getline -#define geteuid __geteuid -#define seteuid __seteuid -#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> @@ -79,9 +57,52 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include <netinet/in.h> #include <arpa/inet.h> - -extern int __rresvport(int *alport) attribute_hidden; -extern int __getc_unlocked (FILE *__stream) attribute_hidden; +libc_hidden_proto(memcmp) +libc_hidden_proto(strcat) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(strncmp) +libc_hidden_proto(strnlen) +libc_hidden_proto(bcopy) +libc_hidden_proto(getpid) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(fcntl) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(perror) +libc_hidden_proto(lstat) +libc_hidden_proto(fstat) +libc_hidden_proto(tolower) +libc_hidden_proto(sysconf) +libc_hidden_proto(getline) +libc_hidden_proto(geteuid) +libc_hidden_proto(seteuid) +libc_hidden_proto(getpwnam_r) +libc_hidden_proto(gethostbyname) +libc_hidden_proto(gethostbyname_r) +libc_hidden_proto(fileno) +libc_hidden_proto(sleep) +libc_hidden_proto(inet_addr) +libc_hidden_proto(inet_ntoa) +libc_hidden_proto(herror) +libc_hidden_proto(bind) +libc_hidden_proto(connect) +libc_hidden_proto(sigblock) +libc_hidden_proto(snprintf) +libc_hidden_proto(poll) +libc_hidden_proto(accept) +libc_hidden_proto(listen) +libc_hidden_proto(sigsetmask) +libc_hidden_proto(getc_unlocked) +libc_hidden_proto(__fgetc_unlocked) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fprintf) + +libc_hidden_proto(rresvport) /* some forward declarations */ static int __ivaliduser2(FILE *hostf, u_int32_t raddr, @@ -110,7 +131,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) int s, lport, timo; char c; - pid = __getpid(); + pid = getpid(); #ifdef __UCLIBC_HAS_REENTRANT_RPC__ hstbuflen = 1024; @@ -160,7 +181,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, @@ -170,14 +191,14 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) sigsetmask(oldmask); /* sigsetmask */ return -1; } - __fcntl(s, F_SETOWN, pid); /* __fcntl */ + fcntl(s, F_SETOWN, pid); sin.sin_family = hp->h_addrtype; bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN (sizeof (sin.sin_addr), hp->h_length)); sin.sin_port = rport; if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) /* __connect */ break; - (void)__close(s); + (void)close(s); if (errno == EADDRINUSE) { lport--; continue; @@ -193,7 +214,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) (void)fprintf(stderr, "connect to address %s: ", inet_ntoa(sin.sin_addr)); __set_errno (oerrno); - __perror(0); + perror(0); hp->h_addr_list++; bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN (sizeof (sin.sin_addr), hp->h_length)); @@ -207,21 +228,21 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) } lport--; if (fd2p == 0) { - __write(s, "", 1); + write(s, "", 1); lport = 0; } else { char num[8]; - int s2 = __rresvport(&lport), s3; + int s2 = rresvport(&lport), s3; socklen_t len = sizeof(from); if (s2 < 0) goto bad; listen(s2, 1); (void)snprintf(num, sizeof(num), "%d", lport); /* __snprintf */ - if (__write(s, num, __strlen(num)+1) != __strlen(num)+1) { + if (write(s, num, strlen(num)+1) != strlen(num)+1) { (void)fprintf(stderr, "rcmd: write (setting up stderr): %m\n"); - (void)__close(s2); + (void)close(s2); goto bad; } pfd[0].fd = s; @@ -232,11 +253,11 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) (void)fprintf(stderr, "rcmd: poll (setting up stderr): %m\n"); else (void)fprintf(stderr, "poll: protocol failure in circuit setup\n"); - (void)__close(s2); + (void)close(s2); goto bad; } s3 = accept(s2, (struct sockaddr *)&from, &len); - (void)__close(s2); + (void)close(s2); if (s3 < 0) { (void)fprintf(stderr, "rcmd: accept: %m\n"); @@ -253,17 +274,17 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) goto bad2; } } - (void)__write(s, locuser, __strlen(locuser)+1); - (void)__write(s, remuser, __strlen(remuser)+1); - (void)__write(s, cmd, __strlen(cmd)+1); - if (__read(s, &c, 1) != 1) { + (void)write(s, locuser, strlen(locuser)+1); + (void)write(s, remuser, strlen(remuser)+1); + (void)write(s, cmd, strlen(cmd)+1); + if (read(s, &c, 1) != 1) { (void)fprintf(stderr, "rcmd: %s: %m\n", *ahost); goto bad2; } if (c != 0) { - while (__read(s, &c, 1) == 1) { - (void)__write(STDERR_FILENO, &c, 1); + while (read(s, &c, 1) == 1) { + (void)write(STDERR_FILENO, &c, 1); if (c == '\n') break; } @@ -273,21 +294,21 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) return s; bad2: if (lport) - (void)__close(*fd2p); + (void)close(*fd2p); bad: - (void)__close(s); + (void)close(s); sigsetmask(oldmask); return -1; } -int attribute_hidden __rresvport(int *alport) +int 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 (;;) { @@ -295,12 +316,12 @@ int attribute_hidden __rresvport(int *alport) if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) return s; if (errno != EADDRINUSE) { - (void)__close(s); + (void)close(s); return -1; } (*alport)--; if (*alport == IPPORT_RESERVED/2) { - (void)__close(s); + (void)close(s); __set_errno (EAGAIN); /* close */ return -1; } @@ -308,7 +329,7 @@ int attribute_hidden __rresvport(int *alport) return -1; } -strong_alias(__rresvport,rresvport) +libc_hidden_def(rresvport) static int __check_rhosts_file = 1; static char *__rcmd_errstr; @@ -386,7 +407,7 @@ iruserfopen (char *file, uid_t okuser) root, if writeable by anyone but the owner, or if hardlinked anywhere, quit. */ cp = NULL; - if (__lstat (file, &st)) + if (lstat (file, &st)) cp = "lstat failed"; else if (!S_ISREG (st.st_mode)) cp = "not regular file"; @@ -395,7 +416,7 @@ iruserfopen (char *file, uid_t okuser) res = fopen (file, "r"); if (!res) cp = "cannot open"; - else if (__fstat (fileno (res), &st) < 0) + else if (fstat (fileno (res), &st) < 0) cp = "fstat failed"; else if (st.st_uid && st.st_uid != okuser) cp = "bad owner"; @@ -478,10 +499,10 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) return -1; #endif - dirlen = __strlen (pwd->pw_dir); + dirlen = strlen (pwd->pw_dir); pbuf = malloc (dirlen + sizeof "/.rhosts"); - __strcpy (pbuf, pwd->pw_dir); - __strcat (pbuf, "/.rhosts"); + strcpy (pbuf, pwd->pw_dir); + strcat (pbuf, "/.rhosts"); /* Change effective uid while reading .rhosts. If root and reading an NFS mounted file system, can't read files that @@ -546,18 +567,18 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) #ifdef HAVE_NETGROUP /* Check nis netgroup. */ - if (__strncmp ("+@", lhost, 2) == 0) + if (strncmp ("+@", lhost, 2) == 0) return innetgr (&lhost[2], rhost, NULL, NULL); - if (__strncmp ("-@", lhost, 2) == 0) + if (strncmp ("-@", lhost, 2) == 0) return -innetgr (&lhost[2], rhost, NULL, NULL); #endif /* HAVE_NETGROUP */ /* -host */ - if (__strncmp ("-", lhost,1) == 0) { + if (strncmp ("-", lhost,1) == 0) { negate = -1; lhost++; - } else if (__strcmp ("+",lhost) == 0) { + } else if (strcmp ("+",lhost) == 0) { return 1; /* asking for trouble, but ok.. */ } @@ -587,7 +608,7 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) /* Spin through ip addresses. */ for (pp = hp->h_addr_list; *pp; ++pp) - if (!__memcmp (&raddr, *pp, sizeof (u_int32_t))) + if (!memcmp (&raddr, *pp, sizeof (u_int32_t))) return negate; /* No match. */ @@ -606,23 +627,23 @@ __icheckuser (const char *luser, const char *ruser) #ifdef HAVE_NETGROUP /* [-+]@netgroup */ - if (__strncmp ("+@", luser, 2) == 0) + if (strncmp ("+@", luser, 2) == 0) return innetgr (&luser[2], NULL, ruser, NULL); - if (__strncmp ("-@", luser,2) == 0) + if (strncmp ("-@", luser,2) == 0) return -innetgr (&luser[2], NULL, ruser, NULL); #endif /* HAVE_NETGROUP */ /* -user */ - if (__strncmp ("-", luser, 1) == 0) - return -(__strcmp (&luser[1], ruser) == 0); + if (strncmp ("-", luser, 1) == 0) + return -(strcmp (&luser[1], ruser) == 0); /* + */ - if (__strcmp ("+", luser) == 0) + if (strcmp ("+", luser) == 0) return 1; /* simple string match */ - return __strcmp (ruser, luser) == 0; + return strcmp (ruser, luser) == 0; } /* @@ -664,16 +685,16 @@ __ivaliduser2(hostf, raddr, luser, ruser, rhost) } /* Skip lines that are too long. */ - if (__strchr (p, '\n') == NULL) { - int ch = __getc_unlocked (hostf); + if (strchr (p, '\n') == NULL) { + int ch = getc_unlocked (hostf); while (ch != '\n' && ch != EOF) - ch = __getc_unlocked (hostf); + ch = getc_unlocked (hostf); continue; } for (;*p && !isspace(*p); ++p) { - *p = __tolower (*p); + *p = tolower (*p); } /* Next we want to find the permitted name for the remote user. */ diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index a90776fc4..305eaffff 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -27,17 +27,6 @@ * SUCH DAMAGE. */ -#define getsockname __getsockname -#define getnameinfo __getnameinfo -#define getaddrinfo __getaddrinfo -#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> #include <sys/types.h> @@ -53,15 +42,36 @@ #include <string.h> #include <unistd.h> +libc_hidden_proto(memset) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(close) +libc_hidden_proto(socket) +libc_hidden_proto(perror) +libc_hidden_proto(sprintf) +libc_hidden_proto(snprintf) +libc_hidden_proto(getsockname) +libc_hidden_proto(getnameinfo) +libc_hidden_proto(getaddrinfo) +libc_hidden_proto(freeaddrinfo) +libc_hidden_proto(sleep) +libc_hidden_proto(atoi) +libc_hidden_proto(connect) +libc_hidden_proto(accept) +libc_hidden_proto(listen) + #define SA_LEN(_x) __libc_sa_len((_x)->sa_family) extern int __libc_sa_len (sa_family_t __af) __THROW attribute_hidden; int rexecoptions; char ahostbuf[NI_MAXHOST] attribute_hidden; -extern int __ruserpass(const char *host, const char **aname, const char **apass) attribute_hidden; +extern int ruserpass(const char *host, const char **aname, const char **apass) attribute_hidden; +libc_hidden_proto(ruserpass) -int attribute_hidden -__rexec_af(char **ahost, int rport, const char *name, const char *pass, const char *cmd, int *fd2p, sa_family_t af) +int +rexec_af(char **ahost, int rport, const char *name, const char *pass, const char *cmd, int *fd2p, sa_family_t af) { struct sockaddr_storage sa2, from; struct addrinfo hints, *res0; @@ -76,7 +86,7 @@ __rexec_af(char **ahost, int rport, const char *name, const char *pass, const ch snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport)); servbuff[sizeof(servbuff) - 1] = '\0'; - __memset(&hints, 0, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; @@ -87,51 +97,51 @@ __rexec_af(char **ahost, int rport, const char *name, const char *pass, const ch } if (res0->ai_canonname){ - __strncpy(ahostbuf, res0->ai_canonname, sizeof(ahostbuf)); + strncpy(ahostbuf, res0->ai_canonname, sizeof(ahostbuf)); ahostbuf[sizeof(ahostbuf)-1] = '\0'; *ahost = ahostbuf; } else{ *ahost = NULL; } - __ruserpass(res0->ai_canonname, &name, &pass); + ruserpass(res0->ai_canonname, &name, &pass); retry: - s = __socket(res0->ai_family, res0->ai_socktype, 0); + s = socket(res0->ai_family, res0->ai_socktype, 0); if (s < 0) { - __perror("rexec: socket"); + perror("rexec: socket"); return (-1); } if (connect(s, res0->ai_addr, res0->ai_addrlen) < 0) { if (errno == ECONNREFUSED && timo <= 16) { - (void) __close(s); + (void) close(s); sleep(timo); timo *= 2; goto retry; } - __perror(res0->ai_canonname); + perror(res0->ai_canonname); return (-1); } if (fd2p == 0) { - (void) __write(s, "", 1); + (void) write(s, "", 1); port = 0; } else { 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); + (void) close(s); return (-1); } listen(s2, 1); sa2len = sizeof (sa2); if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) { - __perror("getsockname"); - (void) __close(s2); + perror("getsockname"); + (void) close(s2); goto bad; } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) { __set_errno(EINVAL); - (void) __close(s2); + (void) close(s2); goto bad; } port = 0; @@ -139,23 +149,23 @@ retry: NULL, 0, servbuff, sizeof(servbuff), NI_NUMERICSERV)) port = atoi(servbuff); - (void) __sprintf(num, "%u", port); - (void) __write(s, num, __strlen(num)+1); + (void) sprintf(num, "%u", port); + (void) write(s, num, strlen(num)+1); { socklen_t len = sizeof (from); s3 = accept(s2, (struct sockaddr *)&from, &len); - __close(s2); + close(s2); if (s3 < 0) { - __perror("accept"); + perror("accept"); port = 0; goto bad; } } *fd2p = s3; } - (void) __write(s, name, __strlen(name) + 1); + (void) write(s, name, strlen(name) + 1); /* should public key encypt the password here */ - (void) __write(s, pass, __strlen(pass) + 1); - (void) __write(s, cmd, __strlen(cmd) + 1); + (void) write(s, pass, strlen(pass) + 1); + (void) write(s, cmd, strlen(cmd) + 1); /* We don't need the memory allocated for the name and the password in ruserpass anymore. */ @@ -164,13 +174,13 @@ retry: if (pass != orig_pass) free ((char *) pass); - if (__read(s, &c, 1) != 1) { - __perror(*ahost); + if (read(s, &c, 1) != 1) { + perror(*ahost); goto bad; } if (c != 0) { - while (__read(s, &c, 1) == 1) { - (void) __write(2, &c, 1); + while (read(s, &c, 1) == 1) { + (void) write(2, &c, 1); if (c == '\n') break; } @@ -180,12 +190,13 @@ retry: return (s); bad: if (port) - (void) __close(*fd2p); - (void) __close(s); + (void) close(*fd2p); + (void) close(s); freeaddrinfo(res0); return (-1); } -strong_alias(__rexec_af,rexec_af) +libc_hidden_proto(rexec_af) +libc_hidden_def(rexec_af) int rexec(ahost, rport, name, pass, cmd, fd2p) @@ -194,5 +205,5 @@ rexec(ahost, rport, name, pass, cmd, fd2p) const char *name, *pass, *cmd; int *fd2p; { - return __rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); + return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); } diff --git a/libc/inet/rpc/rpc_callmsg.c b/libc/inet/rpc/rpc_callmsg.c index 6368e5920..5473ba743 100644 --- a/libc/inet/rpc/rpc_callmsg.c +++ b/libc/inet/rpc/rpc_callmsg.c @@ -38,12 +38,6 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; * */ -#define xdr_enum __xdr_enum -#define xdr_opaque __xdr_opaque -#define xdr_u_int __xdr_u_int -#define xdr_u_long __xdr_u_long -#define xdr_opaque_auth __xdr_opaque_auth - #define __FORCE_GLIBC #include <features.h> @@ -51,11 +45,18 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; #include <sys/param.h> #include <rpc/rpc.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(xdr_enum) +libc_hidden_proto(xdr_opaque) +libc_hidden_proto(xdr_u_int) +libc_hidden_proto(xdr_u_long) +libc_hidden_proto(xdr_opaque_auth) + /* * XDR a call message */ -bool_t attribute_hidden -__xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) +bool_t +xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) { int32_t *buf; struct opaque_auth *oa; @@ -91,7 +92,7 @@ __xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - __memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length)); } oa = &cmsg->rm_call.cb_verf; @@ -99,7 +100,7 @@ __xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - __memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); */ @@ -147,7 +148,7 @@ __xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - __memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); @@ -187,7 +188,7 @@ __xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - __memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); /* no real need... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); @@ -210,4 +211,5 @@ __xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) return xdr_opaque_auth (xdrs, &(cmsg->rm_call.cb_verf)); return FALSE; } -strong_alias(__xdr_callmsg,xdr_callmsg) +libc_hidden_proto(xdr_callmsg) +libc_hidden_def(xdr_callmsg) diff --git a/libc/inet/rpc/rpc_dtablesize.c b/libc/inet/rpc/rpc_dtablesize.c index ede7120b3..09e08b48a 100644 --- a/libc/inet/rpc/rpc_dtablesize.c +++ b/libc/inet/rpc/rpc_dtablesize.c @@ -31,8 +31,6 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #endif -#define getdtablesize __getdtablesize - #define __FORCE_GLIBC #define __USE_BSD #include <features.h> @@ -40,12 +38,14 @@ static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; #include <unistd.h> #include <rpc/clnt.h> +libc_hidden_proto(getdtablesize) + /* * Cache the result of getdtablesize(), so we don't have to do an * expensive system call every time. */ -int attribute_hidden -_rpc_dtablesize_internal (void) +int +_rpc_dtablesize(void) { static int size; @@ -54,4 +54,5 @@ _rpc_dtablesize_internal (void) return size; } -strong_alias(_rpc_dtablesize_internal,_rpc_dtablesize) +libc_hidden_proto(_rpc_dtablesize) +libc_hidden_def(_rpc_dtablesize) diff --git a/libc/inet/rpc/rpc_private.h b/libc/inet/rpc/rpc_private.h index d899b401d..15250059a 100644 --- a/libc/inet/rpc/rpc_private.h +++ b/libc/inet/rpc/rpc_private.h @@ -4,10 +4,7 @@ /* Now define the internal interfaces. */ extern u_long _create_xid (void) attribute_hidden; -#undef get_rpc_createerr -extern struct rpc_createerr *__rpc_thread_createerr_internal (void) - __attribute__ ((__const__)) attribute_hidden; -#define get_rpc_createerr() (*__rpc_thread_createerr_internal ()) +libc_hidden_proto(__rpc_thread_createerr) /* * Multi-threaded support diff --git a/libc/inet/rpc/rpc_prot.c b/libc/inet/rpc/rpc_prot.c index ee6c03644..f6453950b 100644 --- a/libc/inet/rpc/rpc_prot.c +++ b/libc/inet/rpc/rpc_prot.c @@ -44,12 +44,6 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; * routines are also in this program. */ -#define xdr_bytes __xdr_bytes -#define xdr_union __xdr_union -#define xdr_enum __xdr_enum -#define xdr_opaque __xdr_opaque -#define xdr_u_long __xdr_u_long - #define __FORCE_GLIBC #include <features.h> @@ -57,14 +51,20 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; #include <rpc/rpc.h> +libc_hidden_proto(xdr_bytes) +libc_hidden_proto(xdr_union) +libc_hidden_proto(xdr_enum) +libc_hidden_proto(xdr_opaque) +libc_hidden_proto(xdr_u_long) + /* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */ /* * XDR an opaque authentication struct * (see auth.h) */ -bool_t attribute_hidden -__xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) +bool_t +xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) { if (xdr_enum (xdrs, &(ap->oa_flavor))) @@ -72,7 +72,8 @@ __xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) &ap->oa_length, MAX_AUTH_BYTES); return FALSE; } -strong_alias(__xdr_opaque_auth,xdr_opaque_auth) +libc_hidden_proto(xdr_opaque_auth) +libc_hidden_def(xdr_opaque_auth) /* * XDR a DES block @@ -92,7 +93,7 @@ bool_t xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar) { /* personalized union, rather than calling xdr_union */ - if (!__xdr_opaque_auth (xdrs, &(ar->ar_verf))) + if (!xdr_opaque_auth (xdrs, &(ar->ar_verf))) return FALSE; if (!xdr_enum (xdrs, (enum_t *) & (ar->ar_stat))) return FALSE; @@ -109,7 +110,8 @@ xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar) } return TRUE; /* TRUE => open ended set of problems */ } -hidden_strong_alias(xdr_accepted_reply,__xdr_accepted_reply) +libc_hidden_proto(xdr_accepted_reply) +libc_hidden_def(xdr_accepted_reply) /* * XDR the MSG_DENIED part of a reply message union @@ -132,19 +134,20 @@ xdr_rejected_reply (XDR *xdrs, struct rejected_reply *rr) } return FALSE; } -hidden_strong_alias(xdr_rejected_reply,__xdr_rejected_reply) +libc_hidden_proto(xdr_rejected_reply) +libc_hidden_def(xdr_rejected_reply) static const struct xdr_discrim reply_dscrm[3] = { - {(int) MSG_ACCEPTED, (xdrproc_t) __xdr_accepted_reply}, - {(int) MSG_DENIED, (xdrproc_t) __xdr_rejected_reply}, + {(int) MSG_ACCEPTED, (xdrproc_t) xdr_accepted_reply}, + {(int) MSG_DENIED, (xdrproc_t) xdr_rejected_reply}, {__dontcare__, NULL_xdrproc_t}}; /* * XDR a reply message */ -bool_t attribute_hidden -__xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg) +bool_t +xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg) { if (xdr_u_long (xdrs, &(rmsg->rm_xid)) && xdr_enum (xdrs, (enum_t *) & (rmsg->rm_direction)) && @@ -154,7 +157,8 @@ __xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg) NULL_xdrproc_t); return FALSE; } -strong_alias(__xdr_replymsg,xdr_replymsg) +libc_hidden_proto(xdr_replymsg) +libc_hidden_def(xdr_replymsg) /* @@ -162,8 +166,8 @@ strong_alias(__xdr_replymsg,xdr_replymsg) * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. * The rm_xid is not really static, but the user can easily munge on the fly. */ -bool_t attribute_hidden -__xdr_callhdr (XDR *xdrs, struct rpc_msg *cmsg) +bool_t +xdr_callhdr (XDR *xdrs, struct rpc_msg *cmsg) { cmsg->rm_direction = CALL; @@ -177,7 +181,8 @@ __xdr_callhdr (XDR *xdrs, struct rpc_msg *cmsg) return xdr_u_long (xdrs, &(cmsg->rm_call.cb_vers)); return FALSE; } -strong_alias(__xdr_callhdr,xdr_callhdr) +libc_hidden_proto(xdr_callhdr) +libc_hidden_def(xdr_callhdr) /* ************************** Client utility routine ************* */ @@ -242,8 +247,8 @@ rejected (enum reject_stat rjct_stat, /* * given a reply message, fills in the error */ -void attribute_hidden -__seterr_reply (struct rpc_msg *msg, +void +_seterr_reply (struct rpc_msg *msg, struct rpc_err *error) { /* optimized for normal, SUCCESSful case */ @@ -287,4 +292,5 @@ __seterr_reply (struct rpc_msg *msg, break; } } -strong_alias(__seterr_reply,_seterr_reply) +libc_hidden_proto(_seterr_reply) +libc_hidden_def(_seterr_reply) diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c index 4a7d9b044..70ed62262 100644 --- a/libc/inet/rpc/rpc_thread.c +++ b/libc/inet/rpc/rpc_thread.c @@ -1,3 +1,9 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #define __FORCE_GLIBC #include <features.h> #include <stdio.h> @@ -76,8 +82,8 @@ __rpc_thread_variables (void) #undef svc_pollfd #undef svc_max_pollfd -fd_set attribute_hidden * -__rpc_thread_svc_fdset_internal (void) +fd_set * +__rpc_thread_svc_fdset (void) { struct rpc_thread_variables *tvp; @@ -86,10 +92,9 @@ __rpc_thread_svc_fdset_internal (void) return &svc_fdset; return &tvp->svc_fdset_s; } -strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset) -struct rpc_createerr attribute_hidden * -__rpc_thread_createerr_internal (void) +struct rpc_createerr * +__rpc_thread_createerr (void) { struct rpc_thread_variables *tvp; @@ -98,11 +103,9 @@ __rpc_thread_createerr_internal (void) return &rpc_createerr; return &tvp->rpc_createerr_s; } -#undef __rpc_thread_createerr -strong_alias(__rpc_thread_createerr_internal,__rpc_thread_createerr) -struct pollfd attribute_hidden ** -__rpc_thread_svc_pollfd_internal (void) +struct pollfd ** +__rpc_thread_svc_pollfd (void) { struct rpc_thread_variables *tvp; @@ -111,10 +114,9 @@ __rpc_thread_svc_pollfd_internal (void) return &svc_pollfd; return &tvp->svc_pollfd_s; } -strong_alias(__rpc_thread_svc_pollfd_internal,__rpc_thread_svc_pollfd) -int attribute_hidden * -__rpc_thread_svc_max_pollfd_internal (void) +int * +__rpc_thread_svc_max_pollfd (void) { struct rpc_thread_variables *tvp; @@ -123,7 +125,6 @@ __rpc_thread_svc_max_pollfd_internal (void) return &svc_max_pollfd; return &tvp->svc_max_pollfd_s; } -strong_alias(__rpc_thread_svc_max_pollfd_internal,__rpc_thread_svc_max_pollfd) #else #undef svc_fdset @@ -131,34 +132,37 @@ strong_alias(__rpc_thread_svc_max_pollfd_internal,__rpc_thread_svc_max_pollfd) #undef svc_pollfd #undef svc_max_pollfd -fd_set attribute_hidden * __rpc_thread_svc_fdset_internal (void) +fd_set * __rpc_thread_svc_fdset (void) { extern fd_set svc_fdset; return &(svc_fdset); } -strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset) -struct rpc_createerr attribute_hidden * __rpc_thread_createerr_internal (void) +struct rpc_createerr * __rpc_thread_createerr (void) { extern struct rpc_createerr rpc_createerr; return &(rpc_createerr); } -#undef __rpc_thread_createerr -strong_alias(__rpc_thread_createerr_internal,__rpc_thread_createerr) -struct pollfd attribute_hidden ** __rpc_thread_svc_pollfd_internal (void) +struct pollfd ** __rpc_thread_svc_pollfd (void) { extern struct pollfd *svc_pollfd; return &(svc_pollfd); } -strong_alias(__rpc_thread_svc_pollfd_internal,__rpc_thread_svc_pollfd) -int attribute_hidden * __rpc_thread_svc_max_pollfd_internal (void) +int * __rpc_thread_svc_max_pollfd (void) { extern int svc_max_pollfd; return &(svc_max_pollfd); } -strong_alias(__rpc_thread_svc_max_pollfd_internal,__rpc_thread_svc_max_pollfd) #endif /* __UCLIBC_HAS_THREADS__ */ +libc_hidden_proto(__rpc_thread_svc_fdset) +libc_hidden_def(__rpc_thread_svc_fdset) +libc_hidden_proto(__rpc_thread_createerr) +libc_hidden_def(__rpc_thread_createerr) +libc_hidden_proto(__rpc_thread_svc_pollfd) +libc_hidden_def(__rpc_thread_svc_pollfd) +libc_hidden_proto(__rpc_thread_svc_max_pollfd) +libc_hidden_def(__rpc_thread_svc_max_pollfd) diff --git a/libc/inet/rpc/rtime.c b/libc/inet/rpc/rtime.c index b4bbca19c..fc4cfe548 100644 --- a/libc/inet/rpc/rtime.c +++ b/libc/inet/rpc/rtime.c @@ -43,11 +43,6 @@ static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 S * what unix uses. */ -#define connect __connect -#define recvfrom __recvfrom -#define sendto __sendto -#define poll __poll - #define __FORCE_GLIBC #include <features.h> @@ -63,6 +58,14 @@ static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 S #include <errno.h> #include <netinet/in.h> +libc_hidden_proto(read) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(connect) +libc_hidden_proto(recvfrom) +libc_hidden_proto(sendto) +libc_hidden_proto(poll) + #define NYEARS (u_long)(1970 - 1900) #define TOFFSET (u_long)(60*60*24*(365*NYEARS + (NYEARS/4))) @@ -74,7 +77,7 @@ do_close (int s) int save; save = errno; - __close (s); + close (s); __set_errno (save); } @@ -96,7 +99,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); @@ -138,7 +141,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep, do_close (s); return -1; } - res = __read (s, (char *) &thetime, sizeof (thetime)); + res = read (s, (char *) &thetime, sizeof (thetime)); do_close (s); if (res < 0) return (-1); diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index 728ea5bb7..61008b9ec 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -27,14 +27,6 @@ * SUCH DAMAGE. */ -#define __fsetlocking __fsetlocking_internal -#define getgid __getgid -#define getuid __getuid -#define getegid __getegid -#define geteuid __geteuid -#define gethostname __gethostname -#define fileno __fileno - #define __FORCE_GLIBC #include <features.h> #include <sys/types.h> @@ -50,7 +42,27 @@ #include <string.h> #include <unistd.h> -extern int __getc_unlocked (FILE *__stream) attribute_hidden; +libc_hidden_proto(strcat) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(strcasecmp) +libc_hidden_proto(strncasecmp) +libc_hidden_proto(getenv) +libc_hidden_proto(printf) +libc_hidden_proto(fstat) +libc_hidden_proto(__fsetlocking) +libc_hidden_proto(getgid) +libc_hidden_proto(getuid) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(gethostname) +libc_hidden_proto(fileno) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(getc_unlocked) +libc_hidden_proto(__fgetc_unlocked) #define _(X) (X) /* #include "ftp_var.h" */ @@ -101,7 +113,7 @@ static const struct toktab { -int attribute_hidden __ruserpass(const char *host, const char **aname, const char **apass) +int ruserpass(const char *host, const char **aname, const char **apass) { char *hdir, *buf, *tmp; char myname[1024], *mydomain; @@ -111,20 +123,20 @@ int attribute_hidden __ruserpass(const char *host, const char **aname, const cha /* Give up when running a setuid or setgid app. */ if ((getuid() != geteuid()) || getgid() != getegid()) return -1; - hdir = __getenv("HOME"); + hdir = getenv("HOME"); if (hdir == NULL) { /* If we can't get HOME, fail instead of trying ".", which is no improvement. */ return -1; } - buf = alloca (__strlen(hdir) + 8); - __strcpy(buf, hdir); - __strcat(buf, "/.netrc"); + buf = alloca (strlen(hdir) + 8); + strcpy(buf, hdir); + strcat(buf, "/.netrc"); cfile = fopen(buf, "r"); if (cfile == NULL) { if (errno != ENOENT) - __printf("%s", buf); + printf("%s", buf); return (0); } /* No threads use this stream. */ @@ -133,9 +145,9 @@ int attribute_hidden __ruserpass(const char *host, const char **aname, const cha #endif if (gethostname(myname, sizeof(myname)) < 0) myname[0] = '\0'; - mydomain = __strchr(myname, '.'); + mydomain = strchr(myname, '.'); if (mydomain==NULL) { - mydomain=myname + __strlen(myname); + mydomain=myname + strlen(myname); } next: while ((t = token())) switch(t) { @@ -153,11 +165,11 @@ next: * or official hostname. Also allow match of * incompletely-specified host in local domain. */ - if (__strcasecmp(host, tokval) == 0) + if (strcasecmp(host, tokval) == 0) goto match; - if ((tmp = __strchr(host, '.')) != NULL && - __strcasecmp(tmp, mydomain) == 0 && - __strncasecmp(host, tokval, tmp - host) == 0 && + if ((tmp = strchr(host, '.')) != NULL && + strcasecmp(tmp, mydomain) == 0 && + strncasecmp(host, tokval, tmp - host) == 0 && tokval[tmp - host] == '\0') goto match; continue; @@ -169,49 +181,49 @@ next: if (token()) { if (*aname == 0) { char *newp; - newp = malloc((unsigned) __strlen(tokval) + 1); + newp = malloc((unsigned) strlen(tokval) + 1); if (newp == NULL) { - __printf(_("out of memory")); + printf(_("out of memory")); goto bad; } - *aname = __strcpy(newp, tokval); + *aname = strcpy(newp, tokval); } else { - if (__strcmp(*aname, tokval)) + if (strcmp(*aname, tokval)) goto next; } } break; case PASSWD: - if (__strcmp(*aname, "anonymous") && - __fstat(fileno(cfile), &stb) >= 0 && + 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) { char *newp; - newp = malloc((unsigned) __strlen(tokval) + 1); + newp = malloc((unsigned) strlen(tokval) + 1); if (newp == NULL) { - __printf(_("out of memory")); + printf(_("out of memory")); goto bad; } - *apass = __strcpy(newp, tokval); + *apass = strcpy(newp, tokval); } break; case ACCOUNT: #if 0 - if (__fstat(fileno(cfile), &stb) >= 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) { - *aacct = malloc((unsigned) __strlen(tokval) + 1); - (void) __strcpy(*aacct, tokval); + *aacct = malloc((unsigned) strlen(tokval) + 1); + (void) strcpy(*aacct, tokval); } #endif break; @@ -221,33 +233,33 @@ next: (void) fclose(cfile); return (0); } - while ((c=__getc_unlocked(cfile)) != EOF && c == ' ' + 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; *tmp++ = c; - for (i=0; i < 8 && (c=__getc_unlocked(cfile)) != EOF && + for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF && !isspace(c); ++i) { *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'; if (c != '\n') { - while ((c=__getc_unlocked(cfile)) != EOF + while ((c=getc_unlocked(cfile)) != EOF && 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) { @@ -258,8 +270,8 @@ next: } tmp = macros[macnum].mac_start; while (tmp != macbuf + 4096) { - if ((c=__getc_unlocked(cfile)) == EOF) { - __printf("Macro definition missing null line terminator.\n"); + if ((c=getc_unlocked(cfile)) == EOF) { + printf("Macro definition missing null line terminator.\n"); goto bad; } *tmp = c; @@ -273,13 +285,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; @@ -291,7 +303,8 @@ bad: (void) fclose(cfile); return (-1); } -strong_alias(__ruserpass,ruserpass) +libc_hidden_proto(ruserpass) +libc_hidden_def(ruserpass) static int token() @@ -302,24 +315,24 @@ token() if (feof_unlocked(cfile) || ferror_unlocked(cfile)) return (0); - while ((c = __getc_unlocked(cfile)) != EOF && + while ((c = getc_unlocked(cfile)) != EOF && (c == '\n' || c == '\t' || c == ' ' || c == ',')) continue; if (c == EOF) return (0); cp = tokval; if (c == '"') { - while ((c = __getc_unlocked(cfile)) != EOF && c != '"') { + while ((c = getc_unlocked(cfile)) != EOF && c != '"') { if (c == '\\') - c = __getc_unlocked(cfile); + c = getc_unlocked(cfile); *cp++ = c; } } else { *cp++ = c; - while ((c = __getc_unlocked(cfile)) != EOF + while ((c = getc_unlocked(cfile)) != EOF && c != '\n' && c != '\t' && c != ' ' && c != ',') { if (c == '\\') - c = __getc_unlocked(cfile); + c = getc_unlocked(cfile); *cp++ = c; } } @@ -327,7 +340,7 @@ token() if (tokval[0] == 0) return (0); for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i) - if (!__strcmp(&tokstr[toktab[i].tokstr_off], tokval)) + if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval)) return toktab[i].tval; return (ID); } diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 168c6e406..76c046ad3 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -36,17 +36,6 @@ * 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 - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -58,6 +47,17 @@ #include <rpc/pmap_clnt.h> #include <sys/poll.h> +libc_hidden_proto(ffs) +libc_hidden_proto(pmap_set) +libc_hidden_proto(pmap_unset) +libc_hidden_proto(_authenticate) +libc_hidden_proto(_rpc_dtablesize) +/* used by svc_[max_]pollfd */ +libc_hidden_proto(__rpc_thread_svc_pollfd) +libc_hidden_proto(__rpc_thread_svc_max_pollfd) +/* used by svc_fdset */ +libc_hidden_proto(__rpc_thread_svc_fdset) + #ifdef __UCLIBC_HAS_THREADS__ #define xports (*(SVCXPRT ***)&RPC_THREAD_VARIABLE(svc_xports_s)) #else @@ -86,8 +86,8 @@ static struct svc_callout *svc_head; /* *************** SVCXPRT related stuff **************** */ /* Activate a transport handle. */ -void attribute_hidden -__xprt_register (SVCXPRT *xprt) +void +xprt_register (SVCXPRT *xprt) { register int sock = xprt->xp_sock; register int i; @@ -126,11 +126,12 @@ __xprt_register (SVCXPRT *xprt) POLLRDNORM | POLLRDBAND); } } -strong_alias(__xprt_register,xprt_register) +libc_hidden_proto(xprt_register) +libc_hidden_def(xprt_register) /* De-activate a transport handle. */ -void attribute_hidden -__xprt_unregister (SVCXPRT *xprt) +void +xprt_unregister (SVCXPRT *xprt) { register int sock = xprt->xp_sock; register int i; @@ -147,7 +148,8 @@ __xprt_unregister (SVCXPRT *xprt) svc_pollfd[i].fd = -1; } } -strong_alias(__xprt_unregister,xprt_unregister) +libc_hidden_proto(xprt_unregister) +libc_hidden_def(xprt_unregister) /* ********************** CALLOUT list related stuff ************* */ @@ -174,8 +176,8 @@ done: /* Add a service program to the callout list. The dispatch routine will be called when a rpc request for this program number comes in. */ -bool_t attribute_hidden -__svc_register (SVCXPRT * xprt, rpcprog_t prog, rpcvers_t vers, +bool_t +svc_register (SVCXPRT * xprt, rpcprog_t prog, rpcvers_t vers, void (*dispatch) (struct svc_req *, SVCXPRT *), rpcproc_t protocol) { @@ -205,11 +207,12 @@ pmap_it: return TRUE; } -strong_alias(__svc_register,svc_register) +libc_hidden_proto(svc_register) +libc_hidden_def(svc_register) /* Remove a service program from the callout list. */ -void attribute_hidden -__svc_unregister (rpcprog_t prog, rpcvers_t vers) +void +svc_unregister (rpcprog_t prog, rpcvers_t vers) { struct svc_callout *prev; register struct svc_callout *s; @@ -227,13 +230,14 @@ __svc_unregister (rpcprog_t prog, rpcvers_t vers) /* now unregister the information with the local binder service */ pmap_unset (prog, vers); } -strong_alias(__svc_unregister,svc_unregister) +libc_hidden_proto(svc_unregister) +libc_hidden_def(svc_unregister) /* ******************* REPLY GENERATION ROUTINES ************ */ /* Send a reply to an rpc request */ -bool_t attribute_hidden -__svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, +bool_t +svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, caddr_t xdr_location) { struct rpc_msg rply; @@ -246,7 +250,8 @@ __svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, rply.acpted_rply.ar_results.proc = xdr_results; return SVC_REPLY (xprt, &rply); } -strong_alias(__svc_sendreply,svc_sendreply) +libc_hidden_proto(svc_sendreply) +libc_hidden_def(svc_sendreply) /* No procedure error reply */ void @@ -262,8 +267,8 @@ svcerr_noproc (register SVCXPRT *xprt) } /* Can't decode args error reply */ -void attribute_hidden -__svcerr_decode (register SVCXPRT *xprt) +void +svcerr_decode (register SVCXPRT *xprt) { struct rpc_msg rply; @@ -273,7 +278,8 @@ __svcerr_decode (register SVCXPRT *xprt) rply.acpted_rply.ar_stat = GARBAGE_ARGS; SVC_REPLY (xprt, &rply); } -strong_alias(__svcerr_decode,svcerr_decode) +libc_hidden_proto(svcerr_decode) +libc_hidden_def(svcerr_decode) /* Some system error */ void @@ -289,8 +295,8 @@ svcerr_systemerr (register SVCXPRT *xprt) } /* Authentication error reply */ -void attribute_hidden -__svcerr_auth (SVCXPRT *xprt, enum auth_stat why) +void +svcerr_auth (SVCXPRT *xprt, enum auth_stat why) { struct rpc_msg rply; @@ -300,18 +306,19 @@ __svcerr_auth (SVCXPRT *xprt, enum auth_stat why) rply.rjcted_rply.rj_why = why; SVC_REPLY (xprt, &rply); } -strong_alias(__svcerr_auth,svcerr_auth) +libc_hidden_proto(svcerr_auth) +libc_hidden_def(svcerr_auth) /* Auth too weak error reply */ void svcerr_weakauth (SVCXPRT *xprt) { - __svcerr_auth (xprt, AUTH_TOOWEAK); + svcerr_auth (xprt, AUTH_TOOWEAK); } /* Program unavailable error reply */ -void attribute_hidden -__svcerr_noprog (register SVCXPRT *xprt) +void +svcerr_noprog (register SVCXPRT *xprt) { struct rpc_msg rply; @@ -321,11 +328,12 @@ __svcerr_noprog (register SVCXPRT *xprt) rply.acpted_rply.ar_stat = PROG_UNAVAIL; SVC_REPLY (xprt, &rply); } -strong_alias(__svcerr_noprog,svcerr_noprog) +libc_hidden_proto(svcerr_noprog) +libc_hidden_def(svcerr_noprog) /* Program version mismatch error reply */ -void attribute_hidden -__svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, +void +svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, rpcvers_t high_vers) { struct rpc_msg rply; @@ -338,7 +346,8 @@ __svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, rply.acpted_rply.ar_vers.high = high_vers; SVC_REPLY (xprt, &rply); } -strong_alias(__svcerr_progvers,svcerr_progvers) +libc_hidden_proto(svcerr_progvers) +libc_hidden_def(svcerr_progvers) /* ******************* SERVER INPUT STUFF ******************* */ @@ -358,8 +367,8 @@ strong_alias(__svcerr_progvers,svcerr_progvers) * is mallocated in kernel land. */ -void attribute_hidden -__svc_getreq_common (const int fd) +void +svc_getreq_common (const int fd) { enum xprt_stat stat; struct rpc_msg msg; @@ -403,7 +412,7 @@ __svc_getreq_common (const int fd) } else if ((why = _authenticate (&r, &msg)) != AUTH_OK) { - __svcerr_auth (xprt, why); + svcerr_auth (xprt, why); goto call_done; } @@ -433,9 +442,9 @@ __svc_getreq_common (const int fd) /* if we got here, the program or version is not served ... */ if (prog_found) - __svcerr_progvers (xprt, low_vers, high_vers); + svcerr_progvers (xprt, low_vers, high_vers); else - __svcerr_noprog (xprt); + svcerr_noprog (xprt); /* Fall through to ... */ } call_done: @@ -447,10 +456,11 @@ __svc_getreq_common (const int fd) } while (stat == XPRT_MOREREQS); } -strong_alias(__svc_getreq_common,svc_getreq_common) +libc_hidden_proto(svc_getreq_common) +libc_hidden_def(svc_getreq_common) -void attribute_hidden -__svc_getreqset (fd_set *readfds) +void +svc_getreqset (fd_set *readfds) { register u_int32_t mask; register u_int32_t *maskp; @@ -462,23 +472,25 @@ __svc_getreqset (fd_set *readfds) maskp = (u_int32_t *) readfds->fds_bits; for (sock = 0; sock < setsize; sock += 32) for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) - __svc_getreq_common (sock + bit - 1); + svc_getreq_common (sock + bit - 1); } -strong_alias(__svc_getreqset,svc_getreqset) +libc_hidden_proto(svc_getreqset) +libc_hidden_def(svc_getreqset) -void attribute_hidden -__svc_getreq (int rdfds) +void +svc_getreq (int rdfds) { fd_set readfds; FD_ZERO (&readfds); readfds.fds_bits[0] = rdfds; - __svc_getreqset (&readfds); + svc_getreqset (&readfds); } -strong_alias(__svc_getreq,svc_getreq) +libc_hidden_proto(svc_getreq) +libc_hidden_def(svc_getreq) -void attribute_hidden -__svc_getreq_poll (struct pollfd *pfdp, int pollretval) +void +svc_getreq_poll (struct pollfd *pfdp, int pollretval) { register int i; register int fds_found; @@ -493,13 +505,14 @@ __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); + svc_getreq_common (p->fd); } } } -strong_alias(__svc_getreq_poll,svc_getreq_poll) +libc_hidden_proto(svc_getreq_poll) +libc_hidden_def(svc_getreq_poll) #ifdef __UCLIBC_HAS_THREADS__ @@ -508,7 +521,7 @@ void attribute_hidden __rpc_thread_svc_cleanup (void) struct svc_callout *svcp; while ((svcp = svc_head) != NULL) - __svc_unregister (svcp->sc_prog, svcp->sc_vers); + svc_unregister (svcp->sc_prog, svcp->sc_vers); } #endif /* __UCLIBC_HAS_THREADS__ */ diff --git a/libc/inet/rpc/svc_auth.c b/libc/inet/rpc/svc_auth.c index 812463396..0e4f85436 100644 --- a/libc/inet/rpc/svc_auth.c +++ b/libc/inet/rpc/svc_auth.c @@ -101,8 +101,8 @@ svcauthsw[] = * There is an assumption that any flavour less than AUTH_NULL is * invalid. */ -enum auth_stat attribute_hidden -_authenticate_internal (register struct svc_req *rqst, struct rpc_msg *msg) +enum auth_stat +_authenticate (register struct svc_req *rqst, struct rpc_msg *msg) { register int cred_flavor; @@ -115,7 +115,8 @@ _authenticate_internal (register struct svc_req *rqst, struct rpc_msg *msg) return AUTH_REJECTEDCRED; } -strong_alias(_authenticate_internal,_authenticate) +libc_hidden_proto(_authenticate) +libc_hidden_def(_authenticate) static enum auth_stat _svcauth_null (struct svc_req *rqst attribute_unused, struct rpc_msg *msg attribute_unused) diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index 2cd8671c5..220e92b70 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -38,9 +38,6 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define xdrmem_create __xdrmem_create -#define xdr_authunix_parms __xdr_authunix_parms - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -50,6 +47,11 @@ #include <rpc/rpc.h> #include <rpc/svc.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(printf) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_authunix_parms) + /* * Unix longhand authenticator */ @@ -88,7 +90,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg) stat = AUTH_BADCRED; goto done; } - __memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len); + memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len); aup->aup_machname[str_len] = 0; str_len = RNDUP (str_len); buf = (int32_t *) ((char *) buf + str_len); @@ -111,7 +113,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_raw.c b/libc/inet/rpc/svc_raw.c index 986350882..0cdbbb89a 100644 --- a/libc/inet/rpc/svc_raw.c +++ b/libc/inet/rpc/svc_raw.c @@ -40,15 +40,15 @@ static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define xdrmem_create __xdrmem_create -#define xdr_callmsg __xdr_callmsg -#define xdr_replymsg __xdr_replymsg - #define __FORCE_GLIBC #include <features.h> #include "rpc_private.h" #include <rpc/svc.h> +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_callmsg) +libc_hidden_proto(xdr_replymsg) + /* * This is the "network" that we will be moving data over */ diff --git a/libc/inet/rpc/svc_run.c b/libc/inet/rpc/svc_run.c index d2c06b895..5ec4715bd 100644 --- a/libc/inet/rpc/svc_run.c +++ b/libc/inet/rpc/svc_run.c @@ -31,13 +31,6 @@ * Wait for input, call server program. */ -#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 -#define __rpc_thread_svc_max_pollfd __rpc_thread_svc_max_pollfd_internal - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -47,6 +40,13 @@ #include <sys/poll.h> #include <rpc/rpc.h> +libc_hidden_proto(perror) +libc_hidden_proto(svc_getreq_poll) +libc_hidden_proto(poll) +/* used by svc_[max_]pollfd */ +libc_hidden_proto(__rpc_thread_svc_pollfd) +libc_hidden_proto(__rpc_thread_svc_max_pollfd) + /* This function can be used as a signal handler to terminate the server loop. */ void @@ -83,7 +83,7 @@ svc_run (void) free (my_pollfd); if (errno == EINTR) continue; - __perror (_("svc_run: - poll failed")); + perror (_("svc_run: - poll failed")); return; case 0: free (my_pollfd); diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c index 825235450..7657bb7f9 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -38,14 +38,6 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define svc_sendreply __svc_sendreply -#define svc_register __svc_register -#define svcerr_decode __svcerr_decode -#define svcudp_create __svcudp_create -#define pmap_unset __pmap_unset -#define asprintf __asprintf -#define fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -64,6 +56,18 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; # define fputs(s, f) _IO_fputs (s, f) #endif +libc_hidden_proto(strdup) +libc_hidden_proto(memset) +libc_hidden_proto(asprintf) +libc_hidden_proto(fputs) +libc_hidden_proto(write) +libc_hidden_proto(exit) +libc_hidden_proto(svc_sendreply) +libc_hidden_proto(svc_register) +libc_hidden_proto(svcerr_decode) +libc_hidden_proto(svcudp_create) +libc_hidden_proto(pmap_unset) + struct proglst_ { char *(*p_progname) (char *); @@ -105,7 +109,7 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, transp = svcudp_create (RPC_ANYSOCK); if (transp == NULL) { - buf = __strdup (_("couldn't create an rpc server\n")); + buf = strdup (_("couldn't create an rpc server\n")); goto err_out; } } @@ -120,7 +124,7 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, pl = (struct proglst_ *) malloc (sizeof (struct proglst_)); if (pl == NULL) { - buf = __strdup (_("registerrpc: out of memory\n")); + buf = strdup (_("registerrpc: out of memory\n")); goto err_out; } pl->p_progname = progname; @@ -159,8 +163,8 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) { if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE) { - __write (STDERR_FILENO, "xxx\n", 4); - __exit (1); + write (STDERR_FILENO, "xxx\n", 4); + exit (1); } return; } @@ -170,7 +174,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) if (pl->p_prognum == prog && pl->p_procnum == proc) { /* decode arguments into a CLEAN buffer */ - __memset (xdrbuf, 0, sizeof (xdrbuf)); /* required ! */ + memset (xdrbuf, 0, sizeof (xdrbuf)); /* required ! */ if (!svc_getargs (transp_l, pl->p_inproc, xdrbuf)) { svcerr_decode (transp_l); @@ -185,7 +189,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) (void) asprintf (&buf, _("trouble replying to prog %d\n"), pl->p_prognum); - __exit (1); + exit (1); } /* free the decoded arguments */ (void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf); @@ -199,5 +203,5 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) #endif fputs (buf, stderr); free (buf); - __exit (1); + exit (1); } diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index 4a2556159..13a2469dd 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -41,22 +41,6 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; * and a record/tcp stream. */ -#define xdrrec_create __xdrrec_create -#define xdrrec_endofrecord __xdrrec_endofrecord -#define xdrrec_skiprecord __xdrrec_skiprecord -#define xdrrec_eof __xdrrec_eof -#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 fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -76,6 +60,31 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; # define fputs(s, f) _IO_fputs (s, f) #endif +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(perror) +libc_hidden_proto(xdrrec_create) +libc_hidden_proto(xdrrec_endofrecord) +libc_hidden_proto(xdrrec_skiprecord) +libc_hidden_proto(xdrrec_eof) +libc_hidden_proto(xdr_callmsg) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xprt_register) +libc_hidden_proto(xprt_unregister) +libc_hidden_proto(getsockname) +libc_hidden_proto(bind) +libc_hidden_proto(bindresvport) +libc_hidden_proto(poll) +libc_hidden_proto(accept) +libc_hidden_proto(listen) +libc_hidden_proto(fputs) +libc_hidden_proto(fclose) +libc_hidden_proto(abort) + /* * Ops vector for TCP/IP based rpc service handle */ @@ -170,14 +179,14 @@ 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")); + perror (_("svc_tcp.c - tcp socket creation problem")); return (SVCXPRT *) NULL; } madesock = TRUE; } - __memset ((char *) &addr, 0, sizeof (addr)); + memset ((char *) &addr, 0, sizeof (addr)); addr.sin_family = AF_INET; if (bindresvport (sock, &addr)) { @@ -187,9 +196,9 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) if ((getsockname (sock, (struct sockaddr *) &addr, &len) != 0) || (listen (sock, 2) != 0)) { - __perror (_("svc_tcp.c - cannot getsockname or listen")); + perror (_("svc_tcp.c - cannot getsockname or listen")); if (madesock) - (void) __close (sock); + (void) close (sock); return (SVCXPRT *) NULL; } r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r)); @@ -285,7 +294,7 @@ again: * make a new transporter (re-uses xprt) */ xprt = makefd_xprt (sock, r->sendsize, r->recvsize); - __memcpy (&xprt->xp_raddr, &addr, sizeof (addr)); + memcpy (&xprt->xp_raddr, &addr, sizeof (addr)); xprt->xp_addrlen = len; return FALSE; /* there is never an rpc msg to be processed */ } @@ -302,7 +311,7 @@ svctcp_destroy (SVCXPRT *xprt) struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1; xprt_unregister (xprt); - (void) __close (xprt->xp_sock); + (void) close (xprt->xp_sock); if (xprt->xp_port != 0) { /* a rendezvouser socket */ @@ -352,7 +361,7 @@ readtcp (char *xprtptr, char *buf, int len) } while ((pollfd.revents & POLLIN) == 0); - if ((len = __read (sock, buf, len)) > 0) + if ((len = read (sock, buf, len)) > 0) return len; fatal_err: @@ -372,7 +381,7 @@ writetcp (char *xprtptr, char * buf, int len) for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = __write (xprt->xp_sock, buf, cnt)) < 0) + if ((i = write (xprt->xp_sock, buf, cnt)) < 0) { ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; return -1; diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index 82f279814..07c7661b5 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -39,21 +39,6 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ -#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 fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -73,8 +58,31 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; # include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) +libc_hidden_proto(fwprintf) #endif +libc_hidden_proto(memcmp) +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(perror) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(xprt_register) +libc_hidden_proto(xprt_unregister) +libc_hidden_proto(xdrmem_create) +libc_hidden_proto(xdr_callmsg) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(getsockname) +libc_hidden_proto(setsockopt) +libc_hidden_proto(bind) +libc_hidden_proto(bindresvport) +libc_hidden_proto(recvfrom) +libc_hidden_proto(sendto) +libc_hidden_proto(recvmsg) +libc_hidden_proto(sendmsg) +libc_hidden_proto(fputs) +libc_hidden_proto(fprintf) + #define rpc_buffer(xprt) ((xprt)->xp_p1) #ifndef MAX #define MAX(a, b) ((a > b) ? a : b) @@ -127,8 +135,8 @@ struct svcudp_data * see (svc.h, xprt_register). * The routines returns NULL if a problem occurred. */ -SVCXPRT attribute_hidden * -__svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) +SVCXPRT * +svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) { bool_t madesock = FALSE; SVCXPRT *xprt; @@ -140,14 +148,14 @@ __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")); + perror (_("svcudp_create: socket creation problem")); return (SVCXPRT *) NULL; } madesock = TRUE; } - __memset ((char *) &addr, 0, sizeof (addr)); + memset ((char *) &addr, 0, sizeof (addr)); addr.sin_family = AF_INET; if (bindresvport (sock, &addr)) { @@ -156,9 +164,9 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) } if (getsockname (sock, (struct sockaddr *) &addr, &len) != 0) { - __perror (_("svcudp_create - cannot getsockname")); + perror (_("svcudp_create - cannot getsockname")); if (madesock) - (void) __close (sock); + (void) close (sock); return (SVCXPRT *) NULL; } xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT)); @@ -168,7 +176,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n")); + (void) fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n")); else #endif (void) fputs (_("svcudp_create: out of memory\n"), stderr); @@ -194,7 +202,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) { # ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("svcudp_create: xp_pad is too small for IP_PKTINFO\n")); else # endif @@ -211,20 +219,22 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) #endif /* Clear the padding. */ pad = 0; - __memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad)); + memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad)); xprt_register (xprt); return xprt; } -strong_alias(__svcudp_bufcreate,svcudp_bufcreate) +libc_hidden_proto(svcudp_bufcreate) +libc_hidden_def(svcudp_bufcreate) -SVCXPRT attribute_hidden * -__svcudp_create (int sock) +SVCXPRT * +svcudp_create (int sock) { - return __svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE); + return svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE); } -strong_alias(__svcudp_create,svcudp_create) +libc_hidden_proto(svcudp_create) +libc_hidden_def(svcudp_create) static enum xprt_stat svcudp_stat (xprt) @@ -387,7 +397,7 @@ svcudp_destroy (xprt) struct svcudp_data *su = su_data (xprt); xprt_unregister (xprt); - (void) __close (xprt->xp_sock); + (void) close (xprt->xp_sock); XDR_DESTROY (&(su->su_xdrs)); mem_free (rpc_buffer (xprt), su->su_iosz); mem_free ((caddr_t) su, sizeof (struct svcudp_data)); @@ -420,7 +430,7 @@ svcudp_destroy (xprt) (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - __memset((char *) addr, 0, sizeof(type) * (int) (size)) + memset((char *) addr, 0, sizeof(type) * (int) (size)) /* * An entry in the cache @@ -598,7 +608,7 @@ cache_get (xprt, msg, replyp, replylenp) struct svcudp_data *su = su_data (xprt); struct udp_cache *uc = (struct udp_cache *) su->su_cache; -#define EQADDR(a1, a2) (__memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0) +#define EQADDR(a1, a2) (memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0) loc = CACHE_LOC (xprt, su->su_xid); for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) @@ -621,6 +631,6 @@ cache_get (xprt, msg, replyp, replylenp) uc->uc_proc = msg->rm_call.cb_proc; uc->uc_vers = msg->rm_call.cb_vers; uc->uc_prog = msg->rm_call.cb_prog; - __memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr)); + memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr)); return 0; } diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index d71485f0a..02e327a8e 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -37,26 +37,6 @@ * and a record/unix stream. */ -#define xdrrec_create __xdrrec_create -#define xdrrec_endofrecord __xdrrec_endofrecord -#define xdrrec_skiprecord __xdrrec_skiprecord -#define xdrrec_eof __xdrrec_eof -#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 fputs __fputs - #define __FORCE_GLIBC #include <features.h> @@ -75,6 +55,34 @@ # include <wchar.h> #endif +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strlen) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(perror) +libc_hidden_proto(getpid) +libc_hidden_proto(xdrrec_create) +libc_hidden_proto(xdrrec_endofrecord) +libc_hidden_proto(xdrrec_skiprecord) +libc_hidden_proto(xdrrec_eof) +libc_hidden_proto(xdr_callmsg) +libc_hidden_proto(xdr_replymsg) +libc_hidden_proto(xprt_register) +libc_hidden_proto(xprt_unregister) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(getsockname) +libc_hidden_proto(setsockopt) +libc_hidden_proto(bind) +libc_hidden_proto(recvmsg) +libc_hidden_proto(sendmsg) +libc_hidden_proto(poll) +libc_hidden_proto(accept) +libc_hidden_proto(listen) +libc_hidden_proto(fputs) +libc_hidden_proto(abort) + /* * Ops vector for AF_UNIX based rpc service handle */ @@ -167,17 +175,17 @@ 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")); + perror (_("svc_unix.c - AF_UNIX socket creation problem")); return (SVCXPRT *) NULL; } madesock = TRUE; } - __memset (&addr, '\0', sizeof (addr)); + memset (&addr, '\0', sizeof (addr)); addr.sun_family = AF_UNIX; - len = __strlen (path) + 1; - __memcpy (addr.sun_path, path, len); + len = strlen (path) + 1; + memcpy (addr.sun_path, path, len); len += sizeof (addr.sun_family); bind (sock, (struct sockaddr *) &addr, len); @@ -185,9 +193,9 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) if (getsockname (sock, (struct sockaddr *) &addr, &len) != 0 || listen (sock, 2) != 0) { - __perror (_("svc_unix.c - cannot getsockname or listen")); + perror (_("svc_unix.c - cannot getsockname or listen")); if (madesock) - __close (sock); + close (sock); return (SVCXPRT *) NULL; } @@ -284,10 +292,10 @@ again: /* * make a new transporter (re-uses xprt) */ - __memset (&in_addr, '\0', sizeof (in_addr)); + memset (&in_addr, '\0', sizeof (in_addr)); in_addr.sin_family = AF_UNIX; xprt = makefd_xprt (sock, r->sendsize, r->recvsize); - __memcpy (&xprt->xp_raddr, &in_addr, sizeof (in_addr)); + memcpy (&xprt->xp_raddr, &in_addr, sizeof (in_addr)); xprt->xp_addrlen = len; return FALSE; /* there is never an rpc msg to be processed */ } @@ -304,7 +312,7 @@ svcunix_destroy (SVCXPRT *xprt) struct unix_conn *cd = (struct unix_conn *) xprt->xp_p1; xprt_unregister (xprt); - __close (xprt->xp_sock); + close (xprt->xp_sock); if (xprt->xp_port != 0) { /* a rendezvouser socket */ @@ -392,11 +400,11 @@ __msgwrite (int sock, void *data, size_t cnt) /* XXX I'm not sure, if gete?id() is always correct, or if we should use get?id(). But since keyserv needs geteuid(), we have no other chance. It would be much better, if the kernel could pass both to the server. */ - cred.pid = __getpid (); + cred.pid = getpid (); cred.uid = geteuid (); cred.gid = getegid (); - __memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); + memcpy (CMSG_DATA(cmsg), &cred, sizeof (struct ucred)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_CREDENTIALS; cmsg->cmsg_len = sizeof(*cmsg) + sizeof(struct ucred); diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c index 1474c1e08..c83416343 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -41,8 +41,6 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; * xdr. */ -#define fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -56,8 +54,12 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; #ifdef USE_IN_LIBIO # include <wchar.h> +libc_hidden_proto(fwprintf) #endif +libc_hidden_proto(strlen) +libc_hidden_proto(fputs) + /* * constants specific to the xdr "protocol" */ @@ -97,8 +99,8 @@ xdr_void (void) * The definition of xdr_long() is kept for backward * compatibility. Instead xdr_int() should be used. */ -bool_t attribute_hidden -__xdr_long (XDR *xdrs, long *lp) +bool_t +xdr_long (XDR *xdrs, long *lp) { if (xdrs->x_op == XDR_ENCODE @@ -114,13 +116,14 @@ __xdr_long (XDR *xdrs, long *lp) return FALSE; } -strong_alias(__xdr_long,xdr_long) +libc_hidden_proto(xdr_long) +libc_hidden_def(xdr_long) /* * XDR short integers */ -bool_t attribute_hidden -__xdr_short (XDR *xdrs, short *sp) +bool_t +xdr_short (XDR *xdrs, short *sp) { long l; @@ -143,13 +146,14 @@ __xdr_short (XDR *xdrs, short *sp) } return FALSE; } -strong_alias(__xdr_short,xdr_short) +libc_hidden_proto(xdr_short) +libc_hidden_def(xdr_short) /* * XDR integers */ -bool_t attribute_hidden -__xdr_int (XDR *xdrs, int *ip) +bool_t +xdr_int (XDR *xdrs, int *ip) { #if INT_MAX < LONG_MAX @@ -172,22 +176,23 @@ __xdr_int (XDR *xdrs, int *ip) } return FALSE; #elif INT_MAX == LONG_MAX - return __xdr_long (xdrs, (long *) ip); + return xdr_long (xdrs, (long *) ip); #elif INT_MAX == SHRT_MAX - return __xdr_short (xdrs, (short *) ip); + return xdr_short (xdrs, (short *) ip); #else #error unexpected integer sizes in xdr_int() #endif } -strong_alias(__xdr_int,xdr_int) +libc_hidden_proto(xdr_int) +libc_hidden_def(xdr_int) /* * XDR unsigned long integers * The definition of xdr_u_long() is kept for backward * compatibility. Instead xdr_u_int() should be used. */ -bool_t attribute_hidden -__xdr_u_long (XDR *xdrs, u_long *ulp) +bool_t +xdr_u_long (XDR *xdrs, u_long *ulp) { switch (xdrs->x_op) { @@ -214,13 +219,14 @@ __xdr_u_long (XDR *xdrs, u_long *ulp) } return FALSE; } -strong_alias(__xdr_u_long,xdr_u_long) +libc_hidden_proto(xdr_u_long) +libc_hidden_def(xdr_u_long) /* * XDR unsigned integers */ -bool_t attribute_hidden -__xdr_u_int (XDR *xdrs, u_int *up) +bool_t +xdr_u_int (XDR *xdrs, u_int *up) { #if UINT_MAX < ULONG_MAX u_long l; @@ -242,21 +248,22 @@ __xdr_u_int (XDR *xdrs, u_int *up) } return FALSE; #elif UINT_MAX == ULONG_MAX - return __xdr_u_long (xdrs, (u_long *) up); + return xdr_u_long (xdrs, (u_long *) up); #elif UINT_MAX == USHRT_MAX - return __xdr_short (xdrs, (short *) up); + return xdr_short (xdrs, (short *) up); #else #error unexpected integer sizes in xdr_u_int() #endif } -strong_alias(__xdr_u_int,xdr_u_int) +libc_hidden_proto(xdr_u_int) +libc_hidden_def(xdr_u_int) /* * XDR hyper integers * same as xdr_u_hyper - open coded to save a proc call! */ -bool_t attribute_hidden -__xdr_hyper (XDR *xdrs, quad_t *llp) +bool_t +xdr_hyper (XDR *xdrs, quad_t *llp) { long t1; unsigned long int t2; @@ -282,15 +289,16 @@ __xdr_hyper (XDR *xdrs, quad_t *llp) return FALSE; } -strong_alias(__xdr_hyper,xdr_hyper) +libc_hidden_proto(xdr_hyper) +libc_hidden_def(xdr_hyper) /* * XDR hyper integers * same as xdr_hyper - open coded to save a proc call! */ -bool_t attribute_hidden -__xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) +bool_t +xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) { unsigned long t1; unsigned long t2; @@ -316,18 +324,19 @@ __xdr_u_hyper (XDR *xdrs, u_quad_t *ullp) return FALSE; } -strong_alias(__xdr_u_hyper,xdr_u_hyper) +libc_hidden_proto(xdr_u_hyper) +libc_hidden_def(xdr_u_hyper) bool_t xdr_longlong_t (XDR *xdrs, quad_t *llp) { - return __xdr_hyper (xdrs, llp); + return xdr_hyper (xdrs, llp); } bool_t xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp) { - return __xdr_u_hyper (xdrs, ullp); + return xdr_u_hyper (xdrs, ullp); } /* @@ -368,7 +377,7 @@ xdr_char (XDR *xdrs, char *cp) int i; i = (*cp); - if (!__xdr_int (xdrs, &i)) + if (!xdr_int (xdrs, &i)) { return FALSE; } @@ -385,7 +394,7 @@ xdr_u_char (XDR *xdrs, u_char *cp) u_int u; u = (*cp); - if (!__xdr_u_int (xdrs, &u)) + if (!xdr_u_int (xdrs, &u)) { return FALSE; } @@ -396,8 +405,8 @@ xdr_u_char (XDR *xdrs, u_char *cp) /* * XDR booleans */ -bool_t attribute_hidden -__xdr_bool (XDR *xdrs, bool_t *bp) +bool_t +xdr_bool (XDR *xdrs, bool_t *bp) { long lb; @@ -420,13 +429,14 @@ __xdr_bool (XDR *xdrs, bool_t *bp) } return FALSE; } -strong_alias(__xdr_bool,xdr_bool) +libc_hidden_proto(xdr_bool) +libc_hidden_def(xdr_bool) /* * XDR enumerations */ -bool_t attribute_hidden -__xdr_enum (XDR *xdrs, enum_t *ep) +bool_t +xdr_enum (XDR *xdrs, enum_t *ep) { enum sizecheck { @@ -459,27 +469,28 @@ __xdr_enum (XDR *xdrs, enum_t *ep) } return FALSE; #else - return __xdr_long (xdrs, (long *) ep); + return xdr_long (xdrs, (long *) ep); #endif } else if (sizeof (enum sizecheck) == sizeof (short)) { - return __xdr_short (xdrs, (short *) ep); + return xdr_short (xdrs, (short *) ep); } else { return FALSE; } } -strong_alias(__xdr_enum,xdr_enum) +libc_hidden_proto(xdr_enum) +libc_hidden_def(xdr_enum) /* * XDR opaque data * Allows the specification of a fixed size sequence of opaque bytes. * cp points to the opaque object and cnt gives the byte length. */ -bool_t attribute_hidden -__xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) +bool_t +xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) { u_int rndup; static char crud[BYTES_PER_XDR_UNIT]; @@ -522,15 +533,16 @@ __xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) } return FALSE; } -strong_alias(__xdr_opaque,xdr_opaque) +libc_hidden_proto(xdr_opaque) +libc_hidden_def(xdr_opaque) /* * XDR counted bytes * *cpp is a pointer to the bytes, *sizep is the count. * If *cpp is NULL maxsize bytes are allocated */ -bool_t attribute_hidden -__xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) +bool_t +xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int nodesize; @@ -538,7 +550,7 @@ __xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) /* * first deal with the length since xdr bytes are counted */ - if (!__xdr_u_int (xdrs, sizep)) + if (!xdr_u_int (xdrs, sizep)) { return FALSE; } @@ -566,7 +578,7 @@ __xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n")); + (void) fwprintf (stderr, L"%s", _("xdr_bytes: out of memory\n")); else #endif (void) fputs (_("xdr_bytes: out of memory\n"), stderr); @@ -575,7 +587,7 @@ __xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) /* fall into ... */ case XDR_ENCODE: - return __xdr_opaque (xdrs, sp, nodesize); + return xdr_opaque (xdrs, sp, nodesize); case XDR_FREE: if (sp != NULL) @@ -587,7 +599,8 @@ __xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) } return FALSE; } -strong_alias(__xdr_bytes,xdr_bytes) +libc_hidden_proto(xdr_bytes) +libc_hidden_def(xdr_bytes) /* * Implemented here due to commonality of the object. @@ -598,7 +611,7 @@ xdr_netobj (xdrs, np) struct netobj *np; { - return __xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ); + return xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ); } /* @@ -612,15 +625,15 @@ xdr_netobj (xdrs, np) * routine may be called. * If there is no specific or default routine an error is returned. */ -bool_t attribute_hidden -__xdr_union (XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault) +bool_t +xdr_union (XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault) { enum_t dscm; /* * we deal with the discriminator; it's an enum */ - if (!__xdr_enum (xdrs, dscmp)) + if (!xdr_enum (xdrs, dscmp)) { return FALSE; } @@ -642,7 +655,8 @@ __xdr_union (XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choi return ((dfault == NULL_xdrproc_t) ? FALSE : (*dfault) (xdrs, unp, LASTUNSIGNED)); } -strong_alias(__xdr_union,xdr_union) +libc_hidden_proto(xdr_union) +libc_hidden_def(xdr_union) /* * Non-portable xdr primitives. @@ -658,8 +672,8 @@ strong_alias(__xdr_union,xdr_union) * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. */ -bool_t attribute_hidden -__xdr_string (XDR *xdrs, char **cpp, u_int maxsize) +bool_t +xdr_string (XDR *xdrs, char **cpp, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int size; @@ -679,12 +693,12 @@ __xdr_string (XDR *xdrs, char **cpp, u_int maxsize) case XDR_ENCODE: if (sp == NULL) return FALSE; - size = __strlen (sp); + size = strlen (sp); break; case XDR_DECODE: break; } - if (!__xdr_u_int (xdrs, &size)) + if (!xdr_u_int (xdrs, &size)) { return FALSE; } @@ -710,7 +724,7 @@ __xdr_string (XDR *xdrs, char **cpp, u_int maxsize) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("xdr_string: out of memory\n")); else #endif @@ -721,7 +735,7 @@ __xdr_string (XDR *xdrs, char **cpp, u_int maxsize) /* fall into ... */ case XDR_ENCODE: - return __xdr_opaque (xdrs, sp, size); + return xdr_opaque (xdrs, sp, size); case XDR_FREE: mem_free (sp, nodesize); @@ -730,7 +744,8 @@ __xdr_string (XDR *xdrs, char **cpp, u_int maxsize) } return FALSE; } -strong_alias(__xdr_string,xdr_string) +libc_hidden_proto(xdr_string) +libc_hidden_def(xdr_string) /* * Wrapper for xdr_string that can be called directly from @@ -741,7 +756,7 @@ xdr_wrapstring (xdrs, cpp) XDR *xdrs; char **cpp; { - if (__xdr_string (xdrs, cpp, LASTUNSIGNED)) + if (xdr_string (xdrs, cpp, LASTUNSIGNED)) { return TRUE; } diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c index 5432a5d01..cebf44586 100644 --- a/libc/inet/rpc/xdr_array.c +++ b/libc/inet/rpc/xdr_array.c @@ -40,9 +40,6 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; * arrays. See xdr.h for more info on the interface to xdr. */ -#define xdr_u_int __xdr_u_int -#define fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -55,8 +52,13 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; #ifdef USE_IN_LIBIO # include <wchar.h> +libc_hidden_proto(fwprintf) #endif +libc_hidden_proto(memset) +libc_hidden_proto(fputs) +libc_hidden_proto(xdr_u_int) + #define LASTUNSIGNED ((u_int)0-1) @@ -67,8 +69,8 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; * elsize is the size (in bytes) of each element, and elproc is the * xdr procedure to call to handle each element of the array. */ -bool_t attribute_hidden -__xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc) +bool_t +xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc) { u_int i; caddr_t target = *addrp; @@ -107,14 +109,14 @@ __xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsiz { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("xdr_array: out of memory\n")); else #endif (void) fputs (_("xdr_array: out of memory\n"), stderr); return FALSE; } - __memset (target, 0, nodesize); + memset (target, 0, nodesize); break; case XDR_FREE: @@ -142,7 +144,8 @@ __xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsiz } return stat; } -strong_alias(__xdr_array,xdr_array) +libc_hidden_proto(xdr_array) +libc_hidden_def(xdr_array) /* * xdr_vector(): diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c index 4b6a4817e..c2af1393c 100644 --- a/libc/inet/rpc/xdr_mem.c +++ b/libc/inet/rpc/xdr_mem.c @@ -46,6 +46,8 @@ #include <string.h> #include <rpc/rpc.h> +libc_hidden_proto(memcpy) + static bool_t xdrmem_getlong (XDR *, long *); static bool_t xdrmem_putlong (XDR *, const long *); static bool_t xdrmem_getbytes (XDR *, caddr_t, u_int); @@ -75,8 +77,8 @@ static const struct xdr_ops xdrmem_ops = * The procedure xdrmem_create initializes a stream descriptor for a * memory buffer. */ -void attribute_hidden -__xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) +void +xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) { xdrs->x_op = op; /* We have to add the const since the `struct xdr_ops' in `struct XDR' @@ -85,7 +87,8 @@ __xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) xdrs->x_private = xdrs->x_base = addr; xdrs->x_handy = size; } -strong_alias(__xdrmem_create,xdrmem_create) +libc_hidden_proto(xdrmem_create) +libc_hidden_def(xdrmem_create) /* * Nothing needs to be done for the memory case. The argument is clearly @@ -138,7 +141,7 @@ xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) { if ((xdrs->x_handy -= len) < 0) return FALSE; - __memcpy (addr, xdrs->x_private, len); + memcpy (addr, xdrs->x_private, len); xdrs->x_private += len; return TRUE; } @@ -152,7 +155,7 @@ xdrmem_putbytes (XDR *xdrs, const char *addr, u_int len) { if ((xdrs->x_handy -= len) < 0) return FALSE; - __memcpy (xdrs->x_private, addr, len); + memcpy (xdrs->x_private, addr, len); xdrs->x_private += len; return TRUE; } diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c index 15381a6cc..429503cdc 100644 --- a/libc/inet/rpc/xdr_rec.c +++ b/libc/inet/rpc/xdr_rec.c @@ -44,8 +44,6 @@ * The other 31 bits encode the byte length of the fragment. */ -#define fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -60,8 +58,13 @@ # include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) +libc_hidden_proto(fwprintf) #endif +libc_hidden_proto(memcpy) +libc_hidden_proto(fputs) +libc_hidden_proto(lseek) + static bool_t xdrrec_getlong (XDR *, long *); static bool_t xdrrec_putlong (XDR *, const long *); static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int); @@ -144,8 +147,8 @@ static bool_t get_input_bytes (RECSTREAM *, caddr_t, int) internal_function; * write respectively. They are like the system * calls expect that they take an opaque handle rather than an fd. */ -void attribute_hidden -__xdrrec_create (XDR *xdrs, u_int sendsize, +void +xdrrec_create (XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle, int (*readit) (char *, char *, int), int (*writeit) (char *, char *, int)) @@ -162,7 +165,7 @@ __xdrrec_create (XDR *xdrs, u_int sendsize, { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", _("xdrrec_create: out of memory\n")); + (void) fwprintf (stderr, L"%s", _("xdrrec_create: out of memory\n")); else #endif (void) fputs (_("xdrrec_create: out of memory\n"), stderr); @@ -206,7 +209,8 @@ __xdrrec_create (XDR *xdrs, u_int sendsize, rstrm->fbtbc = 0; rstrm->last_frag = TRUE; } -strong_alias(__xdrrec_create,xdrrec_create) +libc_hidden_proto(xdrrec_create) +libc_hidden_def(xdrrec_create) /* @@ -299,7 +303,7 @@ xdrrec_putbytes (XDR *xdrs, const char *addr, u_int len) { current = rstrm->out_boundry - rstrm->out_finger; current = (len < current) ? len : current; - __memcpy (rstrm->out_finger, addr, current); + memcpy (rstrm->out_finger, addr, current); rstrm->out_finger += current; addr += current; len -= current; @@ -319,7 +323,7 @@ xdrrec_getpos (const XDR *xdrs) RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; long pos; - pos = __lseek ((int) (long) rstrm->tcp_handle, (long) 0, 1); + pos = lseek ((int) (long) rstrm->tcp_handle, (long) 0, 1); if (pos != -1) switch (xdrs->x_op) { @@ -478,8 +482,8 @@ xdrrec_putint32 (XDR *xdrs, const int32_t *ip) * Before reading (deserializing from the stream, one should always call * this procedure to guarantee proper record alignment. */ -bool_t attribute_hidden -__xdrrec_skiprecord (XDR *xdrs) +bool_t +xdrrec_skiprecord (XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -494,15 +498,16 @@ __xdrrec_skiprecord (XDR *xdrs) rstrm->last_frag = FALSE; return TRUE; } -strong_alias(__xdrrec_skiprecord,xdrrec_skiprecord) +libc_hidden_proto(xdrrec_skiprecord) +libc_hidden_def(xdrrec_skiprecord) /* * Lookahead function. * Returns TRUE iff there is no more input in the buffer * after consuming the rest of the current record. */ -bool_t attribute_hidden -__xdrrec_eof (XDR *xdrs) +bool_t +xdrrec_eof (XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -518,7 +523,8 @@ __xdrrec_eof (XDR *xdrs) return TRUE; return FALSE; } -strong_alias(__xdrrec_eof,xdrrec_eof) +libc_hidden_proto(xdrrec_eof) +libc_hidden_def(xdrrec_eof) /* * The client must tell the package when an end-of-record has occurred. @@ -526,8 +532,8 @@ strong_alias(__xdrrec_eof,xdrrec_eof) * (output) tcp stream. (This lets the package support batched or * pipelined procedure calls.) TRUE => immediate flush to tcp connection. */ -bool_t attribute_hidden -__xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) +bool_t +xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; u_long len; /* fragment length */ @@ -545,7 +551,8 @@ __xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) rstrm->out_finger += BYTES_PER_XDR_UNIT; return TRUE; } -strong_alias(__xdrrec_endofrecord,xdrrec_endofrecord) +libc_hidden_proto(xdrrec_endofrecord) +libc_hidden_def(xdrrec_endofrecord) /* * Internal useful routines @@ -603,7 +610,7 @@ get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len) continue; } current = (len < current) ? len : current; - __memcpy (addr, rstrm->in_finger, current); + memcpy (addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c index de310b08a..443ce1c8d 100644 --- a/libc/inet/rpc/xdr_reference.c +++ b/libc/inet/rpc/xdr_reference.c @@ -40,9 +40,6 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; * "pointers". See xdr.h for more info on the interface to xdr. */ -#define xdr_bool __xdr_bool -#define fputs __fputs - #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -56,8 +53,13 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; # include <wchar.h> # include <libio/iolibio.h> # define fputs(s, f) _IO_fputs (s, f) +libc_hidden_proto(fwprintf) #endif +libc_hidden_proto(memset) +libc_hidden_proto(xdr_bool) +libc_hidden_proto(fputs) + #define LASTUNSIGNED ((u_int)0-1) /* @@ -69,8 +71,8 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; * size is the size of the referneced structure. * proc is the routine to handle the referenced structure. */ -bool_t attribute_hidden -__xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) +bool_t +xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) { caddr_t loc = *pp; bool_t stat; @@ -87,14 +89,14 @@ __xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) { #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - (void) __fwprintf (stderr, L"%s", + (void) fwprintf (stderr, L"%s", _("xdr_reference: out of memory\n")); else #endif (void) fputs (_("xdr_reference: out of memory\n"), stderr); return FALSE; } - __memset (loc, 0, (int) size); + memset (loc, 0, (int) size); break; default: break; @@ -109,7 +111,8 @@ __xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) } return stat; } -strong_alias(__xdr_reference,xdr_reference) +libc_hidden_proto(xdr_reference) +libc_hidden_def(xdr_reference) /* * xdr_pointer(): @@ -150,5 +153,5 @@ xdr_pointer (xdrs, objpp, obj_size, xdr_obj) *objpp = NULL; return TRUE; } - return __xdr_reference (xdrs, objpp, obj_size, xdr_obj); + return xdr_reference (xdrs, objpp, obj_size, xdr_obj); } diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c index 5c8aec6f9..8bd08590d 100644 --- a/libc/inet/rpc/xdr_stdio.c +++ b/libc/inet/rpc/xdr_stdio.c @@ -37,12 +37,6 @@ * from the stream. */ -#define fread __fread -#define fwrite __fwrite -#define fseek __fseek -#define fflush __fflush -#define ftell __ftell - #include <rpc/types.h> #include <stdio.h> #include <rpc/xdr.h> @@ -55,6 +49,12 @@ # define fwrite(p, m, n, s) _IO_fwrite (p, m, n, s) #endif +libc_hidden_proto(fread) +libc_hidden_proto(fwrite) +libc_hidden_proto(fseek) +libc_hidden_proto(fflush) +libc_hidden_proto(ftell) + static bool_t xdrstdio_getlong (XDR *, long *); static bool_t xdrstdio_putlong (XDR *, const long *); static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int); diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 983045cf7..e003d700c 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -1,6 +1,8 @@ -#ifdef L_recv -#define recvfrom __recvfrom -#endif +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define __FORCE_GLIBC #include <features.h> @@ -47,16 +49,16 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen) return __socketcall(SYS_ACCEPT, args); } #endif -hidden_weak_alias(__libc_accept,__accept) -weak_alias(__libc_accept,accept) +strong_alias(__libc_accept,accept) +libc_hidden_proto(accept) +libc_hidden_def(accept) #endif #ifdef L_bind #ifdef __NR_bind -#define __NR___bind __NR_bind -attribute_hidden _syscall3(int, __bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); +_syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen); #elif defined(__NR_socketcall) -int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) +int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen) { unsigned long args[3]; @@ -66,7 +68,8 @@ int attribute_hidden __bind(int sockfd, const struct sockaddr *myaddr, socklen_t return __socketcall(SYS_BIND, args); } #endif -strong_alias(__bind,bind) +libc_hidden_proto(bind) +libc_hidden_def(bind) #endif #ifdef L_connect @@ -84,8 +87,9 @@ int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen) return __socketcall(SYS_CONNECT, args); } #endif -hidden_weak_alias(__libc_connect,__connect) -weak_alias(__libc_connect,connect) +strong_alias(__libc_connect,connect) +libc_hidden_proto(connect) +libc_hidden_def(connect) #endif #ifdef L_getpeername @@ -106,10 +110,9 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) #ifdef L_getsockname #ifdef __NR_getsockname -#define __NR___getsockname __NR_getsockname -attribute_hidden _syscall3(int, __getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); +_syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); #elif defined(__NR_socketcall) -int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) +int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { unsigned long args[3]; @@ -119,7 +122,8 @@ int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t return __socketcall(SYS_GETSOCKNAME, args); } #endif -strong_alias(__getsockname,getsockname) +libc_hidden_proto(getsockname) +libc_hidden_def(getsockname) #endif #ifdef L_getsockopt @@ -143,10 +147,9 @@ int getsockopt(int fd, int level, int optname, __ptr_t optval, #ifdef L_listen #ifdef __NR_listen -#define __NR___listen __NR_listen -attribute_hidden _syscall2(int, __listen, int, sockfd, int, backlog); +_syscall2(int, listen, int, sockfd, int, backlog); #elif defined(__NR_socketcall) -int attribute_hidden __listen(int sockfd, int backlog) +int listen(int sockfd, int backlog) { unsigned long args[2]; @@ -155,7 +158,8 @@ int attribute_hidden __listen(int sockfd, int backlog) return __socketcall(SYS_LISTEN, args); } #endif -strong_alias(__listen,listen) +libc_hidden_proto(listen) +libc_hidden_def(listen) #endif #ifdef L_recv @@ -175,13 +179,15 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) return (__socketcall(SYS_RECV, args)); } #elif defined(__NR_recvfrom) +libc_hidden_proto(recvfrom) ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags) { - return (__recvfrom(sockfd, buffer, len, flags, NULL, NULL)); + return (recvfrom(sockfd, buffer, len, flags, NULL, NULL)); } #endif -hidden_weak_alias(__libc_recv,__recv) -weak_alias(__libc_recv,recv) +strong_alias(__libc_recv,recv) +libc_hidden_proto(recv) +libc_hidden_def(recv) #endif #ifdef L_recvfrom @@ -205,8 +211,9 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags, return (__socketcall(SYS_RECVFROM, args)); } #endif -hidden_weak_alias(__libc_recvfrom,__recvfrom) -weak_alias(__libc_recvfrom,recvfrom) +strong_alias(__libc_recvfrom,recvfrom) +libc_hidden_proto(recvfrom) +libc_hidden_def(recvfrom) #endif #ifdef L_recvmsg @@ -224,8 +231,9 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags) return (__socketcall(SYS_RECVMSG, args)); } #endif -hidden_weak_alias(__libc_recvmsg,__recvmsg) -weak_alias(__libc_recvmsg,recvmsg) +strong_alias(__libc_recvmsg,recvmsg) +libc_hidden_proto(recvmsg) +libc_hidden_def(recvmsg) #endif #ifdef L_send @@ -245,17 +253,15 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) return (__socketcall(SYS_SEND, args)); } #elif defined(__NR_sendto) -extern ssize_t __sendto (int __fd, __const void *__buf, size_t __n, - int __flags, __CONST_SOCKADDR_ARG __addr, - socklen_t __addr_len) attribute_hidden; - +libc_hidden_proto(sendto) ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags) { - return (__sendto(sockfd, buffer, len, flags, NULL, 0)); + return (sendto(sockfd, buffer, len, flags, NULL, 0)); } #endif -hidden_weak_alias(__libc_send,__send) -weak_alias(__libc_send,send) +strong_alias(__libc_send,send) +libc_hidden_proto(send) +libc_hidden_def(send) #endif #ifdef L_sendmsg @@ -273,8 +279,9 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) return (__socketcall(SYS_SENDMSG, args)); } #endif -hidden_weak_alias(__libc_sendmsg,__sendmsg) -weak_alias(__libc_sendmsg,sendmsg) +strong_alias(__libc_sendmsg,sendmsg) +libc_hidden_proto(sendmsg) +libc_hidden_def(sendmsg) #endif #ifdef L_sendto @@ -298,17 +305,17 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags, return (__socketcall(SYS_SENDTO, args)); } #endif -hidden_weak_alias(__libc_sendto,__sendto) -weak_alias(__libc_sendto,sendto) +strong_alias(__libc_sendto,sendto) +libc_hidden_proto(sendto) +libc_hidden_def(sendto) #endif #ifdef L_setsockopt #ifdef __NR_setsockopt -#define __NR___setsockopt __NR_setsockopt -attribute_hidden _syscall5(int, __setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); +_syscall5(int, setsockopt, int, fd, int, level, int, optname, const void *, optval, socklen_t, optlen); #elif defined(__NR_socketcall) /* [sg]etsockoptions by bir7@leland.stanford.edu */ -int attribute_hidden __setsockopt(int fd, int level, int optname, const void *optval, +int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) { unsigned long args[5]; @@ -321,7 +328,8 @@ int attribute_hidden __setsockopt(int fd, int level, int optname, const void *op return (__socketcall(SYS_SETSOCKOPT, args)); } #endif -strong_alias(__setsockopt,setsockopt) +libc_hidden_proto(setsockopt) +libc_hidden_def(setsockopt) #endif #ifdef L_shutdown @@ -342,10 +350,9 @@ int shutdown(int sockfd, int how) #ifdef L_socket #ifdef __NR_socket -#define __NR___socket __NR_socket -attribute_hidden _syscall3(int, __socket, int, family, int, type, int, protocol); +_syscall3(int, socket, int, family, int, type, int, protocol); #elif defined(__NR_socketcall) -int attribute_hidden __socket(int family, int type, int protocol) +int socket(int family, int type, int protocol) { unsigned long args[3]; @@ -355,7 +362,8 @@ int attribute_hidden __socket(int family, int type, int protocol) return __socketcall(SYS_SOCKET, args); } #endif -strong_alias(__socket,socket) +libc_hidden_proto(socket) +libc_hidden_def(socket) #endif #ifdef L_socketpair diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index c55f0b6ae..130bb044f 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -33,6 +33,9 @@ #include <unistd.h> #include <bits/uClibc_uintmaxtostr.h> +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) + /* Get the prototype from assert.h as a double-check. */ #undef NDEBUG #include <assert.h> diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 69b4c1a6d..3f7bfd859 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -156,6 +156,9 @@ int CTYPE_NAME(NAME) (int c) \ #ifdef L___ctype_assert #ifdef __UCLIBC_HAS_CTYPE_ENFORCED__ +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) + void __isctype_assert(int c, int mask) { fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __uclibc_progname, c, mask); @@ -266,9 +269,10 @@ IS_FUNC_BODY(xdigit); /**********************************************************************/ #ifdef L_tolower +#undef tolower #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __tolower(int c) +int tolower(int c) { #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__) assert(CTYPE_DOMAIN_CHECK(c)); @@ -278,38 +282,38 @@ int attribute_hidden __tolower(int c) #else /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __tolower(int c) +int tolower(int c) { return __C_tolower(c); } #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */ -strong_alias(__tolower,tolower) +libc_hidden_proto(tolower) +libc_hidden_def(tolower) #endif /**********************************************************************/ #ifdef L_tolower_l #undef tolower_l -#undef __tolower_l - -int __tolower_l(int c, __locale_t l) +int tolower_l(int c, __locale_t l) { #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__) assert(CTYPE_DOMAIN_CHECK(c)); #endif return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c; } - -weak_alias(__tolower_l, tolower_l) +libc_hidden_proto(tolower_l) +libc_hidden_def(tolower_l) #endif /**********************************************************************/ #ifdef L_toupper +#undef toupper #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __toupper(int c) +int toupper(int c) { #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__) assert(CTYPE_DOMAIN_CHECK(c)); @@ -319,22 +323,21 @@ int attribute_hidden __toupper(int c) #else /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __toupper(int c) +int toupper(int c) { return __C_toupper(c); } #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */ -strong_alias(__toupper,toupper) +libc_hidden_proto(toupper) +libc_hidden_def(toupper) #endif /**********************************************************************/ #ifdef L_toupper_l #undef toupper_l -#undef __toupper_l - -int __toupper_l(int c, __locale_t l) +int toupper_l(int c, __locale_t l) { #if defined(__UCLIBC_HAS_CTYPE_ENFORCED__) assert(CTYPE_DOMAIN_CHECK(c)); @@ -342,7 +345,8 @@ int __toupper_l(int c, __locale_t l) return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } -weak_alias(__toupper_l, toupper_l) +libc_hidden_proto(toupper_l) +libc_hidden_def(toupper_l) #endif /**********************************************************************/ diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c index feae021e6..ea45829d3 100644 --- a/libc/misc/dirent/alphasort.c +++ b/libc/misc/dirent/alphasort.c @@ -2,9 +2,11 @@ #include <string.h> #include "dirstream.h" +libc_hidden_proto(strcmp) + int alphasort(const void * a, const void * b) { - return __strcmp ((*(const struct dirent **) a)->d_name, + return strcmp ((*(const struct dirent **) a)->d_name, (*(const struct dirent **) b)->d_name); } diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c index c6cfcdacf..2bba1fcc9 100644 --- a/libc/misc/dirent/alphasort64.c +++ b/libc/misc/dirent/alphasort64.c @@ -16,9 +16,10 @@ #include <string.h> #include "dirstream.h" +libc_hidden_proto(strcmp) int alphasort64(const void * a, const void * b) { - return __strcmp ((*(const struct dirent64 **) a)->d_name, + return strcmp ((*(const struct dirent64 **) a)->d_name, (*(const struct dirent64 **) b)->d_name); } diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index 8066b5861..870414a87 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -4,7 +4,10 @@ #include <unistd.h> #include "dirstream.h" -int attribute_hidden __closedir(DIR * dir) +libc_hidden_proto(closedir) +libc_hidden_proto(close) + +int closedir(DIR * dir) { int fd; @@ -24,6 +27,6 @@ int attribute_hidden __closedir(DIR * dir) __pthread_mutex_unlock(&(dir->dd_lock)); free(dir->dd_buf); free(dir); - return __close(fd); + return close(fd); } -strong_alias(__closedir,closedir) +libc_hidden_def(closedir) diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c index 48e955450..236614642 100644 --- a/libc/misc/dirent/dirfd.c +++ b/libc/misc/dirent/dirfd.c @@ -1,8 +1,14 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + #include <dirent.h> #include <errno.h> #include "dirstream.h" -int attribute_hidden __dirfd(DIR * dir) +int dirfd(DIR * dir) { if (!dir || dir->dd_fd == -1) { __set_errno(EBADF); @@ -11,4 +17,5 @@ int attribute_hidden __dirfd(DIR * dir) return dir->dd_fd; } -strong_alias(__dirfd,dirfd) +libc_hidden_proto(dirfd) +libc_hidden_def(dirfd) diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h index 15c70858f..713204c03 100644 --- a/libc/misc/dirent/dirstream.h +++ b/libc/misc/dirent/dirstream.h @@ -72,10 +72,10 @@ struct __dirstream { extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden; -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden; +libc_hidden_proto(readdir) #ifdef __UCLIBC_HAS_LFS__ extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden; -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden; +libc_hidden_proto(readdir64) #endif #endif /* dirent.h */ diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 82e7f364f..707bf45dc 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -7,32 +7,37 @@ #include <sys/stat.h> #include "dirstream.h" +libc_hidden_proto(opendir) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) +libc_hidden_proto(close) +libc_hidden_proto(stat) /* opendir just makes an open() call - it return NULL if it fails * (open sets errno), otherwise it returns a DIR * pointer. */ -DIR attribute_hidden *__opendir(const char *name) +DIR *opendir(const char *name) { int fd; struct stat statbuf; char *buf; DIR *ptr; - if (__stat(name, &statbuf)) + if (stat(name, &statbuf)) return NULL; if (!S_ISDIR(statbuf.st_mode)) { __set_errno(ENOTDIR); return NULL; } - if ((fd = __open(name, O_RDONLY)) < 0) + if ((fd = open(name, O_RDONLY)) < 0) return NULL; /* According to POSIX, directory streams should be closed when * exec. From "Anna Pluzhnikov" <besp@midway.uchicago.edu>. */ - if (__fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) + if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) return NULL; if (!(ptr = malloc(sizeof(*ptr)))) { - __close(fd); + close(fd); __set_errno(ENOMEM); return NULL; } @@ -45,7 +50,7 @@ DIR attribute_hidden *__opendir(const char *name) ptr->dd_max = 512; if (!(buf = calloc(1, ptr->dd_max))) { - __close(fd); + close(fd); free(ptr); __set_errno(ENOMEM); return NULL; @@ -54,4 +59,4 @@ DIR attribute_hidden *__opendir(const char *name) __pthread_mutex_init(&(ptr->dd_lock), NULL); return ptr; } -strong_alias(__opendir,opendir) +libc_hidden_def(opendir) diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c index 2d4ad4aeb..e26479c13 100644 --- a/libc/misc/dirent/readdir.c +++ b/libc/misc/dirent/readdir.c @@ -7,7 +7,9 @@ #include <dirent.h> #include "dirstream.h" -struct dirent attribute_hidden *__readdir(DIR * dir) +libc_hidden_proto(readdir) + +struct dirent *readdir(DIR * dir) { ssize_t bytes; struct dirent *de; @@ -46,4 +48,4 @@ all_done: __pthread_mutex_unlock(&(dir->dd_lock)); return de; } -strong_alias(__readdir,readdir) +libc_hidden_def(readdir) diff --git a/libc/misc/dirent/readdir64.c b/libc/misc/dirent/readdir64.c index 177af3fc9..2134d19fe 100644 --- a/libc/misc/dirent/readdir64.c +++ b/libc/misc/dirent/readdir64.c @@ -20,7 +20,9 @@ #include <dirent.h> #include "dirstream.h" -struct dirent64 attribute_hidden *__readdir64(DIR * dir) +libc_hidden_proto(readdir64) + +struct dirent64 *readdir64(DIR * dir) { ssize_t bytes; struct dirent64 *de; @@ -60,4 +62,4 @@ all_done: return de; } -strong_alias(__readdir64,readdir64) +libc_hidden_def(readdir64) diff --git a/libc/misc/dirent/readdir64_r.c b/libc/misc/dirent/readdir64_r.c index 1cbaf3156..b8de4fa6f 100644 --- a/libc/misc/dirent/readdir64_r.c +++ b/libc/misc/dirent/readdir64_r.c @@ -19,6 +19,8 @@ #include <dirent.h> #include "dirstream.h" +libc_hidden_proto(memcpy) + int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) { int ret; @@ -59,7 +61,7 @@ int readdir64_r(DIR *dir, struct dirent64 *entry, struct dirent64 **result) if (de == NULL) { *result = NULL; } else { - *result = __memcpy (entry, de, de->d_reclen); + *result = memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c index 25cb80b63..769352f0a 100644 --- a/libc/misc/dirent/readdir_r.c +++ b/libc/misc/dirent/readdir_r.c @@ -5,6 +5,8 @@ #include <dirent.h> #include "dirstream.h" +libc_hidden_proto(memcpy) + int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) { int ret; @@ -45,7 +47,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result) if (de == NULL) { *result = NULL; } else { - *result = __memcpy (entry, de, de->d_reclen); + *result = memcpy (entry, de, de->d_reclen); } ret = 0; diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c index 18d6547a8..ec89f17a7 100644 --- a/libc/misc/dirent/rewinddir.c +++ b/libc/misc/dirent/rewinddir.c @@ -3,6 +3,7 @@ #include <unistd.h> #include "dirstream.h" +libc_hidden_proto(lseek) /* rewinddir() just does an lseek(fd,0,0) - see close for comments */ void rewinddir(DIR * dir) @@ -12,7 +13,7 @@ void rewinddir(DIR * dir) return; } __pthread_mutex_lock(&(dir->dd_lock)); - __lseek(dir->dd_fd, 0, SEEK_SET); + lseek(dir->dd_fd, 0, SEEK_SET); dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0; __pthread_mutex_unlock(&(dir->dd_lock)); } diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index 72929fb57..41491baee 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -1,28 +1,8 @@ -/* Copyright (C) 1992-1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - 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. - */ - -/* Modified for uClibc by Erik Andersen - */ - -#define qsort __qsort -#define opendir __opendir -#define closedir __closedir +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <dirent.h> #include <stdio.h> @@ -32,6 +12,12 @@ #include <sys/types.h> #include "dirstream.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(readdir) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(qsort) + int scandir(const char *dir, struct dirent ***namelist, int (*selector) (const struct dirent *), int (*compar) (const void *, const void *)) @@ -49,7 +35,7 @@ int scandir(const char *dir, struct dirent ***namelist, __set_errno (0); pos = 0; - while ((current = __readdir (dp)) != NULL) + while ((current = readdir (dp)) != NULL) if (selector == NULL || (*selector) (current)) { struct dirent *vnew; @@ -76,7 +62,7 @@ int scandir(const char *dir, struct dirent ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent *) __memcpy (vnew, current, dsize); + names[pos++] = (struct dirent *) memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index e77b88d3c..44252b6f0 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -20,10 +20,6 @@ /* Modified for uClibc by Erik Andersen */ -#define qsort __qsort -#define opendir __opendir -#define closedir __closedir - #include <features.h> #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -47,6 +43,11 @@ #include <sys/types.h> #include "dirstream.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(qsort) + int scandir64(const char *dir, struct dirent64 ***namelist, int (*selector) (const struct dirent64 *), int (*compar) (const void *, const void *)) @@ -64,7 +65,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist, __set_errno (0); pos = 0; - while ((current = __readdir64 (dp)) != NULL) + while ((current = readdir64 (dp)) != NULL) if (selector == NULL || (*selector) (current)) { struct dirent64 *vnew; @@ -91,7 +92,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist, if (vnew == NULL) break; - names[pos++] = (struct dirent64 *) __memcpy (vnew, current, dsize); + names[pos++] = (struct dirent64 *) memcpy (vnew, current, dsize); } if (unlikely(errno != 0)) diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c index 6e841291a..5aa848b2a 100644 --- a/libc/misc/dirent/seekdir.c +++ b/libc/misc/dirent/seekdir.c @@ -3,6 +3,8 @@ #include <unistd.h> #include "dirstream.h" +libc_hidden_proto(lseek) + void seekdir(DIR * dir, long int offset) { if (!dir) { @@ -10,7 +12,7 @@ void seekdir(DIR * dir, long int offset) return; } __pthread_mutex_lock(&(dir->dd_lock)); - dir->dd_nextoff = __lseek(dir->dd_fd, offset, SEEK_SET); + dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET); dir->dd_size = dir->dd_nextloc = 0; __pthread_mutex_unlock(&(dir->dd_lock)); } diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index 43fe60cc6..f27a5e7e8 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -5,8 +5,6 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define vfprintf __vfprintf - #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -22,6 +20,18 @@ #warning REMINDER: Deal with wide oriented stderr case. #endif +libc_hidden_proto(vwarn) +libc_hidden_proto(vwarnx) +libc_hidden_proto(err) +libc_hidden_proto(verr) +libc_hidden_proto(verrx) + +libc_hidden_proto(fprintf) +libc_hidden_proto(vfprintf) +libc_hidden_proto(__xpg_strerror_r) +libc_hidden_proto(exit) +libc_hidden_proto(vfprintf) + static void vwarn_work(const char *format, va_list args, int showerr) { /* 0123 45678 9 a b*/ @@ -34,7 +44,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_internal(errno, buf, sizeof(buf)); + __xpg_strerror_r(errno, buf, sizeof(buf)); } __STDIO_AUTO_THREADLOCK(stderr); @@ -49,68 +59,68 @@ static void vwarn_work(const char *format, va_list args, int showerr) __STDIO_AUTO_THREADUNLOCK(stderr); } -void attribute_hidden __vwarn(const char *format, va_list args) +void vwarn(const char *format, va_list args) { vwarn_work(format, args, 1); } -strong_alias(__vwarn,vwarn) +libc_hidden_def(vwarn) void warn(const char *format, ...) { va_list args; va_start(args, format); - __vwarn(format, args); + vwarn(format, args); va_end(args); } -void attribute_hidden __vwarnx(const char *format, va_list args) +void vwarnx(const char *format, va_list args) { vwarn_work(format, args, 0); } -strong_alias(__vwarnx,vwarnx) +libc_hidden_def(vwarnx) void warnx(const char *format, ...) { va_list args; va_start(args, format); - __vwarnx(format, args); + vwarnx(format, args); va_end(args); } -void attribute_hidden __verr(int status, const char *format, va_list args) +void verr(int status, const char *format, va_list args) { - __vwarn(format, args); - __exit(status); + vwarn(format, args); + exit(status); } -strong_alias(__verr,verr) +libc_hidden_def(verr) 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. */ /* The loop is added only to keep gcc happy. */ while(1) va_end(args); } -void attribute_hidden __verrx(int status, const char *format, va_list args) +void verrx(int status, const char *format, va_list args) { - __vwarnx(format, args); - __exit(status); + vwarnx(format, args); + exit(status); } -strong_alias(__verrx,verrx) +libc_hidden_def(verrx) 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. */ /* The loop is added only to keep gcc happy. */ while(1) diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 60605c212..1c2585345 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -22,17 +22,21 @@ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */ -#define strerror __strerror -#define vfprintf __vfprintf -#define fflush __fflush - #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include "error.h" -extern int __putc(int c, FILE *stream) attribute_hidden; +libc_hidden_proto(strcmp) +libc_hidden_proto(strerror) +libc_hidden_proto(fprintf) +libc_hidden_proto(exit) +libc_hidden_proto(putc) +libc_hidden_proto(vfprintf) +libc_hidden_proto(fflush) +libc_hidden_proto(fputc) +libc_hidden_proto(__fputc_unlocked) /* This variable is incremented each time `error' is called. */ unsigned int error_message_count = 0; @@ -59,9 +63,9 @@ void __error (int status, int errnum, const char *message, ...) if (errnum) { fprintf (stderr, ": %s", strerror (errnum)); } - __putc ('\n', stderr); + putc ('\n', stderr); if (status) - __exit (status); + exit (status); } void __error_at_line (int status, int errnum, const char *file_name, @@ -74,7 +78,7 @@ void __error_at_line (int status, int errnum, const char *file_name, static unsigned int old_line_number; if (old_line_number == line_number && - (file_name == old_file_name || !__strcmp (old_file_name, file_name))) + (file_name == old_file_name || !strcmp (old_file_name, file_name))) /* Simply return and print nothing. */ return; @@ -95,9 +99,9 @@ void __error_at_line (int status, int errnum, const char *file_name, if (errnum) { fprintf (stderr, ": %s", strerror (errnum)); } - __putc ('\n', stderr); + putc ('\n', stderr); if (status) - __exit (status); + exit (status); } /* Use the weaks here in an effort at controlling namespace pollution */ diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c index 2ba81de9a..6c1184be2 100644 --- a/libc/misc/file/lockf.c +++ b/libc/misc/file/lockf.c @@ -17,7 +17,6 @@ Boston, MA 02111-1307, USA. */ #include <features.h> -#undef __lockf #include <sys/types.h> #include <unistd.h> @@ -25,14 +24,19 @@ #include <errno.h> #include <string.h> +libc_hidden_proto(lockf) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) + /* lockf is a simplified interface to fcntl's locking facilities. */ -#undef lockf -int attribute_hidden __lockf (int fd, int cmd, off_t len) +int lockf (int fd, int cmd, off_t len) { struct flock fl; - __memset ((char *) &fl, '\0', sizeof (fl)); + memset ((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; @@ -45,9 +49,9 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len) /* Test the lock: return 0 if FD is unlocked or locked by this process; return -1, set errno to EACCES, if another process holds the lock. */ fl.l_type = F_RDLCK; - if (__fcntl (fd, F_GETLK, &fl) < 0) + if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) return 0; __set_errno(EACCES); return -1; @@ -70,6 +74,6 @@ int attribute_hidden __lockf (int fd, int cmd, off_t len) return -1; } - return __fcntl(fd, cmd, &fl); + return fcntl(fd, cmd, &fl); } -strong_alias(__lockf,lockf) +libc_hidden_def(lockf) diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c index 1e294d9a6..be5fc6c07 100644 --- a/libc/misc/file/lockf64.c +++ b/libc/misc/file/lockf64.c @@ -17,7 +17,6 @@ Boston, MA 02111-1307, USA. */ #include <features.h> -#undef __lockf64 #ifdef __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -43,17 +42,20 @@ #ifdef __NR_fcntl64 #define flock flock64 -#define fcntl __fcntl64 +#define fcntl fcntl64 #define F_GETLK F_GETLK64 #define F_SETLK F_SETLK64 -#else -#define fcntl __fcntl #endif +libc_hidden_proto(lockf64) + +libc_hidden_proto(memset) +libc_hidden_proto(fcntl) +libc_hidden_proto(getpid) + /* lockf is a simplified interface to fcntl's locking facilities. */ -#undef lockf64 -int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) +int lockf64 (int fd, int cmd, off64_t len64) { struct flock fl; off_t len = (off_t) len64; @@ -65,7 +67,7 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) return -1; } - __memset((char *) &fl, '\0', sizeof (fl)); + memset((char *) &fl, '\0', sizeof (fl)); /* lockf is always relative to the current file position. */ fl.l_whence = SEEK_CUR; @@ -80,7 +82,7 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) fl.l_type = F_RDLCK; if (fcntl (fd, F_GETLK, &fl) < 0) return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ()) + if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) return 0; __set_errno(EACCES); return -1; @@ -105,5 +107,4 @@ int attribute_hidden __lockf64 (int fd, int cmd, off64_t len64) return fcntl(fd, cmd, &fl); } - -strong_alias(__lockf64,lockf64) +libc_hidden_def(lockf64) diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index d5d3e753b..dc18c2f59 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strcmp __strcmp - #if HAVE_CONFIG_H # include <config.h> #endif @@ -34,11 +32,6 @@ # define HAVE_STRING_H 1 # define STDC_HEADERS # define HAVE___STRCHRNUL 1 -extern void *__mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) - __THROW __nonnull ((1, 2)) attribute_hidden; -extern void *__memchr (__const void *__s, int __c, size_t __n) - __THROW __attribute_pure__ __nonnull ((1)) attribute_hidden; # ifdef __UCLIBC_HAS_WCHAR__ # define HAVE_WCHAR_H 1 # define HAVE_WCTYPE_H 1 @@ -64,6 +57,22 @@ extern void *__memchr (__const void *__s, int __c, size_t __n) # include <stdlib.h> #endif +#ifdef __UCLIBC__ +#define __memset memset +libc_hidden_proto(memchr) +libc_hidden_proto(memset) +libc_hidden_proto(mempcpy) +libc_hidden_proto(strcat) +libc_hidden_proto(strcmp) +/*libc_hidden_proto(strchr)*/ +/*libc_hidden_proto(strchrnul)*/ +libc_hidden_proto(strlen) +libc_hidden_proto(strcoll) +libc_hidden_proto(tolower) +libc_hidden_proto(fnmatch) +libc_hidden_proto(getenv) +#endif + /* For platform which support the ISO C amendement 1 functionality we support user defined character classes. */ #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) @@ -71,24 +80,20 @@ extern void *__memchr (__const void *__s, int __c, size_t __n) # include <wchar.h> # include <wctype.h> # ifdef __UCLIBC__ -extern wctype_t __wctype (__const char *__property) __THROW attribute_hidden; -extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW attribute_hidden; -extern wint_t __btowc (int __c) __THROW attribute_hidden; +libc_hidden_proto(wctype) +libc_hidden_proto(iswctype) +libc_hidden_proto(btowc) # ifdef __UCLIBC_HAS_LOCALE__ -extern size_t __mbsrtowcs (wchar_t *__restrict __dst, - __const char **__restrict __src, size_t __len, - mbstate_t *__restrict __ps) __THROW attribute_hidden; -extern size_t __wcslen (__const wchar_t *__s) __THROW __attribute_pure__ attribute_hidden; -extern wchar_t *__wmempcpy (wchar_t *__restrict __s1, - __const wchar_t *__restrict __s2, size_t __n) - __THROW attribute_hidden; -extern wchar_t *__wcscat (wchar_t *__restrict __dest, - __const wchar_t *__restrict __src) __THROW attribute_hidden; -extern size_t __strnlen (__const char *__string, size_t __maxlen) - __THROW __attribute_pure__ __nonnull ((1)) attribute_hidden; -extern wchar_t *__wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n) - __THROW __attribute_pure__ attribute_hidden; -extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; +libc_hidden_proto(wmemchr) +libc_hidden_proto(wmempcpy) +libc_hidden_proto(wcscat) +/*libc_hidden_proto(wcschr)*/ +/*libc_hidden_proto(wcschrnul)*/ +libc_hidden_proto(wcslen) +libc_hidden_proto(wcscoll) +libc_hidden_proto(towlower) +libc_hidden_proto(mbsrtowcs) +libc_hidden_proto(strnlen) # endif # endif #endif @@ -96,21 +101,22 @@ extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; /* We need some of the locale data (the collation sequence information) but there is no interface to get this information in general. Therefore we support a correct implementation only in glibc. */ -#if defined _LIBC || defined __UCLIBC__ -# ifndef __UCLIBC__ +#if defined _LIBC # include "../locale/localeinfo.h" # include "../locale/elem-hash.h" # include "../locale/coll-lookup.h" # include <shlib-compat.h> -# endif # define CONCAT(a,b) __CONCAT(a,b) -# if defined _LIBC || defined __UCLIBC_HAS_LOCALE__ +# if defined _LIBC # define mbsrtowcs __mbsrtowcs # endif # define fnmatch __fnmatch extern int fnmatch (const char *pattern, const char *string, int flags) attribute_hidden; #endif +#ifdef __UCLIBC__ +# define CONCAT(a,b) __CONCAT(a,b) +#endif /* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */ #define NO_LEADING_PERIOD(flags) \ @@ -168,13 +174,13 @@ extern int fnmatch (const char *pattern, const char *string, int flags) attribut # define CHAR_CLASS_MAX_LENGTH 256 # endif -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # define IS_CHAR_CLASS(string) __wctype (string) # else # define IS_CHAR_CLASS(string) wctype (string) # endif -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # define ISWCTYPE(WC, WT) __iswctype (WC, WT) # else # define ISWCTYPE(WC, WT) iswctype (WC, WT) @@ -246,7 +252,7 @@ __wcschrnul (s, c) # endif /* Note that this evaluates C many times. */ -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # define FOLD(c) ((flags & FNM_CASEFOLD) ? __tolower (c) : (c)) # else # define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) @@ -258,22 +264,22 @@ __wcschrnul (s, c) # define EXT ext_match # define END end_pattern # define L(CS) CS -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # define BTOWC(C) __btowc (C) # else # define BTOWC(C) btowc (C) # endif -# define STRLEN(S) __strlen (S) -# define STRCAT(D, S) __strcat (D, S) -# define MEMPCPY(D, S, N) __mempcpy (D, S, N) -# define MEMCHR(S, C, N) __memchr (S, C, N) -# define STRCOLL(S1, S2) __strcoll (S1, S2) +# define STRLEN(S) strlen (S) +# define STRCAT(D, S) strcat (D, S) +# define MEMPCPY(D, S, N) mempcpy (D, S, N) +# define MEMCHR(S, C, N) memchr (S, C, N) +# define STRCOLL(S1, S2) strcoll (S1, S2) # include "fnmatch_loop.c" # if HANDLE_MULTIBYTE /* Note that this evaluates C many times. */ -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # define FOLD(c) ((flags & FNM_CASEFOLD) ? __towlower (c) : (c)) # else # define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? towlower (c) : (c)) @@ -286,11 +292,11 @@ __wcschrnul (s, c) # define END end_wpattern # define L(CS) L##CS # define BTOWC(C) (C) -# define STRLEN(S) __wcslen (S) -# define STRCAT(D, S) __wcscat (D, S) -# define MEMPCPY(D, S, N) __wmempcpy (D, S, N) -# define MEMCHR(S, C, N) __wmemchr (S, C, N) -# define STRCOLL(S1, S2) __wcscoll (S1, S2) +# define STRLEN(S) wcslen (S) +# define STRCAT(D, S) wcscat (D, S) +# define MEMPCPY(D, S, N) wmempcpy (D, S, N) +# define MEMCHR(S, C, N) wmemchr (S, C, N) +# define STRCOLL(S1, S2) wcscoll (S1, S2) # ifndef __UCLIBC__ # define WIDE_CHAR_VERSION 1 # endif @@ -354,7 +360,7 @@ is_char_class (const wchar_t *wcs) *cp = '\0'; -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC return __wctype (s); # else return wctype (s); @@ -365,15 +371,16 @@ is_char_class (const wchar_t *wcs) # include "fnmatch_loop.c" # endif +extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +libc_hidden_proto(_stdlib_mb_cur_max) -int attribute_hidden +int fnmatch (const char *pattern, const char *string, int flags) { # if HANDLE_MULTIBYTE # ifdef __UCLIBC_HAS_WCHAR__ # undef MB_CUR_MAX -# define MB_CUR_MAX (_stdlib_mb_cur_max_internal ()) -extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; +# define MB_CUR_MAX (_stdlib_mb_cur_max ()) # endif if (__builtin_expect (MB_CUR_MAX, 1) != 1) { @@ -387,9 +394,9 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; __memset (&ps, '\0', sizeof (ps)); p = pattern; #if defined _LIBC || defined __UCLIBC__ - n = __strnlen (pattern, 1024); + n = strnlen (pattern, 1024); #else - n = __strlen (pattern); + n = strlen (pattern); #endif if (__builtin_expect (n < 1024, 1)) { @@ -418,9 +425,9 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; assert (mbsinit (&ps)); #if defined _LIBC || defined __UCLIBC__ - n = __strnlen (string, 1024); + n = strnlen (string, 1024); #else - n = __strlen (string); + n = strlen (string); #endif p = string; if (__builtin_expect (n < 1024, 1)) @@ -453,11 +460,11 @@ extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; } # endif /* mbstate_t and mbsrtowcs or _LIBC. */ - return internal_fnmatch (pattern, string, string + __strlen (string), + return internal_fnmatch (pattern, string, string + strlen (string), flags & FNM_PERIOD, flags); } -# if defined _LIBC || defined __UCLIBC__ +# if defined _LIBC # undef fnmatch # ifndef __UCLIBC__ versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3); @@ -466,9 +473,10 @@ strong_alias (__fnmatch, __fnmatch_old) compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0); # endif libc_hidden_ver (__fnmatch, fnmatch) -# else -strong_alias(__fnmatch,fnmatch) # endif +# else +libc_hidden_proto(fnmatch) +libc_hidden_def(fnmatch) # endif #endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/libc/misc/fnmatch/fnmatch_loop.c b/libc/misc/fnmatch/fnmatch_loop.c index 663af1222..191cef50c 100644 --- a/libc/misc/fnmatch/fnmatch_loop.c +++ b/libc/misc/fnmatch/fnmatch_loop.c @@ -214,7 +214,7 @@ FCT (pattern, string, string_end, no_leading_period, flags) UCHAR fn; if (posixly_correct == 0) - posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; if (n == string_end) return FNM_NOMATCH; @@ -993,7 +993,7 @@ END (const CHAR *pattern) { /* Handle brackets special. */ if (posixly_correct == 0) - posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; /* Skip the not sign. We have to recognize it because of a possibly following ']'. */ @@ -1045,7 +1045,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, { /* Handle brackets special. */ if (posixly_correct == 0) - posixly_correct = __getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; /* Skip the not sign. We have to recognize it because of a possibly following ']'. */ diff --git a/libc/misc/fnmatch/fnmatch_old.c b/libc/misc/fnmatch/fnmatch_old.c index 2762b3930..47075e914 100644 --- a/libc/misc/fnmatch/fnmatch_old.c +++ b/libc/misc/fnmatch/fnmatch_old.c @@ -28,6 +28,9 @@ Cambridge, MA 02139, USA. */ #include <fnmatch.h> #include <ctype.h> +libc_hidden_proto(fnmatch) + +libc_hidden_proto(tolower) /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling @@ -50,13 +53,13 @@ Cambridge, MA 02139, USA. */ /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ -int attribute_hidden __fnmatch(const char *pattern, const char *string, int flags) +int fnmatch(const char *pattern, const char *string, int flags) { register const char *p = pattern, *n = string; register char c; /* Note that this evaluates C many times. */ -# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? __tolower (c) : (c)) +# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) while ((c = *p++) != '\0') { c = FOLD(c); @@ -116,7 +119,7 @@ int attribute_hidden __fnmatch(const char *pattern, const char *string, int flag 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; } @@ -220,5 +223,5 @@ int attribute_hidden __fnmatch(const char *pattern, const char *string, int flag # undef FOLD } -strong_alias(__fnmatch,fnmatch) +libc_hidden_def(fnmatch) #endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index fdea1c208..b2c0c4ee4 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -31,17 +31,6 @@ #define HAVE_SYS_PARAM_H 1 #define HAVE_DECL_STPCPY 1 #define HAVE_MEMPCPY 1 -#define dirfd __dirfd -#define tsearch __tsearch -#define tfind __tfind -#define tdestroy __tdestroy -#define getcwd __getcwd -#define chdir __chdir -#define fchdir __fchdir -#define mempcpy __mempcpy -#define opendir __opendir -#define closedir __closedir -#define stpcpy __stpcpy #endif #if __GNUC__ @@ -64,7 +53,7 @@ char *alloca (); #else # if HAVE_DIRENT_H # include <dirent.h> -# define NAMLEN(dirent) __strlen ((dirent)->d_name) +# define NAMLEN(dirent) strlen ((dirent)->d_name) # else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen @@ -96,6 +85,28 @@ char *alloca (); # include <sys/stat.h> #endif +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(dirfd) +libc_hidden_proto(tsearch) +libc_hidden_proto(tfind) +libc_hidden_proto(tdestroy) +libc_hidden_proto(getcwd) +libc_hidden_proto(chdir) +libc_hidden_proto(fchdir) +libc_hidden_proto(mempcpy) +libc_hidden_proto(opendir) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(readdir64) +libc_hidden_proto(lstat64) +libc_hidden_proto(stat64) +#endif +libc_hidden_proto(closedir) +libc_hidden_proto(stpcpy) +libc_hidden_proto(lstat) +libc_hidden_proto(stat) + #if ! _LIBC && !HAVE_DECL_STPCPY && !defined stpcpy char *stpcpy (); #endif @@ -108,24 +119,30 @@ char *stpcpy (); /* #define NDEBUG 1 */ #include <assert.h> -#if !defined _LIBC && !defined __UCLIBC__ +#if !defined _LIBC # undef __chdir # define __chdir chdir # undef __closedir # define __closedir closedir # undef __fchdir # define __fchdir fchdir -# ifndef __UCLIBC__ # undef __getcwd +# ifndef __UCLIBC__ # define __getcwd(P, N) xgetcwd () extern char *xgetcwd (void); +# else +# define __getcwd getcwd # endif # undef __mempcpy # define __mempcpy mempcpy # undef __opendir # define __opendir opendir # undef __readdir64 +# ifndef __UCLIBC_HAS_LFS__ # define __readdir64 readdir +# else +# define __readdir64 readdir64 +# endif # undef __stpcpy # define __stpcpy stpcpy # undef __tdestroy @@ -136,8 +153,10 @@ extern char *xgetcwd (void); # define __tsearch tsearch # undef internal_function # define internal_function /* empty */ +# ifndef __UCLIBC_HAS_LFS__ # undef dirent64 # define dirent64 dirent +# endif # undef MAX # define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif @@ -167,21 +186,11 @@ int rpl_lstat (const char *, struct stat *); # define LXSTAT __lxstat # define XSTAT __xstat # else -# ifdef __UCLIBC__ -# define LXSTAT(V,f,sb) __lstat(f,sb) -# define XSTAT(V,f,sb) __stat(f,sb) -# define __readdir64 __readdir -# define dirent64 dirent -# else # define LXSTAT(V,f,sb) lstat (f,sb) # define XSTAT(V,f,sb) stat (f,sb) -# endif # endif # define FTW_FUNC_T __ftw_func_t # define NFTW_FUNC_T __nftw_func_t -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden; -# else -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden; #endif /* We define PATH_MAX if the system does not provide a definition. @@ -520,7 +529,7 @@ fail: /* Next, update the `struct FTW' information. */ ++data->ftw.level; - startp = __strchr (data->dirbuf, '\0'); + startp = strchr (data->dirbuf, '\0'); /* There always must be a directory name. */ assert (startp != data->dirbuf); if (startp[-1] != '/') @@ -556,7 +565,7 @@ fail: while (result == 0 && *runp != '\0') { - char *endp = __strchr (runp, '\0'); + char *endp = strchr (runp, '\0'); result = process_entry (data, &dir, runp, endp - runp); @@ -633,10 +642,10 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, data.actdir = 0; data.dirstreams = (struct dir_data **) alloca (data.maxdir * sizeof (struct dir_data *)); - __memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); + memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *)); /* PATH_MAX is always defined when we get here. */ - data.dirbufsize = MAX (2 * __strlen (dir), PATH_MAX); + data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX); data.dirbuf = (char *) malloc (data.dirbufsize); if (data.dirbuf == NULL) return -1; diff --git a/libc/misc/ftw/ftw64.c b/libc/misc/ftw/ftw64.c index c4edd4d0a..de2fe22d1 100644 --- a/libc/misc/ftw/ftw64.c +++ b/libc/misc/ftw/ftw64.c @@ -24,8 +24,8 @@ #define NFTW_NEW_NAME __new_nftw64 #define INO_T ino64_t #define STAT stat64 -#define LXSTAT(V,f,sb) __lstat64(f,sb) -#define XSTAT(V,f,sb) __stat64(f,sb) +#define LXSTAT(V,f,sb) lstat64(f,sb) +#define XSTAT(V,f,sb) stat64(f,sb) #define FTW_FUNC_T __ftw64_func_t #define NFTW_FUNC_T __nftw64_func_t diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index ea87d371c..d55a649ab 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -15,11 +15,6 @@ License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define strrchr __strrchr -#define strcoll __strcoll -#define qsort __qsort -#define fnmatch __fnmatch - #include <features.h> #include <stdlib.h> #include <string.h> @@ -33,8 +28,17 @@ 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; +libc_hidden_proto(memcpy) +libc_hidden_proto(strcat) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strrchr) +libc_hidden_proto(strcoll) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(fnmatch) +libc_hidden_proto(qsort) +libc_hidden_proto(lstat) extern __ptr_t (*__glob_opendir_hook) __P ((const char *directory)); extern void (*__glob_closedir_hook) __P ((__ptr_t stream)); @@ -51,12 +55,15 @@ static int collated_compare __P ((const __ptr_t, const __ptr_t)); #ifdef __GLOB64 extern int __glob_pattern_p(const char *pattern, int quote) attribute_hidden; +libc_hidden_proto(readdir64) +#define __readdir readdir64 #else -extern struct dirent *__readdir (DIR *__dirp) __nonnull ((1)) attribute_hidden; extern int __glob (__const char *__restrict __pattern, int __flags, int (*__errfunc) (__const char *, int), glob_t *__restrict __pglob) __THROW attribute_hidden; extern void __globfree (glob_t *__pglob) __THROW attribute_hidden; +#define __readdir readdir +libc_hidden_proto(readdir) /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ int attribute_hidden __glob_pattern_p(const char *pattern, int quote) @@ -138,7 +145,7 @@ __glob (pattern, flags, errfunc, pglob) { dirlen = filename - pattern; dirname = (char *) alloca (dirlen + 1); - __memcpy (dirname, pattern, dirlen); + memcpy (dirname, pattern, dirlen); dirname[dirlen] = '\0'; ++filename; } @@ -230,11 +237,11 @@ __glob (pattern, flags, errfunc, pglob) /* No matches. */ if (flags & GLOB_NOCHECK) { - size_t len = __strlen (pattern) + 1; + size_t len = strlen (pattern) + 1; char *patcopy = (char *) malloc (len); if (patcopy == NULL) return GLOB_NOSPACE; - __memcpy (patcopy, pattern, len); + memcpy (patcopy, pattern, len); pglob->gl_pathv = (char **) realloc (pglob->gl_pathv, @@ -290,9 +297,9 @@ __glob (pattern, flags, errfunc, pglob) int i; struct stat st; for (i = oldcount; i < pglob->gl_pathc; ++i) - if (__lstat (pglob->gl_pathv[i], &st) == 0 && + if (lstat (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) - __strcat (pglob->gl_pathv[i], "/"); + strcat (pglob->gl_pathv[i], "/"); } if (!(flags & GLOB_NOSORT)) @@ -364,7 +371,7 @@ prefix_array (dirname, array, n, add_slash) int add_slash; { register size_t i; - size_t dirlen = __strlen (dirname); + size_t dirlen = strlen (dirname); if (dirlen == 1 && dirname[0] == '/') /* DIRNAME is just "/", so normal prepending would get us "//foo". @@ -373,7 +380,7 @@ prefix_array (dirname, array, n, add_slash) for (i = 0; i < n; ++i) { - size_t eltlen = __strlen (array[i]) + 1; + size_t eltlen = strlen (array[i]) + 1; char *new = (char *) malloc (dirlen + 1 + eltlen + (add_slash ? 1 : 0)); if (new == NULL) { @@ -382,9 +389,9 @@ prefix_array (dirname, array, n, add_slash) return 1; } - __memcpy (new, dirname, dirlen); + memcpy (new, dirname, dirlen); new[dirlen] = '/'; - __memcpy (&new[dirlen + 1], array[i], eltlen); + memcpy (&new[dirlen + 1], array[i], eltlen); free ((__ptr_t) array[i]); array[i] = new; } @@ -417,7 +424,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)) || @@ -457,7 +464,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) #endif } - if ((!meta && __strcmp (pattern, name) == 0) + if ((!meta && strcmp (pattern, name) == 0) || fnmatch (pattern, name, (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0) @@ -465,12 +472,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) struct globlink *new = (struct globlink *) alloca (sizeof (struct globlink)); if (len == 0) - len = __strlen (name); + len = strlen (name); new->name = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1); if (new->name == NULL) goto memory_error; - __memcpy ((__ptr_t) new->name, name, len); + memcpy ((__ptr_t) new->name, name, len); new->name[len] = '\0'; new->next = names; names = new; @@ -482,14 +489,14 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (nfound == 0 && (flags & GLOB_NOCHECK)) { - size_t len = __strlen (pattern); + size_t len = strlen (pattern); nfound = 1; names = (struct globlink *) alloca (sizeof (struct globlink)); names->next = NULL; names->name = (char *) malloc (len + (flags & GLOB_MARK ? 1 : 0) + 1); if (names->name == NULL) goto memory_error; - __memcpy (names->name, pattern, len); + memcpy (names->name, pattern, len); names->name[len] = '\0'; } @@ -517,7 +524,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; @@ -528,7 +535,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/glob/glob64.c b/libc/misc/glob/glob64.c index f0c65abe0..5baf86810 100644 --- a/libc/misc/glob/glob64.c +++ b/libc/misc/glob/glob64.c @@ -18,15 +18,13 @@ #include <glob.h> #include <sys/stat.h> -extern struct dirent64 *__readdir64 (DIR *__dirp) __nonnull ((1)) attribute_hidden; + extern int __glob64 (__const char *__restrict __pattern, int __flags, int (*__errfunc) (__const char *, int), glob64_t *__restrict __pglob) __THROW attribute_hidden; extern void __globfree (glob_t *__pglob) __THROW attribute_hidden; extern void __globfree64 (glob64_t *__pglob) __THROW attribute_hidden; - #define dirent dirent64 -#define __readdir(dirp) __readdir64(dirp) #define glob_t glob64_t #define __glob(pattern, flags, errfunc, pglob) \ @@ -38,7 +36,7 @@ extern void __globfree64 (glob64_t *__pglob) __THROW attribute_hidden; #undef stat #define stat stat64 -#define __lstat __lstat64 +#define lstat lstat64 #define __GLOB64 1 diff --git a/libc/misc/gnu/obstack.c b/libc/misc/gnu/obstack.c index 6521bd1d4..5fc031555 100644 --- a/libc/misc/gnu/obstack.c +++ b/libc/misc/gnu/obstack.c @@ -51,7 +51,7 @@ # endif #endif -#if defined _LIBC && defined USE_IN_LIBIO +#if (defined _LIBC && defined USE_IN_LIBIO) || defined __UCLIBC_HAS_WCHAR__ # include <wchar.h> #endif @@ -105,6 +105,14 @@ void (*obstack_alloc_failed_handler) () = print_and_abort; # ifndef EXIT_FAILURE # define EXIT_FAILURE 1 # endif + +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) +libc_hidden_proto(exit) +#ifdef __UCLIBC_HAS_WCHAR__ +libc_hidden_proto(fwprintf) +#endif + int obstack_exit_failure = EXIT_FAILURE; /* The non-GNU-C macros copy the obstack into this global variable @@ -480,15 +488,8 @@ _obstack_memory_used (h) # define fputs(s, f) _IO_fputs (s, f) # endif -# ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -# endif - static void -__attribute__ ((noreturn)) +attribute_noreturn print_and_abort () { /* Don't change any of these strings. Yes, it would be possible to add @@ -498,11 +499,11 @@ print_and_abort () a very similar string which requires a separate translation. */ # if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) - __fwprintf (stderr, L"%s\n", _("memory exhausted")); + fwprintf (stderr, L"%s\n", _("memory exhausted")); else # endif fprintf (stderr, "%s\n", _("memory exhausted")); - __exit (obstack_exit_failure); + exit (obstack_exit_failure); } # if 0 diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 414342c79..9987324b2 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -13,11 +13,6 @@ * avoided in the static library case. */ -#define getgid __getgid -#define getuid __getuid -#define getegid __getegid -#define geteuid __geteuid - #define _ERRNO_H #include <features.h> #include <unistd.h> @@ -33,6 +28,21 @@ #include <sys/stat.h> #include <sys/sysmacros.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(strrchr) +libc_hidden_proto(getgid) +libc_hidden_proto(getuid) +libc_hidden_proto(getegid) +libc_hidden_proto(geteuid) +libc_hidden_proto(fstat) +libc_hidden_proto(abort) +libc_hidden_proto(exit) + +extern int __libc_open (__const char *__file, int __oflag, ...) __nonnull ((1)); +libc_hidden_proto(__libc_open) +extern int __libc_fcntl (int __fd, int __cmd, ...); +libc_hidden_proto(__libc_fcntl) + #ifndef SHARED void *__libc_stack_end=NULL; @@ -84,7 +94,8 @@ weak_alias(__environ, environ) /* TODO: don't export __pagesize; we cant now because libpthread uses it */ size_t __pagesize = 0; -hidden_strong_alias(__pagesize,__pagesize_internal) +libc_hidden_proto(__pagesize) +libc_hidden_def(__pagesize) #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 @@ -95,18 +106,17 @@ hidden_strong_alias(__pagesize,__pagesize_internal) static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ - if (unlikely(__fcntl(fd, F_GETFD)==-1 && *(__errno_location())==EBADF)) + if (unlikely(__libc_fcntl(fd, F_GETFD)==-1 && *(__errno_location())==EBADF)) { /* The descriptor is probably not open, so try to use /dev/null */ struct stat st; - int nullfd = __open(_PATH_DEVNULL, mode); + int nullfd = __libc_open(_PATH_DEVNULL, mode); /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not * some other wierd file... */ - if ( (nullfd!=fd) || __fstat(fd, &st) || !S_ISCHR(st.st_mode) || + if ( (nullfd!=fd) || fstat(fd, &st) || !S_ISCHR(st.st_mode) || (st.st_rdev != makedev(1, 3))) { - /* Somebody is trying some trickery here... */ abort(); } } @@ -152,7 +162,7 @@ void __uClibc_init(void) /* Setup an initial value. This may not be perfect, but is * better than malloc using __pagesize=0 for atexit, ctors, etc. */ - __pagesize_internal = PAGE_SIZE; + __pagesize = PAGE_SIZE; #ifdef __UCLIBC_HAS_THREADS__ /* Before we start initializing uClibc we have to call @@ -189,7 +199,8 @@ void __uClibc_init(void) _stdio_init(); } -hidden_strong_alias(__uClibc_init,__uClibc_init_internal) +libc_hidden_proto(__uClibc_init) +libc_hidden_def(__uClibc_init) #ifdef __UCLIBC_CTOR_DTOR__ void attribute_hidden (*__app_fini)(void) = NULL; @@ -237,7 +248,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, while (*aux_dat) { ElfW(auxv_t) *auxv_entry = (ElfW(auxv_t) *) aux_dat; if (auxv_entry->a_type <= AT_EGID) { - __memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); + memcpy(&(auxvt[auxv_entry->a_type]), auxv_entry, sizeof(ElfW(auxv_t))); } aux_dat += 2; } @@ -246,11 +257,11 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, /* 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. */ - __uClibc_init_internal(); + __uClibc_init(); #ifdef __ARCH_HAS_MMU__ /* Make certain getpagesize() gives the correct answer */ - __pagesize_internal = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; + __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; /* Prevent starting SUID binaries where the stdin. stdout, and * stderr file descriptors are not already opened. */ @@ -267,7 +278,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ __progname_full = *argv; - __progname = __strrchr(*argv, '/'); + __progname = strrchr(*argv, '/'); if (__progname != NULL) ++__progname; else @@ -300,5 +311,5 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, /* * Finally, invoke application's main and then exit. */ - __exit(main(argc, argv, __environ)); + exit(main(argc, argv, __environ)); } diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 64fa1e14b..b8b421f13 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -31,10 +31,6 @@ * Use brain damaged getpid() if real random fails. */ -#define open64 __open64 -#define mkdir __mkdir -#define gettimeofday __gettimeofday - #include <stddef.h> #include <stdint.h> #include <stdio.h> @@ -49,12 +45,23 @@ #include <sys/time.h> #include "tempname.h" +libc_hidden_proto(strlen) +libc_hidden_proto(strcmp) +libc_hidden_proto(sprintf) +libc_hidden_proto(mkdir) +libc_hidden_proto(open) +libc_hidden_proto(open64) +libc_hidden_proto(read) +libc_hidden_proto(close) +libc_hidden_proto(getpid) +libc_hidden_proto(stat) +libc_hidden_proto(gettimeofday) /* Return nonzero if DIR is an existent directory. */ static int direxists (const char *dir) { struct stat buf; - return __stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode); + return stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode); } /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is @@ -76,7 +83,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di } else { - plen = __strlen (pfx); + plen = strlen (pfx); if (plen > 5) plen = 5; } @@ -98,7 +105,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di { if (direxists (P_tmpdir)) dir = P_tmpdir; - else if (__strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) + else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) dir = "/tmp"; else { @@ -107,7 +114,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di } } - dlen = __strlen (dir); + dlen = strlen (dir); while (dlen > 1 && dir[dlen - 1] == '/') dlen--; /* remove trailing slashes */ @@ -118,7 +125,7 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di return -1; } - __sprintf (tmpl, "%.*s/%.*sXXXXXX", dlen, dir, plen, pfx); + sprintf (tmpl, "%.*s/%.*sXXXXXX", dlen, dir, plen, pfx); return 0; } @@ -131,13 +138,13 @@ static unsigned int fillrand(unsigned char *buf, unsigned int len) { int fd; unsigned int result = -1; - fd = __open("/dev/urandom", O_RDONLY); + fd = open("/dev/urandom", O_RDONLY); if (fd < 0) { - fd = __open("/dev/random", O_RDONLY | O_NONBLOCK); + fd = open("/dev/random", O_RDONLY | O_NONBLOCK); } if (fd >= 0) { - result = __read(fd, buf, len); - __close(fd); + result = read(fd, buf, len); + close(fd); } return result; } @@ -149,7 +156,7 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len) uint32_t high, low, rh; static uint64_t value; gettimeofday(&tv, NULL); - value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid(); + value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid(); low = value & UINT32_MAX; high = value >> 32; for (i = 0; i < len; ++i) { @@ -188,10 +195,10 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) unsigned char randomness[6]; size_t len; - len = __strlen (tmpl); + len = strlen (tmpl); /* This is where the Xs start. */ XXXXXX = tmpl + len - 6; - if (len < 6 || __strcmp (XXXXXX, "XXXXXX")) + if (len < 6 || strcmp (XXXXXX, "XXXXXX")) { __set_errno (EINVAL); return -1; @@ -212,7 +219,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) case __GT_NOCREATE: { struct stat st; - if (__stat (tmpl, &st) < 0) { + if (stat (tmpl, &st) < 0) { if (errno == ENOENT) { fd = 0; goto restore_and_ret; @@ -223,7 +230,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) fd = 0; } case __GT_FILE: - fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); break; #if defined __UCLIBC_HAS_LFS__ case __GT_BIGFILE: diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 1a20300db..28ebb3fb2 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -46,15 +46,10 @@ * locale support had (8-bit codesets only). */ -#define stpcpy __stpcpy -#define strtok_r __strtok_r -/* #define fflush __fflush */ - #define _GNU_SOURCE #define __CTYPE_HAS_8_BIT_LOCALES 1 - #include <string.h> #include <stdlib.h> #include <stddef.h> @@ -65,6 +60,18 @@ #include <ctype.h> #include <stdio.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(stpcpy) +libc_hidden_proto(strtok_r) +libc_hidden_proto(strlen) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strncmp) +libc_hidden_proto(strchr) +libc_hidden_proto(getenv) +/*libc_hidden_proto(fflush)*/ + #ifdef __UCLIBC_MJN3_ONLY__ #ifdef L_setlocale #warning TODO: Make the link_warning()s a config option? @@ -157,7 +164,7 @@ char *setlocale(int category, register const char *locale) && ( (!locale) /* Request for locale category string. */ || (!*locale) /* Implementation-defined default is C. */ || ((*locale == 'C') && !locale[1]) - || (!__strcmp(locale, "POSIX"))) ) + || (!strcmp(locale, "POSIX"))) ) ? (char *) C_string /* Always in C/POSIX locale. */ : NULL; } @@ -186,6 +193,8 @@ static const char utf8[] = "UTF-8"; */ static char hr_locale[(MAX_LOCALE_CATEGORY_STR * LC_ALL) + MAX_LOCALE_STR]; +libc_hidden_proto(newlocale) + static void update_hr_locale(const unsigned char *spec) { const unsigned char *loc; @@ -228,7 +237,7 @@ static void update_hr_locale(const unsigned char *spec) *n = 0; } else { char at = 0; - __memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); + memcpy(n, LOCALE_NAMES + 5*((*loc)-1), 5); if (n[2] != '_') { at = n[2]; n[2] = '_'; @@ -263,9 +272,6 @@ static void update_hr_locale(const unsigned char *spec) } while (!done); } -extern __locale_t __newlocale (int __category_mask, __const char *__locale, - __locale_t __base) __THROW attribute_hidden; - char *setlocale(int category, const char *locale) { if (((unsigned int)(category)) > LC_ALL) { @@ -276,7 +282,7 @@ char *setlocale(int category, const char *locale) } if (locale != NULL) { /* Not just a query... */ - if (!__newlocale((1 << category), locale, __global_locale)) { + if (!newlocale((1 << category), locale, __global_locale)) { return NULL; /* Failed! */ } update_hr_locale(__global_locale->cur_locale); @@ -460,7 +466,7 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) + cdd->base_idx * sizeof(coldata_base_t) )/2 ); - __memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); + memcpy(cur_collate, cdb, offsetof(coldata_base_t,index2weight_offset)); cur_collate->undefined_idx = cdd->undefined_idx; cur_collate->ti_mask = (1 << cur_collate->ti_shift)-1; @@ -512,9 +518,9 @@ static int init_cur_collate(int der_num, __collate_t *cur_collate) cur_collate->index2ruleidx = cur_collate->index2weight + cur_collate->max_col_index + 1; - __memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, + memcpy(cur_collate->index2weight, cur_collate->index2weight_tbl, cur_collate->num_col_base * sizeof(uint16_t)); - __memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, + memcpy(cur_collate->index2ruleidx, cur_collate->index2ruleidx_tbl, cur_collate->num_col_base * sizeof(uint16_t)); /* now do the overrides */ @@ -599,7 +605,7 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) return 0; /* calloc failed. */ } free(base->collate.index2weight); - __memcpy(&base->collate, &newcol, sizeof(__collate_t)); + memcpy(&base->collate, &newcol, sizeof(__collate_t)); } do { @@ -669,15 +675,15 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) * All of this will be replaced in the next generation * of locale support anyway... */ - __memcpy(base->__ctype_b_data, + memcpy(base->__ctype_b_data, __C_ctype_b - __UCLIBC_CTYPE_B_TBL_OFFSET, (256 + __UCLIBC_CTYPE_B_TBL_OFFSET) * sizeof(__ctype_mask_t)); - __memcpy(base->__ctype_tolower_data, + memcpy(base->__ctype_tolower_data, __C_ctype_tolower - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); - __memcpy(base->__ctype_toupper_data, + memcpy(base->__ctype_toupper_data, __C_ctype_toupper - __UCLIBC_CTYPE_TO_TBL_OFFSET, (256 + __UCLIBC_CTYPE_TO_TBL_OFFSET) * sizeof(__ctype_touplow_t)); @@ -787,7 +793,7 @@ int attribute_hidden _locale_set_l(const unsigned char *p, __locale_t base) d = base->outdigit_length; x = &base->outdigit0_mb; for (c = 0 ; c < 10 ; c++) { - ((unsigned char *)d)[c] = __strlen(x[c]); + ((unsigned char *)d)[c] = strlen(x[c]); assert(d[c] > 0); } } else if (i == LC_NUMERIC) { @@ -852,10 +858,10 @@ static const uint16_t __code2flag[16] = { void attribute_hidden _locale_init_l(__locale_t base) { - __memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); + memset(base->cur_locale, 0, LOCALE_SELECTOR_SIZE); base->cur_locale[0] = '#'; - __memcpy(base->category_item_count, + memcpy(base->category_item_count, __locale_mmap->lc_common_item_offsets_LEN, LC_ALL); @@ -1006,7 +1012,7 @@ static const unsigned char nl_data[C_LC_ALL + 1 + 90 + 320] = { ']', '\x00', '^', '[', 'n', 'N', ']', '\x00', }; -char attribute_hidden *__nl_langinfo(nl_item item) +char *nl_langinfo(nl_item item) { unsigned int c; unsigned int i; @@ -1019,25 +1025,27 @@ char attribute_hidden *__nl_langinfo(nl_item item) } return (char *) cat_start; /* Conveniently, this is the empty string. */ } -strong_alias(__nl_langinfo,nl_langinfo) +libc_hidden_proto(nl_langinfo) +libc_hidden_def(nl_langinfo) #else /* __LOCALE_C_ONLY */ #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; +libc_hidden_proto(nl_langinfo_l) -char attribute_hidden *__nl_langinfo(nl_item item) +char *nl_langinfo(nl_item item) { - return __nl_langinfo_l(item, __UCLIBC_CURLOCALE); + return nl_langinfo_l(item, __UCLIBC_CURLOCALE); } -strong_alias(__nl_langinfo,nl_langinfo) +libc_hidden_proto(nl_langinfo) +libc_hidden_def(nl_langinfo) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ static const char empty[] = ""; -char attribute_hidden *__UCXL(nl_langinfo)(nl_item item __LOCALE_PARAM ) +char *__XL_NPP(nl_langinfo)(nl_item item __LOCALE_PARAM ) { unsigned int c = _NL_ITEM_CATEGORY(item); unsigned int i = _NL_ITEM_INDEX(item); @@ -1049,7 +1057,8 @@ char attribute_hidden *__UCXL(nl_langinfo)(nl_item item __LOCALE_PARAM ) return (char *) empty; } -__UCXL_ALIAS(nl_langinfo) +libc_hidden_proto(__XL_NPP(nl_langinfo)) +libc_hidden_def(__XL_NPP(nl_langinfo)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1082,14 +1091,14 @@ static int find_locale(int category_mask, const char *p, char buf[18]; /* TODO: 7+{max codeset name length} */ const char *q; - if ((q = __strchr(p,'@')) != NULL) { + if ((q = strchr(p,'@')) != NULL) { if ((((size_t)((q-p)-5)) > (sizeof(buf) - 5)) || (p[2] != '_')) { return 0; } /* locale name at least 5 chars long and 3rd char is '_' */ s = LOCALE_AT_MODIFIERS; do { - if (!__strcmp(s+2, q+1)) { + if (!strcmp(s+2, q+1)) { break; } s += 2 + *s; /* TODO - fix this throughout */ @@ -1098,7 +1107,7 @@ static int find_locale(int category_mask, const char *p, return 0; } assert(q - p < sizeof(buf)); - __memcpy(buf, p, q-p); + memcpy(buf, p, q-p); buf[q-p] = 0; buf[2] = s[1]; p = buf; @@ -1106,19 +1115,19 @@ static int find_locale(int category_mask, const char *p, #endif lang_cult = codeset = 0; /* Assume C and default codeset. */ - if (((*p == 'C') && !p[1]) || !__strcmp(p, posix)) { + if (((*p == 'C') && !p[1]) || !strcmp(p, posix)) { goto FIND_LOCALE; } - if ((__strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ + if ((strlen(p) > 5) && (p[5] == '.')) { /* Codeset in locale name? */ /* TODO: maybe CODESET_LIST + *s ??? */ /* 7bit is 1, UTF-8 is 2, 8-bit is >= 3 */ codeset = 2; - if (__strcmp(utf8,p+6) != 0) {/* TODO - fix! */ + if (strcmp(utf8,p+6) != 0) {/* TODO - fix! */ s = CODESET_LIST; do { ++codeset; /* Increment codeset first. */ - if (!__strcmp(CODESET_LIST+*s, p+6)) { + if (!strcmp(CODESET_LIST+*s, p+6)) { goto FIND_LANG_CULT; } } while (*++s); @@ -1131,7 +1140,7 @@ static int find_locale(int category_mask, const char *p, do { /* TODO -- do a binary search? */ /* TODO -- fix gen_mmap!*/ ++lang_cult; /* Increment first since C/POSIX is 0. */ - if (!__strncmp(s,p,5)) { /* Found a matching locale name; */ + if (!strncmp(s,p,5)) { /* Found a matching locale name; */ goto FIND_LOCALE; } s += 5; @@ -1173,14 +1182,14 @@ static unsigned char *composite_locale(int category_mask, const char *locale, int c; int component_mask; - if (!__strchr(locale,'=')) { + if (!strchr(locale,'=')) { if (!find_locale(category_mask, locale, new_locale)) { return NULL; } return new_locale; } - if (__strlen(locale) >= sizeof(buf)) { + if (strlen(locale) >= sizeof(buf)) { return NULL; } stpcpy(buf, locale); @@ -1189,7 +1198,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale, t = strtok_r(buf, "=", &e); /* This can't fail because of strchr test above. */ do { c = 0; - while (__strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { + while (strcmp(CATEGORY_NAMES + (int) CATEGORY_NAMES[c], t)) { if (++c == LC_ALL) { /* Unknown category name! */ return NULL; } @@ -1212,7 +1221,7 @@ static unsigned char *composite_locale(int category_mask, const char *locale, return new_locale; } -__locale_t attribute_hidden __newlocale(int category_mask, const char *locale, __locale_t base) +__locale_t newlocale(int category_mask, const char *locale, __locale_t base) { const unsigned char *p; int i, j, k; @@ -1231,7 +1240,7 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _ #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Rename cur_locale to locale_selector. #endif - __strcpy((char *) new_selector, + strcpy((char *) new_selector, (base ? (char *) base->cur_locale : C_LOCALE_SELECTOR)); if (!*locale) { /* locale == "", so check environment. */ @@ -1251,7 +1260,7 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _ j = 0; do { p = envstr[j]; - } while ((++j < 4) && (!(p = __getenv(p)) || !*p)); + } while ((++j < 4) && (!(p = getenv(p)) || !*p)); /* The user set something... is it valid? */ @@ -1296,8 +1305,8 @@ __locale_t attribute_hidden __newlocale(int category_mask, const char *locale, _ return base; } - -weak_alias(__newlocale, newlocale) +libc_hidden_proto(newlocale) +libc_hidden_def(newlocale) #endif /**********************************************************************/ @@ -1307,7 +1316,7 @@ weak_alias(__newlocale, newlocale) #warning REMINDER: When we allocate ctype tables, remember to dup them. #endif -__locale_t attribute_hidden __duplocale(__locale_t dataset) +__locale_t duplocale(__locale_t dataset) { __locale_t r; uint16_t * i2w; @@ -1320,9 +1329,9 @@ __locale_t attribute_hidden __duplocale(__locale_t dataset) if ((i2w = calloc(n, sizeof(uint16_t))) != NULL ) { - __memcpy(r, dataset, sizeof(__uclibc_locale_t)); + memcpy(r, dataset, sizeof(__uclibc_locale_t)); r->collate.index2weight = i2w; - __memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); + memcpy(i2w, dataset->collate.index2weight, n * sizeof(uint16_t)); } else { free(r); r = NULL; @@ -1330,8 +1339,8 @@ __locale_t attribute_hidden __duplocale(__locale_t dataset) } return r; } - -weak_alias(__duplocale, duplocale) +libc_hidden_proto(duplocale) +libc_hidden_def(duplocale) #endif /**********************************************************************/ @@ -1341,7 +1350,7 @@ weak_alias(__duplocale, duplocale) #warning REMINDER: When we allocate ctype tables, remember to free them. #endif -void __freelocale(__locale_t dataset) +void freelocale(__locale_t dataset) { assert(dataset != __global_locale); assert(dataset != LC_GLOBAL_LOCALE); @@ -1350,13 +1359,11 @@ void __freelocale(__locale_t dataset) free(dataset); /* Free locale */ } -weak_alias(__freelocale, freelocale) - #endif /**********************************************************************/ #ifdef L_uselocale -__locale_t attribute_hidden __uselocale(__locale_t dataset) +__locale_t uselocale(__locale_t dataset) { __locale_t old; @@ -1379,8 +1386,8 @@ __locale_t attribute_hidden __uselocale(__locale_t dataset) } return old; } - -weak_alias(__uselocale, uselocale) +libc_hidden_proto(uselocale) +libc_hidden_def(uselocale) #endif /**********************************************************************/ diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 01970148f..f9734fce5 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -1,14 +1,24 @@ -#define strtok_r __strtok_r -#define strstr __strstr -#define atoi __atoi -#define fseek __fseek -#define fgets __fgets +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mntent.h> +libc_hidden_proto(strstr) +libc_hidden_proto(strtok_r) +libc_hidden_proto(atoi) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fseek) +libc_hidden_proto(fgets) +libc_hidden_proto(abort) +libc_hidden_proto(fprintf) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; @@ -17,7 +27,7 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; #define UNLOCK __pthread_mutex_unlock(&mylock) /* Reentrant version of getmntent. */ -struct mntent attribute_hidden *__getmntent_r (FILE *filep, +struct mntent *getmntent_r (FILE *filep, struct mntent *mnt, char *buff, int bufsize) { char *cp, *ptrptr; @@ -64,7 +74,8 @@ struct mntent attribute_hidden *__getmntent_r (FILE *filep, return mnt; } -strong_alias(__getmntent_r,getmntent_r) +libc_hidden_proto(getmntent_r) +libc_hidden_def(getmntent_r) struct mntent *getmntent(FILE * filep) { @@ -79,7 +90,7 @@ struct mntent *getmntent(FILE * filep) abort(); } - tmp = __getmntent_r(filep, &mnt, buff, BUFSIZ); + tmp = getmntent_r(filep, &mnt, buff, BUFSIZ); UNLOCK; return(tmp); } @@ -101,16 +112,18 @@ char *hasmntopt(const struct mntent *mnt, const char *opt) return strstr(mnt->mnt_opts, opt); } -FILE attribute_hidden *__setmntent(const char *name, const char *mode) +FILE *setmntent(const char *name, const char *mode) { return fopen(name, mode); } -strong_alias(__setmntent,setmntent) +libc_hidden_proto(setmntent) +libc_hidden_def(setmntent) -int attribute_hidden __endmntent(FILE * filep) +int endmntent(FILE * filep) { if (filep != NULL) fclose(filep); return 1; } -strong_alias(__endmntent,endmntent) +libc_hidden_proto(endmntent) +libc_hidden_def(endmntent) diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 419d879be..848097c26 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -835,8 +835,9 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) #ifdef __UCLIBC_HAS_WCHAR__ # undef MB_CUR_MAX -# define MB_CUR_MAX (_stdlib_mb_cur_max_internal ()) -extern size_t _stdlib_mb_cur_max_internal (void) __THROW __wur attribute_hidden; +# define MB_CUR_MAX (_stdlib_mb_cur_max ()) +extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +libc_hidden_proto(_stdlib_mb_cur_max) dfa->mb_cur_max = MB_CUR_MAX; #else dfa->mb_cur_max = 1; diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 99de9fd6c..8bac9c775 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -23,6 +23,7 @@ #endif /* uClibc addons */ +#define _GNU_SOURCE #include <features.h> #ifdef __UCLIBC__ @@ -30,46 +31,50 @@ #define _REGEX_RE_COMP #include <stdbool.h> #include <stdint.h> +#include <string.h> +#include <stdlib.h> #ifdef __UCLIBC_HAS_WCHAR__ #define RE_ENABLE_I18N -#define wcscoll __wcscoll -#define wcrtomb __wcrtomb -#define mbrtowc __mbrtowc -#define iswctype __iswctype -#define iswlower __iswlower -#define iswalnum __iswalnum -#define towlower __towlower -#define towupper __towupper -#define mbsinit __mbsinit #include <wchar.h> #include <wctype.h> -/* attribute_hidden produces text relocation */ -//extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW /*attribute_hidden*/; +#define __iswctype iswctype +#define __wcrtomb wcrtomb +#define __btowc btowc +#define __wctype wctype +libc_hidden_proto(wcscoll) +libc_hidden_proto(wcrtomb) +libc_hidden_proto(mbrtowc) +libc_hidden_proto(iswctype) +libc_hidden_proto(iswlower) +libc_hidden_proto(iswalnum) +libc_hidden_proto(towlower) +libc_hidden_proto(towupper) +libc_hidden_proto(mbsinit) +libc_hidden_proto(btowc) +libc_hidden_proto(wctype) -extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, - mbstate_t *__restrict __ps) attribute_hidden; - -extern wint_t __btowc (int __c) attribute_hidden; - -extern wctype_t __wctype (__const char *__property) attribute_hidden; - -//extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #endif -#define memcmp __memcmp -#define memcpy __memcpy -#define memmove __memmove -#define memset __memset -#define strchr __strchr -#define strcmp __strcmp -#define strlen __strlen -#define strncpy __strncpy -#define getenv __getenv -#define strcasecmp __strcasecmp - -extern void *__mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) attribute_hidden; +#include <ctype.h> +#define __toupper toupper +#define __tolower tolower +#define __mempcpy mempcpy +libc_hidden_proto(toupper) +libc_hidden_proto(tolower) +libc_hidden_proto(memcmp) +libc_hidden_proto(memcpy) +libc_hidden_proto(memmove) +libc_hidden_proto(memset) +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(getenv) +libc_hidden_proto(strcasecmp) +libc_hidden_proto(mempcpy) +libc_hidden_proto(abort) + #endif /* Make sure noone compiles this code with a C++ compiler. */ diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 9031cebff..b64014e98 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -20,37 +20,29 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define HAVE_MEMPCPY -#define memset __memset -#define memcmp __memcmp -#define strcmp __strcmp -#define strlen __strlen -#define wcslen __wcslen -/* for some reason this does not work */ -#define memcpy __memcpy -#define mbrtowc __mbrtowc -#define wcrtomb __wcrtomb -#define wcscoll __wcscoll -#define wctype __wctype -#define iswctype __iswctype -#define iswalnum __iswalnum -#define printf __printf -#define btowc __btowc - /* To exclude some unwanted junk.... */ #undef emacs -#define _REGEX_RE_COMP +#define _GNU_SOURCE #include <features.h> #ifdef __UCLIBC__ # undef _LIBC +# define _REGEX_RE_COMP +# define HAVE_MEMPCPY +# define STDC_HEADERS +# define RE_TRANSLATE_TYPE char * #endif #include <stdlib.h> #include <string.h> -#define STDC_HEADERS -#define RE_TRANSLATE_TYPE char * +#include <stdio.h> -extern void *__mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) /*attribute_hidden*/; +libc_hidden_proto(memset) +libc_hidden_proto(memcmp) +libc_hidden_proto(memcpy) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(printf) +libc_hidden_proto(mempcpy) +libc_hidden_proto(abort) /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined REGEX_MALLOC @@ -89,6 +81,15 @@ extern void *__mempcpy (void *__restrict __dest, /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */ # include <wchar.h> # include <wctype.h> +libc_hidden_proto(wcslen) +libc_hidden_proto(mbrtowc) +libc_hidden_proto(wcrtomb) +libc_hidden_proto(wcscoll) +libc_hidden_proto(wctype) +libc_hidden_proto(iswctype) +libc_hidden_proto(iswalnum) +libc_hidden_proto(btowc) + # endif # if defined _LIBC || defined __UCLIBC__ @@ -113,10 +114,10 @@ extern void *__mempcpy (void *__restrict __dest, __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) +# ifndef __UCLIBC__ # define btowc __btowc /* We are also using some library internals. */ -# ifndef __UCLIBC__ # include <locale/localeinfo.h> # include <locale/elem-hash.h> # include <langinfo.h> @@ -8280,7 +8281,7 @@ regerror (errcode, preg, errbuf, errbuf_size) if (msg_size > errbuf_size) { #if defined HAVE_MEMPCPY || defined _LIBC - *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; + *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; diff --git a/libc/misc/search/hsearch.c b/libc/misc/search/hsearch.c index a9400f3ca..b369408cb 100644 --- a/libc/misc/search/hsearch.c +++ b/libc/misc/search/hsearch.c @@ -17,16 +17,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define hdestroy_r __hdestroy_r -#define hsearch_r __hsearch_r -#define hcreate_r __hcreate_r - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <search.h> +libc_hidden_proto(hdestroy_r) +libc_hidden_proto(hsearch_r) +libc_hidden_proto(hcreate_r) + /* The non-reentrant version use a global space for storing the table. */ static struct hsearch_data htab; diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c index d297b3280..47ff185d4 100644 --- a/libc/misc/search/hsearch_r.c +++ b/libc/misc/search/hsearch_r.c @@ -67,7 +67,7 @@ static int isprime (unsigned int number) indexing as explained in the comment for the hsearch function. The contents of the table is zeroed, especially the field used becomes zero. */ -int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab) +int hcreate_r (size_t nel, struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -96,13 +96,14 @@ int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab) /* everything went alright */ return 1; } -strong_alias(__hcreate_r,hcreate_r) +libc_hidden_proto(hcreate_r) +libc_hidden_def(hcreate_r) #endif #ifdef L_hdestroy_r /* After using the hash table it has to be destroyed. The used memory can be freed and the local static variable can be marked as not used. */ -void attribute_hidden __hdestroy_r (struct hsearch_data *htab) +void hdestroy_r (struct hsearch_data *htab) { /* Test for correct arguments. */ if (htab == NULL) @@ -118,7 +119,8 @@ void attribute_hidden __hdestroy_r (struct hsearch_data *htab) /* the sign for an existing table is an value != NULL in htable */ htab->table = NULL; } -strong_alias(__hdestroy_r,hdestroy_r) +libc_hidden_proto(hdestroy_r) +libc_hidden_def(hdestroy_r) #endif #ifdef L_hsearch_r @@ -135,12 +137,16 @@ strong_alias(__hdestroy_r,hdestroy_r) means used. The used field can be used as a first fast comparison for equality of the stored and the parameter value. This helps to prevent unnecessary expensive calls of strcmp. */ -int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, + +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) + +int hsearch_r (ENTRY item, ACTION action, ENTRY **retval, struct hsearch_data *htab) { unsigned int hval; unsigned int count; - unsigned int len = __strlen (item.key); + unsigned int len = strlen (item.key); unsigned int idx; /* Compute an value for the given string. Perhaps use a better method. */ @@ -166,7 +172,7 @@ int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, unsigned hval2; if (htab->table[idx].used == hval - && __strcmp (item.key, htab->table[idx].entry.key) == 0) + && strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; @@ -190,7 +196,7 @@ int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, /* If entry is found use it. */ if (htab->table[idx].used == hval - && __strcmp (item.key, htab->table[idx].entry.key) == 0) + && strcmp (item.key, htab->table[idx].entry.key) == 0) { *retval = &htab->table[idx].entry; return 1; @@ -224,5 +230,6 @@ int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval, *retval = NULL; return 0; } -strong_alias(__hsearch_r,hsearch_r) +libc_hidden_proto(hsearch_r) +libc_hidden_def(hsearch_r) #endif diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c index 4071cf1ab..eefef2121 100644 --- a/libc/misc/search/lsearch.c +++ b/libc/misc/search/lsearch.c @@ -12,9 +12,11 @@ #include <stdio.h> #include <search.h> +libc_hidden_proto(lfind) + #ifdef L_lfind -void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb, +void *lfind(const void *key, const void *base, size_t *nmemb, size_t size, int (*compar)(const void *, const void *)) { register int n = *nmemb; @@ -26,22 +28,21 @@ void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb, } return (NULL); } -strong_alias(__lfind,lfind) +libc_hidden_def(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; +libc_hidden_proto(memcpy) 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) { - p = __memcpy((base + (size * (*nmemb))), key, size); + if ((p = lfind(key, base, nmemb, size, compar)) == NULL) { + p = memcpy((base + (size * (*nmemb))), key, size); ++(*nmemb); } return (p); diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c index 58f16ab79..47d409468 100644 --- a/libc/misc/search/tsearch.c +++ b/libc/misc/search/tsearch.c @@ -51,7 +51,7 @@ register node **rootp; address of tree root int (*compar)(); ordering function */ -void attribute_hidden *__tsearch(__const void *key, void **vrootp, __compar_fn_t compar) +void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar) { register node *q; register node **rootp = (node **) vrootp; @@ -77,11 +77,12 @@ void attribute_hidden *__tsearch(__const void *key, void **vrootp, __compar_fn_t } return (q); } -strong_alias(__tsearch,tsearch) +libc_hidden_proto(tsearch) +libc_hidden_def(tsearch) #endif #ifdef L_tfind -void attribute_hidden *__tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) +void *tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar) { register node **rootp = (node **) vrootp; @@ -99,7 +100,8 @@ void attribute_hidden *__tfind(__const void *key, void * __const *vrootp, __comp } return NULL; } -strong_alias(__tfind,tfind) +libc_hidden_proto(tfind) +libc_hidden_def(tfind) #endif #ifdef L_tdelete @@ -206,15 +208,15 @@ tdestroy_recurse (node *root, __free_fn_t freefct) free (root); } -void attribute_hidden __tdestroy (void *vroot, __free_fn_t freefct) +void tdestroy (void *vroot, __free_fn_t freefct) { node *root = (node *) vroot; if (root != NULL) { tdestroy_recurse (root, freefct); } } -strong_alias(__tdestroy,tdestroy) +libc_hidden_proto(tdestroy) +libc_hidden_def(tdestroy) #endif /* tsearch.c ends here */ - diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index 63bd640b7..89ab5107d 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -18,10 +18,6 @@ 02111-1307 USA. */ #include <features.h> -#undef __fstatfs64 -#undef __fstatfs - -#ifdef __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 #undef _FILE_OFFSET_BITS @@ -42,13 +38,15 @@ #include <sys/statvfs.h> #include <stddef.h> -#undef fstatfs64 +libc_hidden_proto(memcpy) +libc_hidden_proto(fstatfs) + /* Return information about the filesystem on which FD resides. */ -int attribute_hidden __fstatfs64 (int fd, struct statfs64 *buf) +int fstatfs64 (int fd, struct statfs64 *buf) { struct statfs buf32; - if (__fstatfs (fd, &buf32) < 0) + if (fstatfs (fd, &buf32) < 0) return -1; buf->f_type = buf32.f_type; @@ -60,10 +58,9 @@ int attribute_hidden __fstatfs64 (int fd, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } -strong_alias(__fstatfs64,fstatfs64) - -#endif /* __UCLIBC_HAS_LFS__ */ +libc_hidden_proto(fstatfs64) +libc_hidden_def(fstatfs64) diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c index 14ef6ecce..a3d0ef97c 100644 --- a/libc/misc/statfs/fstatvfs.c +++ b/libc/misc/statfs/fstatvfs.c @@ -29,16 +29,20 @@ #include <sys/statfs.h> #include <sys/statvfs.h> +libc_hidden_proto(fstatfs) +libc_hidden_proto(fstat) +libc_hidden_proto(stat) + int fstatvfs (int fd, struct statvfs *buf) { struct statfs fsbuf; struct stat st; /* Get as much information as possible from the system. */ - if (__fstatfs (fd, &fsbuf) < 0) + if (fstatfs (fd, &fsbuf) < 0) return -1; -#define STAT(st) __fstat (fd, st) +#define STAT(st) fstat (fd, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c index 993caf955..d97895a10 100644 --- a/libc/misc/statfs/fstatvfs64.c +++ b/libc/misc/statfs/fstatvfs64.c @@ -19,7 +19,6 @@ #include <features.h> -#ifdef __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 #undef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 @@ -30,7 +29,6 @@ #ifndef __USE_LARGEFILE64 # define __USE_LARGEFILE64 1 #endif -#endif #define __USE_GNU #include <errno.h> @@ -42,16 +40,19 @@ #include <sys/statfs.h> #include <sys/statvfs.h> +//libc_hidden_proto(fstatfs) +//libc_hidden_proto(fstat) + int fstatvfs (int fd, struct statvfs *buf) { struct statfs fsbuf; struct stat st; /* Get as much information as possible from the system. */ - if (__fstatfs (fd, &fsbuf) < 0) + if (fstatfs (fd, &fsbuf) < 0) return -1; -#define STAT(st) __fstat (fd, st) +#define STAT(st) fstat (fd, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index d41c3052d..2d561976e 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -17,18 +17,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -extern FILE *__setmntent (__const char *__file, __const char *__mode) __THROW attribute_hidden; - -extern struct mntent *__getmntent_r (FILE *__restrict __stream, - struct mntent *__restrict __result, - char *__restrict __buffer, - int __bufsize) __THROW attribute_hidden; - -extern int __endmntent (FILE *__stream) __THROW attribute_hidden; - -extern char *__strsep (char **__restrict __stringp, - __const char *__restrict __delim) - __THROW __nonnull ((1, 2)) attribute_hidden; +libc_hidden_proto(memset) +libc_hidden_proto(strcmp) +libc_hidden_proto(strsep) +libc_hidden_proto(setmntent) +libc_hidden_proto(getmntent_r) +libc_hidden_proto(endmntent) /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf.f_bsize; @@ -52,7 +46,7 @@ extern char *__strsep (char **__restrict __stringp, buf->__f_unused = 0; #endif buf->f_namemax = fsbuf.f_namelen; - __memset (buf->__f_spare, '\0', 6 * sizeof (int)); + memset (buf->__f_spare, '\0', 6 * sizeof (int)); /* What remains to do is to fill the fields f_favail and f_flag. */ @@ -70,20 +64,20 @@ extern char *__strsep (char **__restrict __stringp, struct mntent mntbuf; FILE *mtab; - mtab = __setmntent ("/proc/mounts", "r"); + mtab = setmntent ("/proc/mounts", "r"); if (mtab == NULL) - mtab = __setmntent (_PATH_MOUNTED, "r"); + mtab = setmntent (_PATH_MOUNTED, "r"); if (mtab != NULL) { char tmpbuf[1024]; - while (__getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) + while (getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) { struct stat fsst; /* Find out about the device the current entry is for. */ - if (__stat (mntbuf.mnt_dir, &fsst) >= 0 + if (stat (mntbuf.mnt_dir, &fsst) >= 0 && st.st_dev == fsst.st_dev) { /* Bingo, we found the entry for the device FD is on. @@ -91,22 +85,22 @@ extern char *__strsep (char **__restrict __stringp, char *cp = mntbuf.mnt_opts; char *opt; - while ((opt = __strsep (&cp, ",")) != NULL) - if (__strcmp (opt, "ro") == 0) + while ((opt = strsep (&cp, ",")) != NULL) + if (strcmp (opt, "ro") == 0) buf->f_flag |= ST_RDONLY; - else if (__strcmp (opt, "nosuid") == 0) + else if (strcmp (opt, "nosuid") == 0) buf->f_flag |= ST_NOSUID; - else if (__strcmp (opt, "noexec") == 0) + else if (strcmp (opt, "noexec") == 0) buf->f_flag |= ST_NOEXEC; - else if (__strcmp (opt, "nodev") == 0) + else if (strcmp (opt, "nodev") == 0) buf->f_flag |= ST_NODEV; - else if (__strcmp (opt, "sync") == 0) + else if (strcmp (opt, "sync") == 0) buf->f_flag |= ST_SYNCHRONOUS; - else if (__strcmp (opt, "mand") == 0) + else if (strcmp (opt, "mand") == 0) buf->f_flag |= ST_MANDLOCK; - else if (__strcmp (opt, "noatime") == 0) + else if (strcmp (opt, "noatime") == 0) buf->f_flag |= ST_NOATIME; - else if (__strcmp (opt, "nodiratime") == 0) + else if (strcmp (opt, "nodiratime") == 0) buf->f_flag |= ST_NODIRATIME; /* We can stop looking for more entries. */ @@ -115,7 +109,7 @@ extern char *__strsep (char **__restrict __stringp, } /* Close the file. */ - __endmntent (mtab); + endmntent (mtab); } __set_errno (save_errno); diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 9d326f1f8..230b89b9c 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -18,8 +18,6 @@ 02111-1307 USA. */ #include <features.h> -#undef __statfs64 -#undef __statfs #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 #undef _FILE_OFFSET_BITS @@ -38,14 +36,15 @@ #include <stddef.h> #include <sys/statfs.h> -#if defined __UCLIBC_HAS_LFS__ -#undef statfs64 +libc_hidden_proto(memcpy) +libc_hidden_proto(statfs) + /* Return information about the filesystem on which FILE resides. */ -int attribute_hidden __statfs64 (const char *file, struct statfs64 *buf) +int statfs64 (const char *file, struct statfs64 *buf) { struct statfs buf32; - if (__statfs (file, &buf32) < 0) + if (statfs (file, &buf32) < 0) return -1; buf->f_type = buf32.f_type; @@ -57,10 +56,9 @@ int attribute_hidden __statfs64 (const char *file, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; - __memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; } -strong_alias(__statfs64,statfs64) - -#endif +libc_hidden_proto(statfs64) +libc_hidden_def(statfs64) diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c index a7c553fb6..795126a7b 100644 --- a/libc/misc/statfs/statvfs.c +++ b/libc/misc/statfs/statvfs.c @@ -29,16 +29,19 @@ #include <sys/statfs.h> #include <sys/statvfs.h> +libc_hidden_proto(statfs) +libc_hidden_proto(stat) + int statvfs (const char *file, struct statvfs *buf) { struct statfs fsbuf; struct stat st; /* Get as much information as possible from the system. */ - if (__statfs (file, &fsbuf) < 0) + if (statfs (file, &fsbuf) < 0) return -1; -#define STAT(st) __stat (file, st) +#define STAT(st) stat (file, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c index dc2458f5f..ccde33757 100644 --- a/libc/misc/statfs/statvfs64.c +++ b/libc/misc/statfs/statvfs64.c @@ -42,6 +42,8 @@ #include <sys/statfs.h> #include <sys/statvfs.h> +//libc_hidden_proto(statfs) +//libc_hidden_proto(stat) int statvfs (const char *file, struct statvfs *buf) { @@ -49,10 +51,10 @@ int statvfs (const char *file, struct statvfs *buf) struct stat st; /* Get as much information as possible from the system. */ - if (__statfs (file, &fsbuf) < 0) + if (statfs (file, &fsbuf) < 0) return -1; -#define STAT(st) __stat (file, st) +#define STAT(st) stat (file, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index a4bb56bfc..698d1971d 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,14 +31,6 @@ * SUCH DAMAGE. */ -#define ctime __ctime -#define sigaction __sigaction -#define connect __connect -#define vsnprintf __vsnprintf - -#define __FORCE_GLIBC -#define _GNU_SOURCE -#include <features.h> /* * SYSLOG -- print message on log file * @@ -66,6 +58,9 @@ * - Major code cleanup. */ +#define __FORCE_GLIBC +#define _GNU_SOURCE +#include <features.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/file.h> @@ -85,7 +80,30 @@ #include <ctype.h> #include <signal.h> -extern time_t __time (time_t *__timer) attribute_hidden; +libc_hidden_proto(openlog) +libc_hidden_proto(syslog) +libc_hidden_proto(vsyslog) +libc_hidden_proto(closelog) + +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(memmove) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(open) +/*libc_hidden_proto(fcntl)*/ +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(write) +libc_hidden_proto(getpid) +libc_hidden_proto(ctime) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigemptyset) +libc_hidden_proto(connect) +libc_hidden_proto(sprintf) +libc_hidden_proto(vsnprintf) +libc_hidden_proto(time) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -108,7 +126,7 @@ closelog_intern(int to_default) { LOCK; if (LogFile != -1) { - (void) __close(LogFile); + (void) close(LogFile); } LogFile = -1; connected = 0; @@ -131,8 +149,8 @@ sigpipe_handler (attribute_unused int sig) /* * OPENLOG -- open system log */ -void attribute_hidden -__openlog( const char *ident, int logstat, int logfac ) +void +openlog( const char *ident, int logstat, int logfac ) { int logType = SOCK_DGRAM; @@ -145,33 +163,33 @@ __openlog( const char *ident, int logstat, int logfac ) LogFacility = logfac; if (LogFile == -1) { SyslogAddr.sa_family = AF_UNIX; - (void)__strncpy(SyslogAddr.sa_data, _PATH_LOG, + (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data)); retry: if (LogStat & LOG_NDELAY) { - if ((LogFile = __socket(AF_UNIX, logType, 0)) == -1){ + if ((LogFile = socket(AF_UNIX, logType, 0)) == -1){ UNLOCK; return; } - /* __fcntl(LogFile, F_SETFD, 1); */ + /* fcntl(LogFile, F_SETFD, 1); */ } } if (LogFile != -1 && !connected) { if (connect(LogFile, &SyslogAddr, sizeof(SyslogAddr) - - sizeof(SyslogAddr.sa_data) + __strlen(SyslogAddr.sa_data)) != -1) + sizeof(SyslogAddr.sa_data) + strlen(SyslogAddr.sa_data)) != -1) { connected = 1; } else if (logType == SOCK_DGRAM) { logType = SOCK_STREAM; if (LogFile != -1) { - __close(LogFile); + close(LogFile); LogFile = -1; } goto retry; } else { if (LogFile != -1) { - __close(LogFile); + close(LogFile); LogFile = -1; } } @@ -179,14 +197,14 @@ retry: UNLOCK; } -strong_alias(__openlog,openlog) +libc_hidden_def(openlog) /* * syslog, vsyslog -- * print message on log file; output is intended for syslogd(8). */ -void attribute_hidden -__vsyslog( int pri, const char *fmt, va_list ap ) +void +vsyslog( int pri, const char *fmt, va_list ap ) { register char *p; char *last_chr, *head_end, *end, *stdp; @@ -197,7 +215,7 @@ __vsyslog( int pri, const char *fmt, va_list ap ) struct sigaction action, oldaction; int sigpipe; - __memset (&action, 0, sizeof (action)); + memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; sigemptyset (&action.sa_mask); sigpipe = sigaction (SIGPIPE, &action, &oldaction); @@ -210,7 +228,7 @@ __vsyslog( int pri, const char *fmt, va_list ap ) if (!(LogMask & LOG_MASK(LOG_PRI(pri))) || (pri &~ (LOG_PRIMASK|LOG_FACMASK))) goto getout; if (LogFile < 0 || !connected) - __openlog(LogTag, LogStat | LOG_NDELAY, 0); + openlog(LogTag, LogStat | LOG_NDELAY, 0); /* Set default facility if none specified. */ if ((pri & LOG_FACMASK) == 0) @@ -220,16 +238,16 @@ __vsyslog( int pri, const char *fmt, va_list ap ) * no longer than 64 characters plus length of the LogTag. So it's * safe to test only LogTag and use normal sprintf everywhere else. */ - (void)__time(&now); - stdp = p = tbuf + __sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); + (void)time(&now); + stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); if (LogTag) { - if (__strlen(LogTag) < sizeof(tbuf) - 64) - p += __sprintf(p, "%s", LogTag); + if (strlen(LogTag) < sizeof(tbuf) - 64) + p += sprintf(p, "%s", LogTag); else - p += __sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); + p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>"); } if (LogStat & LOG_PID) - p += __sprintf(p, "[%d]", __getpid()); + p += sprintf(p, "[%d]", getpid()); if (LogTag) { *p++ = ':'; *p++ = ' '; @@ -246,9 +264,9 @@ __vsyslog( int pri, const char *fmt, va_list ap ) p += vsnprintf(p, end - p, fmt, ap); if (p >= end || p < head_end) { /* Returned -1 in case of error... */ static const char truncate_msg[12] = "[truncated] "; - __memmove(head_end + sizeof(truncate_msg), head_end, + memmove(head_end + sizeof(truncate_msg), head_end, end - head_end - sizeof(truncate_msg)); - __memcpy(head_end, truncate_msg, sizeof(truncate_msg)); + memcpy(head_end, truncate_msg, sizeof(truncate_msg)); if (p < head_end) { while (p < end && *p) { p++; @@ -264,14 +282,14 @@ __vsyslog( int pri, const char *fmt, va_list ap ) /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) { *last_chr = '\n'; - (void)__write(STDERR_FILENO, stdp, last_chr - stdp + 1); + (void)write(STDERR_FILENO, stdp, last_chr - stdp + 1); } /* Output the message to the local logger using NUL as a message delimiter. */ p = tbuf; *last_chr = 0; do { - rc = __write(LogFile, p, last_chr + 1 - p); + rc = write(LogFile, p, last_chr + 1 - p); if (rc < 0) { if ((errno==EAGAIN) || (errno==EINTR)) rc=0; @@ -292,12 +310,12 @@ __vsyslog( int pri, const char *fmt, va_list ap ) */ /* should mode be `O_WRONLY | O_NOCTTY' ? -- Uli */ if (LogStat & LOG_CONS && - (fd = __open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { - p = __strchr(tbuf, '>') + 1; + (fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) { + p = strchr(tbuf, '>') + 1; last_chr[0] = '\r'; last_chr[1] = '\n'; - (void)__write(fd, p, last_chr - p + 2); - (void)__close(fd); + (void)write(fd, p, last_chr - p + 2); + (void)close(fd); } getout: @@ -306,28 +324,28 @@ getout: sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); } -strong_alias(__vsyslog,vsyslog) +libc_hidden_def(vsyslog) -void attribute_hidden -__syslog(int pri, const char *fmt, ...) +void +syslog(int pri, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - __vsyslog(pri, fmt, ap); + vsyslog(pri, fmt, ap); va_end(ap); } -strong_alias(__syslog,syslog) +libc_hidden_def(syslog) /* * CLOSELOG -- close the system log */ -void attribute_hidden -__closelog( void ) +void +closelog( void ) { closelog_intern(1); } -strong_alias(__closelog,closelog) +libc_hidden_def(closelog) /* setlogmask -- set the log mask level */ int setlogmask(int pmask) diff --git a/libc/misc/sysvipc/ftok.c b/libc/misc/sysvipc/ftok.c index fd4021d3e..12627cad1 100644 --- a/libc/misc/sysvipc/ftok.c +++ b/libc/misc/sysvipc/ftok.c @@ -20,12 +20,14 @@ #include <sys/ipc.h> #include <sys/stat.h> +libc_hidden_proto(stat) + key_t ftok (const char *pathname, int proj_id) { struct stat st; key_t key; - if (__stat(pathname, &st) < 0) + if (stat(pathname, &st) < 0) return (key_t) -1; key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 33fd16153..14a1ee32b 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -18,7 +18,7 @@ Boston, MA 02111-1307, USA. */ /* SHMLBA uses it */ -#define __getpagesize __getpagesize_internal +#define __getpagesize getpagesize #include <stdlib.h> #include <errno.h> @@ -26,6 +26,8 @@ #include <syscall.h> #include "ipc.h" +libc_hidden_proto(getpagesize) + #ifdef L_shmat /* Attach the shared memory segment associated with SHMID to the data segment of the calling process. SHMADDR and SHMFLG determine how diff --git a/libc/misc/time/adjtime.c b/libc/misc/time/adjtime.c index fd33ff60d..cfa94339a 100644 --- a/libc/misc/time/adjtime.c +++ b/libc/misc/time/adjtime.c @@ -1,10 +1,16 @@ -#define adjtimex __adjtimex +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <limits.h> #include <sys/time.h> #include <sys/timex.h> #include <errno.h> +libc_hidden_proto(adjtimex) + #define MAX_SEC (LONG_MAX / 1000000L - 2) #define MIN_SEC (LONG_MIN / 1000000L + 2) diff --git a/libc/misc/time/ftime.c b/libc/misc/time/ftime.c index 904763241..233d6f70d 100644 --- a/libc/misc/time/ftime.c +++ b/libc/misc/time/ftime.c @@ -16,11 +16,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define gettimeofday __gettimeofday - #include <sys/timeb.h> #include <sys/time.h> +libc_hidden_proto(gettimeofday) + int ftime(timebuf) struct timeb *timebuf; { diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 889e7933f..39aacddd2 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -129,49 +129,54 @@ * differs (intentionally) from glibc's behavior. */ -#define strnlen __strnlen -#define gettimeofday __gettimeofday - #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <time.h> +#include <sys/time.h> #include <limits.h> #include <assert.h> #include <errno.h> #include <ctype.h> #include <langinfo.h> #include <locale.h> +#include <fcntl.h> +#include <unistd.h> #include <bits/uClibc_uintmaxtostr.h> -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_WCHAR__ +#include <wchar.h> +#endif #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; -extern size_t __strftime_l (char *__restrict __s, size_t __maxsize, - __const char *__restrict __format, - __const struct tm *__restrict __tp, - __locale_t __loc) __THROW attribute_hidden; +#endif -extern char *__strptime_l (__const char *__restrict __s, - __const char *__restrict __fmt, struct tm *__tp, - __locale_t __loc) __THROW attribute_hidden; +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(strncpy) +libc_hidden_proto(strnlen) +/* libc_hidden_proto(sprintf) */ +libc_hidden_proto(open) +libc_hidden_proto(read) +libc_hidden_proto(close) +libc_hidden_proto(getenv) +libc_hidden_proto(tzset) +libc_hidden_proto(gettimeofday) +libc_hidden_proto(strncasecmp) +libc_hidden_proto(strtol) +libc_hidden_proto(strtoul) +libc_hidden_proto(nl_langinfo) -extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; +#ifdef __UCLIBC_HAS_XLOCALE__ +libc_hidden_proto(strncasecmp_l) +libc_hidden_proto(strtol_l) +libc_hidden_proto(strtoul_l) +libc_hidden_proto(nl_langinfo_l) #endif #ifndef __isleap @@ -191,8 +196,6 @@ extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; #ifdef __UCLIBC_HAS_TZ_FILE__ #include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> #include "paths.h" /* ":<tzname>+hh:mm:ss<tzname>+hh:mm:ss,Mmm.w.d/hh:mm:ss,Mmm.w.d/hh:mm:ss" + nul */ /* 1 + 2*(1+TZNAME_MAX+1 + 9 + 7 + 9) + 1 = 2*TZNAME_MAX + 56 */ @@ -208,11 +211,6 @@ extern char *__nl_langinfo_l (nl_item __item, __locale_t l) attribute_hidden; extern struct tm __time_tm attribute_hidden; -extern struct tm *__localtime_r (__const time_t *__restrict __timer, - struct tm *__restrict __tp) attribute_hidden; - -extern struct tm *__localtime (__const time_t *__timer) attribute_hidden; - typedef struct { long gmt_offset; long dst_offset; @@ -244,21 +242,19 @@ extern struct tm *__time_localtime_tzi(const time_t *__restrict timer, extern time_t _time_mktime_tzi(struct tm *timeptr, int store_on_success, rule_struct *tzi) attribute_hidden; -extern char *__asctime (__const struct tm *__tp) attribute_hidden; - -extern char *__asctime_r (__const struct tm *__restrict __tp, - char *__restrict __buf) attribute_hidden; - /**********************************************************************/ #ifdef L_asctime +libc_hidden_proto(asctime_r) + static char __time_str[26]; -char attribute_hidden *__asctime(const struct tm *ptm) +char *asctime(const struct tm *ptm) { - return __asctime_r(ptm, __time_str); + return asctime_r(ptm, __time_str); } -strong_alias(__asctime,asctime) +libc_hidden_proto(asctime) +libc_hidden_def(asctime) #endif /**********************************************************************/ @@ -278,7 +274,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, @@ -326,7 +322,7 @@ static const unsigned char at_data[] = { ' ', '?', '?', '?', '?', '\n', 0 }; -char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, +char *asctime_r(register const struct tm *__restrict ptm, register char *__restrict buffer) { int tmp; @@ -335,23 +331,23 @@ char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, assert(buffer); #ifdef SAFE_ASCTIME_R - __memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); + memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); if (((unsigned int)(ptm->tm_wday)) <= 6) { - __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); } if (((unsigned int)(ptm->tm_mon)) <= 11) { - __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); } #else assert(((unsigned int)(ptm->tm_wday)) <= 6); assert(((unsigned int)(ptm->tm_mon)) <= 11); - __memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); + memcpy(buffer, at_data + 3*(7 + 12) - 3, sizeof(at_data) + 3 - 3*(7 + 12)); - __memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); - __memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); + memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); + memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); #endif #ifdef SAFE_ASCTIME_R @@ -400,16 +396,17 @@ char attribute_hidden *__asctime_r(register const struct tm *__restrict ptm, return buffer - 8; } -strong_alias(__asctime_r,asctime_r) +libc_hidden_proto(asctime_r) +libc_hidden_def(asctime_r) #endif /**********************************************************************/ #ifdef L_clock -#define times __times - #include <sys/times.h> +libc_hidden_proto(times) + #ifndef __BCC__ #if CLOCKS_PER_SEC != 1000000L #error unexpected value for CLOCKS_PER_SEC! @@ -474,21 +471,28 @@ clock_t clock(void) /**********************************************************************/ #ifdef L_ctime -char attribute_hidden *__ctime(const time_t *clock) +libc_hidden_proto(asctime) +libc_hidden_proto(localtime) + +char *ctime(const time_t *clock) { /* ANSI/ISO/SUSv3 say that ctime is equivalent to the following. */ - return __asctime(__localtime(clock)); + return asctime(localtime(clock)); } -strong_alias(__ctime,ctime) +libc_hidden_proto(ctime) +libc_hidden_def(ctime) #endif /**********************************************************************/ #ifdef L_ctime_r +libc_hidden_proto(asctime_r) +libc_hidden_proto(localtime_r) + char *ctime_r(const time_t *clock, char *buf) { struct tm xtm; - return __asctime_r(__localtime_r(clock, &xtm), buf); + return asctime_r(localtime_r(clock, &xtm), buf); } #endif @@ -556,28 +560,31 @@ struct tm *gmtime_r(const time_t *__restrict timer, /**********************************************************************/ #ifdef L_localtime -struct tm attribute_hidden *__localtime(const time_t *timer) +libc_hidden_proto(localtime_r) + +struct tm *localtime(const time_t *timer) { register struct tm *ptm = &__time_tm; /* In this implementation, tzset() is called by localtime_r(). */ - __localtime_r(timer, ptm); /* Can return NULL... */ + localtime_r(timer, ptm); /* Can return NULL... */ return ptm; } -strong_alias(__localtime,localtime) +libc_hidden_proto(localtime) +libc_hidden_def(localtime) #endif /**********************************************************************/ #ifdef L_localtime_r -struct tm attribute_hidden *__localtime_r(register const time_t *__restrict timer, +struct tm *localtime_r(register const time_t *__restrict timer, register struct tm *__restrict result) { TZLOCK; - __tzset(); + tzset(); __time_localtime_tzi(timer, result, _time_tzinfo); @@ -585,7 +592,8 @@ struct tm attribute_hidden *__localtime_r(register const time_t *__restrict time return result; } -strong_alias(__localtime_r,localtime_r) +libc_hidden_proto(localtime_r) +libc_hidden_def(localtime_r) #endif /**********************************************************************/ @@ -610,7 +618,7 @@ static const char *lookup_tzname(const char *key) ll_tzname_item_t *p; for (p=ll_tzname ; p ; p=p->next) { - if (!__strcmp(p->tzname, key)) { + if (!strcmp(p->tzname, key)) { return p->tzname; } } @@ -621,7 +629,7 @@ static const char *lookup_tzname(const char *key) /* Insert as 3rd item in the list. */ p->next = ll_tzname[1].next; ll_tzname[1].next = p; - __strcpy(p->tzname, key); + strcpy(p->tzname, key); return p->tzname; } } @@ -765,8 +773,8 @@ time_t timegm(struct tm *timeptr) { rule_struct gmt_tzinfo[2]; - __memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); - __strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ + memset(gmt_tzinfo, 0, sizeof(gmt_tzinfo)); + strcpy(gmt_tzinfo[0].tzname, "GMT"); /* Match glibc behavior here. */ return _time_mktime_tzi(timeptr, 1, gmt_tzinfo); } @@ -777,13 +785,16 @@ time_t timegm(struct tm *timeptr) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -size_t attribute_hidden __strftime(char *__restrict s, size_t maxsize, +libc_hidden_proto(strftime_l) + +size_t strftime(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr) { - return __strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); + return strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } -strong_alias(__strftime,strftime) +libc_hidden_proto(strftime) +libc_hidden_def(strftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -983,7 +994,7 @@ static int load_field(int k, const struct tm *__restrict timeptr) #warning TODO: Check multibyte format string validity. #endif -size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, +size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) { @@ -1003,7 +1014,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, unsigned char mod; unsigned char code; - __tzset(); /* We'll, let's get this out of the way. */ + tzset(); /* We'll, let's get this out of the way. */ lvl = 0; p = format; @@ -1056,7 +1067,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 = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, + && (*(o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(((unsigned char *)p)[4])) __LOCALE_ARG ))) @@ -1065,7 +1076,7 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, goto LOOP; } #endif - p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, + p = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(*((unsigned char *)p))) __LOCALE_ARG ); @@ -1242,7 +1253,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 = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG ); + o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG ); } else { o_count = ((i >> 1) & 3) + 1; o = buf + o_count; @@ -1265,8 +1276,8 @@ size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, } goto LOOP; } - -__UCXL_ALIAS(strftime) +libc_hidden_proto(__XL_NPP(strftime)) +libc_hidden_def(__XL_NPP(strftime)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1284,12 +1295,15 @@ __UCXL_ALIAS(strftime) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -char attribute_hidden *__strptime(const char *__restrict buf, const char *__restrict format, +libc_hidden_proto(strptime_l) + +char *strptime(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm) { - return __strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); + return strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); } -strong_alias(__strptime,strptime) +libc_hidden_proto(strptime) +libc_hidden_def(strptime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1435,7 +1449,9 @@ static const unsigned char spec[] = { #define MAX_PUSH 4 -char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *__restrict format, +libc_hidden_proto(localtime_r) + +char *__XL_NPP(strptime)(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm __LOCALE_PARAM) { register const char *p; @@ -1503,7 +1519,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 = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, + && (*(o = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(((unsigned char *)p)[4])) __LOCALE_ARG ))) @@ -1512,7 +1528,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * goto LOOP; } #endif - p = __UCXL(nl_langinfo)(_NL_ITEM(LC_TIME, + p = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, (int)(*((unsigned char *)p))) __LOCALE_ARG ); goto LOOP; @@ -1527,8 +1543,8 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * /* Go backwards to check full names before abreviations. */ do { --j; - o = __UCXL(nl_langinfo)(i+j __LOCALE_ARG); - if (!__UCXL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { + o = __XL_NPP(nl_langinfo)(i+j __LOCALE_ARG); + if (!__XL_NPP(strncasecmp)(buf,o,strlen(o) __LOCALE_ARG) && *o) { do { /* Found a match. */ ++buf; } while (*++o); @@ -1556,9 +1572,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 = __UCXL(strtoul)(buf, &o, 10 __LOCALE_ARG); + t = __XL_NPP(strtoul)(buf, &o, 10 __LOCALE_ARG); #else - t = __UCXL(strtol)(buf, &o, 10 __LOCALE_ARG); + t = __XL_NPP(strtol)(buf, &o, 10 __LOCALE_ARG); #endif } if ((o == buf) || errno) { /* Not a number or overflow. */ @@ -1568,7 +1584,7 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * buf = o; if (!code) { /* s */ - __localtime_r(&t, tm); /* TODO: check for failure? */ + localtime_r(&t, tm); /* TODO: check for failure? */ i = 0; do { /* Now copy values from tm to fields. */ fields[i] = ((int *) tm)[i]; @@ -1644,8 +1660,8 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * } return NULL; } - -__UCXL_ALIAS(strptime) +libc_hidden_proto(__XL_NPP(strptime)) +libc_hidden_def(__XL_NPP(strptime)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1783,11 +1799,11 @@ static char *read_TZ_file(char *buf) size_t todo; char *p = NULL; - if ((fd = __open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { + if ((fd = open(__UCLIBC_TZ_FILE_PATH__, O_RDONLY)) >= 0) { todo = TZ_BUFLEN; p = buf; do { - if ((r = __read(fd, p, todo)) < 0) { + if ((r = read(fd, p, todo)) < 0) { goto ERROR; } if (r == 0) { @@ -1807,14 +1823,14 @@ static char *read_TZ_file(char *buf) ERROR: p = NULL; } - __close(fd); + close(fd); } return p; } #endif /* __UCLIBC_HAS_TZ_FILE__ */ -void attribute_hidden __tzset(void) +void tzset(void) { register const char *e; register char *s; @@ -1832,7 +1848,7 @@ void attribute_hidden __tzset(void) TZLOCK; - e = __getenv(TZ); /* TZ env var always takes precedence. */ + e = getenv(TZ); /* TZ env var always takes precedence. */ #if defined(__UCLIBC_HAS_TZ_FILE__) && !defined(__UCLIBC_HAS_TZ_FILE_READ_MANY__) /* Put this inside the lock to prevent the possiblity of two different @@ -1859,8 +1875,8 @@ void attribute_hidden __tzset(void) #ifdef __UCLIBC_HAS_TZ_CACHING__ *oldval = 0; /* Set oldval to an empty string. */ #endif /* __UCLIBC_HAS_TZ_CACHING__ */ - __memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); - __strcpy(_time_tzinfo[0].tzname, UTC); + memset(_time_tzinfo, 0, 2*sizeof(rule_struct)); + strcpy(_time_tzinfo[0].tzname, UTC); goto DONE; } @@ -1869,13 +1885,13 @@ void attribute_hidden __tzset(void) } #ifdef __UCLIBC_HAS_TZ_CACHING__ - if (__strcmp(e, oldval) == 0) { /* Same string as last time... */ + if (strcmp(e, oldval) == 0) { /* Same string as last time... */ goto FAST_DONE; /* So nothing to do. */ } /* Make a copy of the TZ env string. It won't be nul-terminated if * it is too long, but it that case it will be illegal and will be reset * to the empty string anyway. */ - __strncpy(oldval, e, TZ_BUFLEN); + strncpy(oldval, e, TZ_BUFLEN); #endif /* __UCLIBC_HAS_TZ_CACHING__ */ count = 0; @@ -1989,7 +2005,7 @@ void attribute_hidden __tzset(void) } } - __memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); + memcpy(_time_tzinfo, new_rules, sizeof(new_rules)); DONE: tzname[0] = _time_tzinfo[0].tzname; tzname[1] = _time_tzinfo[1].tzname; @@ -2001,7 +2017,7 @@ void attribute_hidden __tzset(void) #endif TZUNLOCK; } -strong_alias(__tzset,tzset) +libc_hidden_def(tzset) #endif /**********************************************************************/ /* #ifdef L_utime */ @@ -2203,7 +2219,7 @@ time_t attribute_hidden _time_mktime(struct tm *timeptr, int store_on_success) TZLOCK; - __tzset(); + tzset(); t = _time_mktime_tzi(timeptr, store_on_success, _time_tzinfo); @@ -2236,7 +2252,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes register const unsigned char *s; int d, default_dst; - __memcpy(p, timeptr, sizeof(struct tm)); + memcpy(p, timeptr, sizeof(struct tm)); if (!tzi[1].tzname[0]) { /* No dst in this timezone, */ p[8] = 0; /* so set tm_isdst to 0. */ @@ -2326,7 +2342,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes if (store_on_success) { - __memcpy(timeptr, p, sizeof(struct tm)); + memcpy(timeptr, p, sizeof(struct tm)); } @@ -2340,29 +2356,28 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, - __const wchar_t *__restrict __format, - __const struct tm *__restrict __timeptr, - __locale_t __loc) __THROW attribute_hidden; +libc_hidden_proto(wcsftime_l) size_t wcsftime(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict timeptr) { - return __wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); + return wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } +libc_hidden_proto(wcsftime) +libc_hidden_def(wcsftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -size_t attribute_hidden __UCXL(wcsftime)(wchar_t *__restrict s, size_t maxsize, +size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) { #warning wcsftime always fails return 0; /* always fail */ } - -__UCXL_ALIAS(wcsftime) +libc_hidden_proto(__XL_NPP(wcsftime)) +libc_hidden_def(__XL_NPP(wcsftime)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 9b83b6ede..9754e9b49 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -27,10 +27,6 @@ * SUCH DAMAGE. */ -#define __fsetlocking __fsetlocking_internal -#define rewind __rewind -#define fgets_unlocked __fgets_unlocked - #define _GNU_SOURCE #include <features.h> #include <ttyent.h> @@ -43,7 +39,17 @@ #include <pthread.h> #endif -extern int __getc_unlocked (FILE *__stream) attribute_hidden; +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strncmp) +libc_hidden_proto(__fsetlocking) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets_unlocked) +libc_hidden_proto(getc_unlocked) +libc_hidden_proto(__fgetc_unlocked) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(abort) static char zapchar; static FILE *tf; @@ -89,7 +95,7 @@ static char * skip(register char *p) static char * value(register char *p) { - return ((p = __strchr(p, '=')) ? ++p : NULL); + return ((p = strchr(p, '=')) ? ++p : NULL); } int attribute_hidden __setttyent(void) @@ -132,8 +138,8 @@ struct ttyent attribute_hidden * __getttyent(void) return (NULL); } /* skip lines that are too big */ - if (!__strchr(p, '\n')) { - while ((c = __getc_unlocked(tf)) != '\n' && c != EOF) + if (!strchr(p, '\n')) { + while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; } @@ -158,8 +164,8 @@ struct ttyent attribute_hidden * __getttyent(void) tty.ty_status = 0; tty.ty_window = NULL; -#define scmp(e) !__strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) -#define vcmp(e) !__strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' +#define scmp(e) !strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1]) +#define vcmp(e) !strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '=' for (; *p; p = skip(p)) { if (scmp(_TTYS_OFF)) tty.ty_status &= ~TTY_ON; @@ -181,7 +187,7 @@ struct ttyent attribute_hidden * __getttyent(void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ((p = __strchr(p, '\n'))) + if ((p = strchr(p, '\n'))) *p = '\0'; return (&tty); } @@ -206,7 +212,7 @@ struct ttyent * getttynam(const char *tty) __setttyent(); while ((t = __getttyent())) - if (!__strcmp(tty, t->ty_name)) + if (!strcmp(tty, t->ty_name)) break; __endttyent(); return (t); diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index 3ad5bc828..c1932d7d7 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -20,7 +20,16 @@ #include <string.h> #include <utmp.h> - +libc_hidden_proto(strcmp) +libc_hidden_proto(strdup) +libc_hidden_proto(strncmp) +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) +libc_hidden_proto(close) +libc_hidden_proto(lseek) +libc_hidden_proto(setutent) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -37,47 +46,47 @@ static struct utmp static_utmp; static const char default_file_name[] = _PATH_UTMP; static const char *static_ut_name = (const char *) default_file_name; -void attribute_hidden __setutent(void) +void setutent(void) { int ret; LOCK; if (static_fd == -1) { - if ((static_fd = __open(static_ut_name, O_RDWR)) < 0) { - if ((static_fd = __open(static_ut_name, O_RDONLY)) < 0) { + if ((static_fd = open(static_ut_name, O_RDWR)) < 0) { + if ((static_fd = open(static_ut_name, O_RDONLY)) < 0) { goto bummer; } } /* Make sure the file will be closed on exec() */ - ret = __fcntl(static_fd, F_GETFD, 0); + ret = fcntl(static_fd, F_GETFD, 0); if (ret >= 0) { - ret = __fcntl(static_fd, F_GETFD, 0); + ret = fcntl(static_fd, F_GETFD, 0); } if (ret < 0) { bummer: UNLOCK; static_fd = -1; - __close(static_fd); + close(static_fd); return; } } - __lseek(static_fd, 0, SEEK_SET); + lseek(static_fd, 0, SEEK_SET); UNLOCK; return; } -strong_alias(__setutent,setutent) +libc_hidden_def(setutent) static struct utmp *__getutent(int utmp_fd) { if (utmp_fd == -1) { - __setutent(); + setutent(); } if (utmp_fd == -1) { return NULL; } LOCK; - if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) + if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) { return NULL; } @@ -90,7 +99,7 @@ void endutent(void) { LOCK; if (static_fd != -1) { - __close(static_fd); + close(static_fd); } static_fd = -1; UNLOCK; @@ -120,7 +129,7 @@ struct utmp attribute_hidden *__getutid (const struct utmp *utmp_entry) utmp_entry->ut_type == DEAD_PROCESS || utmp_entry->ut_type == LOGIN_PROCESS || utmp_entry->ut_type == USER_PROCESS) && - !__strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) + !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) { return lutmp; } @@ -137,7 +146,7 @@ struct utmp *getutline(const struct utmp *utmp_entry) while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && - !__strcmp(lutmp->ut_line, utmp_entry->ut_line)) + !strcmp(lutmp->ut_line, utmp_entry->ut_line)) { return lutmp; } @@ -151,15 +160,15 @@ struct utmp *pututline (const struct utmp *utmp_entry) LOCK; /* Ignore the return value. That way, if they've already positioned the file pointer where they want it, everything will work out. */ - __lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); + lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); if (__getutid(utmp_entry) != NULL) { - __lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); - if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR); + if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } else { - __lseek(static_fd, (off_t) 0, SEEK_END); - if (__write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) + lseek(static_fd, (off_t) 0, SEEK_END); + if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp)) return NULL; } @@ -173,7 +182,7 @@ int utmpname (const char *new_ut_name) if (new_ut_name != NULL) { if (static_ut_name != default_file_name) free((char *)static_ut_name); - static_ut_name = __strdup(new_ut_name); + static_ut_name = strdup(new_ut_name); if (static_ut_name == NULL) { /* We should probably whine about out-of-memory * errors here... Instead just reset to the default */ @@ -182,7 +191,7 @@ int utmpname (const char *new_ut_name) } if (static_fd != -1) - __close(static_fd); + close(static_fd); UNLOCK; return 0; } diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index 35947f19e..0378070e7 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -1,23 +1,10 @@ -/* wtmp support rubbish (i.e. complete crap) +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * Written by Erik Andersen <andersee@debian.org> - * - * This 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. - * - * This 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. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 675 Mass Ave, - * Cambridge, MA 02139, USA. */ + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ -#define gettimeofday __gettimeofday +/* wtmp support rubbish (i.e. complete crap) */ #include <string.h> #include <sys/time.h> @@ -27,36 +14,45 @@ #include <fcntl.h> #include <sys/file.h> +#if 0 +libc_hidden_proto(memset) +libc_hidden_proto(strncpy) +libc_hidden_proto(updwtmp) +#endif +libc_hidden_proto(open) +libc_hidden_proto(write) +libc_hidden_proto(close) +libc_hidden_proto(lockf) +libc_hidden_proto(gettimeofday) #if 0 /* This is enabled in uClibc/libutil/logwtmp.c */ void logwtmp (const char *line, const char *name, const char *host) { struct utmp lutmp; - __memset (&(lutmp), 0, sizeof (struct utmp)); + memset (&(lutmp), 0, sizeof (struct utmp)); lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS; lutmp.ut_pid = __getpid(); - __strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); - __strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); - __strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); + strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); + strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); + strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); gettimeofday(&(lutmp.ut_tv), NULL); updwtmp(_PATH_WTMP, &(lutmp)); } #endif -extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) +void updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; - fd = __open(wtmp_file, O_APPEND | O_WRONLY, 0); + fd = open(wtmp_file, O_APPEND | O_WRONLY, 0); if (fd >= 0) { - if (__lockf(fd, F_LOCK, 0)==0) { - __write(fd, (const char *) lutmp, sizeof(struct utmp)); - __lockf(fd, F_ULOCK, 0); - __close(fd); + if (lockf(fd, F_LOCK, 0)==0) { + write(fd, (const char *) lutmp, sizeof(struct utmp)); + lockf(fd, F_ULOCK, 0); + close(fd); } } } - diff --git a/libc/misc/wchar/Makefile.in b/libc/misc/wchar/Makefile.in index 9059d71d8..f1d5f3876 100644 --- a/libc/misc/wchar/Makefile.in +++ b/libc/misc/wchar/Makefile.in @@ -20,7 +20,7 @@ MSRC:=wchar.c MOBJ:= btowc.o wctob.o mbsinit.o mbrlen.o mbrtowc.o wcrtomb.o mbsrtowcs.o \ wcsrtombs.o _wchar_utf8sntowcs.o _wchar_wcsntoutf8s.o \ - __mbsnrtowcs.o __wcsnrtombs.o wcwidth.o wcswidth.o + mbsnrtowcs.o wcsnrtombs.o wcwidth.o wcswidth.o ifeq ($(UCLIBC_HAS_LOCALE),y) MOBJ+=iconv.o diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 2535b5fff..28efbba22 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -164,13 +164,6 @@ #define KUHN 1 -extern size_t __mbrtowc (wchar_t *__restrict __pwc, - __const char *__restrict __s, size_t __n, - mbstate_t *__p) attribute_hidden; - -extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, - mbstate_t *__restrict __ps) attribute_hidden; - /* Implementation-specific work functions. */ extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn, @@ -180,20 +173,12 @@ extern size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn, extern size_t _wchar_wcsntoutf8s(char *__restrict s, size_t n, const wchar_t **__restrict src, size_t wn) attribute_hidden; -/* glibc extensions. */ - -extern size_t __mbsnrtowcs(wchar_t *__restrict dst, - const char **__restrict src, - size_t NMC, size_t len, mbstate_t *__restrict ps) attribute_hidden; - -extern size_t __wcsnrtombs(char *__restrict dst, - const wchar_t **__restrict src, - size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden; - /**********************************************************************/ #ifdef L_btowc -wint_t attribute_hidden __btowc(int c) +libc_hidden_proto(mbrtowc) + +wint_t btowc(int c) { #ifdef __CTYPE_HAS_8_BIT_LOCALES @@ -204,7 +189,7 @@ wint_t attribute_hidden __btowc(int c) if (c != EOF) { *buf = (unsigned char) c; mbstate.__mask = 0; /* Initialize the mbstate. */ - if (__mbrtowc(&wc, buf, 1, &mbstate) <= 1) { + if (mbrtowc(&wc, buf, 1, &mbstate) <= 1) { return wc; } } @@ -223,7 +208,8 @@ wint_t attribute_hidden __btowc(int c) #endif /* __CTYPE_HAS_8_BIT_LOCALES */ } -strong_alias(__btowc,btowc) +libc_hidden_proto(btowc) +libc_hidden_def(btowc) #endif /**********************************************************************/ @@ -231,13 +217,15 @@ strong_alias(__btowc,btowc) /* Note: We completely ignore ps in all currently supported conversions. */ +libc_hidden_proto(wcrtomb) + int wctob(wint_t c) { #ifdef __CTYPE_HAS_8_BIT_LOCALES unsigned char buf[MB_LEN_MAX]; - return (__wcrtomb(buf, c, NULL) == 1) ? *buf : EOF; + return (wcrtomb(buf, c, NULL) == 1) ? *buf : EOF; #else /* __CTYPE_HAS_8_BIT_LOCALES */ @@ -260,29 +248,35 @@ int wctob(wint_t c) /**********************************************************************/ #ifdef L_mbsinit -int attribute_hidden __mbsinit(const mbstate_t *ps) +int mbsinit(const mbstate_t *ps) { return !ps || !ps->__mask; } -strong_alias(__mbsinit,mbsinit) +libc_hidden_proto(mbsinit) +libc_hidden_def(mbsinit) #endif /**********************************************************************/ #ifdef L_mbrlen -size_t attribute_hidden __mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps) +libc_hidden_proto(mbrtowc) + +size_t mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps) { static mbstate_t mbstate; /* Rely on bss 0-init. */ - return __mbrtowc(NULL, s, n, (ps != NULL) ? ps : &mbstate); + return mbrtowc(NULL, s, n, (ps != NULL) ? ps : &mbstate); } -strong_alias(__mbrlen,mbrlen) +libc_hidden_proto(mbrlen) +libc_hidden_def(mbrlen) #endif /**********************************************************************/ #ifdef L_mbrtowc -size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restrict s, +libc_hidden_proto(mbsnrtowcs) + +size_t mbrtowc(wchar_t *__restrict pwc, const char *__restrict s, size_t n, mbstate_t *__restrict ps) { static mbstate_t mbstate; /* Rely on bss 0-init. */ @@ -323,7 +317,7 @@ size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restric #warning TODO: This adds a trailing nul! #endif /* __UCLIBC_MJN3_ONLY__ */ - r = __mbsnrtowcs(wcbuf, &p, SIZE_MAX, 1, ps); + r = mbsnrtowcs(wcbuf, &p, SIZE_MAX, 1, ps); if (((ssize_t) r) >= 0) { if (pwc) { @@ -332,16 +326,19 @@ size_t attribute_hidden __mbrtowc(wchar_t *__restrict pwc, const char *__restric } return (size_t) r; } -strong_alias(__mbrtowc,mbrtowc) +libc_hidden_proto(mbrtowc) +libc_hidden_def(mbrtowc) #endif /**********************************************************************/ #ifdef L_wcrtomb +libc_hidden_proto(wcsnrtombs) + /* Note: We completely ignore ps in all currently supported conversions. */ /* TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcrtomb(register char *__restrict s, wchar_t wc, +size_t wcrtomb(register char *__restrict s, wchar_t wc, mbstate_t *__restrict ps) { #ifdef __UCLIBC_MJN3_ONLY__ @@ -360,24 +357,28 @@ size_t attribute_hidden __wcrtomb(register char *__restrict s, wchar_t wc, pwc = wcbuf; wcbuf[0] = wc; - r = __wcsnrtombs(s, &pwc, 1, MB_LEN_MAX, ps); + r = wcsnrtombs(s, &pwc, 1, MB_LEN_MAX, ps); return (r != 0) ? r : 1; } -strong_alias(__wcrtomb,wcrtomb) +libc_hidden_proto(wcrtomb) +libc_hidden_def(wcrtomb) #endif /**********************************************************************/ #ifdef L_mbsrtowcs -size_t attribute_hidden __mbsrtowcs(wchar_t *__restrict dst, const char **__restrict src, +libc_hidden_proto(mbsnrtowcs) + +size_t mbsrtowcs(wchar_t *__restrict dst, const char **__restrict src, size_t len, mbstate_t *__restrict ps) { static mbstate_t mbstate; /* Rely on bss 0-init. */ - return __mbsnrtowcs(dst, src, SIZE_MAX, len, + return mbsnrtowcs(dst, src, SIZE_MAX, len, ((ps != NULL) ? ps : &mbstate)); } -strong_alias(__mbsrtowcs,mbsrtowcs) +libc_hidden_proto(mbsrtowcs) +libc_hidden_def(mbsrtowcs) #endif /**********************************************************************/ @@ -387,12 +388,15 @@ strong_alias(__mbsrtowcs,mbsrtowcs) * TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcsrtombs(char *__restrict dst, const wchar_t **__restrict src, +libc_hidden_proto(wcsnrtombs) + +size_t wcsrtombs(char *__restrict dst, const wchar_t **__restrict src, size_t len, mbstate_t *__restrict ps) { - return __wcsnrtombs(dst, src, SIZE_MAX, len, ps); + return wcsnrtombs(dst, src, SIZE_MAX, len, ps); } -strong_alias(__wcsrtombs,wcsrtombs) +libc_hidden_proto(wcsrtombs) +libc_hidden_def(wcsrtombs) #endif /**********************************************************************/ @@ -686,11 +690,11 @@ size_t attribute_hidden _wchar_wcsntoutf8s(char *__restrict s, size_t n, #endif /**********************************************************************/ -#ifdef L___mbsnrtowcs +#ifdef L_mbsnrtowcs /* WARNING: We treat len as SIZE_MAX when dst is NULL! */ -size_t attribute_hidden __mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, +size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, size_t NMC, size_t len, mbstate_t *__restrict ps) { static mbstate_t mbstate; /* Rely on bss 0-init. */ @@ -788,18 +792,19 @@ size_t attribute_hidden __mbsnrtowcs(wchar_t *__restrict dst, const char **__res } return len - count; } -weak_alias(__mbsnrtowcs,mbsnrtowcs) +libc_hidden_proto(mbsnrtowcs) +libc_hidden_def(mbsnrtowcs) #endif /**********************************************************************/ -#ifdef L___wcsnrtombs +#ifdef L_wcsnrtombs /* WARNING: We treat len as SIZE_MAX when dst is NULL! */ /* Note: We completely ignore ps in all currently supported conversions. * TODO: Check for valid state anyway? */ -size_t attribute_hidden __wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, +size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, size_t NWC, size_t len, mbstate_t *__restrict ps) { const __uwchar_t *s; @@ -907,7 +912,8 @@ size_t attribute_hidden __wcsnrtombs(char *__restrict dst, const wchar_t **__res } return len - count; } -weak_alias(__wcsnrtombs,wcsnrtombs) +libc_hidden_proto(wcsnrtombs) +libc_hidden_def(wcsnrtombs) #endif /**********************************************************************/ @@ -1027,7 +1033,9 @@ static const signed char new_wtbl[] = { 0, 2, 1, 2, 1, 0, 1, }; -int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) +libc_hidden_proto(wcsnrtombs) + +int wcswidth(const wchar_t *pwcs, size_t n) { int h, l, m, count; wchar_t wc; @@ -1047,7 +1055,7 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) mbstate_t mbstate; mbstate.__mask = 0; /* Initialize the mbstate. */ - if (__wcsnrtombs(NULL, &pwcs, n, SIZE_MAX, &mbstate) == ((size_t) - 1)) { + if (wcsnrtombs(NULL, &pwcs, n, SIZE_MAX, &mbstate) == ((size_t) - 1)) { return -1; } } @@ -1124,7 +1132,7 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) #else /* __UCLIBC_HAS_LOCALE__ */ -int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) +int wcswidth(const wchar_t *pwcs, size_t n) { int count; wchar_t wc; @@ -1147,17 +1155,18 @@ int attribute_hidden __wcswidth(const wchar_t *pwcs, size_t n) #endif /* __UCLIBC_HAS_LOCALE__ */ -strong_alias(__wcswidth,wcswidth) +libc_hidden_proto(wcswidth) +libc_hidden_def(wcswidth) #endif /**********************************************************************/ #ifdef L_wcwidth -extern int __wcswidth (__const wchar_t *__s, size_t __n) attribute_hidden; +libc_hidden_proto(wcswidth) int wcwidth(wchar_t wc) { - return __wcswidth(&wc, 1); + return wcswidth(&wc, 1); } #endif @@ -1256,13 +1265,15 @@ const unsigned char __iconv_codesets[] = "\x0b\x01""US-ASCII\x00" "\x07\x01""ASCII"; /* Must be last! (special case to save a nul) */ +libc_hidden_proto(strcasecmp) + static int find_codeset(const char *name) { const unsigned char *s; int codeset; for (s = __iconv_codesets ; *s ; s += *s) { - if (!__strcasecmp(s+2, name)) { + if (!strcasecmp(s+2, name)) { return s[1]; } } @@ -1275,7 +1286,7 @@ static int find_codeset(const char *name) s = __LOCALE_DATA_CODESET_LIST; do { ++codeset; /* Increment codeset first. */ - if (!__strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) { + if (!strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) { return codeset; } } while (*++s); diff --git a/libc/misc/wchar/wstdio.c b/libc/misc/wchar/wstdio.c index 55e7fef6b..69287f871 100644 --- a/libc/misc/wchar/wstdio.c +++ b/libc/misc/wchar/wstdio.c @@ -49,12 +49,6 @@ * Should auto_wr_transition init the mbstate object? */ -#define wcslen __wcslen -#define wcsrtombs __wcsrtombs -#define mbrtowc __mbrtowc -#define wcrtomb __wcrtomb -#define fflush_unlocked __fflush_unlocked - #define _GNU_SOURCE #include <stdio.h> #include <wchar.h> @@ -168,6 +162,8 @@ static void munge_stream(register FILE *stream, unsigned char *buf) stream->bufpos = stream->bufread = stream->bufend = stream->bufstart = buf; } +libc_hidden_proto(mbrtowc) + UNLOCKED(wint_t,fgetwc,(register FILE *stream),(stream)) { wint_t wi; @@ -263,6 +259,8 @@ UNLOCKED(wint_t,fgetwc,(register FILE *stream),(stream)) return wi; } +libc_hidden_proto(fgetwc_unlocked) +libc_hidden_def(fgetwc_unlocked) strong_alias(fgetwc_unlocked,getwc_unlocked) strong_alias(fgetwc,getwc) @@ -271,6 +269,8 @@ strong_alias(fgetwc,getwc) /**********************************************************************/ #ifdef L_getwchar +libc_hidden_proto(fgetwc_unlocked) + UNLOCKED_STREAM(wint_t,getwchar,(void),(),stdin) { register FILE *stream = stdin; /* This helps bcc optimize. */ @@ -282,6 +282,8 @@ UNLOCKED_STREAM(wint_t,getwchar,(void),(),stdin) /**********************************************************************/ #ifdef L_fgetws +libc_hidden_proto(fgetwc_unlocked) + UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n, FILE *__restrict stream),(ws, n, stream)) { @@ -289,7 +291,7 @@ UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n, wint_t wi; while ((n > 1) - && ((wi = __fgetwc_unlocked(stream)) != WEOF) + && ((wi = fgetwc_unlocked(stream)) != WEOF) && ((*p++ = wi) != '\n') ) { --n; @@ -309,6 +311,8 @@ UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n, /**********************************************************************/ #ifdef L_fputwc +/* libc_hidden_proto(wcrtomb) */ + UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream)) { #if 1 @@ -329,6 +333,8 @@ UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream)) ? wc : WEOF; #endif } +libc_hidden_proto(fputwc_unlocked) +libc_hidden_def(fputwc_unlocked) strong_alias(fputwc_unlocked,putwc_unlocked) strong_alias(fputwc,putwc) @@ -337,6 +343,8 @@ strong_alias(fputwc,putwc) /**********************************************************************/ #ifdef L_putwchar +libc_hidden_proto(fputwc_unlocked) + UNLOCKED_STREAM(wint_t,putwchar,(wchar_t wc),(wc),stdout) { register FILE *stream = stdout; /* This helps bcc optimize. */ @@ -348,6 +356,9 @@ UNLOCKED_STREAM(wint_t,putwchar,(wchar_t wc),(wc),stdout) /**********************************************************************/ #ifdef L_fputws +libc_hidden_proto(wcslen) +/* libc_hidden_proto(wcsrtombs) */ + UNLOCKED(int,fputws,(const wchar_t *__restrict ws, register FILE *__restrict stream),(ws, stream)) { @@ -393,6 +404,8 @@ UNLOCKED(int,fputws,(const wchar_t *__restrict ws, /* Reentrant. */ +libc_hidden_proto(fflush_unlocked) + wint_t ungetwc(wint_t c, register FILE *stream) { __STDIO_THREADLOCK(stream); diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index 659000558..0be119a57 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -38,9 +38,11 @@ #include <stdint.h> #include <bits/uClibc_uwchar.h> -extern wctype_t __wctype (__const char *__property) attribute_hidden; -extern wint_t __towlower (wint_t __wc) __THROW attribute_hidden; -extern wint_t __towupper (wint_t __wc) __THROW attribute_hidden; +libc_hidden_proto(strcmp) +libc_hidden_proto(towlower) +libc_hidden_proto(towupper) +libc_hidden_proto(towctrans) +libc_hidden_proto(iswctype) #if defined(__LOCALE_C_ONLY) && defined(__UCLIBC_DO_XLOCALE) #error xlocale functionality is not supported in stub locale mode. @@ -48,10 +50,10 @@ extern wint_t __towupper (wint_t __wc) __THROW attribute_hidden; #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> -extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW attribute_hidden; -extern wint_t __towupper_l(wint_t __wc, __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 attribute_hidden; +libc_hidden_proto(towlower_l) +libc_hidden_proto(towupper_l) +libc_hidden_proto(towctrans_l) +libc_hidden_proto(iswctype_l) #endif /* __UCLIBC_HAS_XLOCALE__ */ /* We know wide char support is enabled. We wouldn't be here otherwise. */ @@ -182,26 +184,23 @@ enum { #ifdef __UCLIBC_DO_XLOCALE -extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) - __THROW attribute_hidden; - #define ISW_FUNC_BODY(NAME) \ -int attribute_hidden __PASTE3(__isw,NAME,_l) (wint_t wc, __locale_t l) \ +int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \ { \ - return __iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ + return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ } \ -weak_alias(__PASTE3(__isw,NAME,_l), __PASTE3(isw,NAME,_l)) +libc_hidden_proto(__PASTE3(isw,NAME,_l)); \ +libc_hidden_def(__PASTE3(isw,NAME,_l)) #else /* __UCLIBC_DO_XLOCALE */ -extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW attribute_hidden; - #define ISW_FUNC_BODY(NAME) \ -int attribute_hidden __PASTE2(__isw,NAME) (wint_t wc) \ +int __PASTE2(isw,NAME) (wint_t wc) \ { \ - return __iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ + return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ } \ -weak_alias(__PASTE2(__isw,NAME), __PASTE2(isw,NAME)) +libc_hidden_proto(__PASTE2(isw,NAME)); \ +libc_hidden_def(__PASTE2(isw,NAME)) #endif /* __UCLIBC_DO_XLOCALE */ /**********************************************************************/ @@ -280,9 +279,9 @@ ISW_FUNC_BODY(xdigit); #if defined(L_towlower) || defined(L_towlower_l) #ifdef L_towlower -#define TOWLOWER(w) __towlower(w) +#define TOWLOWER(w) towlower(w) #else /* L_towlower */ -#define TOWLOWER(w) __towlower_l(w, __locale_t locale) +#define TOWLOWER(w) towlower_l(w, __locale_t locale) #undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -290,9 +289,9 @@ ISW_FUNC_BODY(xdigit); #endif /* L_towlower */ #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __UCLIBC_CURLOCALE) +#define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE) #else /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d) #endif /* __UCLIBC_HAS_XLOCALE__ */ #define __C_towlower(wc) \ @@ -300,7 +299,7 @@ ISW_FUNC_BODY(xdigit); #ifdef __LOCALE_C_ONLY -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc) { #ifdef __UCLIBC_HAS_CTYPE_TABLES__ return __C_towlower(wc); @@ -317,14 +316,14 @@ wint_t attribute_hidden __towlower(wint_t wc) #if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc) { - return __towctrans_l(wc, _CTYPE_tolower, __UCLIBC_CURLOCALE); + return towctrans_l(wc, _CTYPE_tolower, __UCLIBC_CURLOCALE); } #else /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWLOWER(wint_t wc) +wint_t TOWLOWER(wint_t wc) { return TOWCTRANS(wc, _CTYPE_tolower); } @@ -335,14 +334,14 @@ wint_t attribute_hidden TOWLOWER(wint_t wc) #if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towlower(wint_t wc) +wint_t towlower(wint_t wc) { - return __towlower_l(wc, __UCLIBC_CURLOCALE); + return towlower_l(wc, __UCLIBC_CURLOCALE); } #else /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWLOWER(wint_t wc) +wint_t TOWLOWER(wint_t wc) { unsigned int sc, n, i; __uwchar_t u = wc; @@ -373,13 +372,15 @@ wint_t attribute_hidden TOWLOWER(wint_t wc) #endif /* SMALL_UPLOW */ #ifdef L_towlower_l -strong_alias(__towlower_l,towlower_l) +//libc_hidden_proto(towlower_l) +libc_hidden_def(towlower_l) #endif /* L_towlower_l */ #endif /* __LOCALE_C_ONLY */ #ifndef L_towlower_l -strong_alias(__towlower,towlower) +//libc_hidden_proto(towlower) +libc_hidden_def(towlower) #endif #endif @@ -387,9 +388,9 @@ strong_alias(__towlower,towlower) #if defined(L_towupper) || defined(L_towupper_l) #ifdef L_towupper -#define TOWUPPER(w) __towupper(w) +#define TOWUPPER(w) towupper(w) #else /* L_towupper */ -#define TOWUPPER(w) __towupper_l(w, __locale_t locale) +#define TOWUPPER(w) towupper_l(w, __locale_t locale) #undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -397,9 +398,9 @@ strong_alias(__towlower,towlower) #endif /* L_towupper */ #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __UCLIBC_CURLOCALE) +#define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE) #else /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d) #endif /* __UCLIBC_HAS_XLOCALE__ */ #define __C_towupper(wc) \ @@ -407,7 +408,7 @@ strong_alias(__towlower,towlower) #ifdef __LOCALE_C_ONLY -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc) { #ifdef __UCLIBC_HAS_CTYPE_TABLES__ return __C_towupper(wc); @@ -425,14 +426,14 @@ wint_t attribute_hidden __towupper(wint_t wc) #if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc) { - return __towctrans_l(wc, _CTYPE_toupper, __UCLIBC_CURLOCALE); + return towctrans_l(wc, _CTYPE_toupper, __UCLIBC_CURLOCALE); } #else /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWUPPER(wint_t wc) +wint_t TOWUPPER(wint_t wc) { return TOWCTRANS(wc, _CTYPE_toupper); } @@ -443,14 +444,14 @@ wint_t attribute_hidden TOWUPPER(wint_t wc) #if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towupper(wint_t wc) +wint_t towupper(wint_t wc) { - return __towupper_l(wc, __UCLIBC_CURLOCALE); + return towupper_l(wc, __UCLIBC_CURLOCALE); } #else /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */ -wint_t attribute_hidden TOWUPPER(wint_t wc) +wint_t TOWUPPER(wint_t wc) { unsigned int sc, n, i; __uwchar_t u = wc; @@ -481,13 +482,15 @@ wint_t attribute_hidden TOWUPPER(wint_t wc) #endif /* SMALL_UPLOW */ #ifdef L_towupper_l -strong_alias(__towupper_l,towupper_l) +//libc_hidden_proto(towupper_l) +libc_hidden_def(towupper_l) #endif /* L_towupper_l */ #endif /* __LOCALE_C_ONLY */ #ifndef L_towupper_l -strong_alias(__towupper,towupper) +//libc_hidden_proto(towupper) +libc_hidden_def(towupper) #endif #endif @@ -497,7 +500,7 @@ strong_alias(__towupper,towupper) static const unsigned char typestring[] = __CTYPE_TYPESTRING; /* extern const unsigned char typestring[]; */ -wctype_t attribute_hidden __wctype(const char *property) +wctype_t wctype(const char *property) { const unsigned char *p; int i; @@ -505,7 +508,7 @@ wctype_t attribute_hidden __wctype(const char *property) p = typestring; i = 1; do { - if (!__strcmp(property, ++p)) { + if (!strcmp(property, ++p)) { return i; } ++i; @@ -515,7 +518,8 @@ wctype_t attribute_hidden __wctype(const char *property) /* TODO - Add locale-specific classifications. */ return 0; } -strong_alias(__wctype,wctype) +libc_hidden_proto(wctype) +libc_hidden_def(wctype) #endif /**********************************************************************/ @@ -525,12 +529,14 @@ strong_alias(__wctype,wctype) #warning REMINDER: Currently wctype_l simply calls wctype. #endif /* __UCLIBC_MJN3_ONLY__ */ -wctype_t attribute_hidden __wctype_l (const char *property, __locale_t locale) +libc_hidden_proto(wctype) + +wctype_t wctype_l (const char *property, __locale_t locale) { - return __wctype(property); + return wctype(property); } - -weak_alias(__wctype_l, wctype_l) +libc_hidden_proto(wctype_l) +libc_hidden_def(wctype_l) #endif /**********************************************************************/ @@ -579,7 +585,7 @@ static const unsigned short int desc2flag[] = { #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc) { /* Note... wctype_t is unsigned. */ @@ -593,7 +599,7 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc) #else /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc) { /* This is lame, but it is here just to get it working for now. */ @@ -641,9 +647,9 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc) #endif /* __UCLIBC_MJN3_ONLY__ */ #ifdef L_iswctype -#define ISWCTYPE(w,d) __iswctype(w,d) +#define ISWCTYPE(w,d) iswctype(w,d) #else /* L_iswctype */ -#define ISWCTYPE(w,d) __iswctype_l(w,d, __locale_t locale) +#define ISWCTYPE(w,d) iswctype_l(w,d, __locale_t locale) #undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -652,14 +658,14 @@ int attribute_hidden __iswctype(wint_t wc, wctype_t desc) #if defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) -int attribute_hidden __iswctype(wint_t wc, wctype_t desc) +int iswctype(wint_t wc, wctype_t desc) { - return __iswctype_l(wc, desc, __UCLIBC_CURLOCALE); + return iswctype_l(wc, desc, __UCLIBC_CURLOCALE); } #else /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */ -int attribute_hidden ISWCTYPE(wint_t wc, wctype_t desc) +int ISWCTYPE(wint_t wc, wctype_t desc) { unsigned int sc, n, i0, i1; unsigned char d = __CTYPE_unclassified; @@ -709,13 +715,15 @@ int attribute_hidden ISWCTYPE(wint_t wc, wctype_t desc) #endif /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */ #ifdef L_iswctype_l -weak_alias(__iswctype_l, iswctype_l) +//libc_hidden_proto(iswctype_l) +libc_hidden_def(iswctype_l) #endif /* L_iswctype_l */ #endif /* __LOCALE_C_ONLY */ #ifdef L_iswctype -weak_alias(__iswctype, iswctype) +//libc_hidden_proto(iswctype) +libc_hidden_def(iswctype) #endif /* L_iswctype */ #endif @@ -728,14 +736,14 @@ weak_alias(__iswctype, iswctype) #ifndef _tolower #warning _tolower is undefined! -#define _tolower(c) __tolower(c) +#define _tolower(c) tolower(c) #endif #ifndef _toupper #warning _toupper is undefined! -#define _toupper(c) __toupper(c) +#define _toupper(c) toupper(c) #endif -wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) +wint_t towctrans(wint_t wc, wctrans_t desc) { if (((unsigned int)(desc - _CTYPE_tolower)) <= (_CTYPE_toupper - _CTYPE_tolower) @@ -753,9 +761,9 @@ wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) #else /* __LOCALE_C_ONLY */ #ifdef L_towctrans -#define TOWCTRANS(w,d) __towctrans(w,d) +#define TOWCTRANS(w,d) towctrans(w,d) #else /* L_towctrans */ -#define TOWCTRANS(w,d) __towctrans_l(w,d, __locale_t locale) +#define TOWCTRANS(w,d) towctrans_l(w,d, __locale_t locale) #undef __UCLIBC_CURLOCALE_DATA #undef __UCLIBC_CURLOCALE #define __UCLIBC_CURLOCALE_DATA (*locale) @@ -763,25 +771,25 @@ wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) #endif /* L_towctrans */ #ifdef __UCLIBC_HAS_XLOCALE__ -#define TOWLOWER(w,l) __towlower_l(w,l) -#define TOWUPPER(w,l) __towupper_l(w,l) +#define TOWLOWER(w,l) towlower_l(w,l) +#define TOWUPPER(w,l) towupper_l(w,l) #else /* __UCLIBC_HAS_XLOCALE__ */ -#define TOWLOWER(w,l) __towlower(w) -#define TOWUPPER(w,l) __towupper(w) +#define TOWLOWER(w,l) towlower(w) +#define TOWUPPER(w,l) towupper(w) #endif /* __UCLIBC_HAS_XLOCALE__ */ #if defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) -wint_t attribute_hidden __towctrans(wint_t wc, wctrans_t desc) +wint_t towctrans(wint_t wc, wctrans_t desc) { - return __towctrans_l(wc, desc, __UCLIBC_CURLOCALE); + return towctrans_l(wc, desc, __UCLIBC_CURLOCALE); } #else /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */ #ifdef SMALL_UPLOW -wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) +wint_t TOWCTRANS(wint_t wc, wctrans_t desc) { unsigned int sc, n, i; __uwchar_t u = wc; @@ -839,7 +847,7 @@ wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) #else /* SMALL_UPLOW */ -wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) +wint_t TOWCTRANS(wint_t wc, wctrans_t desc) { if (ENCODING == __ctype_encoding_7_bit) { if ((((__uwchar_t) wc) > 0x7f) @@ -882,13 +890,15 @@ wint_t attribute_hidden TOWCTRANS(wint_t wc, wctrans_t desc) #endif /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */ #ifdef L_towctrans_l -strong_alias(__towctrans_l, towctrans_l) +//libc_hidden_proto(towctrans_l) +libc_hidden_def(towctrans_l) #endif /* L_towctrans_l */ #endif /* __LOCALE_C_ONLY */ #ifndef L_towctrans_l -strong_alias(__towctrans,towctrans) +//libc_hidden_proto(towctrans) +libc_hidden_def(towctrans) #endif #endif @@ -897,7 +907,7 @@ strong_alias(__towctrans,towctrans) static const char transstring[] = __CTYPE_TRANSTRING; -wctrans_t attribute_hidden __wctrans(const char *property) +wctrans_t wctrans(const char *property) { const unsigned char *p; int i; @@ -905,7 +915,7 @@ wctrans_t attribute_hidden __wctrans(const char *property) p = transstring; i = 1; do { - if (!__strcmp(property, ++p)) { + if (!strcmp(property, ++p)) { return i; } ++i; @@ -915,7 +925,8 @@ wctrans_t attribute_hidden __wctrans(const char *property) /* TODO - Add locale-specific translations. */ return 0; } -strong_alias(__wctrans,wctrans) +libc_hidden_proto(wctrans) +libc_hidden_def(wctrans) #endif /**********************************************************************/ @@ -925,14 +936,12 @@ strong_alias(__wctrans,wctrans) #warning REMINDER: Currently wctrans_l simply calls wctrans. #endif /* __UCLIBC_MJN3_ONLY__ */ -extern wctrans_t __wctrans (__const char *__property) __THROW attribute_hidden; +libc_hidden_proto(wctrans) -wctrans_t __wctrans_l(const char *property, __locale_t locale) +wctrans_t wctrans_l(const char *property, __locale_t locale) { - return __wctrans(property); + return wctrans(property); } -weak_alias(__wctrans_l, wctrans_l) - #endif /**********************************************************************/ diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index a91e64e3c..70d43e1e1 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -19,25 +19,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define mempcpy __mempcpy -#define stpcpy __stpcpy -#define strndup __strndup -#define strspn __strspn -#define strcspn __strcspn -#define setenv __setenv -#define unsetenv __unsetenv -#define waitpid __waitpid -#define kill __kill -#define getuid __getuid -#define getpwnam_r __getpwnam_r -#define getpwuid_r __getpwuid_r -#define execve __execve -#define dup2 __dup2 -#define atoi __atoi -#define fnmatch __fnmatch -#define pipe __pipe -#define fork __fork - #define _GNU_SOURCE #include <features.h> #include <sys/types.h> @@ -55,6 +36,37 @@ #include <glob.h> #include <wordexp.h> +libc_hidden_proto(mempcpy) +libc_hidden_proto(stpcpy) +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strdup) +libc_hidden_proto(strlen) +libc_hidden_proto(strndup) +libc_hidden_proto(strspn) +libc_hidden_proto(strcspn) +libc_hidden_proto(setenv) +libc_hidden_proto(unsetenv) +libc_hidden_proto(waitpid) +libc_hidden_proto(kill) +libc_hidden_proto(getuid) +libc_hidden_proto(getpwnam_r) +libc_hidden_proto(getpwuid_r) +libc_hidden_proto(execve) +libc_hidden_proto(dup2) +libc_hidden_proto(atoi) +libc_hidden_proto(fnmatch) +libc_hidden_proto(pipe) +libc_hidden_proto(fork) +libc_hidden_proto(open) +libc_hidden_proto(close) +libc_hidden_proto(read) +libc_hidden_proto(getenv) +libc_hidden_proto(getpid) +libc_hidden_proto(sprintf) +libc_hidden_proto(fprintf) +libc_hidden_proto(abort) + extern void __wordfree (wordexp_t *__wordexp) __THROW attribute_hidden; extern int __glob (__const char *__restrict __pattern, int __flags, int (*__errfunc) (__const char *, int), @@ -155,7 +167,7 @@ static char *w_addstr(char *buffer, size_t * actlen, size_t * maxlen, { size_t len; assert(str != NULL); /* w_addstr only called from this file */ - len = __strlen(str); + len = strlen(str); return w_addmem(buffer, actlen, maxlen, str, len); } @@ -170,7 +182,7 @@ static int w_addword(wordexp_t * pwordexp, char *word) * the caller sees them. */ if (word == NULL) { - word = __strdup(""); + word = strdup(""); if (word == NULL) goto no_space; } @@ -272,7 +284,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length, if (*word_length != 0) { if (!((*word)[*word_length - 1] == '=' && wordc == 0)) { if (!((*word)[*word_length - 1] == ':' - && __strchr(*word, '=') && wordc == 0)) { + && strchr(*word, '=') && wordc == 0)) { *word = w_addchar(*word, word_length, max_length, '~'); return *word ? 0 : WRDE_NOSPACE; } @@ -303,7 +315,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length, results are unspecified. We do a lookup on the uid if HOME is unset. */ - home = __getenv("HOME"); + home = getenv("HOME"); if (home != NULL) { *word = w_addstr(*word, word_length, max_length, home); if (*word == NULL) @@ -397,7 +409,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length, } for (match = 0; match < globbuf.gl_pathc; ++match) { - char *matching_word = __strdup(globbuf.gl_pathv[match]); + char *matching_word = strdup(globbuf.gl_pathv[match]); if (matching_word == NULL || w_addword(pwordexp, matching_word)) { __globfree(&globbuf); @@ -424,8 +436,8 @@ parse_glob(char **word, size_t * word_length, size_t * max_length, glob_list.we_wordv = NULL; glob_list.we_offs = 0; for (; words[*offset] != '\0'; ++*offset) { - if ((ifs && __strchr(ifs, words[*offset])) || - (!ifs && __strchr(" \t\n", words[*offset]))) + if ((ifs && strchr(ifs, words[*offset])) || + (!ifs && strchr(" \t\n", words[*offset]))) /* Reached IFS */ break; @@ -515,7 +527,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; } @@ -782,24 +794,24 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec) /* Redirect output. */ dup2(fildes[1], 1); - __close(fildes[1]); + close(fildes[1]); /* Redirect stderr to /dev/null if we have to. */ if (showerr == 0) { int fd; - __close(2); - fd = __open(_PATH_DEVNULL, O_WRONLY); + close(2); + fd = open(_PATH_DEVNULL, O_WRONLY); if (fd >= 0 && fd != 2) { dup2(fd, 2); - __close(fd); + close(fd); } } /* Make sure the subshell doesn't field-split on our behalf. */ unsetenv("IFS"); - __close(fildes[0]); + close(fildes[0]); execve(_PATH_BSHELL, (char *const *) args, __environ); /* Bad. What now? */ @@ -832,8 +844,8 @@ exec_comm(char *comm, char **word, size_t * word_length, if ((pid = fork()) < 0) { /* Bad */ - __close(fildes[0]); - __close(fildes[1]); + close(fildes[0]); + close(fildes[1]); return WRDE_NOSPACE; } @@ -842,17 +854,17 @@ exec_comm(char *comm, char **word, size_t * word_length, /* Parent */ - __close(fildes[1]); + close(fildes[1]); buffer = alloca(bufsize); if (!pwordexp) /* Quoted - no field splitting */ { while (1) { - if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = read(fildes[0], buffer, bufsize)) < 1) break; } @@ -875,17 +887,17 @@ exec_comm(char *comm, char **word, size_t * word_length, */ while (1) { - if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) { + if ((buflen = read(fildes[0], buffer, bufsize)) < 1) { if (waitpid(pid, &status, WNOHANG) == 0) continue; - if ((buflen = __read(fildes[0], buffer, bufsize)) < 1) + if ((buflen = read(fildes[0], buffer, bufsize)) < 1) break; } for (i = 0; i < buflen; ++i) { - if (__strchr(ifs, buffer[i]) != NULL) { + if (strchr(ifs, buffer[i]) != NULL) { /* Current character is IFS */ - if (__strchr(ifs_white, buffer[i]) == NULL) { + if (strchr(ifs_white, buffer[i]) == NULL) { /* Current character is IFS but not whitespace */ if (copying == 2) { /* current character @@ -979,7 +991,7 @@ exec_comm(char *comm, char **word, size_t * word_length, } } - __close(fildes[0]); + close(fildes[0]); /* Check for syntax error (re-execute but with "-n" flag) */ if (buflen < 1 && status != 0) { @@ -1002,7 +1014,7 @@ exec_comm(char *comm, char **word, size_t * word_length, no_space: kill(pid, SIGKILL); waitpid(pid, NULL, 0); - __close(fildes[0]); + close(fildes[0]); return WRDE_NOSPACE; } @@ -1201,7 +1213,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto envsubst; } while (isdigit(words[++*offset])); - } else if (__strchr("*@$", words[*offset]) != NULL) { + } else if (strchr("*@$", words[*offset]) != NULL) { /* Special parameter. */ special = 1; env = w_addchar(env, &env_length, &env_maxlen, words[*offset]); @@ -1237,7 +1249,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, break; case ':': - if (__strchr("-=?+", words[1 + *offset]) == NULL) + if (strchr("-=?+", words[1 + *offset]) == NULL) goto syntax; colon_seen = 1; @@ -1348,7 +1360,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Is it `$$'? */ if (*env == '$') { buffer[20] = '\0'; - value = _itoa(__getpid(), &buffer[20]); + value = _itoa(getpid(), &buffer[20]); } /* Is it `${#*}' or `${#@}'? */ else if ((*env == '*' || *env == '@') && seen_hash) { @@ -1369,7 +1381,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Build up value parameter by parameter (copy them) */ for (p = 1; __libc_argv[p]; ++p) - plist_len += __strlen(__libc_argv[p]) + 1; /* for space */ + plist_len += strlen(__libc_argv[p]) + 1; /* for space */ value = malloc(plist_len); if (value == NULL) goto no_space; @@ -1399,7 +1411,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, goto no_space; for (p = 2; __libc_argv[p + 1]; p++) { - char *newword = __strdup(__libc_argv[p]); + char *newword = strdup(__libc_argv[p]); if (newword == NULL || w_addword(pwordexp, newword)) goto no_space; @@ -1415,7 +1427,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, } } } else - value = __getenv(env); + value = getenv(env); if (value == NULL && (flags & WRDE_UNDEF)) { /* Variable not defined. */ @@ -1579,7 +1591,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (value == NULL || pattern == NULL || *pattern == '\0') break; - end = value + __strlen(value); + end = value + strlen(value); switch (action) { case ACT_RP_SHORT_LEFT: @@ -1589,7 +1601,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = __strdup(p); + char *newval = strdup(p); if (newval == NULL) { free(value); @@ -1613,7 +1625,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (fnmatch(pattern, value, 0) != FNM_NOMATCH) { *p = c; if (free_value) { - char *newval = __strdup(p); + char *newval = strdup(p); if (newval == NULL) { free(value); @@ -1717,7 +1729,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Substitute NULL */ goto success; - value = pattern ? __strdup(pattern) : pattern; + value = pattern ? strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1730,7 +1742,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? __strdup(pattern) : pattern; + value = pattern ? strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1759,7 +1771,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, if (free_value && value) free(value); - value = pattern ? __strdup(pattern) : pattern; + value = pattern ? strdup(pattern) : pattern; free_value = 1; if (pattern && !value) @@ -1783,7 +1795,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, param_length[20] = '\0'; *word = w_addstr(*word, word_length, max_length, - _itoa(value ? __strlen(value) : 0, + _itoa(value ? strlen(value) : 0, ¶m_length[20])); if (free_value) { assert(value != NULL); @@ -1805,7 +1817,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, return *word ? 0 : WRDE_NOSPACE; } else { /* Need to field-split */ - char *value_copy = __strdup(value); /* Don't modify value */ + char *value_copy = strdup(value); /* Don't modify value */ char *field_begin = value_copy; int seen_nonws_ifs = 0; @@ -1845,7 +1857,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length, /* Skip at most one non-whitespace IFS character after the field */ seen_nonws_ifs = 0; - if (*next_field && __strchr(ifs, *next_field)) { + if (*next_field && strchr(ifs, *next_field)) { seen_nonws_ifs = 1; next_field++; } @@ -2088,11 +2100,11 @@ int wordexp(const char *words, wordexp_t * we, int flags) /* Find out what the field separators are. * There are two types: whitespace and non-whitespace. */ - ifs = __getenv("IFS"); + ifs = getenv("IFS"); if (!ifs) /* IFS unset - use <space><tab><newline>. */ - ifs = __strcpy(ifs_white, " \t\n"); + ifs = strcpy(ifs_white, " \t\n"); else { char *ifsch = ifs; char *whch = ifs_white; @@ -2211,11 +2223,11 @@ int wordexp(const char *words, wordexp_t * we, int flags) default: /* Is it a word separator? */ - if (__strchr(" \t", words[words_offset]) == NULL) { + if (strchr(" \t", words[words_offset]) == NULL) { char ch = words[words_offset]; /* Not a word separator -- but is it a valid word char? */ - if (__strchr("\n|&;<>(){}", ch)) { + if (strchr("\n|&;<>(){}", ch)) { /* Fail */ error = WRDE_BADCHAR; goto do_error; diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index f99e9f026..1f1981ac5 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -19,10 +19,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define sigfillset __sigfillset_internal -#define sigaction __sigaction -#define alarm __alarm - #include <features.h> #include <fcntl.h> #include <signal.h> @@ -31,6 +27,17 @@ #include <sys/file.h> #include <paths.h> +libc_hidden_proto(memset) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) +libc_hidden_proto(close) +libc_hidden_proto(sigfillset) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) +libc_hidden_proto(sigaddset) +libc_hidden_proto(sigemptyset) +libc_hidden_proto(alarm) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; @@ -46,7 +53,7 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; static int lock_fd = -1; /* Prototypes for local functions. */ -static void noop_handler __P ((int __sig)); +static void noop_handler (int __sig); int lckpwdf (void) @@ -65,7 +72,7 @@ int lckpwdf (void) LOCK; - lock_fd = __open (_PATH_PASSWD, O_WRONLY); + lock_fd = open (_PATH_PASSWD, O_WRONLY); if (lock_fd == -1) { /* Cannot create lock file. */ UNLOCK; @@ -73,18 +80,18 @@ int lckpwdf (void) } /* Make sure file gets correctly closed when process finished. */ - flags = __fcntl (lock_fd, F_GETFD, 0); + flags = fcntl (lock_fd, F_GETFD, 0); if (flags == -1) { /* Cannot get file flags. */ - __close(lock_fd); + close(lock_fd); lock_fd = -1; UNLOCK; return -1; } flags |= FD_CLOEXEC; /* Close on exit. */ - if (__fcntl (lock_fd, F_SETFD, flags) < 0) { + if (fcntl (lock_fd, F_SETFD, flags) < 0) { /* Cannot set new flags. */ - __close(lock_fd); + close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -98,7 +105,7 @@ int lckpwdf (void) It is important that we don't change the signal state. We must restore the old signal behaviour. */ - __memset (&new_act, '\0', sizeof (struct sigaction)); + memset (&new_act, '\0', sizeof (struct sigaction)); new_act.sa_handler = noop_handler; sigfillset (&new_act.sa_mask); new_act.sa_flags = 0ul; @@ -106,7 +113,7 @@ int lckpwdf (void) /* Install new action handler for alarm and save old. */ if (sigaction (SIGALRM, &new_act, &saved_act) < 0) { /* Cannot install signal handler. */ - __close(lock_fd); + close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -115,9 +122,9 @@ int lckpwdf (void) /* Now make sure the alarm signal is not blocked. */ sigemptyset (&new_set); sigaddset (&new_set, SIGALRM); - if (__sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) { + if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) { sigaction (SIGALRM, &saved_act, NULL); - __close(lock_fd); + close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -128,24 +135,24 @@ int lckpwdf (void) alarm (TIMEOUT); /* Try to get the lock. */ - __memset (&fl, '\0', sizeof (struct flock)); + memset (&fl, '\0', sizeof (struct flock)); fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; - result = __fcntl (lock_fd, F_SETLKW, &fl); + result = fcntl (lock_fd, F_SETLKW, &fl); /* Clear alarm. */ alarm (0); /* Restore old set of handled signals. We don't need to know about the current one.*/ - __sigprocmask (SIG_SETMASK, &saved_set, NULL); + sigprocmask (SIG_SETMASK, &saved_set, NULL); /* Restore old action handler for alarm. We don't need to know about the current one. */ sigaction (SIGALRM, &saved_act, NULL); if (result < 0) { - __close(lock_fd); + close(lock_fd); lock_fd = -1; UNLOCK; return -1; @@ -166,7 +173,7 @@ int ulckpwdf (void) } else { LOCK; - result = __close (lock_fd); + result = close (lock_fd); /* Mark descriptor as unused. */ lock_fd = -1; UNLOCK; diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 0f7c564f0..1237df72c 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -18,11 +18,6 @@ * */ -#define setgroups __setgroups -#define strtoul __strtoul -#define rewind __rewind -#define fgets_unlocked __fgets_unlocked - #define _GNU_SOURCE #include <features.h> #include <stdio.h> @@ -43,16 +38,19 @@ #include <pthread.h> #endif -extern int __getspnam_r (__const char *__name, struct spwd *__result_buf, - char *__buffer, size_t __buflen, - struct spwd **__result) attribute_hidden; - -extern int __getpwuid_r (__uid_t __uid, - struct passwd *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) attribute_hidden; - -extern int __fputc_unlocked_internal(int c, FILE *stream) attribute_hidden; +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(setgroups) +libc_hidden_proto(strtoul) +libc_hidden_proto(rewind) +libc_hidden_proto(fgets_unlocked) +libc_hidden_proto(__fputc_unlocked) +libc_hidden_proto(sprintf) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fprintf) /**********************************************************************/ /* Sizes for staticly allocated buffers. */ @@ -89,7 +87,7 @@ extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, /**********************************************************************/ #ifdef L_fgetpwent_r -int attribute_hidden __fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, +int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct passwd **__restrict result) { @@ -103,13 +101,14 @@ int attribute_hidden __fgetpwent_r(FILE *__restrict stream, struct passwd *__res return rv; } -strong_alias(__fgetpwent_r,fgetpwent_r) +libc_hidden_proto(fgetpwent_r) +libc_hidden_def(fgetpwent_r) #endif /**********************************************************************/ #ifdef L_fgetgrent_r -int attribute_hidden __fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, +int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct group **__restrict result) { @@ -123,13 +122,14 @@ int attribute_hidden __fgetgrent_r(FILE *__restrict stream, struct group *__rest return rv; } -strong_alias(__fgetgrent_r,fgetgrent_r) +libc_hidden_proto(fgetgrent_r) +libc_hidden_def(fgetgrent_r) #endif /**********************************************************************/ #ifdef L_fgetspent_r -int attribute_hidden __fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, +int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct spwd **__restrict result) { @@ -143,7 +143,8 @@ int attribute_hidden __fgetspent_r(FILE *__restrict stream, struct spwd *__restr return rv; } -strong_alias(__fgetspent_r,fgetspent_r) +libc_hidden_proto(fgetspent_r) +libc_hidden_def(fgetspent_r) #endif /**********************************************************************/ @@ -153,10 +154,7 @@ strong_alias(__fgetspent_r,fgetspent_r) /**********************************************************************/ #ifdef L_fgetpwent -extern int __fgetpwent_r (FILE *__restrict __stream, - struct passwd *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) attribute_hidden; +libc_hidden_proto(fgetpwent_r) struct passwd *fgetpwent(FILE *stream) { @@ -164,7 +162,7 @@ struct passwd *fgetpwent(FILE *stream) static struct passwd resultbuf; struct passwd *result; - __fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -172,10 +170,7 @@ struct passwd *fgetpwent(FILE *stream) /**********************************************************************/ #ifdef L_fgetgrent -extern int __fgetgrent_r (FILE *__restrict __stream, - struct group *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) attribute_hidden; +libc_hidden_proto(fgetgrent_r) struct group *fgetgrent(FILE *stream) { @@ -183,7 +178,7 @@ struct group *fgetgrent(FILE *stream) static struct group resultbuf; struct group *result; - __fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -191,9 +186,7 @@ struct group *fgetgrent(FILE *stream) /**********************************************************************/ #ifdef L_fgetspent -extern int __fgetspent_r (FILE *__stream, struct spwd *__result_buf, - char *__buffer, size_t __buflen, - struct spwd **__result) attribute_hidden; +libc_hidden_proto(fgetspent_r) struct spwd *fgetspent(FILE *stream) { @@ -201,7 +194,7 @@ struct spwd *fgetspent(FILE *stream) static struct spwd resultbuf; struct spwd *result; - __fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -209,7 +202,7 @@ struct spwd *fgetspent(FILE *stream) /**********************************************************************/ #ifdef L_sgetspent_r -int attribute_hidden __sgetspent_r(const char *string, struct spwd *result_buf, +int sgetspent_r(const char *string, struct spwd *result_buf, char *buffer, size_t buflen, struct spwd **result) { int rv = ERANGE; @@ -223,10 +216,10 @@ int attribute_hidden __sgetspent_r(const char *string, struct spwd *result_buf, } if (string != buffer) { - if (__strlen(string) >= buflen) { + if (strlen(string) >= buflen) { goto DO_ERANGE; } - __strcpy(buffer, string); + strcpy(buffer, string); } if (!(rv = __parsespent(result_buf, buffer))) { @@ -236,7 +229,8 @@ int attribute_hidden __sgetspent_r(const char *string, struct spwd *result_buf, DONE: return rv; } -strong_alias(__sgetspent_r,sgetspent_r) +libc_hidden_proto(sgetspent_r) +libc_hidden_def(sgetspent_r) #endif /**********************************************************************/ @@ -246,40 +240,36 @@ strong_alias(__sgetspent_r,sgetspent_r) #endif #ifdef L_getpwnam_r -#define GETXXKEY_R_FUNC_HIDDEN __getpwnam_r #define GETXXKEY_R_FUNC getpwnam_r #define GETXXKEY_R_PARSER __parsepwent #define GETXXKEY_R_ENTTYPE struct passwd -#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->pw_name, key)) +#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD #include "pwd_grp_internal.c" #endif #ifdef L_getgrnam_r -#define GETXXKEY_R_FUNC_HIDDEN __getgrnam_r #define GETXXKEY_R_FUNC getgrnam_r #define GETXXKEY_R_PARSER __parsegrent #define GETXXKEY_R_ENTTYPE struct group -#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->gr_name, key)) +#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP #include "pwd_grp_internal.c" #endif #ifdef L_getspnam_r -#define GETXXKEY_R_FUNC_HIDDEN __getspnam_r #define GETXXKEY_R_FUNC getspnam_r #define GETXXKEY_R_PARSER __parsespent #define GETXXKEY_R_ENTTYPE struct spwd -#define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->sp_namp, key)) +#define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW #include "pwd_grp_internal.c" #endif #ifdef L_getpwuid_r -#define GETXXKEY_R_FUNC_HIDDEN __getpwuid_r #define GETXXKEY_R_FUNC getpwuid_r #define GETXXKEY_R_PARSER __parsepwent #define GETXXKEY_R_ENTTYPE struct passwd @@ -290,7 +280,6 @@ strong_alias(__sgetspent_r,sgetspent_r) #endif #ifdef L_getgrgid_r -#define GETXXKEY_R_FUNC_HIDDEN __getgrgid_r #define GETXXKEY_R_FUNC getgrgid_r #define GETXXKEY_R_PARSER __parsegrent #define GETXXKEY_R_ENTTYPE struct group @@ -303,13 +292,15 @@ strong_alias(__sgetspent_r,sgetspent_r) /**********************************************************************/ #ifdef L_getpwuid +libc_hidden_proto(getpwuid_r) + struct passwd *getpwuid(uid_t uid) { static char buffer[PWD_BUFFER_SIZE]; static struct passwd resultbuf; struct passwd *result; - __getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); + getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -317,9 +308,7 @@ struct passwd *getpwuid(uid_t uid) /**********************************************************************/ #ifdef L_getgrgid -extern int __getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) attribute_hidden; +libc_hidden_proto(getgrgid_r) struct group *getgrgid(gid_t gid) { @@ -327,7 +316,7 @@ struct group *getgrgid(gid_t gid) static struct group resultbuf; struct group *result; - __getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result); + getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -339,6 +328,9 @@ struct group *getgrgid(gid_t gid) * to have been created as a reentrant version of the non-standard * functions getspuid. Why getspuid was added, I do not know. */ +libc_hidden_proto(getpwuid_r) +libc_hidden_proto(getspnam_r) + int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct spwd **__restrict result) @@ -349,8 +341,8 @@ int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf, char pwd_buff[PWD_BUFFER_SIZE]; *result = NULL; - if (!(rv = __getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp))) { - rv = __getspnam_r(password.pw_name, resultbuf, buffer, buflen, result); + if (!(rv = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp))) { + rv = getspnam_r(password.pw_name, resultbuf, buffer, buflen, result); } return rv; @@ -363,6 +355,8 @@ int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf, /* This function is non-standard and is currently not built. * Why it was added, I do not know. */ +libc_hidden_proto(getspuid_r) + struct spwd *getspuid(uid_t uid) { static char buffer[PWD_BUFFER_SIZE]; @@ -377,10 +371,7 @@ struct spwd *getspuid(uid_t uid) /**********************************************************************/ #ifdef L_getpwnam -extern int __getpwnam_r (__const char *__restrict __name, - struct passwd *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) attribute_hidden; +libc_hidden_proto(getpwnam_r) struct passwd *getpwnam(const char *name) { @@ -388,7 +379,7 @@ struct passwd *getpwnam(const char *name) static struct passwd resultbuf; struct passwd *result; - __getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -396,10 +387,7 @@ struct passwd *getpwnam(const char *name) /**********************************************************************/ #ifdef L_getgrnam -extern int __getgrnam_r (__const char *__restrict __name, - struct group *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) attribute_hidden; +libc_hidden_proto(getgrnam_r) struct group *getgrnam(const char *name) { @@ -407,7 +395,7 @@ struct group *getgrnam(const char *name) static struct group resultbuf; struct group *result; - __getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -415,13 +403,15 @@ struct group *getgrnam(const char *name) /**********************************************************************/ #ifdef L_getspnam +libc_hidden_proto(getspnam_r) + struct spwd *getspnam(const char *name) { static char buffer[PWD_BUFFER_SIZE]; static struct spwd resultbuf; struct spwd *result; - __getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -429,6 +419,8 @@ struct spwd *getspnam(const char *name) /**********************************************************************/ #ifdef L_getpw +libc_hidden_proto(getpwuid_r) + int getpw(uid_t uid, char *buf) { struct passwd resultbuf; @@ -437,8 +429,8 @@ 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", + } else if (!getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) { + 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), @@ -487,7 +479,7 @@ void endpwent(void) } -int attribute_hidden __getpwent_r(struct passwd *__restrict resultbuf, +int getpwent_r(struct passwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct passwd **__restrict result) { @@ -515,7 +507,7 @@ int attribute_hidden __getpwent_r(struct passwd *__restrict resultbuf, return rv; } -strong_alias(__getpwent_r,getpwent_r) +libc_hidden_proto(getpwent_r) #endif /**********************************************************************/ @@ -542,7 +534,7 @@ void endgrent(void) UNLOCK; } -int attribute_hidden __getgrent_r(struct group *__restrict resultbuf, +int getgrent_r(struct group *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct group **__restrict result) { @@ -570,7 +562,8 @@ int attribute_hidden __getgrent_r(struct group *__restrict resultbuf, return rv; } -strong_alias(__getgrent_r,getgrent_r) +libc_hidden_proto(getgrent_r) +libc_hidden_def(getgrent_r) #endif /**********************************************************************/ @@ -597,7 +590,7 @@ void endspent(void) UNLOCK; } -int attribute_hidden __getspent_r(struct spwd *resultbuf, char *buffer, +int getspent_r(struct spwd *resultbuf, char *buffer, size_t buflen, struct spwd **result) { int rv; @@ -624,15 +617,14 @@ int attribute_hidden __getspent_r(struct spwd *resultbuf, char *buffer, return rv; } -strong_alias(__getspent_r,getspent_r) +libc_hidden_proto(getspent_r) +libc_hidden_def(getspent_r) #endif /**********************************************************************/ #ifdef L_getpwent - -extern int __getpwent_r (struct passwd *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct passwd **__restrict __result) attribute_hidden; + +libc_hidden_proto(getpwent_r) struct passwd *getpwent(void) { @@ -640,7 +632,7 @@ struct passwd *getpwent(void) static struct passwd pwd; struct passwd *result; - __getpwent_r(&pwd, line_buff, sizeof(line_buff), &result); + getpwent_r(&pwd, line_buff, sizeof(line_buff), &result); return result; } @@ -648,9 +640,7 @@ struct passwd *getpwent(void) /**********************************************************************/ #ifdef L_getgrent -extern int __getgrent_r (struct group *__restrict __resultbuf, - char *__restrict __buffer, size_t __buflen, - struct group **__restrict __result) attribute_hidden; +libc_hidden_proto(getgrent_r) struct group *getgrent(void) { @@ -658,7 +648,7 @@ struct group *getgrent(void) static struct group gr; struct group *result; - __getgrent_r(&gr, line_buff, sizeof(line_buff), &result); + getgrent_r(&gr, line_buff, sizeof(line_buff), &result); return result; } @@ -666,8 +656,7 @@ struct group *getgrent(void) /**********************************************************************/ #ifdef L_getspent -extern int __getspent_r (struct spwd *__result_buf, char *__buffer, - size_t __buflen, struct spwd **__result) attribute_hidden; +libc_hidden_proto(getspent_r) struct spwd *getspent(void) { @@ -675,7 +664,7 @@ struct spwd *getspent(void) static struct spwd spwd; struct spwd *result; - __getspent_r(&spwd, line_buff, sizeof(line_buff), &result); + getspent_r(&spwd, line_buff, sizeof(line_buff), &result); return result; } @@ -683,9 +672,7 @@ struct spwd *getspent(void) /**********************************************************************/ #ifdef L_sgetspent -extern int __sgetspent_r (__const char *__string, struct spwd *__result_buf, - char *__buffer, size_t __buflen, - struct spwd **__result) attribute_hidden; +libc_hidden_proto(sgetspent_r) struct spwd *sgetspent(const char *string) { @@ -693,7 +680,7 @@ struct spwd *sgetspent(const char *string) static struct spwd spwd; struct spwd *result; - __sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); + sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); return result; } @@ -726,7 +713,7 @@ int initgroups(const char *user, gid_t gid) assert(group.gr_mem); /* Must have at least a NULL terminator. */ if (group.gr_gid != gid) { for (m=group.gr_mem ; *m ; m++) { - if (!__strcmp(*m, user)) { + if (!strcmp(*m, user)) { if (!(num_groups & 7)) { gid_t *tmp = (gid_t *) realloc(group_list, @@ -809,7 +796,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) do { if (!*m) { - if (__fputc_unlocked_internal('\n', f) >= 0) { + if (__fputc_unlocked('\n', f) >= 0) { rv = 0; } break; @@ -875,7 +862,7 @@ int putspent(const struct spwd *p, FILE *stream) goto DO_UNLOCK; } - if (__fputc_unlocked_internal('\n', stream) > 0) { + if (__fputc_unlocked('\n', stream) > 0) { rv = 0; } @@ -919,7 +906,7 @@ int attribute_hidden __parsepwent(void *data, char *line) /* NOTE: glibc difference - glibc allows omission of * ':' seperators after the gid field if all remaining * entries are empty. We require all separators. */ - if (!(line = __strchr(line, ':'))) { + if (!(line = strchr(line, ':'))) { break; } } else { @@ -971,7 +958,7 @@ int attribute_hidden __parsegrent(void *data, char *line) if (i < 2) { *((char **) p) = line; - if (!(line = __strchr(line, ':'))) { + if (!(line = strchr(line, ':'))) { break; } *line++ = 0; @@ -1071,7 +1058,7 @@ int attribute_hidden __parsespent(void *data, char * line) p = ((char *) ((struct spwd *) data)) + sp_off[i]; if (i < 2) { *((char **) p) = line; - if (!(line = __strchr(line, ':'))) { + if (!(line = strchr(line, ':'))) { break; } } else { @@ -1148,7 +1135,7 @@ int attribute_hidden __pgsreader(int (*__parserfunc)(void *d, char *line), void break; } - line_len = __strlen(line_buff) - 1; /* strlen() must be > 0. */ + line_len = strlen(line_buff) - 1; /* strlen() must be > 0. */ if (line_buff[line_len] == '\n') { line_buff[line_len] = 0; } else if (line_len + 2 == buflen) { /* line too long */ diff --git a/libc/pwd_grp/pwd_grp_internal.c b/libc/pwd_grp/pwd_grp_internal.c index 8520cf45b..6d32ec911 100644 --- a/libc/pwd_grp/pwd_grp_internal.c +++ b/libc/pwd_grp/pwd_grp_internal.c @@ -55,7 +55,7 @@ /**********************************************************************/ #ifdef GETXXKEY_R_FUNC -int attribute_hidden GETXXKEY_R_FUNC_HIDDEN(DO_GETXXKEY_R_KEYTYPE key, +int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key, GETXXKEY_R_ENTTYPE *__restrict resultbuf, char *__restrict buffer, size_t buflen, GETXXKEY_R_ENTTYPE **__restrict result) @@ -89,7 +89,8 @@ int attribute_hidden GETXXKEY_R_FUNC_HIDDEN(DO_GETXXKEY_R_KEYTYPE key, return rv; } -strong_alias(GETXXKEY_R_FUNC_HIDDEN,GETXXKEY_R_FUNC) +libc_hidden_proto(GETXXKEY_R_FUNC) +libc_hidden_def(GETXXKEY_R_FUNC) #endif /**********************************************************************/ diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c index 91a332af6..6de79a714 100644 --- a/libc/signal/killpg.c +++ b/libc/signal/killpg.c @@ -16,11 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define kill __kill - #include <errno.h> #include <signal.h> +libc_hidden_proto(kill) /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in diff --git a/libc/signal/raise.c b/libc/signal/raise.c index 5a964c4b6..09beba0d6 100644 --- a/libc/signal/raise.c +++ b/libc/signal/raise.c @@ -3,18 +3,18 @@ * under the GNU Library General Public License. */ -#define kill __kill - #include <unistd.h> #include <string.h> #include <signal.h> #include <sys/types.h> -#undef raise -int attribute_hidden __raise(int signo) +libc_hidden_proto(raise) + +libc_hidden_proto(getpid) +libc_hidden_proto(kill) + +int raise(int signo) { - return kill(__getpid(), signo); + return kill(getpid(), signo); } - -/* psm: keep this weak, because the one in libpthread.so could overwrite it */ -weak_alias(__raise, raise) +libc_hidden_def(raise) diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index fb46f9c01..01b8c763a 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -22,6 +22,7 @@ #include <sys/syscall.h> +libc_hidden_proto(memcpy) /* The difference here is that the sigaction structure used in the kernel is not the same as we use in the libc. Therefore we must @@ -32,7 +33,7 @@ /* 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 +int attribute_hidden __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; @@ -40,7 +41,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER kact.sa_restorer = act->sa_restorer; @@ -55,7 +56,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; @@ -69,7 +70,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) /* 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 +int attribute_hidden __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { int result; @@ -103,6 +104,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) -weak_alias(__libc_sigaction,sigaction) +strong_alias(__libc_sigaction,sigaction) +libc_hidden_proto(sigaction) +libc_hidden_def(sigaction) #endif diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c index e5813c117..36d1edc32 100644 --- a/libc/signal/sigaddset.c +++ b/libc/signal/sigaddset.c @@ -32,3 +32,5 @@ sigaddset (set, signo) return __sigaddset (set, signo); } +libc_hidden_proto(sigaddset) +libc_hidden_def(sigaddset) diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index d3568b9f5..8dd4eebd7 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -19,20 +19,22 @@ #include <errno.h> #include <signal.h> +libc_hidden_proto(sigprocmask) + #include "sigset-cvt-mask.h" /* Block signals in MASK, returning the old mask. */ -int attribute_hidden __sigblock (int mask) +int sigblock (int mask) { sigset_t set, oset; if (sigset_set_old_mask (&set, mask) < 0) return -1; - if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0) + if (sigprocmask (SIG_BLOCK, &set, &oset) < 0) return -1; return sigset_get_old_mask (&oset); } - -strong_alias (__sigblock, sigblock) +libc_hidden_proto(sigblock) +libc_hidden_def(sigblock) diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c index ea36b6c3c..6fa7241c7 100644 --- a/libc/signal/sigdelset.c +++ b/libc/signal/sigdelset.c @@ -19,8 +19,7 @@ #include "sigsetops.h" /* Add SIGNO to SET. */ -int attribute_hidden -__sigdelset_internal (sigset_t *set, int signo) +int sigdelset (sigset_t *set, int signo) { if (set == NULL || signo <= 0 || signo >= NSIG) { @@ -30,4 +29,5 @@ __sigdelset_internal (sigset_t *set, int signo) return __sigdelset (set, signo); } -strong_alias(__sigdelset_internal,sigdelset) +libc_hidden_proto(sigdelset) +libc_hidden_def(sigdelset) diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 777edbdd5..64330a686 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -20,6 +20,8 @@ #include <signal.h> #include <string.h> +libc_hidden_proto(memset) + /* Clear all signals from SET. */ int sigemptyset (set) @@ -31,7 +33,9 @@ sigemptyset (set) return -1; } - __memset (set, 0, sizeof (sigset_t)); + memset (set, 0, sizeof (sigset_t)); return 0; } +libc_hidden_proto(sigemptyset) +libc_hidden_def(sigemptyset) diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 84862cfa2..2f72e8247 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -20,9 +20,12 @@ #include <signal.h> #include <string.h> +libc_hidden_proto(memset) +libc_hidden_proto(__sigdelset) + /* Set all signals in SET. */ -int attribute_hidden -__sigfillset_internal (sigset_t *set) +int +sigfillset (sigset_t *set) { if (set == NULL) { @@ -30,7 +33,7 @@ __sigfillset_internal (sigset_t *set) return -1; } - __memset (set, 0xff, sizeof (sigset_t)); + memset (set, 0xff, sizeof (sigset_t)); /* If the implementation uses a cancellation signal don't set the bit. */ #ifdef SIGCANCEL @@ -43,4 +46,5 @@ __sigfillset_internal (sigset_t *set) return 0; } -strong_alias(__sigfillset_internal,sigfillset) +libc_hidden_proto(sigfillset) +libc_hidden_def(sigfillset) diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c index 18e3d367d..8b6db202d 100644 --- a/libc/signal/siggetmask.c +++ b/libc/signal/siggetmask.c @@ -19,11 +19,12 @@ #include <signal.h> -extern int __sigblock (int __mask) __THROW /*__attribute_deprecated__*/ attribute_hidden; +libc_hidden_proto(sigblock) + int siggetmask (void) { - return __sigblock (0); + return sigblock (0); } link_warning (siggetmask, diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index 29b452f63..d51ac1243 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -23,6 +23,9 @@ #define _GNU_SOURCE #include <signal.h> +libc_hidden_proto(sigprocmask) +libc_hidden_proto(sigaddset) + int sighold (sig) int sig; @@ -30,7 +33,7 @@ sighold (sig) sigset_t set; /* Retrieve current signal set. */ - if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) return -1; /* Add the specified signal. */ @@ -38,5 +41,5 @@ sighold (sig) return -1; /* Set the new mask. */ - return __sigprocmask (SIG_SETMASK, &set, NULL); + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c index 3f8b8985f..f44784b93 100644 --- a/libc/signal/sigignore.c +++ b/libc/signal/sigignore.c @@ -18,8 +18,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigaction __sigaction - #define _GNU_SOURCE #include <errno.h> #define __need_NULL @@ -27,6 +25,7 @@ #include <signal.h> #include <string.h> /* For the real memset prototype. */ +libc_hidden_proto(sigaction) int sigignore (sig) diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index 797c52843..022d185bc 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -16,12 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigaction __sigaction - #include <stddef.h> #include <signal.h> #include <errno.h> +libc_hidden_proto(sigaction) + /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c index d11933891..26eec738f 100644 --- a/libc/signal/sigjmp.c +++ b/libc/signal/sigjmp.c @@ -21,6 +21,8 @@ #include <signal.h> #include <libc-internal.h> +libc_hidden_proto(sigprocmask) + /* This function is called by the `sigsetjmp' macro before doing a `__setjmp' on ENV[0].__jmpbuf. Always return zero. */ @@ -29,7 +31,7 @@ attribute_hidden int __sigjmp_save (sigjmp_buf env, int savemask) { env[0].__mask_was_saved = (savemask && - __sigprocmask (SIG_BLOCK, (sigset_t *) NULL, &env[0].__saved_mask) == 0); + sigprocmask (SIG_BLOCK, (sigset_t *) NULL, &env[0].__saved_mask) == 0); return 0; } diff --git a/libc/signal/signal.c b/libc/signal/signal.c index bcc31c0bc..c9ad64387 100644 --- a/libc/signal/signal.c +++ b/libc/signal/signal.c @@ -18,12 +18,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigaction __sigaction - #include <errno.h> #include <signal.h> #include <string.h> /* For the real memset prototype. */ +libc_hidden_proto(sigaction) sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ @@ -51,6 +50,7 @@ __bsd_signal (int sig, __sighandler_t handler) return oact.sa_handler; } -weak_alias (__bsd_signal, bsd_signal) -hidden_weak_alias (__bsd_signal, __signal) -weak_alias (__bsd_signal, signal) +strong_alias(__bsd_signal,bsd_signal) +strong_alias(__bsd_signal,signal) +libc_hidden_proto(signal) +libc_hidden_def(signal) diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index 7e0852dbc..e5dfc8e01 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -17,25 +17,26 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigdelset __sigdelset_internal -#define sigsuspend __sigsuspend - #include <errno.h> #include <signal.h> #include <stddef.h> /* For NULL. */ +libc_hidden_proto(sigprocmask) +libc_hidden_proto(sigdelset) +libc_hidden_proto(sigsuspend) + #include "sigset-cvt-mask.h" /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ -int attribute_hidden __sigpause_internal (int sig_or_mask, int is_sig) +int __sigpause (int sig_or_mask, int is_sig) { sigset_t set; if (is_sig != 0) { /* The modern X/Open implementation is requested. */ - if (__sigprocmask (0, NULL, &set) < 0 + if (sigprocmask (0, NULL, &set) < 0 /* Yes, we call `sigdelset' and not `__sigdelset'. */ || sigdelset (&set, sig_or_mask) < 0) return -1; @@ -45,7 +46,8 @@ int attribute_hidden __sigpause_internal (int sig_or_mask, int is_sig) return sigsuspend (&set); } -strong_alias(__sigpause_internal,__sigpause) +libc_hidden_proto(__sigpause) +libc_hidden_def(__sigpause) #undef sigpause @@ -54,5 +56,7 @@ strong_alias(__sigpause_internal,__sigpause) the BSD version. So make this the default. */ int sigpause (int mask) { - return __sigpause_internal (mask, 0); + return __sigpause (mask, 0); } +libc_hidden_proto(sigpause) +libc_hidden_def(sigpause) diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index e2fa775bd..a0f55d419 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -18,13 +18,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigdelset __sigdelset_internal - #define __need_NULL #include <stddef.h> #define _GNU_SOURCE #include <signal.h> +libc_hidden_proto(sigprocmask) +libc_hidden_proto(sigdelset) + int sigrelse (sig) int sig; @@ -32,7 +33,7 @@ sigrelse (sig) sigset_t set; /* Retrieve current signal set. */ - if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0) + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) return -1; /* Remove the specified signal. */ @@ -40,5 +41,5 @@ sigrelse (sig) return -1; /* Set the new mask. */ - return __sigprocmask (SIG_SETMASK, &set, NULL); + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index 305cd96fb..d2a395bcf 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigaction __sigaction - #include <errno.h> #define __need_NULL #include <stddef.h> @@ -25,6 +23,8 @@ #include <signal.h> #include <string.h> /* For the real memset prototype. */ +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) /* Set the disposition for SIG. */ __sighandler_t @@ -48,7 +48,7 @@ sigset (sig, disp) return SIG_ERR; /* Add the signal set to the current signal mask. */ - if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0) + if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) return SIG_ERR; return SIG_HOLD; @@ -78,7 +78,7 @@ sigset (sig, disp) return SIG_ERR; /* Remove the signal set from the current signal mask. */ - if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) + if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) return SIG_ERR; return oact.sa_handler; diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 56d7eccfa..ea68d3ebb 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -19,21 +19,24 @@ #include <errno.h> #include <signal.h> +libc_hidden_proto(sigprocmask) + #include "sigset-cvt-mask.h" /* Set the mask of blocked signals to MASK, returning the old mask. */ -int attribute_hidden -__sigsetmask (int mask) +int +sigsetmask (int mask) { sigset_t set, oset; if (sigset_set_old_mask (&set, mask) < 0) return -1; - if (__sigprocmask (SIG_SETMASK, &set, &oset) < 0) + if (sigprocmask (SIG_SETMASK, &set, &oset) < 0) return -1; return sigset_get_old_mask (&oset); } -weak_alias(__sigsetmask,sigsetmask) +libc_hidden_proto(sigsetmask) +libc_hidden_def(sigsetmask) diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index 13d65ed5e..cd46d2dbe 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -18,14 +18,13 @@ * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. */ -#define sigwaitinfo __sigwaitinfo - #include <errno.h> #include <signal.h> #include <string.h> -#undef sigwait -int attribute_hidden __sigwait (const sigset_t *set, int *sig) +libc_hidden_proto(sigwaitinfo) + +int sigwait (const sigset_t *set, int *sig) { int ret = 1; if ((ret = sigwaitinfo(set, NULL)) != -1) { @@ -34,6 +33,5 @@ int attribute_hidden __sigwait (const sigset_t *set, int *sig) } return 1; } - -/* psm: keep this weak, because the one in libpthread.so could overwrite it */ -weak_alias(__sigwait, sigwait) +libc_hidden_proto(sigwait) +libc_hidden_def(sigwait) diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c index 608aef235..97a216363 100644 --- a/libc/signal/sysv_signal.c +++ b/libc/signal/sysv_signal.c @@ -16,12 +16,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define sigaction __sigaction - #include <errno.h> #include <signal.h> #include <string.h> /* For the real memset prototype. */ +libc_hidden_proto(sigaction) /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT diff --git a/libc/stdio/_READ.c b/libc/stdio/_READ.c index e27309c11..0c7febb3c 100644 --- a/libc/stdio/_READ.c +++ b/libc/stdio/_READ.c @@ -5,10 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define read __read - #include "_stdio.h" +libc_hidden_proto(read) +libc_hidden_proto(abort) + /* Given a reading stream without its end-of-file indicator set and * with no buffered input or ungots, read at most 'bufsize' bytes * into 'buf' (which may be the stream's __bufstart). diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c index 5b6070cc3..74f253626 100644 --- a/libc/stdio/__fsetlocking.c +++ b/libc/stdio/__fsetlocking.c @@ -15,7 +15,7 @@ * glibc treats invalid locking_mode args as FSETLOCKING_INTERNAL. */ -int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode) +int __fsetlocking(FILE *stream, int locking_mode) { #ifdef __UCLIBC_HAS_THREADS__ int current = 1 + (stream->__user_locking & 1); @@ -44,4 +44,5 @@ int attribute_hidden __fsetlocking_internal(FILE *stream, int locking_mode) #endif } -strong_alias(__fsetlocking_internal,__fsetlocking) +libc_hidden_proto(__fsetlocking) +libc_hidden_def(__fsetlocking) diff --git a/libc/stdio/_cs_funcs.c b/libc/stdio/_cs_funcs.c index ef92048c0..38a8351e5 100644 --- a/libc/stdio/_cs_funcs.c +++ b/libc/stdio/_cs_funcs.c @@ -7,20 +7,29 @@ #include "_stdio.h" +libc_hidden_proto(read) +libc_hidden_proto(write) +libc_hidden_proto(close) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(lseek64) +#else +libc_hidden_proto(lseek) +#endif + /**********************************************************************/ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ /**********************************************************************/ ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize) { - return __read(*((int *) cookie), buf, bufsize); + return read(*((int *) cookie), buf, bufsize); } /**********************************************************************/ ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize) { - return __write(*((int *) cookie), (char *) buf, bufsize); + return write(*((int *) cookie), (char *) buf, bufsize); } /**********************************************************************/ @@ -30,9 +39,9 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence __offmax_t res; #ifdef __UCLIBC_HAS_LFS__ - res = __lseek64(*((int *) cookie), *pos, whence); + res = lseek64(*((int *) cookie), *pos, whence); #else - res = __lseek(*((int *) cookie), *pos, whence); + res = lseek(*((int *) cookie), *pos, whence); #endif return (res >= 0) ? ((*pos = res), 0) : ((int) res); @@ -42,7 +51,7 @@ int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence int attribute_hidden _cs_close(void *cookie) { - return __close(*((int *) cookie)); + return close(*((int *) cookie)); } /**********************************************************************/ @@ -54,9 +63,9 @@ int attribute_hidden __stdio_seek(FILE *stream, register __offmax_t *pos, int wh __offmax_t res; #ifdef __UCLIBC_HAS_LFS__ - res = __lseek64(stream->__filedes, *pos, whence); + res = lseek64(stream->__filedes, *pos, whence); #else - res = __lseek(stream->__filedes, *pos, whence); + res = lseek(stream->__filedes, *pos, whence); #endif return (res >= 0) ? ((*pos = res), 0) : ((int) res); diff --git a/libc/stdio/_flushlbf.c b/libc/stdio/_flushlbf.c index 31ed2fc55..8a551a746 100644 --- a/libc/stdio/_flushlbf.c +++ b/libc/stdio/_flushlbf.c @@ -8,6 +8,8 @@ #include "_stdio.h" #include <stdio_ext.h> +libc_hidden_proto(fflush_unlocked) + /* Solaris function -- * Flush all line buffered (writing) streams. */ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index b4f4d46c7..02051eff9 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -5,10 +5,12 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define isatty __isatty - #include "_stdio.h" +libc_hidden_proto(isatty) +libc_hidden_proto(open) +libc_hidden_proto(fcntl) + /* * Cases: * fopen64 : filename != NULL, stream == NULL, filedes == -2 @@ -121,7 +123,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, /* NOTE: fopencookie needs changing if the basic check changes! */ if (((i & (((int) fname_or_mode) + 1)) != i) /* Basic agreement? */ || (((open_mode & ~((__mode_t) fname_or_mode)) & O_APPEND) - && __fcntl(filedes, F_SETFL, O_APPEND)) /* Need O_APPEND. */ + && fcntl(filedes, F_SETFL, O_APPEND)) /* Need O_APPEND. */ ) { goto DO_EINVAL; } @@ -130,7 +132,7 @@ FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, & O_LARGEFILE) ); } else { __STDIO_WHEN_LFS( if (filedes < -1) open_mode |= O_LARGEFILE ); - if ((stream->__filedes = __open(((const char *) fname_or_mode), + if ((stream->__filedes = open(((const char *) fname_or_mode), open_mode, 0666)) < 0) { goto FREE_STREAM; } diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index 99fc9a9dd..03fe6b1db 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -11,6 +11,8 @@ #include <locale.h> #include <bits/uClibc_fpmax.h> +libc_hidden_proto(memset) + typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf); @@ -417,7 +419,7 @@ ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info if (mode == 'f') { round += exp; if (round < -1) { - __memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ + memset(buf, '0', DECIMAL_DIG); /* OK, since 'f' -> decimal case. */ exp = -1; round = -1; } diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index 600b15e6d..1e0f7ceee 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -5,11 +5,12 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define memrchr __memrchr -#define memchr __memchr - #include "_stdio.h" +libc_hidden_proto(memchr) +libc_hidden_proto(memcpy) +libc_hidden_proto(memrchr) + #ifdef __STDIO_BUFFERS /* Either buffer data or (commit buffer if necessary and) write. */ @@ -35,7 +36,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, if (pending > bytes) { pending = bytes; } - __memcpy(stream->__bufpos, buffer, pending); + memcpy(stream->__bufpos, buffer, pending); stream->__bufpos += pending; __STDIO_STREAM_VALIDATE(stream); return bytes; @@ -43,7 +44,7 @@ size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, /* RETRY: */ if (bytes <= __STDIO_STREAM_BUFFER_WAVAIL(stream)) { - __memcpy(stream->__bufpos, buffer, bytes); + memcpy(stream->__bufpos, buffer, bytes); stream->__bufpos += bytes; if (__STDIO_STREAM_IS_LBF(stream) && memrchr(buffer, '\n', bytes) /* Search backwards. */ diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 54319118f..6454b3f3b 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -5,10 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define isatty __isatty - #include "_stdio.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(isatty) + /* This is pretty much straight from uClibc, but with one important * difference. * @@ -169,7 +170,7 @@ void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - __memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); + memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer)); } #endif diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 0badc9fd1..d6b68b3bb 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -18,36 +18,8 @@ #include <stdlib.h> #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__ @@ -287,8 +259,6 @@ extern int __stdio_trans2w(FILE *__restrict stream) attribute_hidden; extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag) attribute_hidden; extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidden; -extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf, - int __modes, size_t __n) __THROW attribute_hidden; /**********************************************************************/ #ifdef __STDIO_BUFFERS @@ -376,46 +346,11 @@ extern int __setvbuf (FILE *__restrict __stream, char *__restrict __buf, #endif /* __STDIO_BUFFERS */ /**********************************************************************/ -extern int __fputs_unlocked(const char *__restrict s, FILE *__restrict stream) attribute_hidden; - -extern int __putchar_unlocked(int c); - - -extern size_t __fwrite_unlocked(const void *__restrict ptr, size_t size, - size_t nmemb, FILE *__restrict stream) attribute_hidden; - -extern size_t __fread_unlocked(void *__restrict ptr, size_t size, - size_t nmemb, FILE *__restrict stream) attribute_hidden; - -extern int __fputc_unlocked_internal(int c, FILE *stream) attribute_hidden; - -extern int __fflush_unlocked(FILE *stream) attribute_hidden; - extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden; -extern void __clearerr_unlocked(FILE *stream); -extern int __feof_unlocked(FILE *stream); -extern int __ferror_unlocked(FILE *stream); - -extern int __fgetc_unlocked_internal(FILE *stream) attribute_hidden; -extern int __getc_unlocked(FILE *stream) attribute_hidden; -extern char *__fgets_unlocked(char *__restrict s, int n, - FILE * __restrict stream) attribute_hidden; - -extern int __fileno_unlocked(FILE *stream) attribute_hidden; - -extern int __getchar_unlocked(void) attribute_hidden; - -extern int __fseek(FILE *stream, long int offset, int whence) attribute_hidden; -extern long int __ftell(FILE *stream) attribute_hidden; -#ifdef __UCLIBC_HAS_LFS__ -extern int __fseeko64(FILE *stream, __off64_t offset, int whence) attribute_hidden; -extern __off64_t __ftello64(FILE *stream) attribute_hidden; -#endif - #ifdef __STDIO_HAS_OPENLIST /* Uses an implementation hack!!! */ -#define __STDIO_FLUSH_LBF_STREAMS __fflush_unlocked((FILE *) &_stdio_openlist) +#define __STDIO_FLUSH_LBF_STREAMS fflush_unlocked((FILE *) &_stdio_openlist) #else #define __STDIO_FLUSH_LBF_STREAMS ((void)0) #endif @@ -453,9 +388,6 @@ extern FILE *_stdio_fopen(intptr_t fname_or_mode, #ifdef __UCLIBC_HAS_WCHAR__ extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, FILE *__restrict stream) attribute_hidden; - -extern wint_t __fgetwc_unlocked(register FILE *stream) attribute_hidden; -extern wint_t __fputwc_unlocked(wchar_t wc, FILE *stream) attribute_hidden; #endif /**********************************************************************/ diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c index 650a5e1a0..ed1a583fc 100644 --- a/libc/stdio/_trans2w.c +++ b/libc/stdio/_trans2w.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(fseek) + /* Function to handle transition to writing. * Initialize or verify the stream's orientation (even if readonly). * Check that the stream is writable. @@ -64,7 +66,7 @@ int attribute_hidden __stdio_trans2w(FILE * __restrict stream) * the end even if not reading.*/ if (((__STDIO_STREAM_BUFFER_RAVAIL(stream)) || (stream->__modeflags & __FLAG_UNGOT)) - && __fseek(stream, 0L, + && fseek(stream, 0L, ((stream->__modeflags & __FLAG_APPEND) ? SEEK_END : SEEK_CUR)) ) { diff --git a/libc/stdio/_uintmaxtostr.c b/libc/stdio/_uintmaxtostr.c index bf92506d5..4310d6458 100644 --- a/libc/stdio/_uintmaxtostr.c +++ b/libc/stdio/_uintmaxtostr.c @@ -11,6 +11,8 @@ #include <locale.h> #include <bits/uClibc_uintmaxtostr.h> +libc_hidden_proto(memcpy) + /* Avoid using long long / and % operations to cut down dependencies on * libgcc.a. Definitely helps on i386 at least. */ #if (INTMAX_MAX > INT_MAX) && (((INTMAX_MAX/INT_MAX)/2) - 2 <= INT_MAX) @@ -61,7 +63,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -79,7 +81,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - __memcpy(bufend, + memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else @@ -104,7 +106,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (!grouping) { /* Finished a group. */ bufend -= __UCLIBC_CURLOCALE_DATA.thousands_sep_len; - __memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, + memcpy(bufend, __UCLIBC_CURLOCALE_DATA.thousands_sep, __UCLIBC_CURLOCALE_DATA.thousands_sep_len); if (g[1] != 0) { /* g[1] == 0 means repeat last grouping. */ /* Note: g[1] == -1 means no further grouping. But since @@ -131,7 +133,7 @@ char attribute_hidden *_uintmaxtostr(register char * __restrict bufend, uintmax_ #ifndef __LOCALE_C_ONLY if (unlikely(outdigit)) { bufend -= __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]; - __memcpy(bufend, + memcpy(bufend, (&__UCLIBC_CURLOCALE_DATA.outdigit0_mb)[digit], __UCLIBC_CURLOCALE_DATA.outdigit_length[digit]); } else diff --git a/libc/stdio/_wfwrite.c b/libc/stdio/_wfwrite.c index 792cff604..fb5c6b3ee 100644 --- a/libc/stdio/_wfwrite.c +++ b/libc/stdio/_wfwrite.c @@ -5,8 +5,6 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define wmemcpy __wmemcpy - #include "_stdio.h" #include <wchar.h> @@ -17,9 +15,9 @@ #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Fix prototype. #endif -extern size_t __wcsnrtombs(char *__restrict dst, - const wchar_t **__restrict src, - size_t NWC, size_t len, mbstate_t *__restrict ps) attribute_hidden; + +libc_hidden_proto(wmemcpy) +libc_hidden_proto(wcsnrtombs) size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, register FILE *__restrict stream) @@ -55,7 +53,7 @@ size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, pw = ws; while (n > count) { - r = __wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state); + r = wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->__state); if (r != ((size_t) -1)) { /* No encoding errors */ if (!r) { ++r; /* 0 is returned when nul is reached. */ diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c index 207b35a3c..98865545e 100644 --- a/libc/stdio/asprintf.c +++ b/libc/stdio/asprintf.c @@ -5,16 +5,16 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define vasprintf __vasprintf - #include "_stdio.h" #include <stdarg.h> +libc_hidden_proto(vasprintf) + #ifndef __STDIO_HAS_VSNPRINTF #warning Skipping asprintf and __asprintf since no vsnprintf! #else -int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict format, ...) +int asprintf(char **__restrict buf, const char * __restrict format, ...) { va_list arg; int rv; @@ -26,6 +26,7 @@ int attribute_hidden __asprintf(char **__restrict buf, const char * __restrict f return rv; } -strong_alias(__asprintf,asprintf) +libc_hidden_proto(asprintf) +libc_hidden_def(asprintf) #endif diff --git a/libc/stdio/clearerr.c b/libc/stdio/clearerr.c index cf1e623c7..a96ecaa89 100644 --- a/libc/stdio/clearerr.c +++ b/libc/stdio/clearerr.c @@ -7,18 +7,19 @@ #include "_stdio.h" +#undef clearerr #ifdef __DO_UNLOCKED -void __clearerr_unlocked(register FILE *stream) +#undef clearerr_unlocked +void clearerr_unlocked(register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); __CLEARERR_UNLOCKED(stream); } -weak_alias(__clearerr_unlocked,clearerr_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__clearerr_unlocked,clearerr) +strong_alias(clearerr_unlocked,clearerr) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/ctermid.c b/libc/stdio/ctermid.c index 11e43f336..1cb8a0845 100644 --- a/libc/stdio/ctermid.c +++ b/libc/stdio/ctermid.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(strcpy) + char *ctermid(register char *s) { static char sbuf[L_ctermid]; @@ -21,6 +23,6 @@ char *ctermid(register char *s) return s; #else /* glibc always returns /dev/tty for linux. */ - return __strcpy((s ? s : sbuf), "/dev/tty"); + return strcpy((s ? s : sbuf), "/dev/tty"); #endif } diff --git a/libc/stdio/dprintf.c b/libc/stdio/dprintf.c index 1fc46c722..6e24374cd 100644 --- a/libc/stdio/dprintf.c +++ b/libc/stdio/dprintf.c @@ -5,11 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define vdprintf __vdprintf - #include "_stdio.h" #include <stdarg.h> +libc_hidden_proto(vdprintf) + int dprintf(int filedes, const char * __restrict format, ...) { va_list arg; diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c index e019ad53e..fc770dce8 100644 --- a/libc/stdio/fclose.c +++ b/libc/stdio/fclose.c @@ -9,8 +9,10 @@ #include "_stdio.h" -#undef fclose -int attribute_hidden __fclose(register FILE *stream) +libc_hidden_proto(close) +libc_hidden_proto(fflush_unlocked) + +int fclose(register FILE *stream) { int rv = 0; __STDIO_AUTO_THREADLOCK_VAR; @@ -47,7 +49,7 @@ int attribute_hidden __fclose(register FILE *stream) #ifdef __STDIO_BUFFERS /* Write any pending buffered chars. */ if (__STDIO_STREAM_IS_WRITING(stream)) { - rv = __fflush_unlocked(stream); + rv = fflush_unlocked(stream); } #endif @@ -87,4 +89,5 @@ int attribute_hidden __fclose(register FILE *stream) return rv; } -strong_alias(__fclose,fclose) +libc_hidden_proto(fclose) +libc_hidden_def(fclose) diff --git a/libc/stdio/fcloseall.c b/libc/stdio/fcloseall.c index dbb600067..5be9b553e 100644 --- a/libc/stdio/fcloseall.c +++ b/libc/stdio/fcloseall.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(fclose) + /* NOTE: GLIBC difference!!! -- fcloseall * According to the info pages, glibc actually fclose()s all open files. * Apparently, glibc's new version only fflush()s and unbuffers all diff --git a/libc/stdio/fdopen.c b/libc/stdio/fdopen.c index bca7f23fb..acf6231b2 100644 --- a/libc/stdio/fdopen.c +++ b/libc/stdio/fdopen.c @@ -7,12 +7,15 @@ #include "_stdio.h" -FILE attribute_hidden *__fdopen(int filedes, const char *mode) +libc_hidden_proto(fdopen) +libc_hidden_proto(fcntl) + +FILE *fdopen(int filedes, const char *mode) { intptr_t cur_mode; - return (((cur_mode = __fcntl(filedes, F_GETFL))) != -1) + return (((cur_mode = fcntl(filedes, F_GETFL))) != -1) ? _stdio_fopen(cur_mode, mode, NULL, filedes) : NULL; } -strong_alias(__fdopen,fdopen) +libc_hidden_def(fdopen) diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c index b0528d5ae..e5f03b720 100644 --- a/libc/stdio/feof.c +++ b/libc/stdio/feof.c @@ -7,18 +7,19 @@ #include "_stdio.h" +#undef feof #ifdef __DO_UNLOCKED -int __feof_unlocked(register FILE *stream) +#undef feof_unlocked +int feof_unlocked(register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); return __FEOF_UNLOCKED(stream); } -weak_alias(__feof_unlocked,feof_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__feof_unlocked,feof) +strong_alias(feof_unlocked,feof) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/ferror.c b/libc/stdio/ferror.c index e8d19bfa4..947b89ed1 100644 --- a/libc/stdio/ferror.c +++ b/libc/stdio/ferror.c @@ -7,18 +7,19 @@ #include "_stdio.h" +#undef ferror #ifdef __DO_UNLOCKED -int __ferror_unlocked(register FILE *stream) +#undef ferror_unlocked +int ferror_unlocked(register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); return __FERROR_UNLOCKED(stream); } -weak_alias(__ferror_unlocked,ferror_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__ferror_unlocked,ferror) +strong_alias(ferror_unlocked,ferror) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c index 0a74afe3f..e33a0065a 100644 --- a/libc/stdio/fflush.c +++ b/libc/stdio/fflush.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(fflush_unlocked) + #ifdef __DO_UNLOCKED #ifdef __UCLIBC_MJN3_ONLY__ @@ -31,7 +33,7 @@ #endif -int attribute_hidden __fflush_unlocked(register FILE *stream) +int fflush_unlocked(register FILE *stream) { #ifdef __STDIO_BUFFERS @@ -125,16 +127,17 @@ int attribute_hidden __fflush_unlocked(register FILE *stream) return 0; #endif /* __STDIO_BUFFERS */ } +libc_hidden_def(fflush_unlocked) -weak_alias(__fflush_unlocked,fflush_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fflush_unlocked,__fflush) -weak_alias(__fflush_unlocked,fflush) +strong_alias(fflush_unlocked,fflush) +libc_hidden_proto(fflush) +libc_hidden_def(fflush) #endif #elif defined __UCLIBC_HAS_THREADS__ -int attribute_hidden __fflush(register FILE *stream) +int fflush(register FILE *stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; @@ -147,15 +150,16 @@ int attribute_hidden __fflush(register FILE *stream) __STDIO_AUTO_THREADLOCK(stream); - retval = __fflush_unlocked(stream); + retval = fflush_unlocked(stream); __STDIO_AUTO_THREADUNLOCK(stream); } else { - retval = __fflush_unlocked(stream); + retval = fflush_unlocked(stream); } return retval; } -strong_alias(__fflush,fflush) +libc_hidden_proto(fflush) +libc_hidden_def(fflush) #endif diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c index d83b6c92a..599d12b30 100644 --- a/libc/stdio/fgetc.c +++ b/libc/stdio/fgetc.c @@ -1,6 +1,7 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ @@ -14,7 +15,9 @@ #ifdef __DO_UNLOCKED -int attribute_hidden __fgetc_unlocked_internal(FILE *stream) +libc_hidden_proto(fflush_unlocked) + +int __fgetc_unlocked(FILE *stream) { __STDIO_STREAM_VALIDATE(stream); @@ -68,20 +71,32 @@ int attribute_hidden __fgetc_unlocked_internal(FILE *stream) return EOF; } +libc_hidden_proto(__fgetc_unlocked) +libc_hidden_def(__fgetc_unlocked) + +strong_alias(__fgetc_unlocked,fgetc_unlocked) +libc_hidden_proto(fgetc_unlocked) +libc_hidden_def(fgetc_unlocked) + +//strong_alias(__fgetc_unlocked,__getc_unlocked) +//libc_hidden_proto(__getc_unlocked) +//libc_hidden_def(__getc_unlocked) +strong_alias(__fgetc_unlocked,getc_unlocked) +libc_hidden_proto(getc_unlocked) +libc_hidden_def(getc_unlocked) -strong_alias(__fgetc_unlocked_internal,__fgetc_unlocked) -weak_alias(__fgetc_unlocked_internal,fgetc_unlocked) -hidden_strong_alias(__fgetc_unlocked_internal,__getc_unlocked) -weak_alias(__fgetc_unlocked_internal,getc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fgetc_unlocked_internal,__fgetc) -weak_alias(__fgetc_unlocked_internal,fgetc) -weak_alias(__fgetc_unlocked_internal,getc) +strong_alias(__fgetc_unlocked,fgetc) +libc_hidden_proto(fgetc) +libc_hidden_def(fgetc) +strong_alias(__fgetc_unlocked,getc) #endif #elif defined __UCLIBC_HAS_THREADS__ -int attribute_hidden __fgetc(register FILE *stream) +libc_hidden_proto(__fgetc_unlocked) + +int fgetc(register FILE *stream) { if (stream->__user_locking != 0) { return __GETC_UNLOCKED_MACRO(stream); @@ -93,7 +108,9 @@ int attribute_hidden __fgetc(register FILE *stream) return retval; } } -strong_alias(__fgetc,fgetc) -weak_alias(__fgetc,getc) +libc_hidden_proto(fgetc) +libc_hidden_def(fgetc) + +strong_alias(fgetc,getc) #endif diff --git a/libc/stdio/fgetpos.c b/libc/stdio/fgetpos.c index 03c18ab93..610737d36 100644 --- a/libc/stdio/fgetpos.c +++ b/libc/stdio/fgetpos.c @@ -8,9 +8,11 @@ #include "_stdio.h" #ifndef __DO_LARGEFILE -#define FTELL __ftell +#define FTELL ftell #endif +libc_hidden_proto(FTELL) + int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos) { #ifdef __STDIO_MBSTATE diff --git a/libc/stdio/fgetpos64.c b/libc/stdio/fgetpos64.c index 6f46746b1..32b7120aa 100644 --- a/libc/stdio/fgetpos64.c +++ b/libc/stdio/fgetpos64.c @@ -10,5 +10,5 @@ #define __DO_LARGEFILE #define fgetpos fgetpos64 #define fpos_t fpos64_t -#define FTELL __ftello64 +#define FTELL ftello64 #include "fgetpos.c" diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c index 5baf63a58..031eadaaf 100644 --- a/libc/stdio/fgets.c +++ b/libc/stdio/fgets.c @@ -7,9 +7,13 @@ #include "_stdio.h" +libc_hidden_proto(fgets_unlocked) + #ifdef __DO_UNLOCKED -char attribute_hidden *__fgets_unlocked(char *__restrict s, int n, +libc_hidden_proto(__fgetc_unlocked) + +char *fgets_unlocked(char *__restrict s, int n, register FILE * __restrict stream) { register char *p; @@ -34,7 +38,7 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n, break; } } else { - if ((c = __fgetc_unlocked_internal(stream)) == EOF) { + if ((c = __fgetc_unlocked(stream)) == EOF) { if (__FERROR_UNLOCKED(stream)) { goto ERROR; } @@ -57,17 +61,17 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n, ERROR: return NULL; } - -weak_alias(__fgets_unlocked,fgets_unlocked) +libc_hidden_def(fgets_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fgets_unlocked,__fgets) -weak_alias(__fgets_unlocked,fgets) +strong_alias(fgets_unlocked,fgets) +libc_hidden_proto(fgets) +libc_hidden_def(fgets) #endif #elif defined __UCLIBC_HAS_THREADS__ -char attribute_hidden *__fgets(char *__restrict s, int n, +char *fgets(char *__restrict s, int n, register FILE * __restrict stream) { char *retval; @@ -75,12 +79,13 @@ char attribute_hidden *__fgets(char *__restrict s, int n, __STDIO_AUTO_THREADLOCK(stream); - retval = __fgets_unlocked(s, n, stream); + retval = fgets_unlocked(s, n, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fgets,fgets) +libc_hidden_proto(fgets) +libc_hidden_def(fgets) #endif diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c index 45ff86b80..dbcf6bec6 100644 --- a/libc/stdio/fgetwc.c +++ b/libc/stdio/fgetwc.c @@ -5,10 +5,12 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define mbrtowc __mbrtowc - #include "_stdio.h" +libc_hidden_proto(fgetwc_unlocked) + +libc_hidden_proto(mbrtowc) + #ifdef __DO_UNLOCKED static void munge_stream(register FILE *stream, unsigned char *buf) @@ -19,7 +21,7 @@ static void munge_stream(register FILE *stream, unsigned char *buf) __STDIO_STREAM_DISABLE_PUTC(stream); } -wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream) +wint_t fgetwc_unlocked(register FILE *stream) { wint_t wi; wchar_t wc[1]; @@ -107,31 +109,33 @@ wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream) return wi; } +libc_hidden_def(fgetwc_unlocked) -weak_alias(__fgetwc_unlocked,fgetwc_unlocked) -weak_alias(__fgetwc_unlocked,getwc_unlocked) +strong_alias(fgetwc_unlocked,getwc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fgetwc_unlocked,__fgetwc) -weak_alias(__fgetwc_unlocked,fgetwc) -weak_alias(__fgetwc_unlocked,getwc) +strong_alias(fgetwc_unlocked,fgetwc) +libc_hidden_proto(fgetwc) +libc_hidden_def(fgetwc) +strong_alias(fgetwc_unlocked,getwc) #endif #elif defined __UCLIBC_HAS_THREADS__ -wint_t attribute_hidden __fgetwc(register FILE *stream) +wint_t fgetwc(register FILE *stream) { wint_t retval; __STDIO_AUTO_THREADLOCK_VAR; __STDIO_AUTO_THREADLOCK(stream); - retval = __fgetwc_unlocked(stream); + retval = fgetwc_unlocked(stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fgetwc,fgetwc) -weak_alias(__fgetwc,getwc) +libc_hidden_proto(fgetwc) +libc_hidden_def(fgetwc) +strong_alias(fgetwc,getwc) #endif diff --git a/libc/stdio/fgetws.c b/libc/stdio/fgetws.c index fe8da002d..c7dcc7d2b 100644 --- a/libc/stdio/fgetws.c +++ b/libc/stdio/fgetws.c @@ -7,12 +7,13 @@ #include "_stdio.h" -extern wchar_t *__fgetws_unlocked(wchar_t *__restrict ws, int n, - FILE *__restrict stream) attribute_hidden; +libc_hidden_proto(fgetws_unlocked) + +libc_hidden_proto(fgetwc_unlocked) #ifdef __DO_UNLOCKED -wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n, +wchar_t *fgetws_unlocked(wchar_t *__restrict ws, int n, FILE *__restrict stream) { register wchar_t *p = ws; @@ -21,7 +22,7 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n, __STDIO_STREAM_VALIDATE(stream); while ((n > 1) - && ((wi = __fgetwc_unlocked(stream)) != WEOF) + && ((wi = fgetwc_unlocked(stream)) != WEOF) && ((*p++ = wi) != '\n') ) { --n; @@ -36,10 +37,10 @@ wchar_t attribute_hidden *__fgetws_unlocked(wchar_t *__restrict ws, int n, *p = 0; return ws; } +libc_hidden_def(fgetws_unlocked) -weak_alias(__fgetws_unlocked,fgetws_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fgetws_unlocked,fgetws) +strong_alias(fgetws_unlocked,fgetws) #endif #elif defined __UCLIBC_HAS_THREADS__ @@ -51,7 +52,7 @@ wchar_t *fgetws(wchar_t *__restrict ws, int n, FILE *__restrict stream) __STDIO_AUTO_THREADLOCK(stream); - retval = __fgetws_unlocked(ws, n, stream); + retval = fgetws_unlocked(ws, n, stream); __STDIO_AUTO_THREADUNLOCK(stream); diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c index bc1ade952..fb895b8a0 100644 --- a/libc/stdio/fileno.c +++ b/libc/stdio/fileno.c @@ -7,9 +7,11 @@ #include "_stdio.h" +libc_hidden_proto(fileno_unlocked) + #ifdef __DO_UNLOCKED -int attribute_hidden __fileno_unlocked(register FILE *stream) +int fileno_unlocked(register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); @@ -20,27 +22,30 @@ int attribute_hidden __fileno_unlocked(register FILE *stream) __set_errno(EBADF); return -1; } +libc_hidden_def(fileno_unlocked) -weak_alias(__fileno_unlocked,fileno_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_weak_alias(__fileno_unlocked,__fileno) -weak_alias(__fileno_unlocked,fileno) +strong_alias(fileno_unlocked,fileno) +libc_hidden_proto(fileno) +libc_hidden_def(fileno) #endif #elif defined __UCLIBC_HAS_THREADS__ -int attribute_hidden __fileno(register FILE *stream) +int fileno(register FILE *stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; __STDIO_AUTO_THREADLOCK(stream); - retval = __fileno_unlocked(stream); + retval = fileno_unlocked(stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fileno,fileno) +libc_hidden_proto(fileno) +libc_hidden_def(fileno) + #endif diff --git a/libc/stdio/fmemopen.c b/libc/stdio/fmemopen.c index fc7870258..7f6021ca4 100644 --- a/libc/stdio/fmemopen.c +++ b/libc/stdio/fmemopen.c @@ -5,10 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define fopencookie __fopencookie - #include "_stdio.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(fopencookie) + #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ #error no custom streams! #endif @@ -37,7 +38,7 @@ static ssize_t fmo_read(register void *cookie, char *buf, size_t bufsize) bufsize = count; } - __memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); + memcpy(buf, COOKIE->buf + COOKIE->pos, bufsize); COOKIE->pos += bufsize; return bufsize; @@ -64,7 +65,7 @@ static ssize_t fmo_write(register void *cookie, const char *buf, size_t bufsize) } } - __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c index ad5d1aa92..d73ce711a 100644 --- a/libc/stdio/fopen.c +++ b/libc/stdio/fopen.c @@ -9,15 +9,14 @@ #ifndef __DO_LARGEFILE # define FILEDES_ARG (-1) -#undef __fopen #undef fopen #else -#undef __fopen64 #undef fopen64 #endif -FILE attribute_hidden *__fopen(const char * __restrict filename, const char * __restrict mode) +FILE *fopen(const char * __restrict filename, const char * __restrict mode) { return _stdio_fopen(((intptr_t) filename), mode, NULL, FILEDES_ARG); } -strong_alias(__fopen,fopen) +libc_hidden_proto(fopen) +libc_hidden_def(fopen) diff --git a/libc/stdio/fopen64.c b/libc/stdio/fopen64.c index c65e9a4e9..cbdb03d68 100644 --- a/libc/stdio/fopen64.c +++ b/libc/stdio/fopen64.c @@ -8,7 +8,6 @@ #include "_stdio.h" #define __DO_LARGEFILE -#define __fopen __fopen64 #undef fopen #define fopen fopen64 #define FILEDES_ARG (-2) diff --git a/libc/stdio/fopencookie.c b/libc/stdio/fopencookie.c index a70e17b80..af51f44c9 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 attribute_hidden *__fopencookie(void * __restrict cookie, const char * __restrict mode, +FILE *fopencookie(void * __restrict cookie, const char * __restrict mode, cookie_io_functions_t io_functions) #else FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, @@ -58,5 +58,6 @@ FILE *_fopencookie(void * __restrict cookie, const char * __restrict mode, return stream; } #ifndef __BCC__ -strong_alias(__fopencookie,fopencookie) +libc_hidden_proto(fopencookie) +libc_hidden_def(fopencookie) #endif diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c index ee19c85a5..092a64981 100644 --- a/libc/stdio/fprintf.c +++ b/libc/stdio/fprintf.c @@ -8,16 +8,18 @@ #include "_stdio.h" #include <stdarg.h> -#undef fprintf -int attribute_hidden __fprintf(FILE * __restrict stream, const char * __restrict format, ...) +libc_hidden_proto(vfprintf) + +int 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) +libc_hidden_proto(fprintf) +libc_hidden_def(fprintf) diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c index 4cc396e08..c30c0a12a 100644 --- a/libc/stdio/fputc.c +++ b/libc/stdio/fputc.c @@ -14,7 +14,7 @@ #ifdef __DO_UNLOCKED -int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream) +int __fputc_unlocked(int c, register FILE *stream) { __STDIO_STREAM_VALIDATE(stream); @@ -68,20 +68,27 @@ int attribute_hidden __fputc_unlocked_internal(int c, register FILE *stream) BAD: return EOF; } +libc_hidden_proto(__fputc_unlocked) +libc_hidden_def(__fputc_unlocked) -strong_alias(__fputc_unlocked_internal,__fputc_unlocked) -weak_alias(__fputc_unlocked_internal,fputc_unlocked) -weak_alias(__fputc_unlocked_internal,putc_unlocked) +strong_alias(__fputc_unlocked,fputc_unlocked) + +strong_alias(__fputc_unlocked,putc_unlocked) +libc_hidden_proto(putc_unlocked) +libc_hidden_def(putc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fputc_unlocked_internal,__fputc) -weak_alias(__fputc_unlocked_internal,fputc) -hidden_strong_alias(__fputc_unlocked_internal,__putc) -weak_alias(__fputc_unlocked_internal,putc) +strong_alias(__fputc_unlocked,fputc) + +strong_alias(__fputc_unlocked,putc) +libc_hidden_proto(putc) +libc_hidden_def(putc) #endif #elif defined __UCLIBC_HAS_THREADS__ -int attribute_hidden __fputc(int c, register FILE *stream) +libc_hidden_proto(__fputc_unlocked) + +int fputc(int c, register FILE *stream) { if (stream->__user_locking != 0) { return __PUTC_UNLOCKED_MACRO(c, stream); @@ -93,8 +100,11 @@ int attribute_hidden __fputc(int c, register FILE *stream) return retval; } } -strong_alias(__fputc,fputc) -hidden_strong_alias(__fputc,__putc) -weak_alias(__fputc,putc) +libc_hidden_proto(fputc) +libc_hidden_def(fputc) + +strong_alias(fputc,putc) +libc_hidden_proto(putc) +libc_hidden_def(putc) #endif diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c index 64e7fd57f..b9dabee30 100644 --- a/libc/stdio/fputs.c +++ b/libc/stdio/fputs.c @@ -7,6 +7,11 @@ #include "_stdio.h" +libc_hidden_proto(fputs_unlocked) + +libc_hidden_proto(strlen) +libc_hidden_proto(fwrite_unlocked) + /* Note: The standard says fputs returns a nonnegative number on * success. In this implementation, we return the length of the * string written on success. @@ -14,35 +19,37 @@ #ifdef __DO_UNLOCKED -int attribute_hidden __fputs_unlocked(register const char * __restrict s, +int fputs_unlocked(register const char * __restrict s, FILE * __restrict stream) { - size_t n = __strlen(s); + size_t n = strlen(s); - return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF); + return ((fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF); } +libc_hidden_def(fputs_unlocked) -weak_alias(__fputs_unlocked,fputs_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fputs_unlocked,__fputs) -weak_alias(__fputs_unlocked,fputs) +strong_alias(fputs_unlocked,fputs) +libc_hidden_proto(fputs) +libc_hidden_def(fputs) #endif #elif defined __UCLIBC_HAS_THREADS__ -int attribute_hidden __fputs(const char * __restrict s, register FILE * __restrict stream) +int fputs(const char * __restrict s, register FILE * __restrict stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; __STDIO_AUTO_THREADLOCK(stream); - retval = __fputs_unlocked(s, stream); + retval = fputs_unlocked(s, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fputs,fputs) +libc_hidden_proto(fputs) +libc_hidden_def(fputs) #endif diff --git a/libc/stdio/fputwc.c b/libc/stdio/fputwc.c index 8f1178710..240c1e9c4 100644 --- a/libc/stdio/fputwc.c +++ b/libc/stdio/fputwc.c @@ -7,18 +7,20 @@ #include "_stdio.h" +libc_hidden_proto(fputwc_unlocked) + #ifdef __DO_UNLOCKED -wint_t attribute_hidden __fputwc_unlocked(wchar_t wc, FILE *stream) +wint_t fputwc_unlocked(wchar_t wc, FILE *stream) { return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF; } +libc_hidden_def(fputwc_unlocked) -weak_alias(__fputwc_unlocked,fputwc_unlocked) -weak_alias(__fputwc_unlocked,putwc_unlocked) +strong_alias(fputwc_unlocked,putwc_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__fputwc_unlocked,fputwc) -weak_alias(__fputwc_unlocked,putwc) +strong_alias(fputwc_unlocked,fputwc) +strong_alias(fputwc_unlocked,putwc) #endif #elif defined __UCLIBC_HAS_THREADS__ @@ -30,13 +32,13 @@ wint_t fputwc(wchar_t wc, register FILE *stream) __STDIO_AUTO_THREADLOCK(stream); - retval = __fputwc_unlocked(wc, stream); + retval = fputwc_unlocked(wc, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -weak_alias(fputwc,putwc) +strong_alias(fputwc,putwc) #endif diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c index 74919d6ea..d00c95797 100644 --- a/libc/stdio/fputws.c +++ b/libc/stdio/fputws.c @@ -5,44 +5,45 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define wcslen __wcslen - #include "_stdio.h" +libc_hidden_proto(fputws_unlocked) + +libc_hidden_proto(wcslen) + #ifdef __DO_UNLOCKED -int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws, +int fputws_unlocked(const wchar_t *__restrict ws, register FILE *__restrict stream) { size_t n = wcslen(ws); return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1; } +libc_hidden_def(fputws_unlocked) -weak_alias(__fputws_unlocked,fputws_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fputws_unlocked,__fputws) -weak_alias(__fputws_unlocked,fputws) +strong_alias(fputws_unlocked,fputws) +libc_hidden_proto(fputws) +libc_hidden_def(fputws) #endif #elif defined __UCLIBC_HAS_THREADS__ -extern int __fputws_unlocked(const wchar_t *__restrict ws, - FILE *__restrict stream) attribute_hidden; - -int attribute_hidden __fputws(const wchar_t *__restrict ws, register FILE *__restrict stream) +int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream) { int retval; __STDIO_AUTO_THREADLOCK_VAR; __STDIO_AUTO_THREADLOCK(stream); - retval = __fputws_unlocked(ws, stream); + retval = fputws_unlocked(ws, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fputws,fputws) +libc_hidden_proto(fputws) +libc_hidden_def(fputws) #endif diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 0defb36a0..417ab2c8d 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -7,9 +7,14 @@ #include "_stdio.h" +libc_hidden_proto(fread_unlocked) + #ifdef __DO_UNLOCKED -size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb, +libc_hidden_proto(memcpy) +libc_hidden_proto(fflush_unlocked) + +size_t fread_unlocked(void * __restrict ptr, size_t size, size_t nmemb, FILE * __restrict stream) { __STDIO_STREAM_VALIDATE(stream); @@ -44,7 +49,7 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz if (avail > todo) { avail = todo; } - __memcpy(buffer, stream->__bufpos, avail); + memcpy(buffer, stream->__bufpos, avail); buffer += avail; stream->__bufpos += avail; if (!(todo -= avail)) { @@ -82,16 +87,17 @@ size_t attribute_hidden __fread_unlocked(void * __restrict ptr, size_t size, siz __STDIO_STREAM_VALIDATE(stream); return 0; } +libc_hidden_def(fread_unlocked) -weak_alias(__fread_unlocked,fread_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fread_unlocked,__fread) -weak_alias(__fread_unlocked,fread) +strong_alias(fread_unlocked,fread) +libc_hidden_proto(fread) +libc_hidden_def(fread) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb, +size_t fread(void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -99,12 +105,13 @@ size_t attribute_hidden __fread(void * __restrict ptr, size_t size, size_t nmemb __STDIO_AUTO_THREADLOCK(stream); - retval = __fread_unlocked(ptr, size, nmemb, stream); + retval = fread_unlocked(ptr, size, nmemb, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fread,fread) +libc_hidden_proto(fread) +libc_hidden_def(fread) #endif diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c index 7df035d48..7314807d3 100644 --- a/libc/stdio/freopen.c +++ b/libc/stdio/freopen.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(fclose) + #ifndef __DO_LARGEFILE # define FILEDES_ARG (-1) #endif diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c index 190485775..0ce4acfb7 100644 --- a/libc/stdio/fseeko.c +++ b/libc/stdio/fseeko.c @@ -12,15 +12,19 @@ #endif #ifndef __DO_LARGEFILE -# define FSEEK __fseek +# define FSEEK fseek # define OFFSET_TYPE long int #endif -int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) +#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) +libc_hidden_proto(fseeko64) +#endif + +int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence) { #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) - return __fseeko64(stream, offset, whence); + return fseeko64(stream, offset, whence); #else @@ -74,8 +78,10 @@ int attribute_hidden FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence } #ifdef __DO_LARGEFILE -strong_alias(__fseeko64,fseeko64) +libc_hidden_proto(fseeko64) +libc_hidden_def(fseeko64) #else -strong_alias(__fseek,fseek) -weak_alias(__fseek,fseeko) +libc_hidden_proto(fseek) +libc_hidden_def(fseek) +strong_alias(fseek,fseeko) #endif diff --git a/libc/stdio/fseeko64.c b/libc/stdio/fseeko64.c index 5bc4ae34e..78cab1b5c 100644 --- a/libc/stdio/fseeko64.c +++ b/libc/stdio/fseeko64.c @@ -8,6 +8,6 @@ #include "_stdio.h" #define __DO_LARGEFILE -#define FSEEK __fseeko64 +#define FSEEK fseeko64 #define OFFSET_TYPE __off64_t #include "fseeko.c" diff --git a/libc/stdio/fsetpos.c b/libc/stdio/fsetpos.c index f33043f3b..d63adc024 100644 --- a/libc/stdio/fsetpos.c +++ b/libc/stdio/fsetpos.c @@ -8,9 +8,11 @@ #include "_stdio.h" #ifndef __DO_LARGEFILE -#define FSEEK __fseek +#define FSEEK fseek #endif +libc_hidden_proto(FSEEK) + int fsetpos(FILE *stream, register const fpos_t *pos) { #ifdef __STDIO_MBSTATE diff --git a/libc/stdio/fsetpos64.c b/libc/stdio/fsetpos64.c index bf7d574cb..82819a4fe 100644 --- a/libc/stdio/fsetpos64.c +++ b/libc/stdio/fsetpos64.c @@ -10,5 +10,5 @@ #define __DO_LARGEFILE #define fsetpos fsetpos64 #define fpos_t fpos64_t -#define FSEEK __fseeko64 +#define FSEEK fseeko64 #include "fsetpos.c" diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c index 7f5c53126..0a3a53856 100644 --- a/libc/stdio/ftello.c +++ b/libc/stdio/ftello.c @@ -7,16 +7,20 @@ #include "_stdio.h" +#if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) +libc_hidden_proto(ftello64) +#endif + #ifndef __DO_LARGEFILE -# define FTELL __ftell +# define FTELL ftell # define OFFSET_TYPE long int #endif -OFFSET_TYPE attribute_hidden FTELL(register FILE *stream) +OFFSET_TYPE FTELL(register FILE *stream) { #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE) - __offmax_t pos = __ftello64(stream); + __offmax_t pos = ftello64(stream); if ((sizeof(long) >= sizeof(__offmax_t)) || (((long) pos) == pos)) { return ((long) pos); @@ -47,8 +51,10 @@ OFFSET_TYPE attribute_hidden FTELL(register FILE *stream) } #ifdef __DO_LARGEFILE -weak_alias(__ftello64,ftello64) +libc_hidden_proto(ftello64) +libc_hidden_def(ftello64) #else -weak_alias(__ftell,ftell) -weak_alias(ftell,ftello) +libc_hidden_proto(ftell) +libc_hidden_def(ftell) +strong_alias(ftell,ftello) #endif diff --git a/libc/stdio/ftello64.c b/libc/stdio/ftello64.c index 32a37d368..905834f39 100644 --- a/libc/stdio/ftello64.c +++ b/libc/stdio/ftello64.c @@ -8,6 +8,6 @@ #include "_stdio.h" #define __DO_LARGEFILE -#define FTELL __ftello64 +#define FTELL ftello64 #define OFFSET_TYPE __off64_t #include "ftello.c" diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index c81d40482..f2a1afbec 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -9,13 +9,15 @@ #include <stdarg.h> #include <wchar.h> +libc_hidden_proto(vfwprintf) + int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) { va_list arg; 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 abe24fbb7..106ee5db6 100644 --- a/libc/stdio/fwrite.c +++ b/libc/stdio/fwrite.c @@ -7,9 +7,11 @@ #include "_stdio.h" +libc_hidden_proto(fwrite_unlocked) + #ifdef __DO_UNLOCKED -size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t size, +size_t fwrite_unlocked(const void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { __STDIO_STREAM_VALIDATE(stream); @@ -33,16 +35,17 @@ size_t attribute_hidden __fwrite_unlocked(const void * __restrict ptr, size_t si return 0; } +libc_hidden_def(fwrite_unlocked) -weak_alias(__fwrite_unlocked,fwrite_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -hidden_strong_alias(__fwrite_unlocked,__fwrite) -weak_alias(__fwrite_unlocked,fwrite) +strong_alias(fwrite_unlocked,fwrite) +libc_hidden_proto(fwrite) +libc_hidden_def(fwrite) #endif #elif defined __UCLIBC_HAS_THREADS__ -size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size, +size_t fwrite(const void * __restrict ptr, size_t size, size_t nmemb, register FILE * __restrict stream) { size_t retval; @@ -50,12 +53,13 @@ size_t attribute_hidden __fwrite(const void * __restrict ptr, size_t size, __STDIO_AUTO_THREADLOCK(stream); - retval = __fwrite_unlocked(ptr, size, nmemb, stream); + retval = fwrite_unlocked(ptr, size, nmemb, stream); __STDIO_AUTO_THREADUNLOCK(stream); return retval; } -strong_alias(__fwrite,fwrite) +libc_hidden_proto(fwrite) +libc_hidden_def(fwrite) #endif diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c index d17704056..6da8307b6 100644 --- a/libc/stdio/getchar.c +++ b/libc/stdio/getchar.c @@ -7,21 +7,21 @@ #include "_stdio.h" -#undef getchar_unlocked -#undef getchar +libc_hidden_proto(__fgetc_unlocked) +#undef getchar #ifdef __DO_UNLOCKED -int attribute_hidden __getchar_unlocked(void) +#undef getchar_unlocked +int getchar_unlocked(void) { register FILE *stream = stdin; return __GETC_UNLOCKED_MACRO(stream); } -weak_alias(__getchar_unlocked,getchar_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__getchar_unlocked,getchar) +strong_alias(getchar_unlocked,getchar) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/getdelim.c b/libc/stdio/getdelim.c index e1b808340..7c769dd63 100644 --- a/libc/stdio/getdelim.c +++ b/libc/stdio/getdelim.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(__fgetc_unlocked) + /* Note: There is a defect in this function. (size_t vs ssize_t). */ /* glibc function -- @@ -20,7 +22,7 @@ #define GETDELIM_GROWBY 64 -ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restrict n, +ssize_t getdelim(char **__restrict lineptr, size_t *__restrict n, int delimiter, register FILE *__restrict stream) { register char *buf; @@ -73,5 +75,5 @@ ssize_t attribute_hidden __getdelim(char **__restrict lineptr, size_t *__restric return pos; } - -strong_alias(__getdelim,getdelim) +libc_hidden_proto(getdelim) +libc_hidden_def(getdelim) diff --git a/libc/stdio/getline.c b/libc/stdio/getline.c index 943526abe..0426d37f5 100644 --- a/libc/stdio/getline.c +++ b/libc/stdio/getline.c @@ -5,13 +5,14 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define getdelim __getdelim - #include "_stdio.h" -ssize_t attribute_hidden __getline(char **__restrict lineptr, size_t *__restrict n, +libc_hidden_proto(getdelim) + +ssize_t getline(char **__restrict lineptr, size_t *__restrict n, FILE *__restrict stream) { return getdelim(lineptr, n, '\n', stream); } -strong_alias(__getline,getline) +libc_hidden_proto(getline) +libc_hidden_def(getline) diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c index 1badd8152..1c908399c 100644 --- a/libc/stdio/gets.c +++ b/libc/stdio/gets.c @@ -11,6 +11,9 @@ link_warning(gets, "the 'gets' function is dangerous and should not be used.") /* UNSAFE FUNCTION -- do not bother optimizing */ +libc_hidden_proto(getchar_unlocked) +libc_hidden_proto(__fgetc_unlocked) + char *gets(char *s) { register char *p = s; @@ -21,7 +24,7 @@ char *gets(char *s) /* Note: don't worry about performance here... this shouldn't be used! * Therefore, force actual function call. */ - while (((c = __getchar_unlocked()) != EOF) && ((*p = c) != '\n')) { + while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) { ++p; } if ((c == EOF) || (s == p)) { diff --git a/libc/stdio/getw.c b/libc/stdio/getw.c index 6b3b9e5e7..e3aeda92c 100644 --- a/libc/stdio/getw.c +++ b/libc/stdio/getw.c @@ -7,12 +7,14 @@ #include "_stdio.h" +libc_hidden_proto(fread_unlocked) + /* SUSv2 Legacy function -- need not be reentrant. */ int getw(FILE *stream) { int aw; - return (__fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0) + return (fread_unlocked((void *) &aw, sizeof(int), 1, stream) != 0) ? aw : EOF; } diff --git a/libc/stdio/getwchar.c b/libc/stdio/getwchar.c index 90e5a032e..9c480b564 100644 --- a/libc/stdio/getwchar.c +++ b/libc/stdio/getwchar.c @@ -9,23 +9,24 @@ #ifdef __DO_UNLOCKED -wint_t __getwchar_unlocked(void) +libc_hidden_proto(fgetwc_unlocked) + +wint_t getwchar_unlocked(void) { - return __fgetwc_unlocked(stdin); + return fgetwc_unlocked(stdin); } -weak_alias(__getwchar_unlocked,getwchar_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__getwchar_unlocked,getwchar) +strong_alias(getwchar_unlocked,getwchar) #endif #elif defined __UCLIBC_HAS_THREADS__ -extern wint_t __fgetwc (__FILE *__stream) attribute_hidden; +libc_hidden_proto(fgetwc) wint_t getwchar(void) { - return __fgetwc(stdin); + return fgetwc(stdin); } #endif diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index ce6bde1a4..9aed79934 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -127,8 +127,6 @@ /**************************************************************************/ -#define strnlen __strnlen - #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE /* for strnlen */ #include "_stdio.h" @@ -148,6 +146,12 @@ #include <pthread.h> #endif /* __UCLIBC_HAS_THREADS__ */ +libc_hidden_proto(strlen) +libc_hidden_proto(strnlen) +libc_hidden_proto(memcpy) +libc_hidden_proto(putc_unlocked) +libc_hidden_proto(__glibc_strerror_r) + /* #undef __UCLIBC_HAS_FLOATS__ */ /* #undef WANT_FLOAT_ERROR */ /* #define WANT_FLOAT_ERROR 1 */ @@ -166,7 +170,7 @@ #ifdef __STDIO_BUFFERS -#define PUTC(C,F) __putc_unlocked((C),(F)) +#define PUTC(C,F) putc_unlocked((C),(F)) #define OUTNSTR _outnstr #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) @@ -190,7 +194,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n) if (r > n) { r = n; } - __memcpy(f->bufpos, s, r); + memcpy(f->bufpos, s, r); f->bufpos += r; } } @@ -199,7 +203,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n) static void putc_unlocked_sprintf(int c, __FILE_vsnprintf *f) { if (!__STDIO_STREAM_IS_FAKE_VSNPRINTF_NB(&f->f)) { - __putc_unlocked(c, &f->f); + putc_unlocked(c, &f->f); } else if (f->bufpos < f->bufend) { *f->bufpos++ = c; } @@ -236,7 +240,7 @@ static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) static void _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) { if (type & 0x80) { /* Some type of padding needed. */ - int buflen = __strlen((const char *) buf); + int buflen = strlen((const char *) buf); if ((len -= buflen) > 0) { _charpad(fp, (type & 0x7f), len); } @@ -341,7 +345,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 attribute_hidden __vfprintf(FILE * __restrict op, register const char * __restrict fmt, +int vfprintf(FILE * __restrict op, register const char * __restrict fmt, va_list ap) { union { @@ -450,7 +454,7 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re if (*fmt == 'm') { flag[FLAG_PLUS] = '\0'; flag[FLAG_0_PAD] = ' '; - p = __glibc_strerror_r_internal(errno, tmp, sizeof(tmp)); + p = __glibc_strerror_r(errno, tmp, sizeof(tmp)); goto print; } #endif @@ -711,4 +715,5 @@ int attribute_hidden __vfprintf(FILE * __restrict op, register const char * __re return i; } -strong_alias(__vfprintf,vfprintf) +libc_hidden_proto(vfprintf) +libc_hidden_def(vfprintf) diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index f750cd11c..fd0c74c48 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -5,10 +5,12 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define fopencookie __fopencookie - #include "_stdio.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(fopencookie) + #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ #error no custom streams! #endif @@ -53,7 +55,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize) } } - __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { @@ -92,7 +94,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) if (buf) { *COOKIE->bufloc = COOKIE->buf = buf; COOKIE->len = leastlen; - __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ + memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ } else { /* TODO: check glibc errno setting... */ return -1; @@ -102,7 +104,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) *pos = COOKIE->pos = --leastlen; if (leastlen > COOKIE->eof) { - __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); + memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); *COOKIE->sizeloc = COOKIE->eof; } @@ -126,7 +128,7 @@ static const cookie_io_functions_t _oms_io_funcs = { * (ie replace the FILE buffer with the cookie buffer and update FILE bufstart, * etc. whenever we seek). */ -FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc) +FILE *open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc) { register __oms_cookie *cookie; register FILE *fp; @@ -162,4 +164,5 @@ FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__rest return NULL; } -strong_alias(__open_memstream,open_memstream) +libc_hidden_proto(open_memstream) +libc_hidden_def(open_memstream) diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c index 9edcf4efb..f10667cbf 100644 --- a/libc/stdio/perror.c +++ b/libc/stdio/perror.c @@ -7,11 +7,14 @@ #include "_stdio.h" +libc_hidden_proto(fprintf) +libc_hidden_proto(__glibc_strerror_r) + #ifdef __UCLIBC_MJN3_ONLY__ #warning CONSIDER: Increase buffer size for error message (non-%m case)? #endif -void attribute_hidden __perror(register const char *s) +void perror(register const char *s) { /* If the program is calling perror, it's a safe bet that printf and * friends are used as well. It is also possible that the calling @@ -30,8 +33,9 @@ void attribute_hidden __perror(register const char *s) { char buf[64]; fprintf(stderr, "%s%s%s\n", s, sep, - __glibc_strerror_r_internal(errno, buf, sizeof(buf))); + __glibc_strerror_r(errno, buf, sizeof(buf))); } #endif } -strong_alias(__perror,perror) +libc_hidden_proto(perror) +libc_hidden_def(perror) diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index f84a27a3c..501cd415c 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -1,6 +1,7 @@ /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * GNU Library General Public License (LGPL) version 2 or later. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ @@ -14,20 +15,23 @@ * Fix failure exit code for failed execve(). */ -#define waitpid __waitpid -#define execl __execl -#define dup2 __dup2 -#define fdopen __fdopen -#define pipe __pipe -#define vfork __vfork -#define fork __fork - #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/wait.h> +libc_hidden_proto(close) +libc_hidden_proto(_exit) +libc_hidden_proto(waitpid) +libc_hidden_proto(execl) +libc_hidden_proto(dup2) +libc_hidden_proto(fdopen) +libc_hidden_proto(pipe) +libc_hidden_proto(vfork) +libc_hidden_proto(fork) +libc_hidden_proto(fclose) + /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ #include <sys/syscall.h> #if ! defined __NR_vfork @@ -88,36 +92,36 @@ FILE *popen(const char *command, const char *modes) parent_fd = pipe_fd[1-child_writing]; if (!(fp = fdopen(parent_fd, modes))) { - __close(parent_fd); - __close(child_fd); + close(parent_fd); + close(child_fd); goto FREE_PI; } VFORK_LOCK; if ((pid = vfork()) == 0) { /* Child of vfork... */ - __close(parent_fd); + close(parent_fd); if (child_fd != child_writing) { dup2(child_fd, child_writing); - __close(child_fd); + close(child_fd); } /* SUSv3 requires that any previously popen()'d streams in the * parent shall be closed in the child. */ for (po = popen_list ; po ; po = po->next) { - __close(po->f->__filedes); + close(po->f->__filedes); } execl("/bin/sh", "sh", "-c", command, (char *)0); /* SUSv3 mandates an exit code of 127 for the child if the * command interpreter can not be invoked. */ - _exit_internal(127); + _exit(127); } VFORK_UNLOCK; /* We need to close the child filedes whether vfork failed or * it succeeded and we're in the parent. */ - __close(child_fd); + close(child_fd); if (pid > 0) { /* Parent of vfork... */ pi->pid = pid; diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 82326a9c3..8c547878e 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -8,15 +8,18 @@ #include "_stdio.h" #include <stdarg.h> -int attribute_hidden __printf(const char * __restrict format, ...) +libc_hidden_proto(vfprintf) + +int 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) +libc_hidden_proto(printf) +libc_hidden_def(printf) diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c index e503b9484..b54a7a815 100644 --- a/libc/stdio/putchar.c +++ b/libc/stdio/putchar.c @@ -7,21 +7,21 @@ #include "_stdio.h" -#undef putchar_unlocked -#undef putchar +libc_hidden_proto(__fputc_unlocked) +#undef putchar #ifdef __DO_UNLOCKED -int __putchar_unlocked(int c) +#undef putchar_unlocked +int putchar_unlocked(int c) { register FILE *stream = stdout; return __PUTC_UNLOCKED_MACRO(c, stream); } -weak_alias(__putchar_unlocked,putchar_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__putchar_unlocked,putchar) +strong_alias(putchar_unlocked,putchar) #endif #elif defined __UCLIBC_HAS_THREADS__ diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c index 3a510325b..08525b2f6 100644 --- a/libc/stdio/puts.c +++ b/libc/stdio/puts.c @@ -7,6 +7,9 @@ #include "_stdio.h" +libc_hidden_proto(__fputc_unlocked) +libc_hidden_proto(fputs_unlocked) + int puts(register const char * __restrict s) { register FILE *stream = stdout; /* This helps bcc optimize. */ @@ -20,9 +23,9 @@ int puts(register const char * __restrict s) * then we could have a newline in the buffer of an LBF stream. */ /* Note: Nonportable as fputs need only return nonnegative on success. */ - if ((n = __fputs_unlocked(s, stream)) != EOF) { + if ((n = fputs_unlocked(s, stream)) != EOF) { ++n; - if (__fputc_unlocked_internal('\n', stream) == EOF) { + if (__fputc_unlocked('\n', stream) == EOF) { n = EOF; } } diff --git a/libc/stdio/putw.c b/libc/stdio/putw.c index 5dfa06890..469e44aea 100644 --- a/libc/stdio/putw.c +++ b/libc/stdio/putw.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(fwrite_unlocked) + /* SUSv2 Legacy function -- need not be reentrant. */ int putw(int w, FILE *stream) @@ -20,9 +22,9 @@ int putw(int w, FILE *stream) #endif #if EOF == -1 - return __fwrite_unlocked((void *) PW, sizeof(int), 1, stream) - 1; + return fwrite_unlocked((void *) PW, sizeof(int), 1, stream) - 1; #else - return (__fwrite_unlocked((void *) PW, sizeof(int), 1, stream) != 0) + return (fwrite_unlocked((void *) PW, sizeof(int), 1, stream) != 0) ? 0 : EOF; #endif } diff --git a/libc/stdio/putwchar.c b/libc/stdio/putwchar.c index d093656e6..e25f35e5e 100644 --- a/libc/stdio/putwchar.c +++ b/libc/stdio/putwchar.c @@ -9,23 +9,25 @@ #ifdef __DO_UNLOCKED -wint_t __putwchar_unlocked(wchar_t wc) +libc_hidden_proto(fputwc_unlocked) + +wint_t putwchar_unlocked(wchar_t wc) { - return __fputwc_unlocked(wc, stdout); + return fputwc_unlocked(wc, stdout); } -weak_alias(__putwchar_unlocked,putwchar_unlocked) #ifndef __UCLIBC_HAS_THREADS__ -weak_alias(__putwchar_unlocked,putwchar) +strong_alias(putwchar_unlocked,putwchar) #endif #elif defined __UCLIBC_HAS_THREADS__ -extern int __fputc (int __c, FILE *__stream) attribute_hidden; +/* psm: should this be fputwc? */ +libc_hidden_proto(fputc) wint_t putwchar(wchar_t wc) { - return __fputc(wc, stdout); + return fputc(wc, stdout); } #endif diff --git a/libc/stdio/remove.c b/libc/stdio/remove.c index 2d4fedcc1..ad9974dff 100644 --- a/libc/stdio/remove.c +++ b/libc/stdio/remove.c @@ -5,21 +5,21 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define rmdir __rmdir -#define unlink __unlink - #include "_stdio.h" #include <unistd.h> #include <errno.h> +libc_hidden_proto(rmdir) +libc_hidden_proto(unlink) + /* SUSv3 states: * If path does not name a directory, remove(path) shall be equivalent * to unlink(path). If path names a directory, remove(path) shall be * equivalent to rmdir(path). */ -int attribute_hidden __remove(register const char *filename) +int remove(register const char *filename) { int saved_errno = errno; int rv; @@ -30,4 +30,5 @@ int attribute_hidden __remove(register const char *filename) } return rv; } -strong_alias(__remove,remove) +libc_hidden_proto(remove) +libc_hidden_def(remove) diff --git a/libc/stdio/rewind.c b/libc/stdio/rewind.c index 8e0acc2d0..713b76ec8 100644 --- a/libc/stdio/rewind.c +++ b/libc/stdio/rewind.c @@ -7,15 +7,18 @@ #include "_stdio.h" -void attribute_hidden __rewind(register FILE *stream) +libc_hidden_proto(fseek) + +void rewind(register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; __STDIO_AUTO_THREADLOCK(stream); __STDIO_STREAM_CLEAR_ERROR(stream); /* Clear the error indicator */ - __fseek(stream, 0L, SEEK_SET); /* first since fseek could set it. */ + fseek(stream, 0L, SEEK_SET); /* first since fseek could set it. */ __STDIO_AUTO_THREADUNLOCK(stream); } -strong_alias(__rewind,rewind) +libc_hidden_proto(rewind) +libc_hidden_def(rewind) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 7fe11514d..8def91c6b 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -43,14 +43,6 @@ * standards and from an official C standard defect report. */ -#define wcslen __wcslen -#define mbsrtowcs __mbsrtowcs -#define mbrtowc __mbrtowc -#define ungetc __ungetc -#define ungetwc __ungetwc -#define iswspace __iswspace -#define wcrtomb __wcrtomb - #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ #define _GNU_SOURCE #include <features.h> @@ -86,6 +78,27 @@ #include <bits/uClibc_fpmax.h> #endif /* __UCLIBC_HAS_FLOATS__ */ +libc_hidden_proto(memcmp) +libc_hidden_proto(memset) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(ungetc) +libc_hidden_proto(vfscanf) +libc_hidden_proto(vsscanf) +libc_hidden_proto(fclose) +libc_hidden_proto(getc_unlocked) +libc_hidden_proto(__fgetc_unlocked) +#ifdef __UCLIBC_HAS_WCHAR__ +libc_hidden_proto(wcslen) +libc_hidden_proto(vfwscanf) +libc_hidden_proto(vswscanf) +libc_hidden_proto(mbsrtowcs) +libc_hidden_proto(mbrtowc) +libc_hidden_proto(ungetwc) +libc_hidden_proto(iswspace) +libc_hidden_proto(fgetwc_unlocked) +#endif + #ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ #ifdef L_vfscanf /* only emit this once */ @@ -147,18 +160,19 @@ _stdlib_strto_l(register const char * __restrict str, /**********************************************************************/ #ifdef L_fscanf -int attribute_hidden __fscanf(FILE * __restrict stream, const char * __restrict format, ...) +int 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) +libc_hidden_proto(fscanf) +libc_hidden_def(fscanf) #endif /**********************************************************************/ @@ -170,7 +184,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; @@ -182,18 +196,19 @@ int scanf(const char * __restrict format, ...) #ifdef __STDIO_HAS_VSSCANF -int attribute_hidden __sscanf(const char * __restrict str, const char * __restrict format, ...) +int 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) +libc_hidden_proto(sscanf) +libc_hidden_def(sscanf) #else /* __STDIO_HAS_VSSCANF */ #warning Skipping sscanf since no vsscanf! @@ -203,11 +218,12 @@ strong_alias(__sscanf,sscanf) /**********************************************************************/ #ifdef L_vscanf -int attribute_hidden __vscanf(const char * __restrict format, va_list arg) +int vscanf(const char * __restrict format, va_list arg) { - return __vfscanf(stdin, format, arg); + return vfscanf(stdin, format, arg); } -strong_alias(__vscanf,vscanf) +libc_hidden_proto(vscanf) +libc_hidden_def(vscanf) #endif /**********************************************************************/ @@ -219,7 +235,7 @@ strong_alias(__vscanf,vscanf) #ifdef __STDIO_BUFFERS -int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) +int vsscanf(__const char *sp, __const char *fmt, va_list ap) { FILE f; @@ -253,22 +269,22 @@ int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) f.__bufstart = f.__bufpos = (unsigned char *) ((void *) sp); f.__bufread = - f.__bufend = f.__bufstart + __strlen(sp); + f.__bufend = f.__bufstart + strlen(sp); __STDIO_STREAM_ENABLE_GETC(&f); __STDIO_STREAM_DISABLE_PUTC(&f); - return __vfscanf(&f, fmt, ap); + return vfscanf(&f, fmt, ap); } -strong_alias(__vsscanf,vsscanf) +libc_hidden_def(vsscanf) #elif !defined(__UCLIBC_HAS_WCHAR__) -int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) +int vsscanf(__const char *sp, __const char *fmt, va_list ap) { __FILE_vsscanf f; f.bufpos = (unsigned char *) ((void *) sp); - f.bufread = f.bufpos + __strlen(sp); + f.bufread = f.bufpos + strlen(sp); /* __STDIO_STREAM_RESET_GCS(&f.f); */ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -296,25 +312,25 @@ int attribute_hidden __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) +libc_hidden_def(vsscanf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) -int attribute_hidden __vsscanf(__const char *sp, __const char *fmt, va_list ap) +int 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); + if ((f = fmemopen((char *)sp, strlen(sp), "r")) != NULL) { + rv = vfscanf(f, fmt, ap); fclose(f); } return rv; } -strong_alias(__vsscanf,vsscanf) +libc_hidden_def(vsscanf) #else #warning Skipping vsscanf since no buffering, no custom streams, and wchar enabled! @@ -333,7 +349,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; @@ -349,7 +365,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; @@ -368,7 +384,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; @@ -383,7 +399,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 @@ -392,7 +408,7 @@ int vwscanf(const wchar_t * __restrict format, va_list arg) #ifdef __STDIO_BUFFERS -int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, +int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -429,9 +445,9 @@ int attribute_hidden __vswscanf(const wchar_t * __restrict str, const wchar_t * #endif f.__nextopen = NULL; - return __vfwscanf(&f, format, arg); + return vfwscanf(&f, format, arg); } -strong_alias(__vswscanf,vswscanf) +libc_hidden_def(vswscanf) #else /* __STDIO_BUFFERS */ #warning Skipping vswscanf since no buffering! #endif /* __STDIO_BUFFERS */ @@ -580,7 +596,6 @@ 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 @@ -590,12 +605,11 @@ 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)) #else /* __UCLIBC_HAS_WCHAR__ */ -#define GETC(SC) __getc_unlocked((SC)->fp) +#define GETC(SC) getc_unlocked((SC)->fp) #endif /* __UCLIBC_HAS_WCHAR__ */ #endif @@ -959,7 +973,7 @@ int attribute_hidden __psfs_parse_spec(register psfs_t *psfs) #ifdef L_vfscanf static int sc_getc(register struct scan_cookie *sc) { - return (__getc_unlocked)(sc->fp); /* Disable the macro. */ + return (getc_unlocked)(sc->fp); /* Disable the macro. */ } static int scan_getwc(register struct scan_cookie *sc) @@ -1031,7 +1045,7 @@ static int sc_getc(register struct scan_cookie *sc) sc->fp->__modeflags |= __FLAG_EOF; return EOF; } - } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) { + } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) { return EOF; } @@ -1077,7 +1091,7 @@ static int scan_getwc(register struct scan_cookie *sc) sc->ungot_flag |= 2; return -1; } - } else if ((wc = __fgetwc_unlocked(sc->fp)) == WEOF) { + } else if ((wc = fgetwc_unlocked(sc->fp)) == WEOF) { sc->ungot_flag |= 2; return -1; } @@ -1148,7 +1162,7 @@ static const char fake_thousands_sep_str[] = ","; #endif /* L_vfwscanf */ -int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) +int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) { const Wuchar *fmt; unsigned char *b; @@ -1201,7 +1215,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric #if defined(NL_ARGMAX) && (NL_ARGMAX > 0) psfs.num_pos_args = -1; /* Must start at -1. */ /* Initialize positional arg ptrs to NULL. */ - __memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); + memset(psfs.pos_args, 0, sizeof(psfs.pos_args)); #endif /* defined(NL_ARGMAX) && (NL_ARGMAX > 0) */ __STDIO_AUTO_THREADLOCK(fp); @@ -1433,7 +1447,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric ++fmt; invert = 1; } - __memset(scanset, invert, sizeof(scanset)); + memset(scanset, invert, sizeof(scanset)); invert = 1-invert; if (*fmt == ']') { @@ -1752,7 +1766,7 @@ int attribute_hidden HIDDEN_VFSCANF (FILE *__restrict fp, const Wchar *__restric return psfs.cnt; } -strong_alias(HIDDEN_VFSCANF,VFSCANF) +libc_hidden_def(VFSCANF) #endif /**********************************************************************/ #ifdef L___psfs_do_numeric @@ -1983,14 +1997,14 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) if ((psfs->conv_num > CONV_i) /* float conversion */ && (!pass || (i == nblk1)) /* possible last */ - && !__memcmp(sc->thousands_sep, sc->fake_decpt, k) + && !memcmp(sc->thousands_sep, sc->fake_decpt, k) /* and prefix matched, so could be decpt */ ) { __scan_getc(sc); p = sc->fake_decpt + k; do { if (!*++p) { - __strcpy(b, sc->decpt); + strcpy(b, sc->decpt); b += sc->decpt_len; goto GOT_DECPT; } @@ -2084,7 +2098,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) p = sc->fake_decpt; do { if (!*p) { - __strcpy(b, sc->decpt); + strcpy(b, sc->decpt); b += sc->decpt_len; break; } diff --git a/libc/stdio/setbuf.c b/libc/stdio/setbuf.c index 02a4736ac..6de2c91a1 100644 --- a/libc/stdio/setbuf.c +++ b/libc/stdio/setbuf.c @@ -7,9 +7,11 @@ #include "_stdio.h" +libc_hidden_proto(setvbuf) + void setbuf(FILE * __restrict stream, register char * __restrict buf) { #ifdef __STDIO_BUFFERS - __setvbuf(stream, buf, ((buf != NULL) ? _IOFBF : _IONBF), BUFSIZ); + setvbuf(stream, buf, ((buf != NULL) ? _IOFBF : _IONBF), BUFSIZ); #endif } diff --git a/libc/stdio/setbuffer.c b/libc/stdio/setbuffer.c index d1f12a1af..3ca4fb7f8 100644 --- a/libc/stdio/setbuffer.c +++ b/libc/stdio/setbuffer.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(setvbuf) + /* A BSD function. The implementation matches the linux man page, * except that we do not bother calling setvbuf if not configured * for stream buffering. @@ -16,6 +18,6 @@ void setbuffer(FILE * __restrict stream, register char * __restrict buf, size_t size) { #ifdef __STDIO_BUFFERS - __setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), size); + setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), size); #endif } diff --git a/libc/stdio/setlinebuf.c b/libc/stdio/setlinebuf.c index 56e89e11b..29b2bdeac 100644 --- a/libc/stdio/setlinebuf.c +++ b/libc/stdio/setlinebuf.c @@ -7,6 +7,8 @@ #include "_stdio.h" +libc_hidden_proto(setvbuf) + /* A BSD function. The implementation matches the linux man page, * except that we do not bother calling setvbuf if not configured * for stream buffering. @@ -15,6 +17,6 @@ void setlinebuf(FILE * __restrict stream) { #ifdef __STDIO_BUFFERS - __setvbuf(stream, NULL, _IOLBF, (size_t) 0); + setvbuf(stream, NULL, _IOLBF, (size_t) 0); #endif } diff --git a/libc/stdio/setvbuf.c b/libc/stdio/setvbuf.c index d12d1576a..2ac258492 100644 --- a/libc/stdio/setvbuf.c +++ b/libc/stdio/setvbuf.c @@ -14,7 +14,7 @@ #error Assumption violated for buffering mode flags #endif -int attribute_hidden __setvbuf(register FILE * __restrict stream, register char * __restrict buf, +int setvbuf(register FILE * __restrict stream, register char * __restrict buf, int mode, size_t size) { #ifdef __STDIO_BUFFERS @@ -104,4 +104,5 @@ int attribute_hidden __setvbuf(register FILE * __restrict stream, register char #endif } -strong_alias(__setvbuf,setvbuf) +libc_hidden_proto(setvbuf) +libc_hidden_def(setvbuf) diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c index a1ea79fc0..9cfe812ca 100644 --- a/libc/stdio/snprintf.c +++ b/libc/stdio/snprintf.c @@ -12,17 +12,20 @@ #warning Skipping snprintf since no vsnprintf! #else -int attribute_hidden __snprintf(char *__restrict buf, size_t size, +libc_hidden_proto(vsnprintf) + +int 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) +libc_hidden_proto(snprintf) +libc_hidden_def(snprintf) #endif diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c index 5778c011d..bbda86bee 100644 --- a/libc/stdio/sprintf.c +++ b/libc/stdio/sprintf.c @@ -12,17 +12,20 @@ #warning Skipping sprintf since no vsnprintf! #else -int attribute_hidden __sprintf(char *__restrict buf, const char * __restrict format, ...) +libc_hidden_proto(vsnprintf) + +int 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) +libc_hidden_proto(sprintf) +libc_hidden_def(sprintf) #endif diff --git a/libc/stdio/swprintf.c b/libc/stdio/swprintf.c index b373df8bd..0c209fe4b 100644 --- a/libc/stdio/swprintf.c +++ b/libc/stdio/swprintf.c @@ -5,12 +5,12 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define vswprintf __vswprintf - #include "_stdio.h" #include <stdarg.h> #include <wchar.h> +libc_hidden_proto(vswprintf) + #ifndef __STDIO_BUFFERS #warning Skipping swprintf since no buffering! #else /* __STDIO_BUFFERS */ diff --git a/libc/stdio/tempnam.c b/libc/stdio/tempnam.c index d626dc0f8..43cbf781b 100644 --- a/libc/stdio/tempnam.c +++ b/libc/stdio/tempnam.c @@ -20,6 +20,8 @@ #include <string.h> #include "../misc/internals/tempname.h" +libc_hidden_proto(strdup) + /* Generate a unique temporary filename using up to five characters of PFX if it is not NULL. The directory to put this file in is searched for as follows: First the environment variable "TMPDIR" is checked. @@ -38,6 +40,6 @@ tempnam (const char *dir, const char *pfx) if (__gen_tempname (buf, __GT_NOCREATE)) return NULL; - return __strdup (buf); + return strdup (buf); } diff --git a/libc/stdio/tmpfile.c b/libc/stdio/tmpfile.c index 606fcc436..f83944539 100644 --- a/libc/stdio/tmpfile.c +++ b/libc/stdio/tmpfile.c @@ -16,14 +16,15 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define fdopen __fdopen -#define remove __remove - #include <features.h> #include <stdio.h> #include <unistd.h> #include "../misc/internals/tempname.h" +libc_hidden_proto(fdopen) +libc_hidden_proto(remove) +libc_hidden_proto(close) + /* This returns a new stream opened on a temporary file (generated by tmpnam). The file is opened with mode "w+b" (binary read/write). If we couldn't generate a unique filename or the file couldn't @@ -45,10 +46,10 @@ FILE * tmpfile (void) (void) remove (buf); if ((f = fdopen (fd, "w+b")) == NULL) - __close (fd); + close (fd); return f; } #ifdef __UCLIBC_HAS_LFS__ -weak_alias(tmpfile,tmpfile64) +strong_alias(tmpfile,tmpfile64) #endif diff --git a/libc/stdio/tmpnam.c b/libc/stdio/tmpnam.c index df2399e66..38475a8ec 100644 --- a/libc/stdio/tmpnam.c +++ b/libc/stdio/tmpnam.c @@ -20,6 +20,8 @@ #include <string.h> #include "../misc/internals/tempname.h" +libc_hidden_proto(memcpy) + static char tmpnam_buffer[L_tmpnam]; /* Generate a unique filename in P_tmpdir. @@ -41,7 +43,7 @@ char * tmpnam (char *s) return NULL; if (s == NULL) - return (char *) __memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); + return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam); return s; } diff --git a/libc/stdio/ungetc.c b/libc/stdio/ungetc.c index de3f1d16b..5e7db7daa 100644 --- a/libc/stdio/ungetc.c +++ b/libc/stdio/ungetc.c @@ -24,7 +24,7 @@ * (See section 7.19.6.2 of the C9X rationale -- WG14/N897.) */ -int attribute_hidden __ungetc(int c, register FILE *stream) +int ungetc(int c, register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; @@ -75,4 +75,5 @@ int attribute_hidden __ungetc(int c, register FILE *stream) return c; } -strong_alias(__ungetc,ungetc) +libc_hidden_proto(ungetc) +libc_hidden_def(ungetc) diff --git a/libc/stdio/ungetwc.c b/libc/stdio/ungetwc.c index c6a99dd9d..082f81bd9 100644 --- a/libc/stdio/ungetwc.c +++ b/libc/stdio/ungetwc.c @@ -12,7 +12,7 @@ * as reset stream->__ungot_width[1] for use by _stdio_adjpos(). */ -wint_t attribute_hidden __ungetwc(wint_t c, register FILE *stream) +wint_t ungetwc(wint_t c, register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; @@ -46,4 +46,5 @@ wint_t attribute_hidden __ungetwc(wint_t c, register FILE *stream) return c; } -strong_alias(__ungetwc,ungetwc) +libc_hidden_proto(ungetwc) +libc_hidden_def(ungetwc) diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c index ca110cbd1..1c184583b 100644 --- a/libc/stdio/vasprintf.c +++ b/libc/stdio/vasprintf.c @@ -5,12 +5,11 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define open_memstream __open_memstream - #include "_stdio.h" #include <stdarg.h> #include <bits/uClibc_va_copy.h> + #ifdef __UCLIBC_MJN3_ONLY__ /* Do the memstream stuff inline to avoid fclose and the openlist? */ #warning CONSIDER: avoid open_memstream call? @@ -20,7 +19,15 @@ #warning Skipping vasprintf since no vsnprintf! #else -int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict format, +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ +libc_hidden_proto(open_memstream) +libc_hidden_proto(fclose) +libc_hidden_proto(vfprintf) +#else +libc_hidden_proto(vsnprintf) +#endif + +int vasprintf(char **__restrict buf, const char * __restrict format, va_list arg) { #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ @@ -32,7 +39,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict *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 +61,14 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict 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,6 +81,7 @@ int attribute_hidden __vasprintf(char **__restrict buf, const char * __restrict #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */ } -strong_alias(__vasprintf,vasprintf) +libc_hidden_proto(vasprintf) +libc_hidden_def(vasprintf) #endif diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 1822f69b7..f36987477 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -8,7 +8,10 @@ #include "_stdio.h" #include <stdarg.h> -int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_list arg) +libc_hidden_proto(vfprintf) +libc_hidden_proto(fflush_unlocked) + +int vdprintf(int filedes, const char * __restrict format, va_list arg) { FILE f; int rv; @@ -47,11 +50,11 @@ int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_ #endif f.__nextopen = NULL; - rv = __vfprintf(&f, format, arg); + rv = vfprintf(&f, format, arg); #ifdef __STDIO_BUFFERS /* If not buffering, then fflush is unnecessary. */ - if ((rv > 0) && __fflush_unlocked(&f)) { + if ((rv > 0) && fflush_unlocked(&f)) { rv = -1; } #endif @@ -60,4 +63,5 @@ int attribute_hidden __vdprintf(int filedes, const char * __restrict format, va_ return rv; } -strong_alias(__vdprintf,vdprintf) +libc_hidden_proto(vdprintf) +libc_hidden_def(vdprintf) diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index bdbf0c788..f0b402b85 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -88,15 +88,6 @@ * treats this as an error. */ -#define strnlen __strnlen -#define wcslen __wcslen -#define wcsnlen __wcsnlen -#define wcsrtombs __wcsrtombs -#define mbsrtowcs __mbsrtowcs -#define btowc __btowc -#define wcrtomb __wcrtomb -#define fputws __fputws - #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE #include <features.h> @@ -127,6 +118,23 @@ #include <bits/uClibc_uintmaxtostr.h> #include <bits/uClibc_va_copy.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(strlen) +libc_hidden_proto(strnlen) +libc_hidden_proto(__glibc_strerror_r) +libc_hidden_proto(fputs_unlocked) +libc_hidden_proto(abort) +#ifdef __UCLIBC_HAS_WCHAR__ +libc_hidden_proto(wcslen) +libc_hidden_proto(wcsnlen) +libc_hidden_proto(mbsrtowcs) +libc_hidden_proto(wcsrtombs) +libc_hidden_proto(btowc) +libc_hidden_proto(wcrtomb) +libc_hidden_proto(fputws) +#endif + /* Some older or broken gcc toolchains define LONG_LONG_MAX but not * LLONG_MAX. Since LLONG_MAX is part of the standard, that's what * we use. So complain if we do not have it but should. @@ -510,7 +518,7 @@ int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ @@ -1116,7 +1124,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) } else { #endif /* NL_ARGMAX */ ppfs->argnumber[2] = 1; - __memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); + memcpy(ppfs->argtype, argtype + 2, ppfs->num_data_args * sizeof(int)); #ifdef NL_ARGMAX } @@ -1196,13 +1204,12 @@ 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 -#define STRLEN __strlen +#define STRLEN strlen #define _PPFS_init _ppfs_init -#define OUTPUT(F,S) __fputs_unlocked(S,F) +#define OUTPUT(F,S) fputs_unlocked(S,F) /* #define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream) */ #define _outnstr(stream, string, len) ((len > 0) ? __stdio_fwrite(string, len, stream) : 0) #define FP_OUT _fp_out_narrow @@ -1214,7 +1221,7 @@ static size_t _fp_out_narrow(FILE *fp, intptr_t type, intptr_t len, intptr_t buf size_t r = 0; if (type & 0x80) { /* Some type of padding needed. */ - int buflen = __strlen((const char *) buf); + int buflen = strlen((const char *) buf); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1229,7 +1236,6 @@ 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 @@ -1285,7 +1291,7 @@ static size_t _fp_out_wide(FILE *fp, intptr_t type, intptr_t len, intptr_t buf) int i; if (type & 0x80) { /* Some type of padding needed */ - int buflen = __strlen(s); + int buflen = strlen(s); if ((len -= buflen) > 0) { if ((r = _charpad(fp, (type & 0x7f), len)) != len) { return r; @@ -1329,7 +1335,7 @@ static int _ppwfs_init(register ppfs_t *ppfs, const wchar_t *fmt0) int r; /* First, zero out everything... argnumber[], argtype[], argptr[] */ - __memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ + memset(ppfs, 0, sizeof(ppfs_t)); /* TODO: nonportable???? */ #ifdef NL_ARGMAX --ppfs->maxposarg; /* set to -1 */ #endif /* NL_ARGMAX */ @@ -1739,7 +1745,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_internal(errno, buf, sizeof(buf)); + s = __glibc_strerror_r(errno, buf, sizeof(buf)); goto SET_STRING_LEN; #endif } else { @@ -1847,7 +1853,9 @@ static int _do_one_spec(FILE * __restrict stream, return 0; } -int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream, +libc_hidden_proto(fprintf) + +int VFPRINTF (FILE * __restrict stream, register const FMT_TYPE * __restrict format, va_list arg) { @@ -1924,6 +1932,7 @@ int attribute_hidden HIDDEN_VFPRINTF (FILE * __restrict stream, return count; } -strong_alias(HIDDEN_VFPRINTF,VFPRINTF) +libc_hidden_proto(VFPRINTF) +libc_hidden_def(VFPRINTF) #endif /**********************************************************************/ diff --git a/libc/stdio/vprintf.c b/libc/stdio/vprintf.c index 9c0e07514..7848a078d 100644 --- a/libc/stdio/vprintf.c +++ b/libc/stdio/vprintf.c @@ -8,7 +8,9 @@ #include "_stdio.h" #include <stdarg.h> +libc_hidden_proto(vfprintf) + 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 6fcc84f2b..dc8cfe036 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -8,13 +8,15 @@ #include "_stdio.h" #include <stdarg.h> +libc_hidden_proto(vfprintf) + #ifdef __UCLIBC_MJN3_ONLY__ #warning WISHLIST: Implement vsnprintf for non-buffered and no custom stream case. #endif /* __UCLIBC_MJN3_ONLY__ */ #ifdef __STDIO_BUFFERS -int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, +int vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -57,7 +59,7 @@ int attribute_hidden __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; @@ -66,7 +68,8 @@ int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, } return rv; } -strong_alias(__vsnprintf,vsnprintf) +libc_hidden_proto(vsnprintf) +libc_hidden_def(vsnprintf) #elif defined(__USE_OLD_VFPRINTF__) @@ -76,7 +79,7 @@ typedef struct { unsigned char *bufpos; } __FILE_vsnprintf; -int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, +int vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { __FILE_vsnprintf f; @@ -114,7 +117,7 @@ int attribute_hidden __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; @@ -123,7 +126,8 @@ int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, } return rv; } -strong_alias(__vsnprintf,vsnprintf) +libc_hidden_proto(vsnprintf) +libc_hidden_def(vsnprintf) #elif defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__) @@ -165,7 +169,7 @@ static ssize_t snpf_write(register void *cookie, const char *buf, #undef COOKIE -int attribute_hidden __vsnprintf(char *__restrict buf, size_t size, +int vsnprintf(char *__restrict buf, size_t size, const char * __restrict format, va_list arg) { FILE f; @@ -199,11 +203,12 @@ int attribute_hidden __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) +libc_hidden_proto(vsnprintf) +libc_hidden_def(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 a7d5e08f5..8e27c19d9 100644 --- a/libc/stdio/vsprintf.c +++ b/libc/stdio/vsprintf.c @@ -12,10 +12,12 @@ #warning Skipping vsprintf since no vsnprintf! #else +libc_hidden_proto(vsnprintf) + 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 d23ba123f..d806c5432 100644 --- a/libc/stdio/vswprintf.c +++ b/libc/stdio/vswprintf.c @@ -9,11 +9,13 @@ #include <stdarg.h> #include <wchar.h> +libc_hidden_proto(vfwprintf) + #ifndef __STDIO_BUFFERS #warning Skipping vswprintf since no buffering! #else /* __STDIO_BUFFERS */ -int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size, +int vswprintf(wchar_t *__restrict buf, size_t size, const wchar_t * __restrict format, va_list arg) { FILE f; @@ -52,7 +54,7 @@ int attribute_hidden __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) { @@ -66,6 +68,7 @@ int attribute_hidden __vswprintf(wchar_t *__restrict buf, size_t size, } return rv; } -strong_alias(__vswprintf,vswprintf) +libc_hidden_proto(vswprintf) +libc_hidden_def(vswprintf) #endif /* __STDIO_BUFFERS */ diff --git a/libc/stdio/vwprintf.c b/libc/stdio/vwprintf.c index 8c3401846..1c32887a4 100644 --- a/libc/stdio/vwprintf.c +++ b/libc/stdio/vwprintf.c @@ -9,7 +9,9 @@ #include <stdarg.h> #include <wchar.h> +libc_hidden_proto(vfwprintf) + 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 00f5ef514..9dc274aec 100644 --- a/libc/stdio/wprintf.c +++ b/libc/stdio/wprintf.c @@ -9,13 +9,15 @@ #include <stdarg.h> #include <wchar.h> +libc_hidden_proto(vfwprintf) + int wprintf(const wchar_t * __restrict format, ...) { va_list arg; 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 78f96a0e2..70b65a1b4 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -18,8 +18,6 @@ Cambridge, MA 02139, USA. */ /* Hacked up for uClibc by Erik Andersen */ -#define sigaction __sigaction - #define _GNU_SOURCE #include <features.h> #include <signal.h> @@ -30,6 +28,13 @@ Cambridge, MA 02139, USA. */ #include <signal.h> #include <errno.h> +libc_hidden_proto(abort) + +libc_hidden_proto(memset) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) +libc_hidden_proto(raise) +libc_hidden_proto(_exit) /* Our last ditch effort to commit suicide */ #if defined(__alpha__) @@ -80,12 +85,8 @@ static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) -extern int __raise (int __sig) __THROW attribute_hidden; - /* Cause an abnormal program termination with core-dump */ -#undef __abort -#undef abort -void attribute_hidden __abort(void) +void abort(void) { sigset_t sigset; @@ -94,7 +95,7 @@ void attribute_hidden __abort(void) /* Unmask SIGABRT to be sure we can get it */ if (__sigemptyset(&sigset) == 0 && __sigaddset(&sigset, SIGABRT) == 0) { - __sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); + sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *) NULL); } while (1) { @@ -114,7 +115,7 @@ void attribute_hidden __abort(void) abort_it: UNLOCK; - __raise(SIGABRT); + raise(SIGABRT); LOCK; } @@ -123,7 +124,7 @@ abort_it: struct sigaction act; been_there_done_that++; - __memset(&act, '\0', sizeof(struct sigaction)); + memset(&act, '\0', sizeof(struct sigaction)); act.sa_handler = SIG_DFL; __sigfillset(&act.sa_mask); act.sa_flags = 0; @@ -141,7 +142,7 @@ abort_it: /* Still here? Try to at least exit */ if (been_there_done_that == 3) { been_there_done_that++; - _exit_internal(127); + _exit(127); } /* Still here? We're screwed. Sleepy time. Good night. */ @@ -150,4 +151,4 @@ abort_it: ABORT_INSTRUCTION; } } -strong_alias(__abort,abort) +libc_hidden_def(abort) diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index db69902c8..c27872f02 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -44,6 +44,9 @@ #include <errno.h> #include <atomic.h> +libc_hidden_proto(exit) +libc_hidden_proto(_exit) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> extern pthread_mutex_t mylock; @@ -320,9 +323,7 @@ extern void (*__rtld_fini)(void); /* * Normal program termination */ -#undef exit -#undef __exit -void attribute_hidden __exit(int rv) +void exit(int rv) { /* Perform exit-specific cleanup (atexit and on_exit) */ LOCK; @@ -345,7 +346,7 @@ void attribute_hidden __exit(int rv) if (_stdio_term) _stdio_term(); - _exit_internal(rv); + _exit(rv); } -strong_alias(__exit,exit) +libc_hidden_def(exit) #endif diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c index 0d82c3543..7fd792fef 100644 --- a/libc/stdlib/drand48.c +++ b/libc/stdlib/drand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r - #include <stdlib.h> +libc_hidden_proto(erand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/drand48_r.c b/libc/stdlib/drand48_r.c index 14235e6e0..0f96e59f7 100644 --- a/libc/stdlib/drand48_r.c +++ b/libc/stdlib/drand48_r.c @@ -17,12 +17,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r - #include <errno.h> #include <math.h> #include <stdlib.h> +libc_hidden_proto(erand48_r) + int drand48_r (struct drand48_data *buffer, double *result) { return erand48_r (buffer->__x, buffer, result); diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c index f5c1a50d4..853c2c35a 100644 --- a/libc/stdlib/erand48.c +++ b/libc/stdlib/erand48.c @@ -17,9 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define erand48_r __erand48_r #include <stdlib.h> +libc_hidden_proto(erand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c index 0a69266a7..fec8b5026 100644 --- a/libc/stdlib/erand48_r.c +++ b/libc/stdlib/erand48_r.c @@ -24,7 +24,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) +int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) { union ieee754_double temp; @@ -45,4 +45,5 @@ int attribute_hidden __erand48_r (unsigned short int xsubi[3], struct drand48_da return 0; } -strong_alias(__erand48_r,erand48_r) +libc_hidden_proto(erand48_r) +libc_hidden_def(erand48_r) diff --git a/libc/stdlib/gcvt.c b/libc/stdlib/gcvt.c index 75e3bbe70..f1c1f4270 100644 --- a/libc/stdlib/gcvt.c +++ b/libc/stdlib/gcvt.c @@ -1,11 +1,13 @@ #include <stdio.h> #include <stdlib.h> +libc_hidden_proto(sprintf) + #ifdef __UCLIBC_HAS_FLOATS__ #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/getenv.c b/libc/stdlib/getenv.c index 6cbdc3e65..c7940f398 100644 --- a/libc/stdlib/getenv.c +++ b/libc/stdlib/getenv.c @@ -1,42 +1,33 @@ /* getenv.c for uClibc - Erik Andersen <andersen@codepoet.org> - - The GNU C Library is free software; you can redistribute it and/or - 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 - Lesser General Public License for more details. - - 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. - */ + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <string.h> #include <unistd.h> +#include <stdlib.h> + +libc_hidden_proto(getenv) +libc_hidden_proto(memcmp) +libc_hidden_proto(strlen) /* IEEE Std 1003.1-2001 says getenv need not be thread safe, so * don't bother locking access to __environ */ -char attribute_hidden *__getenv(const char *var) +char *getenv(const char *var) { int len; char **ep; if (!(ep=__environ)) return NULL; - len = __strlen(var); + len = strlen(var); while(*ep) { - if (__memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { + if (memcmp(var, *ep, len) == 0 && (*ep)[len] == '=') { return *ep + len + 1; } ep++; } return NULL; } - -strong_alias(__getenv,getenv) +libc_hidden_def(getenv) diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c index 4bd082823..a5fde0fce 100644 --- a/libc/stdlib/getpt.c +++ b/libc/stdlib/getpt.c @@ -42,6 +42,9 @@ extern int __bsd_getpt (void) attribute_hidden; #endif +libc_hidden_proto(open) +libc_hidden_proto(close) + /* Open a master pseudo terminal and return its file descriptor. */ int getpt (void) @@ -55,7 +58,7 @@ getpt (void) if (!have_no_dev_ptmx) #endif { - fd = __open (_PATH_DEVPTMX, O_RDWR); + fd = open (_PATH_DEVPTMX, O_RDWR); if (fd != -1) { #if defined __ASSUME_DEVPTS__ @@ -79,7 +82,7 @@ getpt (void) /* If /dev/pts is not mounted then the UNIX98 pseudo terminals are not usable. */ - __close (fd); + close (fd); #if !defined __UNIX98PTY_ONLY__ have_no_dev_ptmx = 1; #endif diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c index 819e0d986..6f812068b 100644 --- a/libc/stdlib/jrand48.c +++ b/libc/stdlib/jrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define jrand48_r __jrand48_r - #include <stdlib.h> +libc_hidden_proto(jrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c index a21bda080..02a082e68 100644 --- a/libc/stdlib/jrand48_r.c +++ b/libc/stdlib/jrand48_r.c @@ -22,7 +22,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) +int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ if (__drand48_iterate (xsubi, buffer) < 0) @@ -33,4 +33,5 @@ int attribute_hidden __jrand48_r (unsigned short int xsubi[3], struct drand48_da return 0; } -strong_alias(__jrand48_r,jrand48_r) +libc_hidden_proto(jrand48_r) +libc_hidden_def(jrand48_r) diff --git a/libc/stdlib/ldiv.c b/libc/stdlib/ldiv.c index f8e789a92..88a877116 100644 --- a/libc/stdlib/ldiv.c +++ b/libc/stdlib/ldiv.c @@ -57,5 +57,5 @@ ldiv (long int numer, long int denom) #if __WORDSIZE == 64 #undef imaxdiv -weak_alias (ldiv, imaxdiv) +strong_alias(ldiv,imaxdiv) #endif diff --git a/libc/stdlib/lldiv.c b/libc/stdlib/lldiv.c index 56ccb2612..09cadc691 100644 --- a/libc/stdlib/lldiv.c +++ b/libc/stdlib/lldiv.c @@ -58,5 +58,5 @@ lldiv (long long int numer, long long int denom) #if __WORDSIZE != 64 #undef imaxdiv -weak_alias (lldiv, imaxdiv) +strong_alias(lldiv,imaxdiv) #endif diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c index bdde5f099..863951f07 100644 --- a/libc/stdlib/lrand48.c +++ b/libc/stdlib/lrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define nrand48_r __nrand48_r - #include <stdlib.h> +libc_hidden_proto(nrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/lrand48_r.c b/libc/stdlib/lrand48_r.c index 0ff1ef25e..46e99c1e6 100644 --- a/libc/stdlib/lrand48_r.c +++ b/libc/stdlib/lrand48_r.c @@ -17,11 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define nrand48_r __nrand48_r - #include <stdlib.h> -int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result) +libc_hidden_proto(nrand48_r) + +int lrand48_r (struct drand48_data *buffer, long int *result) { /* Be generous for the arguments, detect some errors. */ if (buffer == NULL) @@ -29,4 +29,5 @@ int attribute_hidden __lrand48_r (struct drand48_data *buffer, long int *result) return nrand48_r (buffer->__x, buffer, result); } -strong_alias(__lrand48_r,lrand48_r) +libc_hidden_proto(lrand48_r) +libc_hidden_def(lrand48_r) diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 5a208bf28..595142526 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -6,9 +6,6 @@ * Parts of the memalign code were stolen from malloc-930716. */ -#define mmap __mmap -#define munmap __munmap - #define _GNU_SOURCE #include <features.h> #include <unistd.h> @@ -19,6 +16,10 @@ #include <errno.h> #include <sys/mman.h> +libc_hidden_proto(memcpy) +/*libc_hidden_proto(memset)*/ +libc_hidden_proto(mmap) +libc_hidden_proto(munmap) #ifdef L_malloc void *malloc(size_t size) @@ -67,7 +68,7 @@ void * calloc(size_t nmemb, size_t lsize) * doesn't need to actually zero anything.... */ if (result != NULL) { - __memset(result, 0, size); + memset(result, 0, size); } #endif return result; @@ -88,7 +89,7 @@ void *realloc(void *ptr, size_t size) newptr = malloc(size); if (newptr) { - __memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); + memcpy(newptr, ptr, *((size_t *) (ptr - sizeof(size_t)))); free(ptr); } return newptr; diff --git a/libc/stdlib/malloc-standard/calloc.c b/libc/stdlib/malloc-standard/calloc.c index b8c43d9dc..99e8884ad 100644 --- a/libc/stdlib/malloc-standard/calloc.c +++ b/libc/stdlib/malloc-standard/calloc.c @@ -16,6 +16,7 @@ #include "malloc.h" +libc_hidden_proto(memset) /* ------------------------------ calloc ------------------------------ */ void* calloc(size_t n_elements, size_t elem_size) @@ -54,7 +55,7 @@ void* calloc(size_t n_elements, size_t elem_size) assert(nclears >= 3); if (nclears > 9) - __memset(d, 0, clearsize); + memset(d, 0, clearsize); else { *(d+0) = 0; @@ -83,7 +84,7 @@ void* calloc(size_t n_elements, size_t elem_size) d = (size_t*)mem; /* Note the additional (sizeof(size_t)) */ clearsize = chunksize(p) - 2*(sizeof(size_t)); - __memset(d, 0, clearsize); + memset(d, 0, clearsize); } #endif } diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c index 1b294d706..cfc937c60 100644 --- a/libc/stdlib/malloc-standard/free.c +++ b/libc/stdlib/malloc-standard/free.c @@ -14,10 +14,9 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define munmap __munmap - #include "malloc.h" +libc_hidden_proto(munmap) /* ------------------------- __malloc_trim ------------------------- __malloc_trim is an inverse of sorts to __malloc_alloc. It gives memory diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c index 029ceda1f..8a09487c2 100644 --- a/libc/stdlib/malloc-standard/mallinfo.c +++ b/libc/stdlib/malloc-standard/mallinfo.c @@ -16,9 +16,10 @@ #include "malloc.h" +libc_hidden_proto(fprintf) /* ------------------------------ mallinfo ------------------------------ */ -struct mallinfo attribute_hidden __mallinfo(void) +struct mallinfo mallinfo(void) { mstate av; struct mallinfo mi; @@ -78,7 +79,8 @@ struct mallinfo attribute_hidden __mallinfo(void) UNLOCK; return mi; } -strong_alias(__mallinfo,mallinfo) +libc_hidden_proto(mallinfo) +libc_hidden_def(mallinfo) void malloc_stats(FILE *file) { @@ -88,7 +90,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 68d38cb3d..6c3067e5d 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -14,10 +14,6 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define mmap __mmap -#define sysconf __sysconf -#define sbrk __sbrk - #include <features.h> #include <stddef.h> #include <unistd.h> @@ -25,7 +21,12 @@ #include <string.h> #include <malloc.h> #include <stdlib.h> +#include <sys/mman.h> +libc_hidden_proto(mmap) +libc_hidden_proto(sysconf) +libc_hidden_proto(sbrk) +libc_hidden_proto(abort) #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c index 36bfe4d99..ae2d33bee 100644 --- a/libc/stdlib/malloc-standard/realloc.c +++ b/libc/stdlib/malloc-standard/realloc.c @@ -14,11 +14,10 @@ Hacked up for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define mremap __mremap - #include "malloc.h" - +libc_hidden_proto(mremap) +libc_hidden_proto(memcpy) /* ------------------------------ realloc ------------------------------ */ void* realloc(void* oldmem, size_t bytes) @@ -128,7 +127,7 @@ void* realloc(void* oldmem, size_t bytes) assert(ncopies >= 3); if (ncopies > 9) - __memcpy(d, s, copysize); + memcpy(d, s, copysize); else { *(d+0) = *(s+0); @@ -228,7 +227,7 @@ void* realloc(void* oldmem, size_t bytes) /* Must alloc, copy, free. */ newmem = malloc(nb - MALLOC_ALIGN_MASK); if (newmem != 0) { - __memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); + memcpy(newmem, oldmem, oldsize - 2*(sizeof(size_t))); free(oldmem); } } diff --git a/libc/stdlib/malloc/calloc.c b/libc/stdlib/malloc/calloc.c index 94031ce29..5925a9e0a 100644 --- a/libc/stdlib/malloc/calloc.c +++ b/libc/stdlib/malloc/calloc.c @@ -22,6 +22,8 @@ #include <string.h> #include <errno.h> +libc_hidden_proto(memset) + void * calloc(size_t nmemb, size_t lsize) { void *result; @@ -34,7 +36,7 @@ void * calloc(size_t nmemb, size_t lsize) return NULL; } if ((result=malloc(size)) != NULL) { - __memset(result, 0, size); + memset(result, 0, size); } return result; } diff --git a/libc/stdlib/malloc/free.c b/libc/stdlib/malloc/free.c index 81ec38cd9..81c718376 100644 --- a/libc/stdlib/malloc/free.c +++ b/libc/stdlib/malloc/free.c @@ -11,17 +11,16 @@ * Written by Miles Bader <miles@gnu.org> */ -#define munmap __munmap -#define sbrk __sbrk - #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> +libc_hidden_proto(munmap) +libc_hidden_proto(sbrk) + #include "malloc.h" #include "heap.h" - static void free_to_heap (void *mem, struct heap *heap) { diff --git a/libc/stdlib/malloc/heap_debug.c b/libc/stdlib/malloc/heap_debug.c index 7dab95627..9e5b61c43 100644 --- a/libc/stdlib/malloc/heap_debug.c +++ b/libc/stdlib/malloc/heap_debug.c @@ -11,13 +11,14 @@ * Written by Miles Bader <miles@gnu.org> */ -#define vfprintf __vfprintf - #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <string.h> +libc_hidden_proto(vfprintf) +libc_hidden_proto(fprintf) + #include "malloc.h" #include "heap.h" diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c index 6bc8d8773..329788aec 100644 --- a/libc/stdlib/malloc/malloc.c +++ b/libc/stdlib/malloc/malloc.c @@ -11,14 +11,14 @@ * Written by Miles Bader <miles@gnu.org> */ -#define mmap __mmap -#define sbrk __sbrk - #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <sys/mman.h> +libc_hidden_proto(mmap) +libc_hidden_proto(sbrk) + #include "malloc.h" #include "heap.h" diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 707cad13d..9360eecda 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -16,6 +16,7 @@ /* The system pagesize... */ extern size_t __pagesize; +libc_hidden_proto(__pagesize) #define MALLOC_PAGE_SIZE __pagesize /* The minimum size of block we request from the the system to extend the diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index abe5546ca..6c74d78bb 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -11,14 +11,16 @@ * Written by Miles Bader <miles@gnu.org> */ -#define atoi __atoi -#define vfprintf __vfprintf - #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <stdarg.h> +libc_hidden_proto(atoi) +libc_hidden_proto(vfprintf) +libc_hidden_proto(putc) +libc_hidden_proto(getenv) + #include "malloc.h" #include "heap.h" @@ -42,7 +44,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) while (spaces > 0) { - __putc (' ', stderr); + putc (' ', stderr); spaces--; } @@ -50,7 +52,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) vfprintf (stderr, fmt, val); va_end (val); - __putc ('\n', stderr); + putc ('\n', stderr); __malloc_debug_indent (indent); } @@ -58,7 +60,7 @@ __malloc_debug_printf (int indent, const char *fmt, ...) void __malloc_debug_init (void) { - char *ev = __getenv ("MALLOC_DEBUG"); + char *ev = getenv ("MALLOC_DEBUG"); if (ev) { int val = atoi (ev); diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 8dcc35360..0cf83e2bd 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -15,6 +15,8 @@ #include <string.h> #include <errno.h> +libc_hidden_proto(memcpy) + #include "malloc.h" #include "heap.h" @@ -66,7 +68,7 @@ realloc (void *mem, size_t new_size) void *new_mem = malloc (new_size - MALLOC_HEADER_SIZE); if (new_mem) { - __memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); + memcpy (new_mem, mem, size - MALLOC_HEADER_SIZE); free (mem); } mem = new_mem; diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c index a4667e346..6905545bd 100644 --- a/libc/stdlib/mrand48.c +++ b/libc/stdlib/mrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define jrand48_r __jrand48_r - #include <stdlib.h> +libc_hidden_proto(jrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/mrand48_r.c b/libc/stdlib/mrand48_r.c index f79e5f887..ca2bd7bbb 100644 --- a/libc/stdlib/mrand48_r.c +++ b/libc/stdlib/mrand48_r.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define jrand48_r __jrand48_r - #include <stdlib.h> +libc_hidden_proto(jrand48_r) + int mrand48_r (struct drand48_data *buffer, long int *result) { /* Be generous for the arguments, detect some errors. */ diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c index 6e161bcec..0199a30a5 100644 --- a/libc/stdlib/nrand48.c +++ b/libc/stdlib/nrand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define nrand48_r __nrand48_r - #include <stdlib.h> +libc_hidden_proto(nrand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c index f72c07030..6f8afdb77 100644 --- a/libc/stdlib/nrand48_r.c +++ b/libc/stdlib/nrand48_r.c @@ -22,7 +22,7 @@ extern int __drand48_iterate(unsigned short xsubi[3], struct drand48_data *buffer) attribute_hidden; -int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) +int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ if (__drand48_iterate (xsubi, buffer) < 0) @@ -36,4 +36,5 @@ int attribute_hidden __nrand48_r (unsigned short int xsubi[3], struct drand48_da return 0; } -strong_alias(__nrand48_r,nrand48_r) +libc_hidden_proto(nrand48_r) +libc_hidden_def(nrand48_r) diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 8e18e3989..8580143b9 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define isatty __isatty - #define _ISOC99_SOURCE #include <stdio.h> #include <errno.h> @@ -32,6 +30,13 @@ #include <unistd.h> #include <bits/uClibc_uintmaxtostr.h> +libc_hidden_proto(strcat) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(isatty) +libc_hidden_proto(ioctl) +libc_hidden_proto(fstat) +libc_hidden_proto(stat) #if !defined __UNIX98PTY_ONLY__ @@ -64,7 +69,7 @@ extern const char __libc_ptyname2[] attribute_hidden; /* Store at most BUFLEN characters of the pathname of the slave pseudo terminal associated with the master FD is open on in BUF. Return 0 on success, otherwise an error number. */ -int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) +int ptsname_r (int fd, char *buf, size_t buflen) { int save_errno = errno; #if !defined __UNIX98PTY_ONLY__ @@ -88,7 +93,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]; @@ -103,8 +108,8 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) return ERANGE; } - __strcpy (buf, devpts); - __strcat (buf, p); + strcpy (buf, devpts); + strcat (buf, p); /* Note: Don't bother with stat on the slave name and checking the driver's major device number - the ioctl above succeeded so we know the fd was a Unix'98 master and the /dev/pts/ prefix @@ -130,13 +135,13 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) { char *p; - if (buflen < __strlen (_PATH_TTY) + 3) + if (buflen < strlen (_PATH_TTY) + 3) { errno = ERANGE; return ERANGE; } - if (__fstat (fd, &st) < 0) + if (fstat (fd, &st) < 0) return errno; /* Check if FD really is a master pseudo terminal. */ @@ -152,20 +157,20 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) if (major (st.st_rdev) == 4) ptyno -= 128; - if (ptyno / 16 >= __strlen (__libc_ptyname1)) + if (ptyno / 16 >= strlen (__libc_ptyname1)) { errno = ENOTTY; return ENOTTY; } - __strcpy (buf, _PATH_TTY); - p = buf + __strlen (buf); + strcpy (buf, _PATH_TTY); + p = buf + strlen (buf); p[0] = __libc_ptyname1[ptyno / 16]; p[1] = __libc_ptyname2[ptyno % 16]; p[2] = '\0'; } - if (__stat(buf, &st) < 0) + if (stat(buf, &st) < 0) return errno; /* Check if the name we're about to return really corresponds to a @@ -181,7 +186,8 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) errno = save_errno; return 0; } -strong_alias(__ptsname_r,ptsname_r) +libc_hidden_proto(ptsname_r) +libc_hidden_def(ptsname_r) /* Return the pathname of the pseudo terminal slave assoicated with the master FD is open on, or NULL on errors. @@ -191,5 +197,5 @@ ptsname (int fd) { static char buffer[sizeof (_PATH_DEVPTS) + 20]; - return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer; + return ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer; } diff --git a/libc/stdlib/rand.c b/libc/stdlib/rand.c index a4c739c18..cdf58ecc7 100644 --- a/libc/stdlib/rand.c +++ b/libc/stdlib/rand.c @@ -17,10 +17,10 @@ * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. */ -#define random __random - #include <stdlib.h> +libc_hidden_proto(random) + int rand (void) { return((int)random()); diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c index eb146098a..115ff2162 100644 --- a/libc/stdlib/random.c +++ b/libc/stdlib/random.c @@ -22,17 +22,17 @@ * Rewritten to use reentrant functions by Ulrich Drepper, 1995. */ -#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> #include <limits.h> #include <stddef.h> #include <stdlib.h> +libc_hidden_proto(random_r) +libc_hidden_proto(srandom_r) +libc_hidden_proto(setstate_r) +libc_hidden_proto(initstate_r) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> /* POSIX.1c requires that there is mutual exclusion for the `rand' and @@ -191,7 +191,7 @@ void srandom (unsigned int x) srandom_r (x, &unsafe_state); __pthread_mutex_unlock(&lock); } -weak_alias (srandom, srand) +strong_alias(srandom,srand) /* Initialize the state information in the given array of N bytes for future random number generation. Based on the number of bytes we @@ -246,7 +246,7 @@ char * setstate (char *arg_state) rear pointers can't wrap on the same call by not testing the rear pointer if the front one has wrapped. Returns a 31-bit random number. */ -long int attribute_hidden __random (void) +long int random (void) { int32_t retval; @@ -255,4 +255,5 @@ long int attribute_hidden __random (void) __pthread_mutex_unlock(&lock); return retval; } -strong_alias(__random,random) +libc_hidden_proto(random) +libc_hidden_def(random) diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c index b10f29519..67234048b 100644 --- a/libc/stdlib/random_r.c +++ b/libc/stdlib/random_r.c @@ -134,7 +134,7 @@ static const struct random_poly_info random_poly_info = rear pointers can't wrap on the same call by not testing the rear pointer if the front one has wrapped. Returns a 31-bit random number. */ -int attribute_hidden __random_r(struct random_data *buf, int32_t *result) +int random_r(struct random_data *buf, int32_t *result) { int32_t *state; @@ -181,7 +181,8 @@ fail: __set_errno (EINVAL); return -1; } -strong_alias(__random_r,random_r) +libc_hidden_proto(random_r) +libc_hidden_def(random_r) /* Initialize the random number generator based on the given seed. If the type is the trivial no-state-information type, just remember the seed. @@ -191,7 +192,7 @@ strong_alias(__random_r,random_r) information a given number of times to get rid of any initial dependencies introduced by the L.C.R.N.G. Note that the initialization of randtbl[] for default usage relies on values produced by this routine. */ -int attribute_hidden __srandom_r (unsigned int seed, struct random_data *buf) +int srandom_r (unsigned int seed, struct random_data *buf) { int type; int32_t *state; @@ -236,7 +237,7 @@ int attribute_hidden __srandom_r (unsigned int seed, struct random_data *buf) while (--kc >= 0) { int32_t discard; - (void) __random_r (buf, &discard); + (void) random_r (buf, &discard); } done: @@ -245,7 +246,8 @@ done: fail: return -1; } -strong_alias(__srandom_r,srandom_r) +libc_hidden_proto(srandom_r) +libc_hidden_def(srandom_r) /* Initialize the state information in the given array of N bytes for future random number generation. Based on the number of bytes we @@ -258,7 +260,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 attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf) +int initstate_r (unsigned int seed, char *arg_state, size_t n, struct random_data *buf) { int type; int degree; @@ -294,7 +296,7 @@ int attribute_hidden __initstate_r (unsigned int seed, char *arg_state, size_t n buf->state = state; - __srandom_r (seed, buf); + srandom_r (seed, buf); state[-1] = TYPE_0; if (type != TYPE_0) @@ -306,7 +308,8 @@ fail: __set_errno (EINVAL); return -1; } -strong_alias(__initstate_r,initstate_r) +libc_hidden_proto(initstate_r) +libc_hidden_def(initstate_r) /* Restore the state from the given state array. Note: It is important that we also remember the locations of the pointers @@ -316,7 +319,7 @@ strong_alias(__initstate_r,initstate_r) to the order in which things are done, it is OK to call setstate with the same state as the current state Returns a pointer to the old state information. */ -int attribute_hidden __setstate_r (char *arg_state, struct random_data *buf) +int setstate_r (char *arg_state, struct random_data *buf) { int32_t *new_state = 1 + (int32_t *) arg_state; int type; @@ -359,4 +362,5 @@ fail: __set_errno (EINVAL); return -1; } -strong_alias(__setstate_r,setstate_r) +libc_hidden_proto(setstate_r) +libc_hidden_def(setstate_r) diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index 88677f7a7..f82676709 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -1,21 +1,11 @@ /* * realpath.c -- canonicalize pathname by removing symlinks * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com> + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program 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 Public License for more details. + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#define readlink __readlink -#define getcwd __getcwd - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -31,6 +21,12 @@ #include <sys/stat.h> /* for S_IFLNK */ +libc_hidden_proto(strcat) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(readlink) +libc_hidden_proto(getcwd) + #ifndef PATH_MAX #ifdef _POSIX_VERSION #define PATH_MAX _POSIX_PATH_MAX @@ -62,11 +58,11 @@ char resolved_path[]; int n; /* Make a copy of the source path since we may need to modify it. */ - if (__strlen(path) >= PATH_MAX - 2) { + if (strlen(path) >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } - __strcpy(copy_path, path); + strcpy(copy_path, path); path = copy_path; max_path = copy_path + PATH_MAX - 2; /* If it's a relative pathname use getwd for starters. */ @@ -78,7 +74,7 @@ char resolved_path[]; #else getwd(new_path); #endif - new_path += __strlen(new_path); + new_path += strlen(new_path); if (new_path[-1] != '/') *new_path++ = '/'; } else { @@ -132,7 +128,7 @@ char resolved_path[]; if (errno != EINVAL) { /* Make sure it's null terminated. */ *new_path = '\0'; - __strcpy(resolved_path, got_path); + strcpy(resolved_path, got_path); return NULL; } } else { @@ -145,13 +141,13 @@ char resolved_path[]; /* Otherwise back up over this component. */ while (*(--new_path) != '/'); /* Safe sex check. */ - if (__strlen(path) + n >= PATH_MAX - 2) { + if (strlen(path) + n >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } /* Insert symlink contents into path. */ - __strcat(link_path, path); - __strcpy(copy_path, link_path); + strcat(link_path, path); + strcpy(copy_path, link_path); path = copy_path; } #endif /* S_IFLNK */ @@ -162,6 +158,6 @@ char resolved_path[]; new_path--; /* Make sure it's null terminated. */ *new_path = '\0'; - __strcpy(resolved_path, got_path); + strcpy(resolved_path, got_path); return resolved_path; } diff --git a/libc/stdlib/seed48.c b/libc/stdlib/seed48.c index eec56cd21..f068b980d 100644 --- a/libc/stdlib/seed48.c +++ b/libc/stdlib/seed48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define seed48_r __seed48_r - #include <stdlib.h> +libc_hidden_proto(seed48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/seed48_r.c b/libc/stdlib/seed48_r.c index d1c74f24c..a6da03015 100644 --- a/libc/stdlib/seed48_r.c +++ b/libc/stdlib/seed48_r.c @@ -21,10 +21,12 @@ #include <string.h> #include <limits.h> -int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer) +libc_hidden_proto(memcpy) + +int seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer) { /* Save old value at a private place to be used as return value. */ - __memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); + memcpy (buffer->__old_x, buffer->__x, sizeof (buffer->__x)); /* Install new state. */ buffer->__x[2] = seed16v[2]; @@ -36,4 +38,5 @@ int attribute_hidden __seed48_r (unsigned short int seed16v[3], struct drand48_d return 0; } -strong_alias(__seed48_r,seed48_r) +libc_hidden_proto(seed48_r) +libc_hidden_def(seed48_r) diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 413ebed9e..5c19143d1 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -19,8 +19,6 @@ modified for uClibc by Erik Andersen <andersen@codepoet.org> */ -#define strndup __strndup - #define _GNU_SOURCE #include <features.h> #include <errno.h> @@ -28,6 +26,13 @@ #include <string.h> #include <unistd.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(strncmp) +libc_hidden_proto(strndup) +libc_hidden_proto(unsetenv) + #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; @@ -35,7 +40,6 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) -extern int __unsetenv (__const char *__name) attribute_hidden; /* If this variable is not a null pointer we allocated the current environment. */ @@ -53,8 +57,8 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, { register char **ep; register size_t size; - const size_t namelen = __strlen (name); - const size_t vallen = value != NULL ? __strlen (value) + 1 : 0; + const size_t namelen = strlen (name); + const size_t vallen = value != NULL ? strlen (value) + 1 : 0; LOCK; @@ -65,7 +69,7 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) { - if (!__strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') break; else ++size; @@ -97,13 +101,13 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, return -1; } - __memcpy (new_environ[size], name, namelen); + memcpy (new_environ[size], name, namelen); new_environ[size][namelen] = '='; - __memcpy (&new_environ[size][namelen + 1], value, vallen); + memcpy (&new_environ[size][namelen + 1], value, vallen); } if (__environ != last_environ) { - __memcpy ((char *) new_environ, (char *) __environ, + memcpy ((char *) new_environ, (char *) __environ, size * sizeof (char *)); } @@ -121,9 +125,9 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, UNLOCK; return -1; } - __memcpy (np, name, namelen); + memcpy (np, name, namelen); np[namelen] = '='; - __memcpy (&np[namelen + 1], value, vallen); + memcpy (&np[namelen + 1], value, vallen); } *ep = np; } @@ -132,27 +136,28 @@ int attribute_hidden __add_to_environ (const char *name, const char *value, return 0; } -int attribute_hidden __setenv (const char *name, const char *value, int replace) +int setenv (const char *name, const char *value, int replace) { return __add_to_environ (name, value, NULL, replace); } -strong_alias(__setenv,setenv) +libc_hidden_proto(setenv) +libc_hidden_def(setenv) -int attribute_hidden __unsetenv (const char *name) +int unsetenv (const char *name) { size_t len; char **ep; - if (name == NULL || *name == '\0' || __strchr (name, '=') != NULL) { + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } - len = __strlen (name); + len = strlen (name); LOCK; ep = __environ; while (*ep != NULL) { - if (!__strncmp (*ep, name, len) && (*ep)[len] == '=') { + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { /* Found it. Remove this pointer by moving later ones back. */ char **dp = ep; do { @@ -166,7 +171,8 @@ int attribute_hidden __unsetenv (const char *name) UNLOCK; return 0; } -strong_alias(__unsetenv,unsetenv) +libc_hidden_proto(unsetenv) +libc_hidden_def(unsetenv) /* The `clearenv' was planned to be added to POSIX.1 but probably never made it. Nevertheless the POSIX.9 standard (POSIX bindings @@ -189,7 +195,7 @@ int clearenv (void) int putenv (char *string) { int result; - const char *const name_end = __strchr (string, '='); + const char *const name_end = strchr (string, '='); if (name_end != NULL) { char *name = strndup(string, name_end - string); @@ -197,7 +203,7 @@ int putenv (char *string) free(name); return(result); } - __unsetenv (string); + unsetenv (string); return 0; } diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c index 26def8e49..42e90c9f9 100644 --- a/libc/stdlib/srand48.c +++ b/libc/stdlib/srand48.c @@ -17,10 +17,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define srand48_r __srand48_r - #include <stdlib.h> +libc_hidden_proto(srand48_r) + /* Global state for non-reentrant functions. Defined in drand48-iter.c. */ extern struct drand48_data __libc_drand48_data attribute_hidden; diff --git a/libc/stdlib/srand48_r.c b/libc/stdlib/srand48_r.c index d2f959c79..5f9cf1da3 100644 --- a/libc/stdlib/srand48_r.c +++ b/libc/stdlib/srand48_r.c @@ -20,7 +20,7 @@ #include <stdlib.h> #include <limits.h> -int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer) +int srand48_r (long int seedval, struct drand48_data *buffer) { /* The standards say we only have 32 bits. */ if (sizeof (long int) > 4) @@ -36,4 +36,5 @@ int attribute_hidden __srand48_r (long int seedval, struct drand48_data *buffer) return 0; } -strong_alias(__srand48_r,srand48_r) +libc_hidden_proto(srand48_r) +libc_hidden_def(srand48_r) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 8203881a4..42ebaa47b 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -32,14 +32,6 @@ * Add wscto{inttype} functions. */ -#define wcsrtombs __wcsrtombs -#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... */ #define _GNU_SOURCE #include <limits.h> @@ -73,13 +65,11 @@ #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_DO_XLOCALE +libc_hidden_proto(isspace_l) +#else +libc_hidden_proto(isspace) +#endif #ifdef __UCLIBC_HAS_WCHAR__ @@ -87,6 +77,12 @@ extern long long int __strtoll (__const char *__restrict __nptr, #include <wctype.h> #include <bits/uClibc_uwchar.h> +#ifdef __UCLIBC_DO_XLOCALE +libc_hidden_proto(iswspace_l) +#else +libc_hidden_proto(iswspace) +#endif + #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> #endif /* __UCLIBC_HAS_XLOCALE__ */ @@ -150,26 +146,26 @@ extern long long int __strtoll (__const char *__restrict __nptr, extern unsigned long _stdlib_strto_l_l(register const char * __restrict str, char ** __restrict endptr, int base, int sflag, - __locale_t locale_arg); + __locale_t locale_arg) attribute_hidden; #if defined(ULLONG_MAX) extern unsigned long long _stdlib_strto_ll_l(register const char * __restrict str, char ** __restrict endptr, int base, int sflag, - __locale_t locale_arg); + __locale_t locale_arg) attribute_hidden; #endif #ifdef __UCLIBC_HAS_WCHAR__ extern unsigned long _stdlib_wcsto_l_l(register const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base, int sflag, - __locale_t locale_arg); + __locale_t locale_arg) attribute_hidden; #if defined(ULLONG_MAX) extern unsigned long long _stdlib_wcsto_ll_l(register const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base, int sflag, - __locale_t locale_arg); + __locale_t locale_arg) attribute_hidden; #endif #endif /* __UCLIBC_HAS_WCHAR__ */ @@ -179,35 +175,33 @@ _stdlib_wcsto_ll_l(register const wchar_t * __restrict str, extern unsigned long _stdlib_strto_l(register const char * __restrict str, - char ** __restrict endptr, int base, int sflag); + char ** __restrict endptr, int base, int sflag) attribute_hidden; #if defined(ULLONG_MAX) extern unsigned long long _stdlib_strto_ll(register const char * __restrict str, - char ** __restrict endptr, int base, int sflag); + char ** __restrict endptr, int base, int sflag) attribute_hidden; #endif #ifdef __UCLIBC_HAS_WCHAR__ extern unsigned long _stdlib_wcsto_l(register const wchar_t * __restrict str, - wchar_t ** __restrict endptr, int base, int sflag); + wchar_t ** __restrict endptr, int base, int sflag) attribute_hidden; #if defined(ULLONG_MAX) extern unsigned long long _stdlib_wcsto_ll(register const wchar_t * __restrict str, - wchar_t ** __restrict endptr, int base, int sflag); + wchar_t ** __restrict endptr, int base, int sflag) attribute_hidden; #endif #endif /* __UCLIBC_HAS_WCHAR__ */ /**********************************************************************/ #ifdef L_atof -extern double __strtod (__const char *__restrict __nptr, - char **__restrict __endptr) - __THROW __nonnull ((1)) __wur attribute_hidden; +libc_hidden_proto(strtod) double atof(const char *nptr) { - return __strtod(nptr, (char **) NULL); + return strtod(nptr, (char **) NULL); } #endif @@ -267,9 +261,11 @@ strong_alias(llabs,imaxabs) #if INT_MAX < LONG_MAX -int attribute_hidden __atoi(const char *nptr) +libc_hidden_proto(strtol) + +int atoi(const char *nptr) { - return (int) __strtol(nptr, (char **) NULL, 10); + return (int) strtol(nptr, (char **) NULL, 10); } strong_alias(__atoi,atoi) @@ -279,19 +275,23 @@ strong_alias(__atoi,atoi) /**********************************************************************/ #ifdef L_atol -long attribute_hidden __atol(const char *nptr) +libc_hidden_proto(strtol) + +long atol(const char *nptr) { - return __strtol(nptr, (char **) NULL, 10); + return strtol(nptr, (char **) NULL, 10); } -strong_alias(__atol,atol) +libc_hidden_proto(atol) +libc_hidden_def(atol) #if UINT_MAX == ULONG_MAX -hidden_strong_alias(__atol,__atoi) -strong_alias(__atol,atoi) +strong_alias(atol,atoi) +libc_hidden_proto(atoi) +libc_hidden_def(atoi) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(__atol,atoll) +strong_alias(atol,atoll) #endif #endif @@ -300,9 +300,11 @@ strong_alias(__atol,atoll) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) +libc_hidden_proto(strtoll) + 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) */ @@ -311,20 +313,22 @@ long long atoll(const char *nptr) /**********************************************************************/ #if defined(L_strtol) || defined(L_strtol_l) -long attribute_hidden __UCXL(strtol)(const char * __restrict str, char ** __restrict endptr, +long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(strtol)) +libc_hidden_def(__XL_NPP(strtol)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtol_l) strong_alias(strtol,strtoimax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(__XL(strtol),__XL(strtoll)) +strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll)) +libc_hidden_proto(__XL_NPP(strtoll)) +libc_hidden_def(__XL_NPP(strtoll)) #endif #endif @@ -333,15 +337,15 @@ strong_alias(__XL(strtol),__XL(strtoll)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -long long attribute_hidden __UCXL(strtoll)(const char * __restrict str, +long long __XL_NPP(strtoll)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM ) { return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1 __LOCALE_ARG ); } - -__UCXL_ALIAS(strtoll) +libc_hidden_proto(__XL_NPP(strtoll)) +libc_hidden_def(__XL_NPP(strtoll)) #if !defined(L_strtoll_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -356,21 +360,23 @@ strong_alias(strtoll,strtoq) /**********************************************************************/ #if defined(L_strtoul) || defined(L_strtoul_l) -unsigned long attribute_hidden __UCXL(strtoul)(const char * __restrict str, +unsigned long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(strtoul)) +libc_hidden_def(__XL_NPP(strtoul)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_strtoul_l) strong_alias(strtoul,strtoumax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(__XL(strtoul),__XL(strtoull)) +strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull)) +libc_hidden_proto(__XL_NPP(strtoull)) +libc_hidden_def(__XL_NPP(strtoull)) #endif @@ -380,14 +386,14 @@ strong_alias(__XL(strtoul),__XL(strtoull)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -unsigned long long attribute_hidden __UCXL(strtoull)(const char * __restrict str, +unsigned long long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(strtoull)) +libc_hidden_def(__XL_NPP(strtoull)) #if !defined(L_strtoull_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -721,10 +727,10 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc /**********************************************************************/ /* Made _Exit() an alias for _exit(), as per C99. */ /* #ifdef L__Exit */ - +/* libc_hidden_proto(_exit) */ /* void _Exit(int status) */ /* { */ -/* _exit_internal(status); */ +/* _exit(status); */ /* } */ /* #endif */ @@ -769,7 +775,7 @@ void *bsearch(const void *key, const void *base, size_t /* nmemb */ high, * calculation, as well as to reduce the generated code size with * bcc and gcc. */ -void attribute_hidden __qsort (void *base, +void qsort (void *base, size_t nel, size_t width, int (*comp)(const void *, const void *)) @@ -814,7 +820,8 @@ void attribute_hidden __qsort (void *base, } while (wgap); } } -strong_alias(__qsort,qsort) +libc_hidden_proto(qsort) +libc_hidden_def(qsort) /* ---------- original snippets version below ---------- */ @@ -868,7 +875,7 @@ void ssort (void *base, /**********************************************************************/ #ifdef L__stdlib_mb_cur_max -size_t attribute_hidden _stdlib_mb_cur_max_internal(void) +size_t _stdlib_mb_cur_max(void) { #ifdef __CTYPE_HAS_UTF_8_LOCALES return __UCLIBC_CURLOCALE_DATA.mb_cur_max; @@ -881,12 +888,15 @@ size_t attribute_hidden _stdlib_mb_cur_max_internal(void) return 1; #endif } -strong_alias(_stdlib_mb_cur_max_internal,_stdlib_mb_cur_max) +libc_hidden_proto(_stdlib_mb_cur_max) +libc_hidden_def(_stdlib_mb_cur_max) #endif /**********************************************************************/ #ifdef L_mblen +libc_hidden_proto(mbrlen) + int mblen(register const char *s, size_t n) { static mbstate_t state; @@ -913,6 +923,8 @@ int mblen(register const char *s, size_t n) /**********************************************************************/ #ifdef L_mbtowc +libc_hidden_proto(mbrtowc) + int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n) { static mbstate_t state; @@ -941,6 +953,8 @@ int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n) /* Note: We completely ignore state in all currently supported conversions. */ +libc_hidden_proto(wcrtomb) + int wctomb(register char *__restrict s, wchar_t swc) { return (!s) @@ -957,6 +971,8 @@ int wctomb(register char *__restrict s, wchar_t swc) /**********************************************************************/ #ifdef L_mbstowcs +libc_hidden_proto(mbsrtowcs) + size_t mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n) { mbstate_t state; @@ -972,6 +988,8 @@ size_t mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n) /* Note: We completely ignore state in all currently supported conversions. */ +libc_hidden_proto(wcsrtombs) + size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) { const wchar_t *e = pwcs; /* Needed because of restrict. */ @@ -983,20 +1001,22 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) /**********************************************************************/ #if defined(L_wcstol) || defined(L_wcstol_l) -long __UCXL(wcstol)(const wchar_t * __restrict str, +long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(wcstol)) +libc_hidden_def(__XL_NPP(wcstol)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l) strong_alias(wcstol,wcstoimax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(__XL(wcstol),__XL(wcstoll)) +strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll)) +libc_hidden_proto(__XL_NPP(wcstoll) +libc_hidden_def(__XL_NPP(wcstoll) #endif #endif @@ -1005,15 +1025,15 @@ strong_alias(__XL(wcstol),__XL(wcstoll)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -long long attribute_hidden __UCXL(wcstoll)(const wchar_t * __restrict str, +long long __XL_NPP(wcstoll)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM ) { return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1 __LOCALE_ARG ); } - -__UCXL_ALIAS(wcstoll) +libc_hidden_proto(__XL_NPP(wcstoll)) +libc_hidden_def(__XL_NPP(wcstoll)) #if !defined(L_wcstoll_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -1028,21 +1048,23 @@ strong_alias(wcstoll,wcstoq) /**********************************************************************/ #if defined(L_wcstoul) || defined(L_wcstoul_l) -unsigned long attribute_hidden __UCXL(wcstoul)(const wchar_t * __restrict str, +unsigned long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(wcstoul)) +libc_hidden_def(__XL_NPP(wcstoul)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l) strong_alias(wcstoul,wcstoumax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(__XL(wcstoul),__XL(wcstoull)) +strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull)) +libc_hidden_proto(__XL_NPP(wcstoull)) +libc_hidden_def(__XL_NPP(wcstoull)) #endif #endif @@ -1051,14 +1073,14 @@ strong_alias(__XL(wcstoul),__XL(wcstoull)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -unsigned long long attribute_hidden __UCXL(wcstoull)(const wchar_t * __restrict str, +unsigned long long __XL_NPP(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) +libc_hidden_proto(__XL_NPP(wcstoull)) +libc_hidden_def(__XL_NPP(wcstoull)) #if !defined(L_wcstoull_l) #if (ULLONG_MAX == UINTMAX_MAX) diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c index 3a5adcd4e..cdb50fb75 100644 --- a/libc/stdlib/strtod.c +++ b/libc/stdlib/strtod.c @@ -95,9 +95,6 @@ /**********************************************************************/ -#define iswspace __iswspace -#define iswspace_l __iswspace_l - #define _ISOC99_SOURCE 1 #define _GNU_SOURCE #include <stdlib.h> @@ -122,8 +119,6 @@ #include <xlocale.h> #endif /* __UCLIBC_HAS_XLOCALE__ */ - - /* Handle _STRTOD_HEXADECIMAL_FLOATS via uClibc config now. */ #undef _STRTOD_HEXADECIMAL_FLOATS #ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__ @@ -213,6 +208,8 @@ __fpmax_t attribute_hidden __strtofpmax(const Wchar *str, Wchar **endptr, int ex #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ +libc_hidden_proto(memcmp) + __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_power __LOCALE_PARAM ) { @@ -317,7 +314,7 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp goto LOOP; } #else - if (!pos0 && !__memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ + if (!pos0 && !memcmp(pos, decpt, decpt_len)) { /* First decimal point? */ pos0 = (pos += decpt_len); goto LOOP; } @@ -513,8 +510,6 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x) #if defined(L_wcstof) || defined(L_wcstof_l) #define strtof wcstof #define strtof_l wcstof_l -#define __strtof __wcstof -#define __strtof_l __wcstof_l #define __strtofpmax __wcstofpmax #define __strtofpmax_l __wcstofpmax_l #define Wchar wchar_t @@ -523,7 +518,7 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x) #endif -float attribute_hidden __UCXL(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) +float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 1 return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); @@ -539,8 +534,8 @@ float attribute_hidden __UCXL(strtof)(const Wchar *str, Wchar **endptr __LOCAL return y; #endif } - -__UCXL_ALIAS(strtof) +libc_hidden_proto(__XL_NPP(strtof)) +libc_hidden_def(__XL_NPP(strtof)) #endif #endif @@ -551,8 +546,6 @@ __UCXL_ALIAS(strtof) #if defined(L_wcstod) || defined(L_wcstod_l) #define strtod wcstod #define strtod_l wcstod_l -#define __strtod __wcstod -#define __strtod_l __wcstod_l #define __strtofpmax __wcstofpmax #define __strtofpmax_l __wcstofpmax_l #define Wchar wchar_t @@ -560,7 +553,7 @@ __UCXL_ALIAS(strtof) #define Wchar char #endif -double attribute_hidden __UCXL(strtod)(const Wchar *__restrict str, +double __XL_NPP(strtod)(const Wchar *__restrict str, Wchar **__restrict endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 2 @@ -577,8 +570,8 @@ double attribute_hidden __UCXL(strtod)(const Wchar *__restrict str, return y; #endif } - -__UCXL_ALIAS(strtod) +libc_hidden_proto(__XL_NPP(strtod)) +libc_hidden_def(__XL_NPP(strtod)) #endif #endif @@ -589,8 +582,6 @@ __UCXL_ALIAS(strtod) #if defined(L_wcstold) || defined(L_wcstold_l) #define strtold wcstold #define strtold_l wcstold_l -#define __strtold __wcstold -#define __strtold_l __wcstold_l #define __strtofpmax __wcstofpmax #define __strtofpmax_l __wcstofpmax_l #define Wchar wchar_t @@ -598,7 +589,7 @@ __UCXL_ALIAS(strtod) #define Wchar char #endif -long double attribute_hidden __UCXL(strtold)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) +long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 3 return __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); @@ -614,8 +605,8 @@ long double attribute_hidden __UCXL(strtold)(const Wchar *str, Wchar **endptr return y; #endif } - -__UCXL_ALIAS(strtold) +libc_hidden_proto(__XL_NPP(strtold)) +libc_hidden_def(__XL_NPP(strtold)) #endif #endif diff --git a/libc/stdlib/strtof.c b/libc/stdlib/strtof.c index d25a67d05..15863053e 100644 --- a/libc/stdlib/strtof.c +++ b/libc/stdlib/strtof.c @@ -23,10 +23,10 @@ * 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> +libc_hidden_proto(strtod) + float strtof (const char *str, char **endptr) { return(strtod(str,endptr)); diff --git a/libc/stdlib/strtold.c b/libc/stdlib/strtold.c index 3ef1fc491..ac6cc7e9b 100644 --- a/libc/stdlib/strtold.c +++ b/libc/stdlib/strtold.c @@ -23,10 +23,10 @@ * 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> +libc_hidden_proto(strtod) + long double strtold (const char *str, char **endptr) { return(strtod(str,endptr)); diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index a537156fd..e25831e0b 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -1,8 +1,8 @@ -#define wait4 __wait4 -#define execl __execl -#define signal __signal -#define vfork __vfork -#define fork __fork +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdio.h> #include <stddef.h> @@ -10,6 +10,13 @@ #include <unistd.h> #include <sys/wait.h> +libc_hidden_proto(_exit) +libc_hidden_proto(wait4) +libc_hidden_proto(execl) +libc_hidden_proto(signal) +libc_hidden_proto(vfork) +libc_hidden_proto(fork) + /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ #include <sys/syscall.h> #if ! defined __NR_vfork @@ -40,7 +47,7 @@ int __libc_system(char *command) signal(SIGCHLD, SIG_DFL); execl("/bin/sh", "sh", "-c", command, (char *) 0); - _exit_internal(127); + _exit(127); } /* Signals are not absolutly guarenteed with vfork */ signal(SIGQUIT, SIG_IGN); @@ -58,4 +65,4 @@ int __libc_system(char *command) signal(SIGCHLD, save_chld); return wait_val; } -weak_alias(__libc_system, system) +strong_alias(__libc_system,system) diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 0e7d50a99..f88a54bc0 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -17,16 +17,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define memchr __memchr -#define getgid __getgid -#define getuid __getuid -#define setrlimit __setrlimit -#define waitpid __waitpid -#define dup2 __dup2 -#define chmod __chmod -#define vfork __vfork -#define fork __fork - #include <assert.h> #include <errno.h> #include <grp.h> @@ -40,6 +30,20 @@ #include <unistd.h> #include "pty-private.h" +libc_hidden_proto(memchr) +libc_hidden_proto(getgid) +libc_hidden_proto(getuid) +libc_hidden_proto(setrlimit) +libc_hidden_proto(waitpid) +libc_hidden_proto(dup2) +libc_hidden_proto(chmod) +libc_hidden_proto(chown) +libc_hidden_proto(vfork) +libc_hidden_proto(fork) +libc_hidden_proto(stat) +libc_hidden_proto(ptsname_r) +libc_hidden_proto(execle) +libc_hidden_proto(_exit) /* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ #include <sys/syscall.h> @@ -47,8 +51,6 @@ #define vfork fork #endif -extern int __ptsname_r (int fd, char *buf, size_t buflen) attribute_hidden; - /* Return the result of ptsname_r in the buffer pointed to by PTS, which should be of length BUF_LEN. If it is too long to fit in this buffer, a sufficiently long buffer is allocated using malloc, @@ -65,7 +67,7 @@ pts_name (int fd, char **pts, size_t buf_len) if (buf_len) { - rv = __ptsname_r (fd, buf, buf_len); + rv = ptsname_r (fd, buf, buf_len); if (rv != 0 || memchr (buf, '\0', buf_len)) /* We either got an error, or we succeeded and the @@ -122,7 +124,7 @@ grantpt (int fd) if (pts_name (fd, &buf, sizeof (_buf))) return -1; - if (__stat(buf, &st) < 0) + if (stat(buf, &st) < 0) goto cleanup; /* Make sure that we own the device. */ @@ -168,10 +170,10 @@ grantpt (int fd) /* We pase the master pseudo terminal as file descriptor PTY_FILENO. */ if (fd != PTY_FILENO) if (dup2 (fd, PTY_FILENO) < 0) - _exit_internal (FAIL_EBADF); + _exit (FAIL_EBADF); execle (_PATH_PT_CHOWN, _PATH_PT_CHOWN, NULL, NULL); - _exit_internal (FAIL_EXEC); + _exit (FAIL_EXEC); } else { diff --git a/libc/stdlib/unlockpt.c b/libc/stdlib/unlockpt.c index 3f99c1c0b..8c426553c 100644 --- a/libc/stdlib/unlockpt.c +++ b/libc/stdlib/unlockpt.c @@ -22,6 +22,7 @@ #include <sys/ioctl.h> #include <termios.h> +libc_hidden_proto(ioctl) /* Unlock the slave pseudo terminal associated with the master pseudo terminal specified by FD. */ @@ -32,7 +33,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/stdlib/valloc.c b/libc/stdlib/valloc.c index d4f21d121..13dbe0f67 100644 --- a/libc/stdlib/valloc.c +++ b/libc/stdlib/valloc.c @@ -20,12 +20,12 @@ Cambridge, MA 02139, USA. The author may be reached (Email) at the address mike@@ai.mit.edu, or (US mail) as Mike Haertel c/o Free Software Foundation. */ -#define getpagesize __getpagesize_internal - #include <stdlib.h> #include <unistd.h> #include <malloc.h> +libc_hidden_proto(getpagesize) + static size_t pagesize; __ptr_t valloc (size_t size) diff --git a/libc/string/__glibc_strerror_r.c b/libc/string/__glibc_strerror_r.c index 54955ec25..0f9cd16a9 100644 --- a/libc/string/__glibc_strerror_r.c +++ b/libc/string/__glibc_strerror_r.c @@ -8,12 +8,13 @@ #include <features.h> #include <string.h> -char attribute_hidden *__glibc_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) +libc_hidden_proto(__glibc_strerror_r) +libc_hidden_proto(__xpg_strerror_r) + +char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen) { - __xpg_strerror_r_internal(errnum, strerrbuf, buflen); + __xpg_strerror_r(errnum, strerrbuf, buflen); return strerrbuf; } - -strong_alias(__glibc_strerror_r_internal,__glibc_strerror_r) -/*hidden_weak_alias(__glibc_strerror_r_internal,__strerror_r)*/ +libc_hidden_def(__glibc_strerror_r) diff --git a/libc/string/__xpg_strerror_r.c b/libc/string/__xpg_strerror_r.c index 40e114224..6059cbcbd 100644 --- a/libc/string/__xpg_strerror_r.c +++ b/libc/string/__xpg_strerror_r.c @@ -8,9 +8,14 @@ #define _GNU_SOURCE #include <features.h> #include <errno.h> +#include <string.h> #include <bits/uClibc_uintmaxtostr.h> #include "_syserrmsg.h" +libc_hidden_proto(__xpg_strerror_r) +libc_hidden_proto(memcpy) +libc_hidden_proto(strlen) + #ifdef __UCLIBC_HAS_ERRNO_MESSAGES__ extern const char _string_syserrmsgs[] attribute_hidden; @@ -154,8 +159,7 @@ static const unsigned char estridx[] = { #endif -/* __xpg_strerror_r is used in header */ -int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) +int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) { register char *s; int i, retval; @@ -207,20 +211,20 @@ int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */ s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown); - __memcpy(s, unknown, sizeof(unknown)); + memcpy(s, unknown, sizeof(unknown)); GOT_MESG: if (!strerrbuf) { /* SUSv3 */ buflen = 0; } - i = __strlen(s) + 1; + i = strlen(s) + 1; if (i > buflen) { i = buflen; retval = ERANGE; } if (i) { - __memcpy(strerrbuf, s, i); + memcpy(strerrbuf, s, i); strerrbuf[i-1] = 0; /* In case buf was too small. */ } @@ -233,7 +237,7 @@ int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size #else /* __UCLIBC_HAS_ERRNO_MESSAGES__ */ -int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size_t buflen) +int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen) { register char *s; int i, retval; @@ -243,7 +247,7 @@ int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size }; s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown); - __memcpy(s, unknown, sizeof(unknown)); + memcpy(s, unknown, sizeof(unknown)); if (!strerrbuf) { /* SUSv3 */ buflen = 0; @@ -259,7 +263,7 @@ int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size } if (i) { - __memcpy(strerrbuf, s, i); + memcpy(strerrbuf, s, i); strerrbuf[i-1] = 0; /* In case buf was too small. */ } @@ -269,5 +273,4 @@ int attribute_hidden __xpg_strerror_r_internal(int errnum, char *strerrbuf, size } #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */ - -strong_alias(__xpg_strerror_r_internal,__xpg_strerror_r) +libc_hidden_def(__xpg_strerror_r) diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 35fe7dc1b..5a1f33b82 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -19,19 +19,14 @@ #include <errno.h> #include <assert.h> -extern size_t __strlcpy(char *__restrict dst, const char *__restrict src, - size_t n) attribute_hidden; - +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(strlcpy) #ifdef WANT_WIDE -extern int __wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) attribute_hidden; -extern size_t __wcsxfrm (wchar_t *__restrict __s1, - __const wchar_t *__restrict __s2, size_t __n) attribute_hidden; -#endif -#ifdef __UCLIBC_HAS_XLOCALE__ -extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) attribute_hidden; -extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n, __locale_t __l) attribute_hidden; -extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) attribute_hidden; -extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) attribute_hidden; +libc_hidden_proto(wcsxfrm) +libc_hidden_proto(wcscmp) +#else +libc_hidden_proto(strcmp) #endif #ifdef __UCLIBC_HAS_LOCALE__ @@ -49,13 +44,9 @@ extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, size_t __n, __l #if defined(L_strxfrm) || defined(L_strxfrm_l) #define wcscoll strcoll -#define __wcscoll __strcoll #define wcscoll_l strcoll_l -#define __wcscoll_l __strcoll_l #define wcsxfrm strxfrm -#define __wcsxfrm __strxfrm #define wcsxfrm_l strxfrm_l -#define __wcsxfrm_l __strxfrm_l #undef WANT_WIDE #undef Wvoid @@ -69,17 +60,23 @@ extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, size_t __n, __l #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int attribute_hidden __wcscoll (const Wchar *s0, const Wchar *s1) +libc_hidden_proto(wcscoll_l) + +int wcscoll (const Wchar *s0, const Wchar *s1) { - return __wcscoll_l(s0, s1, __UCLIBC_CURLOCALE ); + return wcscoll_l(s0, s1, __UCLIBC_CURLOCALE ); } -strong_alias(__wcscoll,wcscoll) +libc_hidden_proto(wcscoll) +libc_hidden_def(wcscoll) -size_t attribute_hidden __wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) +libc_hidden_proto(wcsxfrm_l) + +size_t wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) { - return __wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); + return wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); } -strong_alias(__wcsxfrm,wcsxfrm) +libc_hidden_proto(wcsxfrm) +libc_hidden_def(wcsxfrm) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -160,7 +157,7 @@ static int lookup(wchar_t wc __LOCALE_PARAM ) static void init_col_state(col_state_t *cs, const Wchar *wcs) { - __memset(cs, 0, sizeof(col_state_t)); + memset(cs, 0, sizeof(col_state_t)); cs->s = wcs; cs->bp = cs->back_buf = cs->ibb; cs->bb_size = 128; @@ -392,7 +389,7 @@ static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM ) cs->weight = 0; return; } - __memcpy(cs->bp, cs->back_buf, cs->bb_size); + memcpy(cs->bp, cs->back_buf, cs->bb_size); } else { cs->bp = realloc(cs->back_buf, cs->bb_size + 128); @@ -517,16 +514,16 @@ static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM ) } while (1); } -int attribute_hidden __UCXL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) +int __XL_NPP(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) { col_state_t ws[2]; int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ #ifdef WANT_WIDE - return __wcscmp(s0, s1); + return wcscmp(s0, s1); #else /* WANT_WIDE */ - return __strcmp(s0, s1); + return strcmp(s0, s1); #endif /* WANT_WIDE */ } @@ -550,11 +547,15 @@ int attribute_hidden __UCXL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCAL return 0; } -__UCXL_ALIAS(wcscoll) +libc_hidden_proto(__XL_NPP(wcscoll)) +libc_hidden_def(__XL_NPP(wcscoll)) #ifdef WANT_WIDE -size_t attribute_hidden __UCXL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, +extern size_t __wcslcpy(wchar_t *__restrict dst, + const wchar_t *__restrict src, size_t n); + +size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { col_state_t cs; @@ -562,7 +563,7 @@ size_t attribute_hidden __UCXL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t * int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ - return __wcsxfrm(ws1, ws2, n); + return __wcslcpy(ws1, ws2, n); } #ifdef __UCLIBC_MJN3_ONLY__ @@ -591,8 +592,8 @@ size_t attribute_hidden __UCXL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t * } return count-1; } - -__UCXL_ALIAS(wcsxfrm) +libc_hidden_proto(__XL_NPP(wcsxfrm)) +libc_hidden_def(__XL_NPP(wcsxfrm)) #else /* WANT_WIDE */ @@ -636,7 +637,7 @@ static size_t store(unsigned char *s, size_t count, size_t n, __uwchar_t weight) return r; } -size_t attribute_hidden __UCXL(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n +size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n __LOCALE_PARAM ) { col_state_t cs; @@ -644,7 +645,7 @@ size_t attribute_hidden __UCXL(strxfrm)(char *__restrict ws1, const char *__rest int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ - return __strlcpy(ws1, ws2, n); + return strlcpy(ws1, ws2, n); } #ifdef __UCLIBC_MJN3_ONLY__ @@ -673,8 +674,8 @@ size_t attribute_hidden __UCXL(strxfrm)(char *__restrict ws1, const char *__rest } return count-1; } - -__UCXL_ALIAS(strxfrm) +libc_hidden_proto(__XL_NPP(strxfrm)) +libc_hidden_def(__XL_NPP(strxfrm)) #endif /* WANT_WIDE */ diff --git a/libc/string/arm/bcopy.S b/libc/string/arm/bcopy.S index 2914b8972..dde4f6027 100644 --- a/libc/string/arm/bcopy.S +++ b/libc/string/arm/bcopy.S @@ -42,18 +42,17 @@ #include <features.h> .text -.global __bcopy -.hidden __bcopy -.type __bcopy,%function +.global bcopy +.type bcopy,%function .align 4 -__bcopy: +bcopy: /* switch the source and destination registers */ eor r0, r1, r0 eor r1, r0, r1 eor r0, r1, r0 - b _memcpy (PLT) + b _memcpy /* (PLT) */ -.size __bcopy,.-__bcopy +.size bcopy,.-bcopy -strong_alias(__bcopy,bcopy) +libc_hidden_def(bcopy) diff --git a/libc/string/arm/bzero.S b/libc/string/arm/bzero.S index 2cb67097e..1f679f5b7 100644 --- a/libc/string/arm/bzero.S +++ b/libc/string/arm/bzero.S @@ -40,16 +40,15 @@ #include <features.h> .text -.global __bzero -.hidden __bzero -.type __bzero,%function +.global bzero +.type bzero,%function .align 4 -__bzero: +bzero: mov r2, r1 mov r1, #0 - b __memset + b HIDDEN_JUMPTARGET(memset) -.size __bzero,.-__bzero +.size bzero,.-bzero -strong_alias(__bzero,bzero) +libc_hidden_def(bzero) diff --git a/libc/string/arm/memcmp.S b/libc/string/arm/memcmp.S index a97e02742..e97bbc480 100644 --- a/libc/string/arm/memcmp.S +++ b/libc/string/arm/memcmp.S @@ -32,12 +32,11 @@ #include <features.h> .text -.global __memcmp -.hidden __memcmp -.type __memcmp,%function +.global memcmp +.type memcmp,%function .align 4 -__memcmp: +memcmp: /* if ((len - 1) < 0) return 0 */ subs r2, r2, #1 movmi r0, #0 @@ -54,7 +53,7 @@ __memcmp: sub r0, r2, r3 mov pc, lr -.size __memcmp,.-__memcmp +.size memcmp,.-memcmp -strong_alias(__memcmp,memcmp) -strong_alias(__memcmp,bcmp) +libc_hidden_def(memcmp) +strong_alias(memcmp,bcmp) diff --git a/libc/string/arm/memcpy.S b/libc/string/arm/memcpy.S index 8f81a15e5..7a5b6ab76 100644 --- a/libc/string/arm/memcpy.S +++ b/libc/string/arm/memcpy.S @@ -40,16 +40,15 @@ #include <features.h> .text -.global __memcpy -.hidden __memcpy -.type __memcpy,%function +.global memcpy +.type memcpy,%function .align 4 -__memcpy: +memcpy: stmfd sp!, {r0, lr} bl _memcpy ldmfd sp!, {r0, pc} -.size __memcpy,.-__memcpy +.size memcpy,.-memcpy -strong_alias(__memcpy,memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/arm/memmove.S b/libc/string/arm/memmove.S index a26cf731e..45cd9b4d4 100644 --- a/libc/string/arm/memmove.S +++ b/libc/string/arm/memmove.S @@ -40,16 +40,15 @@ #include <features.h> .text -.global __memmove -.hidden __memmove -.type __memmove,%function +.global memmove +.type memmove,%function .align 4 -__memmove: +memmove: stmfd sp!, {r0, lr} bl _memcpy ldmfd sp!, {r0, pc} -.size __memmove,.-__memmove +.size memmove,.-memmove -strong_alias(__memmove,memmove) +libc_hidden_def(memmove) diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S index dea05a6b0..476dad52a 100644 --- a/libc/string/arm/memset.S +++ b/libc/string/arm/memset.S @@ -21,12 +21,11 @@ #include <sys/syscall.h> .text -.global __memset -.hidden __memset -.type __memset,%function +.global memset +.type memset,%function .align 4 -__memset: +memset: mov a4, a1 cmp a3, $8 @ at least 8 bytes to do? blt 2f @@ -70,6 +69,6 @@ __memset: strb a2, [a4], $1 mov pc, lr -.size __memset,.-__memset +.size memset,.-memset -strong_alias(__memset,memset) +libc_hidden_def(memset) diff --git a/libc/string/arm/strcmp.S b/libc/string/arm/strcmp.S index 3f462dec0..cdc4ac469 100644 --- a/libc/string/arm/strcmp.S +++ b/libc/string/arm/strcmp.S @@ -32,12 +32,11 @@ #include <features.h> .text -.global __strcmp -.hidden __strcmp -.type __strcmp,%function +.global strcmp +.type strcmp,%function .align 4 -__strcmp: +strcmp: 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1 @@ -47,10 +46,10 @@ __strcmp: sub r0, r2, r3 mov pc, lr -.size __strcmp,.-__strcmp +.size strcmp,.-strcmp -strong_alias(__strcmp,strcmp) +libc_hidden_def(strcmp) #ifndef __UCLIBC_HAS_LOCALE__ -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) +strong_alias(strcmp,strcoll) +libc_hidden_def(strcoll) #endif diff --git a/libc/string/arm/strlen.S b/libc/string/arm/strlen.S index f623cbe20..b7af3480d 100644 --- a/libc/string/arm/strlen.S +++ b/libc/string/arm/strlen.S @@ -27,12 +27,11 @@ */ .text -.global __strlen -.hidden __strlen -.type __strlen,%function +.global strlen +.type strlen,%function .align 4 -__strlen: +strlen: bic r1, r0, $3 @ addr of word containing first byte ldr r2, [r1], $4 @ get the first word ands r3, r0, $3 @ how many bytes are duff? @@ -78,6 +77,6 @@ Llastword: @ drop through to here once we find a #endif mov pc,lr -.size __strlen,.-__strlen +.size strlen,.-strlen -strong_alias(__strlen,strlen) +libc_hidden_def(strlen) diff --git a/libc/string/arm/strncmp.S b/libc/string/arm/strncmp.S index a3278727e..82d45e8f3 100644 --- a/libc/string/arm/strncmp.S +++ b/libc/string/arm/strncmp.S @@ -32,12 +32,11 @@ #include <features.h> .text -.global __strncmp -.hidden __strncmp -.type __strncmp,%function +.global strncmp +.type strncmp,%function .align 4 -__strncmp: +strncmp: /* if (len == 0) return 0 */ cmp r2, #0 moveq r0, #0 @@ -56,6 +55,6 @@ __strncmp: sub r0, r2, r3 mov pc, lr -.size __strncmp,.-__strncmp +.size strncmp,.-strncmp -strong_alias(__strncmp,strncmp) +libc_hidden_def(strncmp) diff --git a/libc/string/basename.c b/libc/string/basename.c index 403cd770b..2c4937fca 100644 --- a/libc/string/basename.c +++ b/libc/string/basename.c @@ -7,7 +7,9 @@ #include "_string.h" -char attribute_hidden *__basename(const char *path) +libc_hidden_proto(basename) + +char *basename(const char *path) { register const char *s; register const char *p; @@ -22,5 +24,4 @@ char attribute_hidden *__basename(const char *path) return (char *) p; } - -strong_alias(__basename,basename) +libc_hidden_def(basename) diff --git a/libc/string/bcopy.c b/libc/string/bcopy.c index 59e586b34..7e4f2328a 100644 --- a/libc/string/bcopy.c +++ b/libc/string/bcopy.c @@ -7,10 +7,13 @@ #include "_string.h" -void attribute_hidden __bcopy(const void *s2, void *s1, size_t n) +libc_hidden_proto(bcopy) +libc_hidden_proto(memmove) + +void bcopy(const void *s2, void *s1, size_t n) { #if 1 - __memmove(s1, s2, n); + memmove(s1, s2, n); #else #ifdef __BCC__ register char *s; @@ -49,5 +52,4 @@ void attribute_hidden __bcopy(const void *s2, void *s1, size_t n) #endif #endif } - -strong_alias(__bcopy,bcopy) +libc_hidden_def(bcopy) diff --git a/libc/string/bzero.c b/libc/string/bzero.c index 0439e39a1..30bdf5674 100644 --- a/libc/string/bzero.c +++ b/libc/string/bzero.c @@ -7,10 +7,12 @@ #include "_string.h" -void attribute_hidden __bzero(void *s, size_t n) +libc_hidden_proto(memset) + +void bzero(void *s, size_t n) { #if 1 - (void)__memset(s, 0, n); + (void)memset(s, 0, n); #else register unsigned char *p = s; #ifdef __BCC__ @@ -27,5 +29,3 @@ void attribute_hidden __bzero(void *s, size_t n) #endif } #undef np - -strong_alias(__bzero,bzero) diff --git a/libc/string/ffs.c b/libc/string/ffs.c index fc76e6c70..d98383d4e 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -9,7 +9,9 @@ #include "_string.h" -int attribute_hidden __ffs(int i) +libc_hidden_proto(ffs) + +int ffs(int i) { #if 1 /* inlined binary search method */ @@ -50,5 +52,4 @@ int attribute_hidden __ffs(int i) return n; #endif } - -strong_alias(__ffs,ffs) +libc_hidden_def(ffs) diff --git a/libc/string/frv/memcpy.S b/libc/string/frv/memcpy.S index abd8a28db..ae843797d 100644 --- a/libc/string/frv/memcpy.S +++ b/libc/string/frv/memcpy.S @@ -31,10 +31,9 @@ # to caller's fixup routine, aborting the remainder of the copy # ############################################################################### - .globl __memcpy - .hidden __memcpy - .type __memcpy,@function -__memcpy: + .globl memcpy + .type memcpy,@function +memcpy: or.p gr8,gr9,gr4 orcc gr10,gr0,gr0,icc3 or.p gr10,gr4,gr4 @@ -123,6 +122,6 @@ memcpy_32: bne icc0,#2,0b bralr - .size __memcpy, .-__memcpy + .size memcpy, .-memcpy -strong_alias(__memcpy,memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/frv/memset.S b/libc/string/frv/memset.S index a548b3779..4e64550e4 100644 --- a/libc/string/frv/memset.S +++ b/libc/string/frv/memset.S @@ -32,10 +32,9 @@ # GR4, GR7, GR8, and GR11 must be managed # ############################################################################### - .globl __memset - .hidden __memset - .type __memset,@function -__memset: + .globl memset + .type memset,@function +memset: orcc.p gr10,gr0,gr5,icc3 ; GR5 = count andi gr9,#0xff,gr9 or.p gr8,gr0,gr4 ; GR4 = address @@ -154,6 +153,6 @@ __memset: cknc icc0,cc7 cstb.p gr12,@(gr4,gr0) ,cc7,#1 bralr - .size __memset, .-__memset + .size memset, .-memset -strong_alias(__memset,memset) +libc_hidden_proto(memset) diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c index 68c820814..9942b609b 100644 --- a/libc/string/generic/memchr.c +++ b/libc/string/generic/memchr.c @@ -25,12 +25,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Search no more than N bytes of S for C. */ -void attribute_hidden *__memchr (const void * s, int c_in, size_t n) +void *memchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -171,5 +173,5 @@ void attribute_hidden *__memchr (const void * s, int c_in, size_t n) return 0; } - -strong_alias(__memchr,memchr) +libc_hidden_proto(memchr) +libc_hidden_def(memchr) diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c index 13e11692a..13de370bb 100644 --- a/libc/string/generic/memcmp.c +++ b/libc/string/generic/memcmp.c @@ -273,7 +273,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len) } int -attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) +memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) { op_t a0; op_t b0; @@ -329,7 +329,6 @@ attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) return 0; } - -strong_alias(__memcmp,memcmp) - -strong_alias(__memcmp,bcmp) +libc_hidden_proto(memcmp) +libc_hidden_def(memcmp) +strong_alias(memcmp,bcmp) diff --git a/libc/string/generic/memcpy.c b/libc/string/generic/memcpy.c index 6db4d0d44..692a254f7 100644 --- a/libc/string/generic/memcpy.c +++ b/libc/string/generic/memcpy.c @@ -209,7 +209,7 @@ static void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2); } -void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len) +void *memcpy (void *dstpp, const void *srcpp, size_t len) { unsigned long int dstp = (long int) dstpp; unsigned long int srcp = (long int) srcpp; @@ -242,5 +242,5 @@ void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len) return dstpp; } - -strong_alias(__memcpy,memcpy) +libc_hidden_proto(memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index 0353759e3..e8982c078 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -19,8 +19,10 @@ #include <string.h> #include <stddef.h> +libc_hidden_proto(memcmp) + /* Return the first occurrence of NEEDLE in HAYSTACK. */ -void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, +void *memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) { const char *begin; @@ -39,12 +41,12 @@ void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, for (begin = (const char *) haystack; begin <= last_possible; ++begin) if (begin[0] == ((const char *) needle)[0] && - !__memcmp ((const void *) &begin[1], + !memcmp ((const void *) &begin[1], (const void *) ((const char *) needle + 1), needle_len - 1)) return (void *) begin; return NULL; } - -strong_alias(__memmem,memmem) +libc_hidden_proto(memmem) +libc_hidden_def(memmem) diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index e34b0005d..0157b148c 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -24,6 +24,8 @@ #include "memcopy.h" #include "pagecopy.h" +libc_hidden_proto(memcpy) + static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -206,7 +208,7 @@ static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2); } -void attribute_hidden *__memmove (void *dest, const void *src, size_t len) +void *memmove (void *dest, const void *src, size_t len) { unsigned long int dstp = (long int) dest; unsigned long int srcp = (long int) src; @@ -217,7 +219,7 @@ void attribute_hidden *__memmove (void *dest, const void *src, size_t len) { #if 1 #warning REMINDER: generic-opt memmove assumes memcpy does forward copying! - __memcpy(dest, src, len); + memcpy(dest, src, len); #else /* Copy from the beginning to the end. */ @@ -276,5 +278,5 @@ void attribute_hidden *__memmove (void *dest, const void *src, size_t len) return (dest); } - -strong_alias(__memmove,memmove) +libc_hidden_proto(memmove) +libc_hidden_def(memmove) diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index d121967cd..ea4dec2b1 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -7,10 +7,12 @@ #include <string.h> -void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len) +libc_hidden_proto(memcpy) + +void *mempcpy (void *dstpp, const void *srcpp, size_t len) { - __memcpy(dstpp, srcpp, len); + memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); } - -strong_alias(__mempcpy,mempcpy) +libc_hidden_proto(mempcpy) +libc_hidden_def(mempcpy) diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c index d27ae03ef..ab61eac72 100644 --- a/libc/string/generic/memrchr.c +++ b/libc/string/generic/memrchr.c @@ -26,12 +26,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Search no more than N bytes of S for C. */ -void attribute_hidden *__memrchr (const void * s, int c_in, size_t n) +void *memrchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -170,5 +172,5 @@ void attribute_hidden *__memrchr (const void * s, int c_in, size_t n) return 0; } - -strong_alias(__memrchr,memrchr) +libc_hidden_proto(memrchr) +libc_hidden_def(memrchr) diff --git a/libc/string/generic/memset.c b/libc/string/generic/memset.c index 91401d7ee..18c065cac 100644 --- a/libc/string/generic/memset.c +++ b/libc/string/generic/memset.c @@ -19,7 +19,7 @@ #include <string.h> #include "memcopy.h" -void attribute_hidden *__memset (void *dstpp, int c, size_t len) +void *memset (void *dstpp, int c, size_t len) { long int dstp = (long int) dstpp; @@ -82,5 +82,5 @@ void attribute_hidden *__memset (void *dstpp, int c, size_t len) return dstpp; } - -strong_alias(__memset,memset) +libc_hidden_proto(memset) +libc_hidden_def(memset) diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c index d1be620eb..3fc0e52f3 100644 --- a/libc/string/generic/rawmemchr.c +++ b/libc/string/generic/rawmemchr.c @@ -25,12 +25,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Find the first occurrence of C in S. */ -void attribute_hidden *__rawmemchr (const void * s, int c_in) +void *rawmemchr (const void * s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -156,5 +158,5 @@ void attribute_hidden *__rawmemchr (const void * s, int c_in) } } } - -strong_alias(__rawmemchr,rawmemchr) +libc_hidden_proto(rawmemchr) +libc_hidden_def(rawmemchr) diff --git a/libc/string/generic/strcat.c b/libc/string/generic/strcat.c index 96412acc5..5111a9a0f 100644 --- a/libc/string/generic/strcat.c +++ b/libc/string/generic/strcat.c @@ -20,7 +20,7 @@ #include "memcopy.h" /* Append SRC on the end of DEST. */ -char attribute_hidden *__strcat (char *dest, const char *src) +char *strcat (char *dest, const char *src) { char *s1 = dest; const char *s2 = src; @@ -44,5 +44,5 @@ char attribute_hidden *__strcat (char *dest, const char *src) return dest; } - -strong_alias(__strcat,strcat) +libc_hidden_proto(strcat) +libc_hidden_def(strcat) diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c index dcb30ad7b..5675ce4ba 100644 --- a/libc/string/generic/strchr.c +++ b/libc/string/generic/strchr.c @@ -24,10 +24,12 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + #include "memcopy.h" /* Find the first occurrence of C in S. */ -char attribute_hidden *__strchr (const char *s, int c_in) +char *strchr (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -178,7 +180,6 @@ char attribute_hidden *__strchr (const char *s, int c_in) return NULL; } - -strong_alias(__strchr,strchr) - -strong_alias(__strchr,index) +libc_hidden_proto(strchr) +libc_hidden_def(strchr) +strong_alias(strchr,index) diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c index a2aafbfb0..eccdba247 100644 --- a/libc/string/generic/strchrnul.c +++ b/libc/string/generic/strchrnul.c @@ -24,10 +24,12 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + #include "memcopy.h" /* Find the first occurrence of C in S or the final NUL byte. */ -char attribute_hidden *__strchrnul (const char *s, int c_in) +char *strchrnul (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -161,5 +163,5 @@ char attribute_hidden *__strchrnul (const char *s, int c_in) /* This should never happen. */ return NULL; } - -strong_alias(__strchrnul,strchrnul) +libc_hidden_proto(strchrnul) +libc_hidden_def(strchrnul) diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c index 209aeed15..1049934a8 100644 --- a/libc/string/generic/strcmp.c +++ b/libc/string/generic/strcmp.c @@ -23,7 +23,7 @@ /* Compare S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int attribute_hidden __strcmp (const char *p1, const char *p2) +int strcmp (const char *p1, const char *p2) { register const unsigned char *s1 = (const unsigned char *) p1; register const unsigned char *s2 = (const unsigned char *) p2; @@ -40,10 +40,11 @@ int attribute_hidden __strcmp (const char *p1, const char *p2) return c1 - c2; } - -strong_alias(__strcmp,strcmp) +libc_hidden_proto(strcmp) +libc_hidden_def(strcmp) #ifndef __UCLIBC_HAS_LOCALE__ -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) +strong_alias(strcmp,strcoll) +libc_hidden_proto(strcoll) +libc_hidden_def(strcoll) #endif diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c index 9280d3561..ab2928e55 100644 --- a/libc/string/generic/strcpy.c +++ b/libc/string/generic/strcpy.c @@ -23,7 +23,7 @@ #include "bp-checks.h" /* Copy SRC to DEST. */ -char attribute_hidden *__strcpy (char *dest, const char *src) +char *strcpy (char *dest, const char *src) { reg_char c; char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src); @@ -43,5 +43,5 @@ char attribute_hidden *__strcpy (char *dest, const char *src) return dest; } - -strong_alias(__strcpy,strcpy) +libc_hidden_proto(strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/generic/strcspn.c b/libc/string/generic/strcspn.c index a06577bca..7fa49a0dc 100644 --- a/libc/string/generic/strcspn.c +++ b/libc/string/generic/strcspn.c @@ -18,19 +18,21 @@ #include <string.h> +libc_hidden_proto(strchr) + /* Return the length of the maximum initial segment of S which contains no characters from REJECT. */ -size_t attribute_hidden __strcspn (const char *s, const char *reject) +size_t strcspn (const char *s, const char *reject) { size_t count = 0; while (*s != '\0') - if (__strchr (reject, *s++) == NULL) + if (strchr (reject, *s++) == NULL) ++count; else return count; return count; } - -strong_alias(__strcspn,strcspn) +libc_hidden_proto(strcspn) +libc_hidden_def(strcspn) diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index 6c1b5eae3..08b5fa830 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -22,9 +22,11 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + /* Return the length of the null-terminated string STR. Scan for the null terminator quickly by testing four bytes at a time. */ -size_t attribute_hidden __strlen (const char *str) +size_t strlen (const char *str) { const char *char_ptr; const unsigned long int *longword_ptr; @@ -146,5 +148,5 @@ size_t attribute_hidden __strlen (const char *str) } } } - -strong_alias(__strlen,strlen) +libc_hidden_proto(strlen) +libc_hidden_def(strlen) diff --git a/libc/string/generic/strncat.c b/libc/string/generic/strncat.c index 5ece4d248..0cdb21a7a 100644 --- a/libc/string/generic/strncat.c +++ b/libc/string/generic/strncat.c @@ -20,7 +20,7 @@ #include "memcopy.h" -char attribute_hidden *__strncat (char *s1, const char *s2, size_t n) +char *strncat (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -73,5 +73,5 @@ char attribute_hidden *__strncat (char *s1, const char *s2, size_t n) return s; } - -strong_alias(__strncat,strncat) +libc_hidden_proto(strncat) +libc_hidden_def(strncat) diff --git a/libc/string/generic/strncmp.c b/libc/string/generic/strncmp.c index 849726f6b..a6285e3a4 100644 --- a/libc/string/generic/strncmp.c +++ b/libc/string/generic/strncmp.c @@ -23,7 +23,7 @@ returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n) +int strncmp (const char *s1, const char *s2, size_t n) { unsigned reg_char c1 = '\0'; unsigned reg_char c2 = '\0'; @@ -64,5 +64,5 @@ int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n) return c1 - c2; } - -strong_alias(__strncmp,strncmp) +libc_hidden_proto(strncmp) +libc_hidden_def(strncmp) diff --git a/libc/string/generic/strncpy.c b/libc/string/generic/strncpy.c index ca4f59e52..3c9ccb9ce 100644 --- a/libc/string/generic/strncpy.c +++ b/libc/string/generic/strncpy.c @@ -19,7 +19,7 @@ #include <string.h> #include "memcopy.h" -char attribute_hidden *__strncpy (char *s1, const char *s2, size_t n) +char *strncpy (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -78,5 +78,5 @@ char attribute_hidden *__strncpy (char *s1, const char *s2, size_t n) return s; } - -strong_alias(__strncpy,strncpy) +libc_hidden_proto(strncpy) +libc_hidden_def(strncpy) diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c index 4b96dde31..95e8a77be 100644 --- a/libc/string/generic/strnlen.c +++ b/libc/string/generic/strnlen.c @@ -24,9 +24,11 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + /* Find the length of S, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ -size_t attribute_hidden __strnlen (const char *str, size_t maxlen) +size_t strnlen (const char *str, size_t maxlen) { const char *char_ptr, *end_ptr = str + maxlen; const unsigned long int *longword_ptr; @@ -156,5 +158,5 @@ size_t attribute_hidden __strnlen (const char *str, size_t maxlen) char_ptr = end_ptr; return char_ptr - str; } - -strong_alias(__strnlen,strnlen) +libc_hidden_proto(strnlen) +libc_hidden_def(strnlen) diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index 529016ede..cf4c6dd3b 100644 --- a/libc/string/generic/strrchr.c +++ b/libc/string/generic/strrchr.c @@ -18,8 +18,10 @@ #include <string.h> +libc_hidden_proto(strchr) + /* Find the last occurrence of C in S. */ -char attribute_hidden *__strrchr (const char *s, int c) +char *strrchr (const char *s, int c) { register const char *found, *p; @@ -28,10 +30,10 @@ char attribute_hidden *__strrchr (const char *s, int c) /* Since strchr is fast, we use it rather than the obvious loop. */ if (c == '\0') - return __strchr (s, '\0'); + return strchr (s, '\0'); found = NULL; - while ((p = __strchr (s, c)) != NULL) + while ((p = strchr (s, c)) != NULL) { found = p; s = p + 1; @@ -39,7 +41,6 @@ char attribute_hidden *__strrchr (const char *s, int c) return (char *) found; } - -strong_alias(__strrchr,strrchr) - -strong_alias (__strrchr,rindex) +libc_hidden_proto(strrchr) +libc_hidden_def(strrchr) +strong_alias(strrchr,rindex) diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index 762b07ff9..5d9c8c307 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -16,11 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strpbrk __strpbrk - #include <string.h> -char attribute_hidden *__strsep (char **stringp, const char *delim) +libc_hidden_proto(strchr) +libc_hidden_proto(strpbrk) + +char *strsep (char **stringp, const char *delim) { char *begin, *end; @@ -44,7 +45,7 @@ char attribute_hidden *__strsep (char **stringp, const char *delim) else if (*begin == '\0') end = NULL; else - end = __strchr (begin + 1, ch); + end = strchr (begin + 1, ch); } } else @@ -63,5 +64,5 @@ char attribute_hidden *__strsep (char **stringp, const char *delim) return begin; } - -strong_alias(__strsep,strsep) +libc_hidden_proto(strsep) +libc_hidden_def(strsep) diff --git a/libc/string/generic/strspn.c b/libc/string/generic/strspn.c index 129c58742..cd2882456 100644 --- a/libc/string/generic/strspn.c +++ b/libc/string/generic/strspn.c @@ -20,7 +20,7 @@ /* Return the length of the maximum initial segment of S which contains only characters in ACCEPT. */ -size_t attribute_hidden __strspn (const char *s, const char *accept) +size_t strspn (const char *s, const char *accept) { const char *p; const char *a; @@ -39,5 +39,5 @@ size_t attribute_hidden __strspn (const char *s, const char *accept) return count; } - -strong_alias(__strspn,strspn) +libc_hidden_proto(strspn) +libc_hidden_def(strspn) diff --git a/libc/string/generic/strstr.c b/libc/string/generic/strstr.c index 12e384014..a7442d614 100644 --- a/libc/string/generic/strstr.c +++ b/libc/string/generic/strstr.c @@ -30,7 +30,7 @@ typedef unsigned chartype; -char attribute_hidden *__strstr (const char *phaystack, const char *pneedle) +char *strstr (const char *phaystack, const char *pneedle) { const unsigned char *haystack, *needle; chartype b; @@ -109,5 +109,5 @@ foundneedle: ret0: return 0; } - -strong_alias(__strstr,strstr) +libc_hidden_proto(strstr) +libc_hidden_def(strstr) diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 1a11166dd..3f7ed2c9f 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -20,6 +20,10 @@ #define _GNU_SOURCE #include <string.h> +libc_hidden_proto(strspn) +libc_hidden_proto(strpbrk) +libc_hidden_proto(rawmemchr) + /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: @@ -30,7 +34,7 @@ x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" */ -char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) +char *strtok_r (char *s, const char *delim, char **save_ptr) { char *token; @@ -38,7 +42,7 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) s = *save_ptr; /* Scan leading delimiters. */ - s += __strspn (s, delim); + s += strspn (s, delim); if (*s == '\0') { *save_ptr = s; @@ -47,10 +51,10 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) /* Find the end of the token. */ token = s; - s = __strpbrk (token, delim); + s = strpbrk (token, delim); if (s == NULL) /* This token finishes the string. */ - *save_ptr = __rawmemchr (token, '\0'); + *save_ptr = rawmemchr (token, '\0'); else { /* Terminate the token and make *SAVE_PTR point past it. */ @@ -59,5 +63,5 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) } return token; } - -strong_alias(__strtok_r,strtok_r) +libc_hidden_proto(strtok_r) +libc_hidden_def(strtok_r) diff --git a/libc/string/i386/memchr.c b/libc/string/i386/memchr.c index c7cd33758..b2fde07ad 100644 --- a/libc/string/i386/memchr.c +++ b/libc/string/i386/memchr.c @@ -32,7 +32,7 @@ #include <string.h> -void attribute_hidden *__memchr(const void *cs, int c, size_t count) +void *memchr(const void *cs, int c, size_t count) { int d0; register void * __res; @@ -47,5 +47,5 @@ void attribute_hidden *__memchr(const void *cs, int c, size_t count) :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count)); return __res; } - -strong_alias(__memchr,memchr) +libc_hidden_proto(memchr) +libc_hidden_def(memchr) diff --git a/libc/string/i386/memcpy.c b/libc/string/i386/memcpy.c index 12ba8d7de..837d7d65b 100644 --- a/libc/string/i386/memcpy.c +++ b/libc/string/i386/memcpy.c @@ -32,7 +32,7 @@ #include <string.h> -void attribute_hidden *__memcpy(void * to, const void * from, size_t n) +void *memcpy(void * to, const void * from, size_t n) { int d0, d1, d2; __asm__ __volatile__( @@ -49,5 +49,5 @@ void attribute_hidden *__memcpy(void * to, const void * from, size_t n) : "memory"); return (to); } - -strong_alias(__memcpy,memcpy) +libc_hidden_proto(memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/i386/memmove.c b/libc/string/i386/memmove.c index d6e29e553..8122803ef 100644 --- a/libc/string/i386/memmove.c +++ b/libc/string/i386/memmove.c @@ -32,7 +32,7 @@ #include <string.h> -void attribute_hidden *__memmove(void *dest, const void *src, size_t n) +void *memmove(void *dest, const void *src, size_t n) { int d0, d1, d2; if (dest<src) @@ -55,5 +55,5 @@ void attribute_hidden *__memmove(void *dest, const void *src, size_t n) :"memory"); return dest; } - -strong_alias(__memmove,memmove) +libc_hidden_proto(memmove) +libc_hidden_def(memmove) diff --git a/libc/string/i386/memset.c b/libc/string/i386/memset.c index eadbf9feb..bf527619a 100644 --- a/libc/string/i386/memset.c +++ b/libc/string/i386/memset.c @@ -32,7 +32,7 @@ #include <string.h> -void attribute_hidden *__memset(void *s, int c, size_t count) +void *memset(void *s, int c, size_t count) { int d0, d1; __asm__ __volatile__( @@ -43,5 +43,5 @@ void attribute_hidden *__memset(void *s, int c, size_t count) :"memory"); return s; } - -strong_alias(__memset,memset) +libc_hidden_proto(memset) +libc_hidden_def(memset) diff --git a/libc/string/i386/strcat.c b/libc/string/i386/strcat.c index 02b2a3c5b..5364c9029 100644 --- a/libc/string/i386/strcat.c +++ b/libc/string/i386/strcat.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strcat(char * dest, const char * src) +char *strcat(char * dest, const char * src) { int d0, d1, d2, d3; __asm__ __volatile__( @@ -47,5 +47,5 @@ char attribute_hidden *__strcat(char * dest, const char * src) : "0" (src), "1" (dest), "2" (0), "3" (0xffffffff):"memory"); return dest; } - -strong_alias(__strcat,strcat) +libc_hidden_proto(strcat) +libc_hidden_def(strcat) diff --git a/libc/string/i386/strchr.c b/libc/string/i386/strchr.c index a8343fa00..3f1aa7635 100644 --- a/libc/string/i386/strchr.c +++ b/libc/string/i386/strchr.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strchr(const char *s, int c) +char *strchr(const char *s, int c) { int d0; register char * __res; @@ -49,7 +49,6 @@ char attribute_hidden *__strchr(const char *s, int c) :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c)); return __res; } - -strong_alias(__strchr,strchr) - -strong_alias(__strchr,index) +libc_hidden_proto(strchr) +libc_hidden_def(strchr) +strong_alias(strchr,index) diff --git a/libc/string/i386/strcmp.c b/libc/string/i386/strcmp.c index f335da646..81cc16c7f 100644 --- a/libc/string/i386/strcmp.c +++ b/libc/string/i386/strcmp.c @@ -32,7 +32,7 @@ #include <string.h> -int attribute_hidden __strcmp(const char *cs, const char *ct) +int strcmp(const char *cs, const char *ct) { int d0, d1; register int __res; @@ -51,10 +51,11 @@ int attribute_hidden __strcmp(const char *cs, const char *ct) :"1" (cs),"2" (ct)); return __res; } - -strong_alias(__strcmp,strcmp) +libc_hidden_proto(strcmp) +libc_hidden_def(strcmp) #ifndef __UCLIBC_HAS_LOCALE__ -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) +strong_alias(strcmp,strcoll) +libc_hidden_proto(strcoll) +libc_hidden_def(strcoll) #endif diff --git a/libc/string/i386/strcpy.c b/libc/string/i386/strcpy.c index 59effd45e..361dcdbb9 100644 --- a/libc/string/i386/strcpy.c +++ b/libc/string/i386/strcpy.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strcpy(char * dest, const char * src) +char *strcpy(char * dest, const char * src) { int d0, d1, d2; __asm__ __volatile__( @@ -44,5 +44,5 @@ char attribute_hidden *__strcpy(char * dest, const char * src) :"0" (src),"1" (dest) : "memory"); return dest; } - -strong_alias(__strcpy,strcpy) +libc_hidden_proto(strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/i386/strlen.c b/libc/string/i386/strlen.c index 01cc46f9e..2ef57e3f8 100644 --- a/libc/string/i386/strlen.c +++ b/libc/string/i386/strlen.c @@ -32,7 +32,7 @@ #include <string.h> -size_t attribute_hidden __strlen(const char *s) +size_t strlen(const char *s) { int d0; register int __res; @@ -44,5 +44,5 @@ size_t attribute_hidden __strlen(const char *s) :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff)); return __res; } - -strong_alias(__strlen,strlen) +libc_hidden_proto(strlen) +libc_hidden_def(strlen) diff --git a/libc/string/i386/strncat.c b/libc/string/i386/strncat.c index b55b87b59..4a6dac31e 100644 --- a/libc/string/i386/strncat.c +++ b/libc/string/i386/strncat.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strncat(char * dest, +char *strncat(char * dest, const char * src, size_t count) { int d0, d1, d2, d3; @@ -57,5 +57,5 @@ char attribute_hidden *__strncat(char * dest, : "memory"); return dest; } - -strong_alias(__strncat,strncat) +libc_hidden_proto(strncat) +libc_hidden_def(strncat) diff --git a/libc/string/i386/strncmp.c b/libc/string/i386/strncmp.c index 2e22bf642..96b966e30 100644 --- a/libc/string/i386/strncmp.c +++ b/libc/string/i386/strncmp.c @@ -32,7 +32,7 @@ #include <string.h> -int attribute_hidden __strncmp(const char *cs, const char *ct, size_t count) +int strncmp(const char *cs, const char *ct, size_t count) { register int __res; int d0, d1, d2; @@ -54,5 +54,5 @@ int attribute_hidden __strncmp(const char *cs, const char *ct, size_t count) :"1" (cs),"2" (ct),"3" (count)); return __res; } - -strong_alias(__strncmp,strncmp) +libc_hidden_proto(strncmp) +libc_hidden_def(strncmp) diff --git a/libc/string/i386/strncpy.c b/libc/string/i386/strncpy.c index 272c60ee4..dde4d3ee1 100644 --- a/libc/string/i386/strncpy.c +++ b/libc/string/i386/strncpy.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strncpy(char * dest, const char * src, size_t count) +char *strncpy(char * dest, const char * src, size_t count) { int d0, d1, d2, d3; __asm__ __volatile__( @@ -52,5 +52,5 @@ char attribute_hidden *__strncpy(char * dest, const char * src, size_t count) :"0" (src),"1" (dest),"2" (count) : "memory"); return dest; } - -strong_alias(__strncpy,strncpy) +libc_hidden_proto(strncpy) +libc_hidden_def(strncpy) diff --git a/libc/string/i386/strnlen.c b/libc/string/i386/strnlen.c index ef5c83a9a..7d9042fa4 100644 --- a/libc/string/i386/strnlen.c +++ b/libc/string/i386/strnlen.c @@ -33,7 +33,7 @@ #define _GNU_SOURCE #include <string.h> -size_t attribute_hidden __strnlen(const char *s, size_t count) +size_t strnlen(const char *s, size_t count) { int d0; register int __res; @@ -51,5 +51,5 @@ size_t attribute_hidden __strnlen(const char *s, size_t count) :"c" (s),"1" (count)); return __res; } - -strong_alias(__strnlen,strnlen) +libc_hidden_proto(strnlen) +libc_hidden_def(strnlen) diff --git a/libc/string/i386/strrchr.c b/libc/string/i386/strrchr.c index 9f0f65a36..094f4418e 100644 --- a/libc/string/i386/strrchr.c +++ b/libc/string/i386/strrchr.c @@ -32,7 +32,7 @@ #include <string.h> -char attribute_hidden *__strrchr(const char *s, int c) +char *strrchr(const char *s, int c) { int d0, d1; register char * __res; @@ -47,7 +47,6 @@ char attribute_hidden *__strrchr(const char *s, int c) :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c)); return __res; } - -strong_alias(__strrchr,strrchr) - -strong_alias(__strrchr,rindex) +libc_hidden_proto(strrchr) +libc_hidden_def(strrchr) +strong_alias(strrchr,rindex) diff --git a/libc/string/memccpy.c b/libc/string/memccpy.c index 81d20b19c..fe5a76a4d 100644 --- a/libc/string/memccpy.c +++ b/libc/string/memccpy.c @@ -9,7 +9,7 @@ #include "_string.h" -void attribute_hidden *__memccpy(void * __restrict s1, const void * __restrict s2, int c, size_t n) +void *memccpy(void * __restrict s1, const void * __restrict s2, int c, size_t n) { register char *r1 = s1; register const char *r2 = s2; @@ -18,5 +18,3 @@ void attribute_hidden *__memccpy(void * __restrict s1, const void * __restrict s return (n == (size_t) -1) ? NULL : r1; } - -strong_alias(__memccpy,memccpy) diff --git a/libc/string/memchr.c b/libc/string/memchr.c index 288bd9748..413999722 100644 --- a/libc/string/memchr.c +++ b/libc/string/memchr.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmemchr __wmemchr # define Wmemchr wmemchr #else -# define __Wmemchr __memchr # define Wmemchr memchr #endif -Wvoid attribute_hidden *__Wmemchr(const Wvoid *s, Wint c, size_t n) +libc_hidden_proto(Wmemchr) + +Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n) { register const Wuchar *r = (const Wuchar *) s; #ifdef __BCC__ @@ -37,4 +37,4 @@ Wvoid attribute_hidden *__Wmemchr(const Wvoid *s, Wint c, size_t n) } #undef np -strong_alias(__Wmemchr,Wmemchr) +libc_hidden_def(Wmemchr) diff --git a/libc/string/memcmp.c b/libc/string/memcmp.c index 9808b3785..9de28c234 100644 --- a/libc/string/memcmp.c +++ b/libc/string/memcmp.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmemcmp __wmemcmp # define Wmemcmp wmemcmp #else -# define __Wmemcmp __memcmp +libc_hidden_proto(memcmp) # define Wmemcmp memcmp #endif -int attribute_hidden __Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n) +int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n) { register const Wuchar *r1 = (const Wuchar *) s1; register const Wuchar *r2 = (const Wuchar *) s2; @@ -37,7 +36,7 @@ int attribute_hidden __Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n) #endif } -strong_alias(__Wmemcmp,Wmemcmp) #ifndef WANT_WIDE -strong_alias(__memcmp,bcmp) +libc_hidden_def(memcmp) +strong_alias(memcmp,bcmp) #endif diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c index abfe1b4ef..dc2986778 100644 --- a/libc/string/memcpy.c +++ b/libc/string/memcpy.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmemcpy __wmemcpy # define Wmemcpy wmemcpy #else -# define __Wmemcpy __memcpy # define Wmemcpy memcpy #endif -Wvoid attribute_hidden *__Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) +libc_hidden_proto(Wmemcpy) + +Wvoid *Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) { register Wchar *r1 = s1; register const Wchar *r2 = s2; @@ -33,5 +33,4 @@ Wvoid attribute_hidden *__Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restric return s1; } - -strong_alias(__Wmemcpy,Wmemcpy) +libc_hidden_def(Wmemcpy) diff --git a/libc/string/memmem.c b/libc/string/memmem.c index a42176181..f57733c4a 100644 --- a/libc/string/memmem.c +++ b/libc/string/memmem.c @@ -7,7 +7,7 @@ #include "_string.h" -void attribute_hidden *__memmem(const void *haystack, size_t haystacklen, +void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) { register const char *ph; @@ -36,5 +36,3 @@ void attribute_hidden *__memmem(const void *haystack, size_t haystacklen, return NULL; } - -strong_alias(__memmem,memmem) diff --git a/libc/string/memmove.c b/libc/string/memmove.c index 9e50cf5a9..3cdcca116 100644 --- a/libc/string/memmove.c +++ b/libc/string/memmove.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmemmove __wmemmove # define Wmemmove wmemmove #else -# define __Wmemmove __memmove +libc_hidden_proto(memmove) # define Wmemmove memmove #endif -Wvoid attribute_hidden *__Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n) +Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n) { #ifdef __BCC__ register Wchar *s = (Wchar *) s1; @@ -54,4 +53,6 @@ Wvoid attribute_hidden *__Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n) #endif } -strong_alias(__Wmemmove,Wmemmove) +#ifndef WANT_WIDE +libc_hidden_def(Wmemmove) +#endif diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c index aed37d03a..70626f24a 100644 --- a/libc/string/mempcpy.c +++ b/libc/string/mempcpy.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmempcpy __wmempcpy # define Wmempcpy wmempcpy #else -# define __Wmempcpy __mempcpy # define Wmempcpy mempcpy #endif -Wvoid attribute_hidden *__Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) +libc_hidden_proto(Wmempcpy) + +Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) { register Wchar *r1 = s1; register const Wchar *r2 = s2; @@ -34,4 +34,4 @@ Wvoid attribute_hidden *__Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restri return r1; } -strong_alias(__Wmempcpy,Wmempcpy) +libc_hidden_def(Wmempcpy) diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c index fb696bc6d..0bb67b2e5 100644 --- a/libc/string/memrchr.c +++ b/libc/string/memrchr.c @@ -7,7 +7,9 @@ #include "_string.h" -void attribute_hidden *__memrchr(const void *s, int c, size_t n) +libc_hidden_proto(memrchr) + +void *memrchr(const void *s, int c, size_t n) { register const unsigned char *r; #ifdef __BCC__ @@ -30,4 +32,4 @@ void attribute_hidden *__memrchr(const void *s, int c, size_t n) } #undef np -strong_alias(__memrchr,memrchr) +libc_hidden_def(memrchr) diff --git a/libc/string/memset.c b/libc/string/memset.c index cb97dbce8..2f3fc271d 100644 --- a/libc/string/memset.c +++ b/libc/string/memset.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wmemset __wmemset # define Wmemset wmemset #else -# define __Wmemset __memset +libc_hidden_proto(memset) # define Wmemset memset #endif -Wvoid attribute_hidden *__Wmemset(Wvoid *s, Wint c, size_t n) +Wvoid *Wmemset(Wvoid *s, Wint c, size_t n) { register Wuchar *p = (Wuchar *) s; #ifdef __BCC__ @@ -34,4 +33,6 @@ Wvoid attribute_hidden *__Wmemset(Wvoid *s, Wint c, size_t n) } #undef np -strong_alias(__Wmemset,Wmemset) +#ifndef WANT_WIDE +libc_hidden_def(memset) +#endif diff --git a/libc/string/mips/memcpy.S b/libc/string/mips/memcpy.S index 2e42b1793..155bc1128 100644 --- a/libc/string/mips/memcpy.S +++ b/libc/string/mips/memcpy.S @@ -40,7 +40,7 @@ # define SWLO swl /* low part is left in little-endian */ #endif -ENTRY (__memcpy) +ENTRY (memcpy) .set noreorder slti t0, a2, 8 # Less than 8? @@ -137,6 +137,6 @@ L(shfth): move a2, t0 .set reorder -END (__memcpy) +END (memcpy) -strong_alias(__memcpy,memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/mips/memset.S b/libc/string/mips/memset.S index 4269ebc6e..9169ad58a 100644 --- a/libc/string/mips/memset.S +++ b/libc/string/mips/memset.S @@ -34,7 +34,7 @@ # define SWHI swr /* high part is right in little-endian */ #endif -ENTRY (__memset) +ENTRY (memset) .set noreorder slti t1, a2, 8 # Less than 8? @@ -87,6 +87,6 @@ L(exit): nop .set reorder -END (__memset) +END (memset) -strong_alias(__memset,memset) +libc_hidden_def(memset) diff --git a/libc/string/mips/sysdep.h b/libc/string/mips/sysdep.h index 27518ac42..96f088c94 100644 --- a/libc/string/mips/sysdep.h +++ b/libc/string/mips/sysdep.h @@ -27,7 +27,6 @@ #define ENTRY(name) \ .globl name; \ - .hidden name; \ .align 2; \ .ent name,0; \ name##: diff --git a/libc/string/powerpc/memcpy.c b/libc/string/powerpc/memcpy.c index 5af96869b..8ed03e526 100644 --- a/libc/string/powerpc/memcpy.c +++ b/libc/string/powerpc/memcpy.c @@ -21,7 +21,7 @@ #include <string.h> -void attribute_hidden *__memcpy(void *to, const void *from, size_t n) +void *memcpy(void *to, const void *from, size_t n) /* PPC can do pre increment and load/store, but not post increment and load/store. Therefore use *++ptr instead of *ptr++. */ { @@ -76,5 +76,5 @@ void attribute_hidden *__memcpy(void *to, const void *from, size_t n) goto copy_chunks; goto lessthan8; } - -strong_alias(__memcpy,memcpy) +libc_hidden_proto(memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/powerpc/memmove.c b/libc/string/powerpc/memmove.c index 1d513a966..10e46867c 100644 --- a/libc/string/powerpc/memmove.c +++ b/libc/string/powerpc/memmove.c @@ -21,7 +21,7 @@ #include <string.h> -void attribute_hidden *__memmove(void *to, const void *from, size_t n) +void *memmove(void *to, const void *from, size_t n) { unsigned long rem, chunks, tmp1, tmp2; unsigned char *tmp_to; @@ -72,5 +72,5 @@ void attribute_hidden *__memmove(void *to, const void *from, size_t n) goto copy_chunks; goto lessthan8; } - -strong_alias(__memmove,memmove) +libc_hidden_proto(memmove) +libc_hidden_def(memmove) diff --git a/libc/string/powerpc/memset.c b/libc/string/powerpc/memset.c index f6cda9579..47df2b607 100644 --- a/libc/string/powerpc/memset.c +++ b/libc/string/powerpc/memset.c @@ -32,7 +32,7 @@ static inline int expand_byte_word(int c){ return c; } -void attribute_hidden *__memset(void *to, int c, size_t n) +void *memset(void *to, int c, size_t n) { unsigned long rem, chunks; unsigned char *tmp_to; @@ -78,5 +78,5 @@ void attribute_hidden *__memset(void *to, int c, size_t n) goto copy_chunks; goto lessthan8; } - -strong_alias(__memset,memset) +libc_hidden_proto(memset) +libc_hidden_def(memset) diff --git a/libc/string/psignal.c b/libc/string/psignal.c index b6d6a30c0..daf9764b1 100644 --- a/libc/string/psignal.c +++ b/libc/string/psignal.c @@ -5,11 +5,13 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#define _GNU_SOURCE #include <features.h> #include <stdio.h> #include <string.h> -extern char *__strsignal (int __sig) __THROW attribute_hidden; +libc_hidden_proto(fprintf) +libc_hidden_proto(strsignal) /* TODO: make this threadsafe with a reentrant version of strsignal? */ @@ -26,5 +28,5 @@ void psignal(int signum, register const char *message) message = (sep += 2); /* or passed an empty string. */ } - fprintf(stderr, "%s%s%s\n", message, sep, __strsignal(signum)); + fprintf(stderr, "%s%s%s\n", message, sep, strsignal(signum)); } diff --git a/libc/string/rawmemchr.c b/libc/string/rawmemchr.c index 81d578a0f..754a34e18 100644 --- a/libc/string/rawmemchr.c +++ b/libc/string/rawmemchr.c @@ -7,7 +7,9 @@ #include "_string.h" -void attribute_hidden *__rawmemchr(const void *s, int c) +libc_hidden_proto(rawmemchr) + +void *rawmemchr(const void *s, int c) { register const unsigned char *r = s; @@ -15,5 +17,4 @@ void attribute_hidden *__rawmemchr(const void *s, int c) return (void *) r; /* silence the warning */ } - -strong_alias(__rawmemchr,rawmemchr) +libc_hidden_def(rawmemchr) diff --git a/libc/string/sh64/memcpy.S b/libc/string/sh64/memcpy.S index d74980613..3c0ea0c0d 100644 --- a/libc/string/sh64/memcpy.S +++ b/libc/string/sh64/memcpy.S @@ -39,12 +39,11 @@ #include <features.h> .section .text..SHmedia32,"ax" - .globl __memcpy - .hidden __memcpy - .type __memcpy, @function + .globl memcpy + .type memcpy, @function .align 5 -__memcpy: +memcpy: #define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1 #define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1 @@ -201,6 +200,6 @@ Loop_ua: stlo.q r5, 8, r1 blink tr1, r63 - .size __memcpy,.-__memcpy + .size memcpy,.-memcpy -strong_alias(__memcpy,memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/sh64/memset.S b/libc/string/sh64/memset.S index cd2ad7998..f588323f0 100644 --- a/libc/string/sh64/memset.S +++ b/libc/string/sh64/memset.S @@ -21,13 +21,12 @@ #endif .section .text..SHmedia32,"ax" - .globl __memset - .hidden __memset - .type __memset, @function + .globl memset + .type memset, @function .align 5 -__memset: +memset: pta/l multiquad, tr0 andi r2, 7, r22 ptabs r18, tr2 @@ -92,6 +91,6 @@ loop: sthi.q r5, -1, r3 blink tr2,r63 - .size __memset,.-__memset + .size memset,.-memset -strong_alias(__memset,memset) +libc_hidden_def(memset) diff --git a/libc/string/sh64/strcpy.S b/libc/string/sh64/strcpy.S index 2ce998257..da79d5143 100644 --- a/libc/string/sh64/strcpy.S +++ b/libc/string/sh64/strcpy.S @@ -18,12 +18,11 @@ #endif .section .text..SHmedia32,"ax" - .globl __strcpy - .hidden __strcpy - .type __strcpy, @function + .globl strcpy + .type strcpy, @function .align 5 -__strcpy: +strcpy: pta/l shortstring,tr1 ldlo.q r3,0,r4 @@ -98,6 +97,6 @@ loop: addi r0, 8, r0 blink tr1, r63 // shortstring - .size __strcpy,.-__strcpy + .size strcpy,.-strcpy -strong_alias(__strcpy,strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/sh64/strlen.S b/libc/string/sh64/strlen.S index 673a34dbd..18f4164ff 100644 --- a/libc/string/sh64/strlen.S +++ b/libc/string/sh64/strlen.S @@ -33,12 +33,11 @@ #include <features.h> .section .text..SHmedia32,"ax" - .globl __strlen - .hidden __strlen - .type __strlen,@function + .globl strlen + .type strlen,@function .balign 16 -__strlen: +strlen: ptabs r18, tr4 /* @@ -59,6 +58,6 @@ loop: or r0, r63, r2 blink tr4, r63 - .size __strlen,.-__strlen + .size strlen,.-strlen -strong_alias(__strlen,strlen) +libc_hidden_def(strlen) diff --git a/libc/string/sparc/_glibc_inc.h b/libc/string/sparc/_glibc_inc.h index 6ef1dbde6..4eb4d755c 100644 --- a/libc/string/sparc/_glibc_inc.h +++ b/libc/string/sparc/_glibc_inc.h @@ -14,7 +14,6 @@ #define ENTRY(sym) \ .global sym; \ - .hidden sym; \ .align ENTRY_ALIGN; \ .type sym,%function; \ sym: diff --git a/libc/string/sparc/sparc32/memchr.S b/libc/string/sparc/sparc32/memchr.S index e012844ba..4d57a553b 100644 --- a/libc/string/sparc/sparc32/memchr.S +++ b/libc/string/sparc/sparc32/memchr.S @@ -63,7 +63,7 @@ 1: retl sub %o0, 1, %o0 -ENTRY(__memchr) +ENTRY(memchr) andcc %o1, 0xff, %o1 sll %o1, 8, %g6 andcc %o0, 3, %g0 @@ -136,9 +136,9 @@ ENTRY(__memchr) sub %o0, 3, %o0 4: retl sub %o0, 4, %o0 -END(__memchr) -strong_alias(__memchr,memchr) +END(memchr) +libc_hidden_def(memchr) #if !__BOUNDED_POINTERS__ -weak_alias(__memchr,__ubp_memchr) +weak_alias(memchr,__ubp_memchr) #endif diff --git a/libc/string/sparc/sparc32/memcpy.S b/libc/string/sparc/sparc32/memcpy.S index a1dd246e6..3f40d7822 100644 --- a/libc/string/sparc/sparc32/memcpy.S +++ b/libc/string/sparc/sparc32/memcpy.S @@ -161,14 +161,14 @@ b 3f sub %o0, 2, %o0 -ENTRY(__bcopy) +ENTRY(bcopy) mov %o0, %o3 mov %o1, %o0 mov %o3, %o1 -END(__bcopy) -strong_alias(__bcopy,bcopy) +END(bcopy) +libc_hidden_def(bcopy) -ENTRY(__memmove) +ENTRY(memmove) cmp %o0, %o1 st %o0, [%sp + 64] bleu 9f @@ -448,10 +448,10 @@ ENTRY(__memmove) sub %o2, 2, %o2 b 3f add %o0, 2, %o0 -END(__memmove) -strong_alias(__memmove,memmove) +END(memmove) +libc_hidden_def(memmove) -ENTRY(__memcpy) /* %o0=dst %o1=src %o2=len */ +ENTRY(memcpy) /* %o0=dst %o1=src %o2=len */ sub %o0, %o1, %o4 st %o0, [%sp + 64] 9: andcc %o4, 3, %o5 @@ -966,5 +966,5 @@ ENTRY(__memcpy) /* %o0=dst %o1=src %o2=len */ sub %o7, %o4, %o5 110: retl sub %o7, %g6, %o5 -END(__memcpy) -strong_alias(__memcpy,memcpy) +END(memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/sparc/sparc32/memset.S b/libc/string/sparc/sparc32/memset.S index b60b881be..41e172cd8 100644 --- a/libc/string/sparc/sparc32/memset.S +++ b/libc/string/sparc/sparc32/memset.S @@ -43,7 +43,7 @@ .text .align 4 -ENTRY(__bzero) +ENTRY(bzero) b 1f mov %g0, %g3 @@ -60,10 +60,10 @@ ENTRY(__bzero) add %o1, %o2, %o1 b 4f sub %o0, %o2, %o0 -END(__bzero) -strong_alias(__bzero,bzero) +END(bzero) +libc_hidden_def(bzero) -ENTRY(__memset) +ENTRY(memset) and %o1, 0xff, %g3 sll %g3, 8, %g2 or %g3, %g2, %g3 @@ -148,5 +148,5 @@ ENTRY(__memset) stb %g3, [%o0 + 6] 0: retl nop -END(__memset) -strong_alias(__memset,memset) +END(memset) +libc_hidden_def(memset) diff --git a/libc/string/sparc/sparc32/stpcpy.S b/libc/string/sparc/sparc32/stpcpy.S index 26d2fecbd..daf116eb1 100644 --- a/libc/string/sparc/sparc32/stpcpy.S +++ b/libc/string/sparc/sparc32/stpcpy.S @@ -65,7 +65,7 @@ 1: retl add %o0, -1, %o0 -ENTRY(__stpcpy) +ENTRY(stpcpy) andcc %o1, 3, %g0 bne 10b sethi %hi(0x80808080), %o4 @@ -156,6 +156,6 @@ ENTRY(__stpcpy) add %o0, 1, %o0 19: retl nop -END(__stpcpy) +END(stpcpy) -strong_alias(__stpcpy,stpcpy) +libc_hidden_def(stpcpy) diff --git a/libc/string/sparc/sparc32/strcat.S b/libc/string/sparc/sparc32/strcat.S index 2ee630b23..eda029a16 100644 --- a/libc/string/sparc/sparc32/strcat.S +++ b/libc/string/sparc/sparc32/strcat.S @@ -91,7 +91,7 @@ b 3f sub %o0, 1, %o0 -ENTRY(__strcat) +ENTRY(strcat) mov %o0, %g2 andcc %o0, 3, %g0 bne 11b @@ -343,6 +343,6 @@ ENTRY(__strcat) srl %o5, 16, %o4 retl mov %g2, %o0 -END(__strcat) +END(strcat) -strong_alias(__strcat,strcat) +libc_hidden_def(strcat) diff --git a/libc/string/sparc/sparc32/strchr.S b/libc/string/sparc/sparc32/strchr.S index 69360c53a..d06bbe3cc 100644 --- a/libc/string/sparc/sparc32/strchr.S +++ b/libc/string/sparc/sparc32/strchr.S @@ -67,7 +67,7 @@ 1: retl sub %o0, 1, %o0 -ENTRY(__strchr) +ENTRY(strchr) andcc %o1, 0xff, %o1 be 12f sll %o1, 8, %o2 @@ -215,11 +215,11 @@ ENTRY(__strchr) 1: or %o4, %lo(0x01010101), %o2 b 7f ld [%o0], %g4 -END(__strchr) -strong_alias(__strchr,strchr) -strong_alias(__strchr,index) +END(strchr) +libc_hidden_def(strchr) +strong_alias(strchr,index) -ENTRY(__strrchr) +ENTRY(strrchr) andcc %o1, 0xff, %o1 clr %o5 be 12b @@ -276,6 +276,6 @@ ENTRY(__strrchr) ld [%o0], %g4 9: retl mov %o5, %o0 -END(__strrchr) -strong_alias(__strrchr,strrchr) -strong_alias(__strrchr,rindex) +END(strrchr) +libc_hidden_def(strrchr) +strong_alias(strrchr,rindex) diff --git a/libc/string/sparc/sparc32/strcmp.S b/libc/string/sparc/sparc32/strcmp.S index 6a807e08a..d43883de6 100644 --- a/libc/string/sparc/sparc32/strcmp.S +++ b/libc/string/sparc/sparc32/strcmp.S @@ -74,7 +74,7 @@ 2: retl mov %o4, %o0 -ENTRY(__strcmp) +ENTRY(strcmp) andcc %o0, 3, %g0 bne 10b sethi %hi(0x80808080), %g1 @@ -252,6 +252,5 @@ ENTRY(__strcmp) ld [%i0], %i4 jmpl %i7 + 8, %g0 restore %g4, %g0, %o0 -END(__strcmp) - -strong_alias(__strcmp,strcmp) +END(strcmp) +libc_hidden_def(strcmp) diff --git a/libc/string/sparc/sparc32/strcpy.S b/libc/string/sparc/sparc32/strcpy.S index ab57e00a5..4d7742ebc 100644 --- a/libc/string/sparc/sparc32/strcpy.S +++ b/libc/string/sparc/sparc32/strcpy.S @@ -63,7 +63,7 @@ b 6f andcc %o0, 3, %g3 -ENTRY(__strcpy) +ENTRY(strcpy) mov %o0, %g2 andcc %o1, 3, %g0 bne 1b @@ -269,6 +269,5 @@ ENTRY(__strcpy) srl %o5, 16, %o4 retl mov %g2, %o0 -END(__strcpy) - -strong_alias(__strcpy,strcpy) +END(strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/sparc/sparc32/strlen.S b/libc/string/sparc/sparc32/strlen.S index 81beb7f62..4edfe7e78 100644 --- a/libc/string/sparc/sparc32/strlen.S +++ b/libc/string/sparc/sparc32/strlen.S @@ -63,7 +63,7 @@ 3: retl mov 2, %o0 -ENTRY(__strlen) +ENTRY(strlen) mov %o0, %o1 andcc %o0, 3, %g0 bne 10b @@ -98,6 +98,5 @@ ENTRY(__strlen) add %o4, 1, %o4 13: retl sub %o4, %o1, %o0 -END(__strlen) - -strong_alias(__strlen,strlen) +END(strlen) +libc_hidden_def(strlen) diff --git a/libc/string/sparc/sparc64/memchr.S b/libc/string/sparc/sparc64/memchr.S index 7017b5540..6096cc218 100644 --- a/libc/string/sparc/sparc64/memchr.S +++ b/libc/string/sparc/sparc64/memchr.S @@ -54,7 +54,7 @@ .text .align 32 -ENTRY(__memchr) +ENTRY(memchr) and %o1, 0xff, %o1 /* IEU0 Group */ #ifdef USE_BPR brz,pn %o2, 12f /* CTI+IEU1 */ @@ -253,9 +253,9 @@ ENTRY(__memchr) 23: retl /* CTI+IEU1 Group */ add %o0, -1, %o0 /* IEU0 */ -END(__memchr) +END(memchr) -strong_alias(__memchr,memchr) +libc_hidden_def(memchr) #if !__BOUNDED_POINTERS__ -weak_alias(__memchr,__ubp_memchr) +weak_alias(memchr,__ubp_memchr) #endif diff --git a/libc/string/sparc/sparc64/memcpy.S b/libc/string/sparc/sparc64/memcpy.S index 4201b5ec2..4246b3564 100644 --- a/libc/string/sparc/sparc64/memcpy.S +++ b/libc/string/sparc/sparc64/memcpy.S @@ -191,7 +191,7 @@ .text .align 32 -ENTRY(__bcopy) +ENTRY(bcopy) sub %o1, %o0, %o4 /* IEU0 Group */ mov %o0, %g3 /* IEU1 */ cmp %o4, %o2 /* IEU1 Group */ @@ -205,8 +205,8 @@ ENTRY(__bcopy) add %o0, %o2, %o0 /* IEU0 */ retl nop -END(__bcopy) -strong_alias(__bcopy,bcopy) +END(bcopy) +libc_hidden_def(bcopy) .align 32 200: be,pt %xcc, 201f /* CTI */ @@ -504,7 +504,7 @@ END(__align_cpy_16) #endif .align 32 -ENTRY(__memcpy) +ENTRY(memcpy) 210: #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ @@ -695,8 +695,8 @@ ENTRY(__memcpy) 214: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(__memcpy) -strong_alias(__memcpy,memcpy) +END(memcpy) +libc_hidden_def(memcpy) .align 32 228: andcc %o2, 1, %g0 /* IEU1 Group */ @@ -721,7 +721,7 @@ strong_alias(__memcpy,memcpy) nop .align 32 -ENTRY(__memmove) +ENTRY(memmove) #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ #endif @@ -912,10 +912,10 @@ ENTRY(__memmove) 234: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(__memmove) -strong_alias(__memmove,memmove) +END(memmove) +libc_hidden_def(memmove) #ifdef USE_BPR -weak_alias(__memcpy,__align_cpy_1) -weak_alias(__memcpy,__align_cpy_2) +weak_alias(memcpy,__align_cpy_1) +weak_alias(memcpy,__align_cpy_2) #endif diff --git a/libc/string/sparc/sparc64/memset.S b/libc/string/sparc/sparc64/memset.S index 6fb25d211..6238f0f97 100644 --- a/libc/string/sparc/sparc64/memset.S +++ b/libc/string/sparc/sparc64/memset.S @@ -36,7 +36,7 @@ /* Well, memset is a lot easier to get right than bcopy... */ .text .align 32 -ENTRY(__memset) +ENTRY(memset) andcc %o1, 0xff, %o1 mov %o0, %o5 be,a,pt %icc, 50f @@ -176,8 +176,8 @@ ENTRY(__memset) nop ba,pt %xcc, 18b ldd [%o0], %f0 -END(__memset) -strong_alias(__memset,memset) +END(memset) +libc_hidden_def(memset) #define ZERO_BLOCKS(base, offset, source) \ stx source, [base - offset - 0x38]; \ @@ -191,7 +191,7 @@ strong_alias(__memset,memset) .text .align 32 -ENTRY(__bzero) +ENTRY(bzero) #ifndef USE_BPR srl %o1, 0, %o1 #endif @@ -309,5 +309,5 @@ ENTRY(__bzero) stb %g0, [%o0 - 1] 0: retl mov %o5, %o0 -END(__bzero) -strong_alias(__bzero,bzero) +END(bzero) +libc_hidden_def(bzero) diff --git a/libc/string/sparc/sparc64/sparcv9b/memcpy.S b/libc/string/sparc/sparc64/sparcv9b/memcpy.S index dd381c7ef..6bfe839ea 100644 --- a/libc/string/sparc/sparc64/sparcv9b/memcpy.S +++ b/libc/string/sparc/sparc64/sparcv9b/memcpy.S @@ -36,7 +36,7 @@ .text .align 32 -ENTRY(__bcopy) +ENTRY(bcopy) sub %o1, %o0, %o4 mov %o0, %g4 cmp %o4, %o2 @@ -50,8 +50,8 @@ ENTRY(__bcopy) add %o0, %o2, %o0 retl nop -END(__bcopy) -strong_alias(__bcopy,bcopy) +END(bcopy) +libc_hidden_def(bcopy) /* Special/non-trivial issues of this code: * @@ -68,7 +68,7 @@ strong_alias(__bcopy,bcopy) * of up to 2.4GB per second. */ .align 32 -ENTRY(__memcpy) +ENTRY(memcpy) 100: /* %o0=dst, %o1=src, %o2=len */ mov %o0, %g5 @@ -329,8 +329,8 @@ small_copy_unaligned: retl mov %g5, %o0 -END(__memcpy) -strong_alias(__memcpy,memcpy) +END(memcpy) +libc_hidden_def(memcpy) #define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \ ldx [%src - offset - 0x20], %t0; \ @@ -405,7 +405,7 @@ strong_alias(__memcpy,memcpy) mov %g4, %o0 .align 32 -ENTRY(__memmove) +ENTRY(memmove) mov %o0, %g5 #ifndef USE_BPR srl %o2, 0, %o2 /* IEU1 Group */ @@ -597,8 +597,8 @@ ENTRY(__memmove) 234: wr %g0, FPRS_FEF, %fprs retl mov %g4, %o0 -END(__memmove) -strong_alias(__memmove,memmove) +END(memmove) +libc_hidden_def(memmove) #ifdef USE_BPR weak_alias(memcpy,__align_cpy_1) diff --git a/libc/string/sparc/sparc64/stpcpy.S b/libc/string/sparc/sparc64/stpcpy.S index 6bd24cfee..8c26c6bec 100644 --- a/libc/string/sparc/sparc64/stpcpy.S +++ b/libc/string/sparc/sparc64/stpcpy.S @@ -45,7 +45,7 @@ .text .align 32 -ENTRY(__stpcpy) +ENTRY(stpcpy) sethi %hi(0x01010101), %g1 /* IEU0 Group */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ andcc %o0, 7, %g0 /* IEU1 */ @@ -267,6 +267,5 @@ ENTRY(__stpcpy) retl /* CTI+IEU1 Group */ mov %g6, %o0 /* IEU0 */ -END(__stpcpy) - -strong_alias(__stpcpy,stpcpy) +END(stpcpy) +libc_hidden_def(stpcpy) diff --git a/libc/string/sparc/sparc64/strcat.S b/libc/string/sparc/sparc64/strcat.S index fb3ad2d12..fcc4ba59c 100644 --- a/libc/string/sparc/sparc64/strcat.S +++ b/libc/string/sparc/sparc64/strcat.S @@ -47,7 +47,7 @@ .text .align 32 -ENTRY(__strcat) +ENTRY(strcat) sethi %hi(0x01010101), %g1 /* IEU0 Group */ ldub [%o0], %o3 /* Load */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -335,6 +335,5 @@ ENTRY(__strcat) stb %o4, [%o0 - 8] /* Store */ retl /* CTI+IEU1 Group */ mov %g6, %o0 /* IEU0 */ -END(__strcat) - -strong_alias(__strcat,strcat) +END(strcat) +libc_hidden_def(strcat) diff --git a/libc/string/sparc/sparc64/strchr.S b/libc/string/sparc/sparc64/strchr.S index 34c30df31..6a371352a 100644 --- a/libc/string/sparc/sparc64/strchr.S +++ b/libc/string/sparc/sparc64/strchr.S @@ -47,7 +47,7 @@ .text .align 32 -ENTRY(__strchr) +ENTRY(strchr) andcc %o1, 0xff, %o1 /* IEU1 Group */ be,pn %icc, 17f /* CTI */ sllx %o1, 8, %g3 /* IEU0 Group */ @@ -327,12 +327,12 @@ ENTRY(__strchr) lduba [%o0] ASI_PNF, %o3 /* Load */ retl /* CTI+IEU1 Group */ add %o0, -1, %o0 /* IEU0 */ -END(__strchr) -strong_alias(__strchr,strchr) -strong_alias(__strchr,index) +END(strchr) +libc_hidden_def(strchr) +strong_alias(strchr,index) .align 32 -ENTRY(__strrchr) +ENTRY(strrchr) andcc %o1, 0xff, %o1 /* IEU1 Group */ be,pn %icc, 17b /* CTI */ clr %g4 /* IEU0 */ @@ -476,6 +476,6 @@ ENTRY(__strrchr) ba,pt %xcc, 1b /* CTI Group */ ldx [%o0], %o3 /* Load */ -END(__strrchr) -strong_alias(__strrchr,strrchr) -strong_alias(__strrchr,rindex) +END(strrchr) +libc_hidden_def(strrchr) +strong_alias(strrchr,rindex) diff --git a/libc/string/sparc/sparc64/strcmp.S b/libc/string/sparc/sparc64/strcmp.S index 0e078e9ac..df9e69179 100644 --- a/libc/string/sparc/sparc64/strcmp.S +++ b/libc/string/sparc/sparc64/strcmp.S @@ -45,7 +45,7 @@ .text .align 32 -ENTRY(__strcmp) +ENTRY(strcmp) sethi %hi(0x01010101), %g1 /* IEU0 Group */ andcc %o0, 7, %g0 /* IEU1 */ bne,pn %icc, 7f /* CTI */ @@ -275,6 +275,5 @@ ENTRY(__strcmp) ba,pt %xcc, 11b /* CTI Group */ ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */ -END(__strcmp) - -strong_alias(__strcmp,strcmp) +END(strcmp) +libc_hidden_def(strcmp) diff --git a/libc/string/sparc/sparc64/strcpy.S b/libc/string/sparc/sparc64/strcpy.S index d9dff104a..1317d5489 100644 --- a/libc/string/sparc/sparc64/strcpy.S +++ b/libc/string/sparc/sparc64/strcpy.S @@ -45,7 +45,7 @@ .text .align 32 -ENTRY(__strcpy) +ENTRY(strcpy) sethi %hi(0x01010101), %g1 /* IEU0 Group */ mov %o0, %g6 /* IEU1 */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -240,6 +240,6 @@ ENTRY(__strcpy) stb %o4, [%o0 - 8] /* Store */ retl /* CTI+IEU1 Group */ mov %g6, %o0 /* IEU0 */ -END(__strcpy) +END(strcpy) -strong_alias(__strcpy,strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/sparc/sparc64/strlen.S b/libc/string/sparc/sparc64/strlen.S index 3c1cfc0d8..1fe854961 100644 --- a/libc/string/sparc/sparc64/strlen.S +++ b/libc/string/sparc/sparc64/strlen.S @@ -39,7 +39,7 @@ .text .align 32 -ENTRY(__strlen) +ENTRY(strlen) sethi %hi(0x01010101), %g1 /* IEU0 Group */ ldub [%o0], %o3 /* Load */ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */ @@ -169,6 +169,5 @@ ENTRY(__strlen) add %o0, -1, %o0 /* IEU0 Group */ retl /* CTI+IEU1 Group */ sub %o0, %o1, %o0 /* IEU0 */ -END(__strlen) - -strong_alias(__strlen,strlen) +END(strlen) +libc_hidden_def(strlen) diff --git a/libc/string/stpcpy.c b/libc/string/stpcpy.c index 540d04831..f34b9f65a 100644 --- a/libc/string/stpcpy.c +++ b/libc/string/stpcpy.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstpcpy __wcpcpy # define Wstpcpy wcpcpy #else -# define __Wstpcpy __stpcpy +libc_hidden_proto(stpcpy) # define Wstpcpy stpcpy #endif -Wchar attribute_hidden *__Wstpcpy(register Wchar * __restrict s1, const Wchar * __restrict s2) +Wchar *Wstpcpy(register Wchar * __restrict s1, const Wchar * __restrict s2) { #ifdef __BCC__ do { @@ -28,4 +27,6 @@ Wchar attribute_hidden *__Wstpcpy(register Wchar * __restrict s1, const Wchar * return s1 - 1; } -strong_alias(__Wstpcpy,Wstpcpy) +#ifndef WANT_WIDE +libc_hidden_def(stpcpy) +#endif diff --git a/libc/string/stpncpy.c b/libc/string/stpncpy.c index 5b45d0ef9..2603d2bd0 100644 --- a/libc/string/stpncpy.c +++ b/libc/string/stpncpy.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstpncpy __wcpncpy # define Wstpncpy wcpncpy #else -# define __Wstpncpy __stpncpy +libc_hidden_proto(stpncpy) # define Wstpncpy stpncpy #endif -Wchar attribute_hidden *__Wstpncpy(register Wchar * __restrict s1, +Wchar *Wstpncpy(register Wchar * __restrict s1, register const Wchar * __restrict s2, size_t n) { @@ -38,4 +37,6 @@ Wchar attribute_hidden *__Wstpncpy(register Wchar * __restrict s1, #endif } -strong_alias(__Wstpncpy,Wstpncpy) +#ifndef WANT_WIDE +libc_hidden_def(stpncpy) +#endif diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 1d758e2ca..42d7230ae 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -9,44 +9,40 @@ #include <ctype.h> #include <locale.h> -#ifdef __UCLIBC_HAS_XLOCALE__ -extern int __strcasecmp_l (__const char *__s1, __const char *__s2, - __locale_t __loc) - __THROW __attribute_pure__ __nonnull ((1, 2, 3)) attribute_hidden; -extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - __locale_t __loc) __THROW attribute_hidden; -#endif - #ifdef WANT_WIDE # define strcasecmp wcscasecmp -# define __strcasecmp __wcscasecmp # define strcasecmp_l wcscasecmp_l -# define __strcasecmp_l __wcscasecmp_l # ifdef __UCLIBC_DO_XLOCALE -# define TOLOWER(C) __towlower_l((C), locale_arg) -extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW attribute_hidden; +libc_hidden_proto(towlower_l) +# define TOLOWER(C) towlower_l((C), locale_arg) # else -# define TOLOWER(C) __towlower((C)) +libc_hidden_proto(towlower) +# define TOLOWER(C) towlower((C)) # endif #else # ifdef __UCLIBC_DO_XLOCALE -# define TOLOWER(C) __tolower_l((C), locale_arg) +libc_hidden_proto(tolower_l) +# define TOLOWER(C) tolower_l((C), locale_arg) # else -# define TOLOWER(C) __tolower((C)) +libc_hidden_proto(tolower) +# define TOLOWER(C) tolower((C)) # endif #endif #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int attribute_hidden __strcasecmp(register const Wchar *s1, register const Wchar *s2) +libc_hidden_proto(strcasecmp_l) + +int strcasecmp(register const Wchar *s1, register const Wchar *s2) { - return __strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE); + return strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE); } -strong_alias(__strcasecmp,strcasecmp) +libc_hidden_proto(strcasecmp) +libc_hidden_def(strcasecmp) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -int attribute_hidden __UCXL(strcasecmp)(register const Wchar *s1, register const Wchar *s2 +int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2 __LOCALE_PARAM ) { #ifdef WANT_WIDE @@ -70,6 +66,7 @@ int attribute_hidden __UCXL(strcasecmp)(register const Wchar *s1, register const return r; #endif } -__UCXL_ALIAS(strcasecmp) +libc_hidden_proto(__XL_NPP(strcasecmp)) +libc_hidden_def(__XL_NPP(strcasecmp)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/string/strcasestr.c b/libc/string/strcasestr.c index 5222eda71..d835440ec 100644 --- a/libc/string/strcasestr.c +++ b/libc/string/strcasestr.c @@ -8,7 +8,9 @@ #include "_string.h" #include <ctype.h> -char attribute_hidden *__strcasestr(const char *s1, const char *s2) +libc_hidden_proto(tolower) + +char *strcasestr(const char *s1, const char *s2) { register const char *s = s1; register const char *p = s2; @@ -19,7 +21,7 @@ char attribute_hidden *__strcasestr(const char *s1, const char *s2) return (char *) s1;; } if ((*p == *s) - || (__tolower(*((unsigned char *)p)) == __tolower(*((unsigned char *)s))) + || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s))) ) { ++p; ++s; @@ -34,7 +36,7 @@ char attribute_hidden *__strcasestr(const char *s1, const char *s2) #else while (*p && *s) { if ((*p == *s) - || (__tolower(*((unsigned char *)p)) == __tolower(*((unsigned char *)s))) + || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s))) ) { ++p; ++s; @@ -47,5 +49,3 @@ char attribute_hidden *__strcasestr(const char *s1, const char *s2) return (*p) ? NULL : (char *) s1; #endif } - -strong_alias(__strcasestr,strcasestr) diff --git a/libc/string/strcat.c b/libc/string/strcat.c index 5288f93ed..40a9be111 100644 --- a/libc/string/strcat.c +++ b/libc/string/strcat.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrcat __wcscat # define Wstrcat wcscat #else -# define __Wstrcat __strcat # define Wstrcat strcat #endif -Wchar attribute_hidden *__Wstrcat(Wchar * __restrict s1, register const Wchar * __restrict s2) +libc_hidden_proto(Wstrcat) + +Wchar *Wstrcat(Wchar * __restrict s1, register const Wchar * __restrict s2) { register Wchar *s = s1; @@ -25,5 +25,4 @@ Wchar attribute_hidden *__Wstrcat(Wchar * __restrict s1, register const Wchar * return s1; } - -strong_alias(__Wstrcat,Wstrcat) +libc_hidden_def(Wstrcat) diff --git a/libc/string/strchr.c b/libc/string/strchr.c index 93f394ab1..6bfd2077d 100644 --- a/libc/string/strchr.c +++ b/libc/string/strchr.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrchr __wcschr # define Wstrchr wcschr #else -# define __Wstrchr __strchr # define Wstrchr strchr #endif -Wchar attribute_hidden *__Wstrchr(register const Wchar *s, Wint c) +libc_hidden_proto(Wstrchr) + +Wchar *Wstrchr(register const Wchar *s, Wint c) { do { if (*s == ((Wchar)c)) { @@ -25,9 +25,8 @@ Wchar attribute_hidden *__Wstrchr(register const Wchar *s, Wint c) return NULL; } - -strong_alias(__Wstrchr,Wstrchr) +libc_hidden_def(Wstrchr) #ifndef WANT_WIDE -strong_alias(__strchr,index) +strong_alias(strchr,index) #endif diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c index c498532fd..cc3883402 100644 --- a/libc/string/strchrnul.c +++ b/libc/string/strchrnul.c @@ -8,18 +8,17 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrchrnul __wcschrnul # define Wstrchrnul wcschrnul #else -# define __Wstrchrnul __strchrnul # define Wstrchrnul strchrnul #endif -Wchar attribute_hidden *__Wstrchrnul(register const Wchar *s, Wint c) +libc_hidden_proto(Wstrchrnul) + +Wchar *Wstrchrnul(register const Wchar *s, Wint c) { --s; while (*++s && (*s != ((Wchar)c))); return (Wchar *) s; } - -strong_alias(__Wstrchrnul,Wstrchrnul) +libc_hidden_def(Wstrchrnul) diff --git a/libc/string/strcmp.c b/libc/string/strcmp.c index 1fb8625ff..0ca95766c 100644 --- a/libc/string/strcmp.c +++ b/libc/string/strcmp.c @@ -8,14 +8,16 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrcmp __wcscmp # define Wstrcmp wcscmp +# define Wstrcoll wcscoll #else -# define __Wstrcmp __strcmp # define Wstrcmp strcmp +# define Wstrcoll strcoll #endif -int attribute_hidden __Wstrcmp(register const Wchar *s1, register const Wchar *s2) +libc_hidden_proto(Wstrcmp) + +int Wstrcmp(register const Wchar *s1, register const Wchar *s2) { #ifdef WANT_WIDE while (*((Wuchar *)s1) == *((Wuchar *)s2)) { @@ -35,15 +37,10 @@ int attribute_hidden __Wstrcmp(register const Wchar *s1, register const Wchar *s return r; #endif } - -strong_alias(__Wstrcmp,Wstrcmp) +libc_hidden_def(Wstrcmp) #ifndef __UCLIBC_HAS_LOCALE__ -# ifdef WANT_WIDE -hidden_strong_alias(__wcscmp,__wcscoll) -strong_alias(__wcscmp,wcscoll) -# else -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) -# endif +strong_alias(Wstrcmp,Wstrcoll) +libc_hidden_proto(Wstrcoll) +libc_hidden_def(Wstrcoll) #endif diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c index 3b0e490eb..cda4094ac 100644 --- a/libc/string/strcpy.c +++ b/libc/string/strcpy.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrcpy __wcscpy # define Wstrcpy wcscpy #else -# define __Wstrcpy __strcpy # define Wstrcpy strcpy #endif -Wchar attribute_hidden *__Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2) +libc_hidden_proto(Wstrcpy) + +Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2) { register Wchar *s = s1; @@ -29,5 +29,4 @@ Wchar attribute_hidden *__Wstrcpy(Wchar * __restrict s1, const Wchar * __restric return s1; } - -strong_alias(__Wstrcpy,Wstrcpy) +libc_hidden_def(Wstrcpy) diff --git a/libc/string/strcspn.c b/libc/string/strcspn.c index 7a709a77f..75d2e081b 100644 --- a/libc/string/strcspn.c +++ b/libc/string/strcspn.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrcspn __wcscspn # define Wstrcspn wcscspn #else -# define __Wstrcspn __strcspn +libc_hidden_proto(strcspn) # define Wstrcspn strcspn #endif -size_t attribute_hidden __Wstrcspn(const Wchar *s1, const Wchar *s2) +size_t Wstrcspn(const Wchar *s1, const Wchar *s2) { register const Wchar *s; register const Wchar *p; @@ -29,4 +28,6 @@ size_t attribute_hidden __Wstrcspn(const Wchar *s1, const Wchar *s2) return s - s1; } -strong_alias(__Wstrcspn,Wstrcspn) +#ifndef WANT_WIDE +libc_hidden_def(strcspn) +#endif diff --git a/libc/string/strdup.c b/libc/string/strdup.c index e2ccead9d..dff5af60a 100644 --- a/libc/string/strdup.c +++ b/libc/string/strdup.c @@ -9,18 +9,21 @@ #include <stdlib.h> #ifdef WANT_WIDE -# define __Wstrdup __wcsdup +libc_hidden_proto(wcslen) +libc_hidden_proto(wcscpy) # define Wstrdup wcsdup -# define Wstrlen __wcslen -# define Wstrcpy __wcscpy +# define Wstrlen wcslen +# define Wstrcpy wcscpy #else -# define __Wstrdup __strdup +libc_hidden_proto(strdup) +libc_hidden_proto(strlen) +libc_hidden_proto(strcpy) # define Wstrdup strdup -# define Wstrlen __strlen -# define Wstrcpy __strcpy +# define Wstrlen strlen +# define Wstrcpy strcpy #endif -Wchar attribute_hidden *__Wstrdup(register const Wchar *s1) +Wchar *Wstrdup(register const Wchar *s1) { register Wchar *s; @@ -31,4 +34,6 @@ Wchar attribute_hidden *__Wstrdup(register const Wchar *s1) return s; } -strong_alias(__Wstrdup,Wstrdup) +#ifndef WANT_WIDE +libc_hidden_def(strdup) +#endif diff --git a/libc/string/strerror.c b/libc/string/strerror.c index a2f1f4833..1b5cb3ff2 100644 --- a/libc/string/strerror.c +++ b/libc/string/strerror.c @@ -9,13 +9,15 @@ #include <string.h> #include "_syserrmsg.h" -char attribute_hidden *__strerror(int errnum) +libc_hidden_proto(strerror) +libc_hidden_proto(__xpg_strerror_r) + +char *strerror(int errnum) { static char buf[_STRERROR_BUFSIZE]; - __xpg_strerror_r_internal(errnum, buf, sizeof(buf)); + __xpg_strerror_r(errnum, buf, sizeof(buf)); return buf; } - -strong_alias(__strerror,strerror) +libc_hidden_def(strerror) diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 3920db083..2f3d29fff 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -8,18 +8,22 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrlcpy __wcslcpy -# define Wstrlcpy wcslcpy +# define Wstrlcpy __wcslcpy +# define Wstrxfrm wcsxfrm #else -# define __Wstrlcpy __strlcpy # define Wstrlcpy strlcpy +# define Wstrxfrm strxfrm #endif + /* OpenBSD function: * Copy at most n-1 chars from src to dst and nul-terminate dst. * Returns strlen(src), so truncation occurred if the return value is >= n. */ -size_t attribute_hidden __Wstrlcpy(register Wchar *__restrict dst, +#ifdef WANT_WIDE +attribute_hidden +#endif +size_t Wstrlcpy(register Wchar *__restrict dst, register const Wchar *__restrict src, size_t n) { @@ -42,15 +46,16 @@ size_t attribute_hidden __Wstrlcpy(register Wchar *__restrict dst, return src - src0; } - -strong_alias(__Wstrlcpy,Wstrlcpy) - +#ifndef WANT_WIDE +libc_hidden_proto(strlcpy) +libc_hidden_def(strlcpy) +#ifndef __UCLIBC_HAS_LOCALE__ +strong_alias(strlcpy,strxfrm) +libc_hidden_proto(strxfrm) +libc_hidden_def(strxfrm) +#endif +#else #ifndef __UCLIBC_HAS_LOCALE__ -# ifdef WANT_WIDE -hidden_strong_alias(__wcslcpy,__wcsxfrm) strong_alias(__wcslcpy,wcsxfrm) -# else -hidden_strong_alias(__strlcpy,__strxfrm) -strong_alias(__strlcpy,strxfrm) -# endif +#endif #endif diff --git a/libc/string/strlen.c b/libc/string/strlen.c index 27cd8481c..bcb096b97 100644 --- a/libc/string/strlen.c +++ b/libc/string/strlen.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrlen __wcslen # define Wstrlen wcslen #else -# define __Wstrlen __strlen # define Wstrlen strlen #endif -size_t attribute_hidden __Wstrlen(const Wchar *s) +libc_hidden_proto(Wstrlen) + +size_t Wstrlen(const Wchar *s) { register const Wchar *p; @@ -23,5 +23,4 @@ size_t attribute_hidden __Wstrlen(const Wchar *s) return p - s; } - -strong_alias(__Wstrlen,Wstrlen) +libc_hidden_def(Wstrlen) diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index bfc865a8c..1de214c73 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -9,44 +9,40 @@ #include <ctype.h> #include <locale.h> -#ifdef __UCLIBC_HAS_XLOCALE__ -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; -extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - size_t __n, __locale_t __loc) __THROW attribute_hidden; -#endif - #ifdef WANT_WIDE # define strncasecmp wcsncasecmp -# define __strncasecmp __wcsncasecmp # define strncasecmp_l wcsncasecmp_l -# define __strncasecmp_l __wcsncasecmp_l # ifdef __UCLIBC_DO_XLOCALE -# define TOLOWER(C) __towlower_l((C), locale_arg) -extern wint_t __towlower_l (wint_t __wc, __locale_t __locale) __THROW attribute_hidden; +libc_hidden_proto(towlower_l) +# define TOLOWER(C) towlower_l((C), locale_arg) # else -# define TOLOWER(C) __towlower((C)) +libc_hidden_proto(towlower) +# define TOLOWER(C) towlower((C)) # endif #else # ifdef __UCLIBC_DO_XLOCALE -# define TOLOWER(C) __tolower_l((C), locale_arg) +libc_hidden_proto(tolower_l) +# define TOLOWER(C) tolower_l((C), locale_arg) # else -# define TOLOWER(C) __tolower((C)) +libc_hidden_proto(tolower) +# define TOLOWER(C) tolower((C)) # endif #endif #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int attribute_hidden __strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) +libc_hidden_proto(strncasecmp_l) + +int strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) { - return __strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE); + return strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE); } -strong_alias(__strncasecmp,strncasecmp) +libc_hidden_proto(strncasecmp) +libc_hidden_def(strncasecmp) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -int attribute_hidden __UCXL(strncasecmp)(register const Wchar *s1, register const Wchar *s2, +int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2, size_t n __LOCALE_PARAM ) { #ifdef WANT_WIDE @@ -73,6 +69,7 @@ int attribute_hidden __UCXL(strncasecmp)(register const Wchar *s1, register cons return r; #endif } -__UCXL_ALIAS(strncasecmp) +libc_hidden_proto(__XL_NPP(strncasecmp)) +libc_hidden_def(__XL_NPP(strncasecmp)) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/string/strncat.c b/libc/string/strncat.c index 20fbcfa27..61170c369 100644 --- a/libc/string/strncat.c +++ b/libc/string/strncat.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrncat __wcsncat # define Wstrncat wcsncat #else -# define __Wstrncat __strncat +libc_hidden_proto(strncat) # define Wstrncat strncat #endif -Wchar attribute_hidden *__Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2, +Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2, size_t n) { register Wchar *s = s1; @@ -35,4 +34,6 @@ Wchar attribute_hidden *__Wstrncat(Wchar * __restrict s1, register const Wchar * return s1; } -strong_alias(__Wstrncat,Wstrncat) +#ifndef WANT_WIDE +libc_hidden_def(strncat) +#endif diff --git a/libc/string/strncmp.c b/libc/string/strncmp.c index ad80ce8e5..e7caf916c 100644 --- a/libc/string/strncmp.c +++ b/libc/string/strncmp.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrncmp __wcsncmp # define Wstrncmp wcsncmp #else -# define __Wstrncmp __strncmp +libc_hidden_proto(strncmp) # define Wstrncmp strncmp #endif -int attribute_hidden __Wstrncmp(register const Wchar *s1, register const Wchar *s2, size_t n) +int Wstrncmp(register const Wchar *s1, register const Wchar *s2, size_t n) { #ifdef WANT_WIDE while (n && (*((Wuchar *)s1) == *((Wuchar *)s2))) { @@ -38,5 +37,4 @@ int attribute_hidden __Wstrncmp(register const Wchar *s1, register const Wchar * return r; #endif } - -strong_alias(__Wstrncmp,Wstrncmp) +libc_hidden_def(strncmp) diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c index 09124ac99..7c6654626 100644 --- a/libc/string/strncpy.c +++ b/libc/string/strncpy.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrncpy __wcsncpy # define Wstrncpy wcsncpy #else -# define __Wstrncpy __strncpy +libc_hidden_proto(strncpy) # define Wstrncpy strncpy #endif -Wchar attribute_hidden *__Wstrncpy(Wchar * __restrict s1, register const Wchar * __restrict s2, +Wchar *Wstrncpy(Wchar * __restrict s1, register const Wchar * __restrict s2, size_t n) { register Wchar *s = s1; @@ -35,5 +34,4 @@ Wchar attribute_hidden *__Wstrncpy(Wchar * __restrict s1, register const Wchar * return s1; } - -strong_alias(__Wstrncpy,Wstrncpy) +libc_hidden_def(strncpy) diff --git a/libc/string/strndup.c b/libc/string/strndup.c index 5cee0272d..89c58ccec 100644 --- a/libc/string/strndup.c +++ b/libc/string/strndup.c @@ -8,18 +8,21 @@ #include "_string.h" #include <stdlib.h> -char attribute_hidden *__strndup(register const char *s1, size_t n) +libc_hidden_proto(strndup) +libc_hidden_proto(strnlen) +libc_hidden_proto(memcpy) + +char *strndup(register const char *s1, size_t n) { register char *s; - n = __strnlen(s1,n); /* Avoid problems if s1 not nul-terminated. */ + n = strnlen(s1,n); /* Avoid problems if s1 not nul-terminated. */ if ((s = malloc(n + 1)) != NULL) { - __memcpy(s, s1, n); + memcpy(s, s1, n); s[n] = 0; } return s; } - -strong_alias(__strndup,strndup) +libc_hidden_def(strndup) diff --git a/libc/string/strnlen.c b/libc/string/strnlen.c index 6732cc532..547dd23b2 100644 --- a/libc/string/strnlen.c +++ b/libc/string/strnlen.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrnlen __wcsnlen # define Wstrnlen wcsnlen #else -# define __Wstrnlen __strnlen # define Wstrnlen strnlen #endif -size_t attribute_hidden __Wstrnlen(const Wchar *s, size_t max) +libc_hidden_proto(Wstrnlen) + +size_t Wstrnlen(const Wchar *s, size_t max) { register const Wchar *p = s; #ifdef __BCC__ @@ -34,4 +34,4 @@ size_t attribute_hidden __Wstrnlen(const Wchar *s, size_t max) } #undef maxp -strong_alias(__Wstrnlen,Wstrnlen) +libc_hidden_def(Wstrnlen) diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c index 704b1bc71..abeb84380 100644 --- a/libc/string/strpbrk.c +++ b/libc/string/strpbrk.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrpbrk __wcspbrk # define Wstrpbrk wcspbrk #else -# define __Wstrpbrk __strpbrk # define Wstrpbrk strpbrk #endif -Wchar attribute_hidden *__Wstrpbrk(const Wchar *s1, const Wchar *s2) +libc_hidden_proto(Wstrpbrk) + +Wchar *Wstrpbrk(const Wchar *s1, const Wchar *s2) { register const Wchar *s; register const Wchar *p; @@ -27,5 +27,4 @@ Wchar attribute_hidden *__Wstrpbrk(const Wchar *s1, const Wchar *s2) } return NULL; } - -strong_alias(__Wstrpbrk,Wstrpbrk) +libc_hidden_def(Wstrpbrk) diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c index cb30afea7..7c44a346a 100644 --- a/libc/string/strrchr.c +++ b/libc/string/strrchr.c @@ -8,14 +8,13 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrrchr __wcsrchr # define Wstrrchr wcsrchr #else -# define __Wstrrchr __strrchr +libc_hidden_proto(strrchr) # define Wstrrchr strrchr #endif -Wchar attribute_hidden *__Wstrrchr(register const Wchar *s, Wint c) +Wchar *Wstrrchr(register const Wchar *s, Wint c) { register const Wchar *p; @@ -28,8 +27,7 @@ Wchar attribute_hidden *__Wstrrchr(register const Wchar *s, Wint c) return (Wchar *) p; /* silence the warning */ } - -strong_alias(__Wstrrchr,Wstrrchr) +libc_hidden_def(strrchr) #ifndef WANT_WIDE -strong_alias(__strrchr,rindex) +strong_alias(strrchr,rindex) #endif diff --git a/libc/string/strsep.c b/libc/string/strsep.c index 993fafecb..7f421891e 100644 --- a/libc/string/strsep.c +++ b/libc/string/strsep.c @@ -7,18 +7,22 @@ #include "_string.h" -char attribute_hidden *__strsep(char ** __restrict s1, const char * __restrict s2) +libc_hidden_proto(strsep) +libc_hidden_proto(strpbrk) +libc_hidden_proto(strcspn) + +char *strsep(char ** __restrict s1, const char * __restrict s2) { register char *s = *s1; register char *p; #if 1 p = NULL; - if (s && *s && (p = __strpbrk(s, s2))) { + if (s && *s && (p = strpbrk(s, s2))) { *p++ = 0; } #else - if (s && *s && *(p = s + __strcspn(s, s2))) { + if (s && *s && *(p = s + strcspn(s, s2))) { *p++ = 0; } else { p = NULL; @@ -27,5 +31,4 @@ char attribute_hidden *__strsep(char ** __restrict s1, const char * __restrict s *s1 = p; return s; } - -strong_alias(__strsep,strsep) +libc_hidden_def(strsep) diff --git a/libc/string/strsignal.c b/libc/string/strsignal.c index 13aa3b1ad..b99facc81 100644 --- a/libc/string/strsignal.c +++ b/libc/string/strsignal.c @@ -19,6 +19,9 @@ #include <bits/uClibc_uintmaxtostr.h> #include <signal.h> +libc_hidden_proto(strsignal) +libc_hidden_proto(memcpy) + #define _SYS_NSIG 32 #ifdef __UCLIBC_HAS_SIGNUM_MESSAGES__ @@ -81,7 +84,7 @@ static const unsigned char sstridx[] = { }; #endif -char attribute_hidden *__strsignal(int signum) +char *strsignal(int signum) { register char *s; int i; @@ -120,7 +123,7 @@ char attribute_hidden *__strsignal(int signum) } s = _int10tostr(buf+sizeof(buf)-1, signum) - sizeof(unknown); - __memcpy(s, unknown, sizeof(unknown)); + memcpy(s, unknown, sizeof(unknown)); DONE: return s; @@ -128,18 +131,18 @@ char attribute_hidden *__strsignal(int signum) #else /* __UCLIBC_HAS_SIGNUM_MESSAGES__ */ -char attribute_hidden *__strsignal(int signum) +char *strsignal(int signum) { static char buf[_STRSIGNAL_BUFSIZE]; static const char unknown[] = { 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' ' }; - return (char *) __memcpy(_int10tostr(buf+sizeof(buf)-1, signum) + return (char *) memcpy(_int10tostr(buf+sizeof(buf)-1, signum) - sizeof(unknown), unknown, sizeof(unknown)); } #endif /* __UCLIBC_HAS_SIGNUM_MESSAGES__ */ -strong_alias(__strsignal,strsignal) +libc_hidden_def(strsignal) diff --git a/libc/string/strspn.c b/libc/string/strspn.c index 9074c13ad..ca83ef900 100644 --- a/libc/string/strspn.c +++ b/libc/string/strspn.c @@ -8,14 +8,14 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrspn __wcsspn # define Wstrspn wcsspn #else -# define __Wstrspn __strspn # define Wstrspn strspn #endif -size_t attribute_hidden __Wstrspn(const Wchar *s1, const Wchar *s2) +libc_hidden_proto(Wstrspn) + +size_t Wstrspn(const Wchar *s1, const Wchar *s2) { register const Wchar *s = s1; register const Wchar *p = s2; @@ -28,5 +28,4 @@ size_t attribute_hidden __Wstrspn(const Wchar *s1, const Wchar *s2) } return s - s1; } - -strong_alias(__Wstrspn,Wstrspn) +libc_hidden_def(Wstrspn) diff --git a/libc/string/strstr.c b/libc/string/strstr.c index 7256b9da2..685a2f83c 100644 --- a/libc/string/strstr.c +++ b/libc/string/strstr.c @@ -8,16 +8,15 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrstr __wcsstr # define Wstrstr wcsstr #else -# define __Wstrstr __strstr +libc_hidden_proto(strstr) # define Wstrstr strstr #endif /* NOTE: This is the simple-minded O(len(s1) * len(s2)) worst-case approach. */ -Wchar attribute_hidden *__Wstrstr(const Wchar *s1, const Wchar *s2) +Wchar *Wstrstr(const Wchar *s1, const Wchar *s2) { register const Wchar *s = s1; register const Wchar *p = s2; @@ -38,8 +37,8 @@ Wchar attribute_hidden *__Wstrstr(const Wchar *s1, const Wchar *s2) } } while (1); } - -strong_alias(__Wstrstr,Wstrstr) -#ifdef WANT_WIDE -strong_alias(__wcsstr,wcswcs) +#ifndef WANT_WIDE +libc_hidden_def(strstr) +#else +strong_alias(wcsstr,wcswcs) #endif diff --git a/libc/string/strtok.c b/libc/string/strtok.c index 4b8aef6b5..127497c9d 100644 --- a/libc/string/strtok.c +++ b/libc/string/strtok.c @@ -9,12 +9,14 @@ #if 0 /*def WANT_WIDE*/ # define Wstrtok wcstok -# define Wstrtok_r __wcstok_r +# define Wstrtok_r wcstok_r #else # define Wstrtok strtok -# define Wstrtok_r __strtok_r +# define Wstrtok_r strtok_r #endif +libc_hidden_proto(Wstrtok_r) + Wchar *Wstrtok(Wchar * __restrict s1, const Wchar * __restrict s2) { static Wchar *next_start; /* Initialized to 0 since in bss. */ diff --git a/libc/string/strtok_r.c b/libc/string/strtok_r.c index c8ba588eb..bda56d71c 100644 --- a/libc/string/strtok_r.c +++ b/libc/string/strtok_r.c @@ -8,18 +8,21 @@ #include "_string.h" #ifdef WANT_WIDE -# define __Wstrtok_r __wcstok +libc_hidden_proto(wcsspn) +libc_hidden_proto(wcspbrk) # define Wstrtok_r wcstok -# define Wstrspn __wcsspn -# define Wstrpbrk __wcspbrk +# define Wstrspn wcsspn +# define Wstrpbrk wcspbrk #else -# define __Wstrtok_r __strtok_r +libc_hidden_proto(strtok_r) +libc_hidden_proto(strspn) +libc_hidden_proto(strpbrk) # define Wstrtok_r strtok_r -# define Wstrspn __strspn -# define Wstrpbrk __strpbrk +# define Wstrspn strspn +# define Wstrpbrk strpbrk #endif -Wchar attribute_hidden *__Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2, +Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2, Wchar ** __restrict next_start) { register Wchar *s; @@ -52,4 +55,6 @@ Wchar attribute_hidden *__Wstrtok_r(Wchar * __restrict s1, const Wchar * __restr #endif } -strong_alias(__Wstrtok_r,Wstrtok_r) +#ifndef WANT_WIDE +libc_hidden_def(strtok_r) +#endif diff --git a/libc/string/x86_64/_glibc_inc.h b/libc/string/x86_64/_glibc_inc.h index 3c31957db..88cef2ea3 100644 --- a/libc/string/x86_64/_glibc_inc.h +++ b/libc/string/x86_64/_glibc_inc.h @@ -14,7 +14,6 @@ #define ENTRY(sym) \ .global sym; \ - .hidden sym; \ .align ENTRY_ALIGN; \ .type sym,%function; \ sym: diff --git a/libc/string/x86_64/bzero.S b/libc/string/x86_64/bzero.S index 73ba75436..2b6ac0988 100644 --- a/libc/string/x86_64/bzero.S +++ b/libc/string/x86_64/bzero.S @@ -1,3 +1,3 @@ -#define __memset __bzero +#define memset bzero #include "memset.S" -strong_alias(__bzero,bzero) +libc_hidden_def(bzero) diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S index 973cd513f..b3bb0f96c 100644 --- a/libc/string/x86_64/memcpy.S +++ b/libc/string/x86_64/memcpy.S @@ -23,7 +23,7 @@ /* BEWARE: `#ifdef memcpy' means that memcpy is redefined as `mempcpy', and the return value is the byte after the last one copied in the destination. */ -#define MEMPCPY_P (defined __memcpy) +#define MEMPCPY_P (defined memcpy) .text #if defined PIC && !defined NOT_IN_libc @@ -32,7 +32,7 @@ ENTRY (__memcpy_chk) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memcpy_chk) #endif -ENTRY (BP_SYM (__memcpy)) +ENTRY (BP_SYM (memcpy)) /* Cutoff for the big loop is a size of 32 bytes since otherwise the loop will never be entered. */ cmpq $32, %rdx @@ -92,7 +92,7 @@ ENTRY (BP_SYM (__memcpy)) #endif ret -END (BP_SYM (__memcpy)) +END (BP_SYM (memcpy)) #if !MEMPCPY_P -strong_alias(__memcpy,memcpy) +libc_hidden_def(memcpy) #endif diff --git a/libc/string/x86_64/mempcpy.S b/libc/string/x86_64/mempcpy.S index 3a8e925fd..3816d9f72 100644 --- a/libc/string/x86_64/mempcpy.S +++ b/libc/string/x86_64/mempcpy.S @@ -1,3 +1,3 @@ -#define __memcpy __mempcpy +#define memcpy mempcpy #include "memcpy.S" -strong_alias(__mempcpy,mempcpy) +libc_hidden_def(mempcpy) diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S index 923e1c208..d72d74468 100644 --- a/libc/string/x86_64/memset.S +++ b/libc/string/x86_64/memset.S @@ -22,7 +22,7 @@ #include "_glibc_inc.h" /* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */ -#define BZERO_P (defined __memset) +#define BZERO_P (defined memset) /* This is somehow experimental and could made dependend on the cache size. */ @@ -35,7 +35,7 @@ ENTRY (__memset_chk) jb HIDDEN_JUMPTARGET (__chk_fail) END (__memset_chk) #endif -ENTRY (__memset) +ENTRY (memset) #if BZERO_P mov %rsi,%rdx /* Adjust parameter. */ xorl %esi,%esi /* Fill with 0s. */ @@ -131,9 +131,9 @@ ENTRY (__memset) jne 11b jmp 4b -END (__memset) +END (memset) #if !BZERO_P -strong_alias(__memset,memset) +libc_hidden_def(memset) #endif #if !BZERO_P && defined PIC && !defined NOT_IN_libc diff --git a/libc/string/x86_64/stpcpy.S b/libc/string/x86_64/stpcpy.S index 075773371..138d0fb17 100644 --- a/libc/string/x86_64/stpcpy.S +++ b/libc/string/x86_64/stpcpy.S @@ -1,4 +1,4 @@ #define USE_AS_STPCPY -#define STRCPY __stpcpy +#define STRCPY stpcpy #include "strcpy.S" -strong_alias(__stpcpy,stpcpy) +libc_hidden_def(stpcpy) diff --git a/libc/string/x86_64/strcat.S b/libc/string/x86_64/strcat.S index 6c7189a21..9b0068981 100644 --- a/libc/string/x86_64/strcat.S +++ b/libc/string/x86_64/strcat.S @@ -23,7 +23,7 @@ .text -ENTRY (BP_SYM (__strcat)) +ENTRY (BP_SYM (strcat)) movq %rdi, %rcx /* Dest. register. */ andl $7, %ecx /* mask alignment bits */ movq %rdi, %rax /* Duplicate destination pointer. */ @@ -253,6 +253,6 @@ ENTRY (BP_SYM (__strcat)) 24: movq %rdi, %rax /* Source is return value. */ retq -END (BP_SYM (__strcat)) +END (BP_SYM (strcat)) -strong_alias(__strcat,strcat) +libc_hidden_def(strcat) diff --git a/libc/string/x86_64/strchr.S b/libc/string/x86_64/strchr.S index 312d62b61..6f6635a39 100644 --- a/libc/string/x86_64/strchr.S +++ b/libc/string/x86_64/strchr.S @@ -22,7 +22,7 @@ .text -ENTRY (BP_SYM (__strchr)) +ENTRY (BP_SYM (strchr)) /* Before we start with the main loop we process single bytes until the source pointer is aligned. This has two reasons: @@ -282,7 +282,7 @@ ENTRY (BP_SYM (__strchr)) 6: nop retq -END (BP_SYM (__strchr)) +END (BP_SYM (strchr)) -strong_alias(__strchr,strchr) -strong_alias (BP_SYM (__strchr), BP_SYM (index)) +libc_hidden_def(strchr) +strong_alias (BP_SYM (strchr), BP_SYM (index)) diff --git a/libc/string/x86_64/strcmp.S b/libc/string/x86_64/strcmp.S index b0252f341..437e145bf 100644 --- a/libc/string/x86_64/strcmp.S +++ b/libc/string/x86_64/strcmp.S @@ -22,7 +22,7 @@ #include "_glibc_inc.h" .text -ENTRY (BP_SYM (__strcmp)) +ENTRY (BP_SYM (strcmp)) L(oop): movb (%rdi), %al cmpb (%rsi), %al jne L(neq) @@ -38,10 +38,10 @@ L(neq): movl $1, %eax movl $-1, %ecx cmovbl %ecx, %eax ret -END (BP_SYM (__strcmp)) +END (BP_SYM (strcmp)) -strong_alias(__strcmp,strcmp) +libc_hidden_def(strcmp) #ifndef __UCLIBC_HAS_LOCALE__ -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) +strong_alias(strcmp,strcoll) +libc_hidden_def(strcoll) #endif diff --git a/libc/string/x86_64/strcpy.S b/libc/string/x86_64/strcpy.S index 0bd2a6471..d9a51b0bb 100644 --- a/libc/string/x86_64/strcpy.S +++ b/libc/string/x86_64/strcpy.S @@ -21,7 +21,7 @@ #include "_glibc_inc.h" #ifndef USE_AS_STPCPY -# define STRCPY __strcpy +# define STRCPY strcpy #endif .text @@ -152,5 +152,5 @@ ENTRY (BP_SYM (STRCPY)) retq END (BP_SYM (STRCPY)) #ifndef USE_AS_STPCPY -strong_alias(__strcpy,strcpy) +libc_hidden_def(strcpy) #endif diff --git a/libc/string/x86_64/strcspn.S b/libc/string/x86_64/strcspn.S index 35959e500..fed12b5f6 100644 --- a/libc/string/x86_64/strcspn.S +++ b/libc/string/x86_64/strcspn.S @@ -26,10 +26,10 @@ #include "_glibc_inc.h" /* BEWARE: `#ifdef strcspn' means that strcspn is redefined as `strpbrk' */ -#define STRPBRK_P (defined __strcspn) +#define STRPBRK_P (defined strcspn) .text -ENTRY (__strcspn) +ENTRY (strcspn) movq %rdi, %rdx /* Save SRC. */ @@ -120,8 +120,8 @@ L(4): addq $256, %rsp /* remove skipset */ non-valid character */ #endif ret -END (__strcspn) +END (strcspn) #if !STRPBRK_P -strong_alias(__strcspn,strcspn) +libc_hidden_def(strcspn) #endif diff --git a/libc/string/x86_64/strlen.S b/libc/string/x86_64/strlen.S index 77aae71ba..0441dc46c 100644 --- a/libc/string/x86_64/strlen.S +++ b/libc/string/x86_64/strlen.S @@ -22,7 +22,7 @@ .text -ENTRY (__strlen) +ENTRY (strlen) movq %rdi, %rcx /* Duplicate source pointer. */ andl $7, %ecx /* mask alignment bits */ movq %rdi, %rax /* duplicate destination. */ @@ -132,6 +132,6 @@ ENTRY (__strlen) 2: subq %rdi, %rax /* compute difference to string start */ ret -END (__strlen) +END (strlen) -strong_alias(__strlen,strlen) +libc_hidden_def(strlen) diff --git a/libc/string/x86_64/strpbrk.S b/libc/string/x86_64/strpbrk.S index 94b14d091..72a47bcb9 100644 --- a/libc/string/x86_64/strpbrk.S +++ b/libc/string/x86_64/strpbrk.S @@ -1,3 +1,3 @@ -#define __strcspn __strpbrk +#define strcspn strpbrk #include "strcspn.S" -strong_alias(__strpbrk,strpbrk) +libc_hidden_proto(strpbrk) diff --git a/libc/string/x86_64/strspn.S b/libc/string/x86_64/strspn.S index ae5b4a1df..c126abd2e 100644 --- a/libc/string/x86_64/strspn.S +++ b/libc/string/x86_64/strspn.S @@ -26,7 +26,7 @@ #include "_glibc_inc.h" .text -ENTRY (__strspn) +ENTRY (strspn) movq %rdi, %rdx /* Save SRC. */ @@ -111,6 +111,6 @@ L(4): addq $256, %rsp /* remove stopset */ characters, so compute distance to first non-valid character */ ret -END (__strspn) +END (strspn) -strong_alias(__strspn,strspn) +libc_hidden_def(strspn) diff --git a/libc/sysdeps/linux/alpha/__longjmp.S b/libc/sysdeps/linux/alpha/__longjmp.S index b78489f53..910ec0781 100644 --- a/libc/sysdeps/linux/alpha/__longjmp.S +++ b/libc/sysdeps/linux/alpha/__longjmp.S @@ -54,3 +54,4 @@ __longjmp: ret .end __longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/alpha/brk.S b/libc/sysdeps/linux/alpha/brk.S index a3f2edfe7..de0a7563f 100644 --- a/libc/sysdeps/linux/alpha/brk.S +++ b/libc/sysdeps/linux/alpha/brk.S @@ -38,12 +38,11 @@ __curbrk: .skip 8 #endif .text -.globl __brk; -.hidden __brk; +.globl brk; .align 3; -.ent __brk , 0; +.ent brk , 0; -__brk: +brk: .frame $30 , 8 , $26 ldgp $29, 0($27) subq $30, 8, $30 @@ -77,7 +76,6 @@ $err0: ldi $0, ENOMEM $err1: addq $30, 8, $30 jmp $31, __syscall_error - .end __brk + .end brk -.weak brk; - brk = __brk +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/alpha/clone.S b/libc/sysdeps/linux/alpha/clone.S index ed5a4f487..9db118afd 100644 --- a/libc/sysdeps/linux/alpha/clone.S +++ b/libc/sysdeps/linux/alpha/clone.S @@ -29,11 +29,11 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text -.globl __clone; +.globl clone; .align 3; -.ent __clone , 0; +.ent clone , 0; -__clone: +clone: .frame $30 , 0, $26 .prologue 0 @@ -64,7 +64,7 @@ $error: 1: ldgp gp,0(gp) jmp zero,__syscall_error -.end __clone +.end clone /* Load up the arguments to the function. Put this block of code in its own function so that we can terminate the stack trace with our @@ -87,13 +87,9 @@ thread_start: /* Call _exit rather than doing it inline for breakpoint purposes */ mov v0,a0 - jsr ra,_exit_internal + jsr ra,HIDDEN_JUMPTARGET(_exit) /* Die horribly. */ halt .end thread_start - -.weak clone; - clone = __clone - diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S index 822e15a69..ee588b2c8 100644 --- a/libc/sysdeps/linux/arm/__longjmp.S +++ b/libc/sysdeps/linux/arm/__longjmp.S @@ -60,3 +60,4 @@ __longjmp: ldmia ip , {v1-v6, sl, fp, sp, pc} .size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/arm/brk.c b/libc/sysdeps/linux/arm/brk.c index e711db3b1..88f489e26 100644 --- a/libc/sysdeps/linux/arm/brk.c +++ b/libc/sysdeps/linux/arm/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk = (void*)INTERNAL_SYSCALL(brk, , 1, addr); @@ -37,4 +37,4 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S index 946d4bdda..550d43f4d 100644 --- a/libc/sysdeps/linux/arm/clone.S +++ b/libc/sysdeps/linux/arm/clone.S @@ -28,10 +28,10 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: @ sanity check args cmp r0, #0 cmpne r1, #0 @@ -59,14 +59,11 @@ __clone: ldr pc, [sp] @ and we are done, passing the return value through r0 - b _exit_internal + b HIDDEN_JUMPTARGET(_exit) __error: b __syscall_error -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone #endif diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index 0c0c21182..ed370d551 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -33,12 +33,6 @@ the area affected (this is a kernel limitation). So we now just enable all the ports all of the time. */ -#define readlink __readlink -#define mmap __mmap -#define sscanf __sscanf -#define fscanf __fscanf -#define fgets __fgets - #include <errno.h> #include <fcntl.h> #include <stdio.h> @@ -53,6 +47,18 @@ #include <asm/page.h> #include <sys/sysctl.h> +libc_hidden_proto(readlink) +libc_hidden_proto(mmap) +libc_hidden_proto(sscanf) +libc_hidden_proto(fscanf) +libc_hidden_proto(fprintf) +libc_hidden_proto(fgets) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(strcmp) +libc_hidden_proto(open) +libc_hidden_proto(close) + #include <linux/version.h> #define PATH_ARM_SYSTYPE "/etc/arm_systype" @@ -163,7 +169,7 @@ init_iosys (void) /* translate systype name into i/o system: */ for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i) { - if (__strcmp (platform[i].name, systype) == 0) { + if (strcmp (platform[i].name, systype) == 0) { io.shift = platform[i].shift; io.io_base = platform[i].io_base; io.initdone = 1; @@ -191,14 +197,14 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) if (! io.base) { int fd; - fd = __open ("/dev/mem", O_RDWR); + fd = open ("/dev/mem", O_RDWR); if (fd < 0) return -1; io.base = (unsigned long int) mmap (0, MAX_PORT << io.shift, PROT_READ | PROT_WRITE, MAP_SHARED, fd, io.io_base); - __close (fd); + close (fd); if ((long) io.base == -1) return -1; } @@ -206,6 +212,8 @@ int ioperm (unsigned long int from, unsigned long int num, int turn_on) return 0; } +libc_hidden_proto(ioperm) +libc_hidden_def(ioperm) void diff --git a/libc/sysdeps/linux/arm/iopl.c b/libc/sysdeps/linux/arm/iopl.c index 0cd306d42..552ba6c67 100644 --- a/libc/sysdeps/linux/arm/iopl.c +++ b/libc/sysdeps/linux/arm/iopl.c @@ -21,6 +21,8 @@ #include <sys/io.h> #include <errno.h> +libc_hidden_proto(ioperm) + #define MAX_PORT 0x10000 int iopl(int level) diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S index dd6f3c477..784d73440 100644 --- a/libc/sysdeps/linux/arm/mmap64.S +++ b/libc/sysdeps/linux/arm/mmap64.S @@ -52,7 +52,7 @@ mmap64: mov r0, ip @ first arg was clobbered teq r5, $0 ldmeqfd sp!, {r4, r5, lr} - beq __mmap + beq HIDDEN_JUMPTARGET(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 c2f79c337..3d3112a29 100644 --- a/libc/sysdeps/linux/arm/sigaction.c +++ b/libc/sysdeps/linux/arm/sigaction.c @@ -39,10 +39,9 @@ extern void __default_rt_sa_restorer(void); __default_sa_restorer #endif - - #ifdef __NR_rt_sigaction +libc_hidden_proto(memcpy) /* 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. */ @@ -53,7 +52,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER /* If the user specified SA_ONSTACK this means she is trying to @@ -78,7 +77,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; @@ -90,8 +89,6 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #else - - /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) @@ -129,6 +126,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) -weak_alias(__libc_sigaction,sigaction) +strong_alias(__libc_sigaction,sigaction) +libc_hidden_proto(sigaction) +libc_hidden_def(sigaction) #endif diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 68798995a..0bf97c223 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -16,12 +16,11 @@ #ifdef __NR_fork .text -.global __vfork -.hidden __vfork -.type __vfork,%function +.global vfork +.type vfork,%function .align 4 -__vfork: +vfork: #ifdef __NR_vfork swi __NR_vfork @@ -44,6 +43,6 @@ __vfork: __error: b __syscall_error -.size __vfork,.-__vfork -strong_alias(__vfork,vfork) +.size vfork,.-vfork +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/bfin/brk.c b/libc/sysdeps/linux/bfin/brk.c index 1cb30216d..334bf6fc0 100644 --- a/libc/sysdeps/linux/bfin/brk.c +++ b/libc/sysdeps/linux/bfin/brk.c @@ -1,3 +1,8 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <unistd.h> #include <sys/syscall.h> @@ -6,7 +11,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -28,4 +33,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/bfin/vfork.S b/libc/sysdeps/linux/bfin/vfork.S index 1f9539c55..694265b7a 100644 --- a/libc/sysdeps/linux/bfin/vfork.S +++ b/libc/sysdeps/linux/bfin/vfork.S @@ -1,4 +1,4 @@ - +#include <features.h> #include <asm/unistd.h> .text .globl _vfork @@ -10,3 +10,4 @@ _vfork: p0 = __NR_vfork; excpt 0; rts; +libc_hidden_def(_vfork) diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index 09409fe81..43c6b6517 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -16,18 +16,18 @@ static _syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info, const struct timespec *, timeout, size_t, setsize); -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) +int sigwaitinfo(const sigset_t * set, siginfo_t * info) { return __rt_sigtimedwait(set, info, NULL, _NSIG / 8); } -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, +int sigtimedwait(const sigset_t * set, siginfo_t * info, const struct timespec *timeout) { return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); } #else -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) +int sigwaitinfo(const sigset_t * set, siginfo_t * info) { if (set == NULL) __set_errno(EINVAL); @@ -36,7 +36,7 @@ int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) return -1; } -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, +int sigtimedwait(const sigset_t * set, siginfo_t * info, const struct timespec *timeout) { if (set == NULL) @@ -46,6 +46,7 @@ int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, return -1; } #endif -/* keep these weak so that libpthread can overwrite them */ -weak_alias(__sigtimedwait,sigtimedwait) -weak_alias(__sigwaitinfo,sigwaitinfo) +libc_hidden_proto(sigwaitinfo) +libc_hidden_def(sigwaitinfo) +libc_hidden_proto(sigtimedwait) +libc_hidden_def(sigtimedwait) diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index ca9aff5e7..f8652def6 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -11,18 +11,16 @@ #include <stdarg.h> #include <fcntl.h> -#undef __fcntl - #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -extern int __fcntl64(int fd, int cmd, ...) attribute_hidden; +extern int __libc_fcntl64(int fd, int cmd, ...); +libc_hidden_proto(__libc_fcntl64) #endif -#undef fcntl #define __NR___syscall_fcntl __NR_fcntl static inline _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg); -int attribute_hidden __fcntl(int fd, int cmd, ...) +int __libc_fcntl(int fd, int cmd, ...) { long arg; va_list list; @@ -33,7 +31,7 @@ int attribute_hidden __fcntl(int fd, int cmd, ...) if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return __fcntl64(fd, cmd, arg); + return __libc_fcntl64(fd, cmd, arg); #else __set_errno(ENOSYS); return -1; @@ -41,10 +39,15 @@ int attribute_hidden __fcntl(int fd, int cmd, ...) } return (__syscall_fcntl(fd, cmd, arg)); } -strong_alias(__fcntl,fcntl) -weak_alias(__fcntl,__libc_fcntl) +libc_hidden_proto(__libc_fcntl) +libc_hidden_def(__libc_fcntl) + +strong_alias(__libc_fcntl,fcntl) +libc_hidden_proto(fcntl) +libc_hidden_def(fcntl) #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__fcntl,__fcntl64) -weak_alias(__fcntl,fcntl64) -weak_alias(__fcntl,__libc_fcntl64) +strong_alias(__libc_fcntl,__libc_fcntl64) +strong_alias(__libc_fcntl,fcntl64) +libc_hidden_proto(fcntl64) +libc_hidden_def(fcntl64) #endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 9231808e3..759ba949f 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -12,10 +12,9 @@ #include <fcntl.h> #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -#undef fcntl64 #define __NR___syscall_fcntl64 __NR_fcntl64 static inline _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg); -int attribute_hidden __fcntl64(int fd, int cmd, ...) +int __libc_fcntl64(int fd, int cmd, ...) { long arg; va_list list; @@ -26,6 +25,10 @@ int attribute_hidden __fcntl64(int fd, int cmd, ...) va_end(list); return (__syscall_fcntl64(fd, cmd, arg)); } -strong_alias(__fcntl64,fcntl64) -weak_alias(__fcntl64,__libc_fcntl64) +libc_hidden_proto(__libc_fcntl64) +libc_hidden_def(__libc_fcntl64) + +strong_alias(__libc_fcntl64,fcntl64) +libc_hidden_proto(fcntl64) +libc_hidden_def(fcntl64) #endif diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 4e450bbc5..a708fad90 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -32,12 +32,11 @@ static inline _syscall1(void, __syscall_exit, int, status); #endif -#undef _exit -#undef _exit_internal -void attribute_noreturn attribute_hidden _exit_internal(int status) +void attribute_noreturn _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) INLINE_SYSCALL(exit, 1, status); } -strong_alias(_exit_internal,_exit) +libc_hidden_proto(_exit) +libc_hidden_def(_exit) diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c index ef33051e8..a6c9be2b8 100644 --- a/libc/sysdeps/linux/common/adjtimex.c +++ b/libc/sysdeps/linux/common/adjtimex.c @@ -10,8 +10,7 @@ #include "syscalls.h" #include <sys/timex.h> -#define __NR___adjtimex __NR_adjtimex -attribute_hidden _syscall1(int, __adjtimex, struct timex *, buf); - -strong_alias(__adjtimex, adjtimex) -weak_alias(__adjtimex, ntp_adjtime) +_syscall1(int, adjtimex, struct timex *, buf); +libc_hidden_proto(adjtimex) +libc_hidden_def(adjtimex) +strong_alias(adjtimex,ntp_adjtime) diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index 8239cec5b..6089a50cf 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -7,16 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define setitimer __setitimer - #include "syscalls.h" #include <unistd.h> #ifdef __NR_alarm #define __NR___alarm __NR_alarm -attribute_hidden _syscall1(unsigned int, __alarm, unsigned int, seconds); +_syscall1(unsigned int, alarm, unsigned int, seconds); #else #include <sys/time.h> -unsigned int attribute_hidden __alarm(unsigned int seconds) + +libc_hidden_proto(setitimer) + +unsigned int alarm(unsigned int seconds) { struct itimerval old, new; unsigned int retval; @@ -35,4 +36,5 @@ unsigned int attribute_hidden __alarm(unsigned int seconds) return retval; } #endif -strong_alias(__alarm,alarm) +libc_hidden_proto(alarm) +libc_hidden_def(alarm) diff --git a/libc/sysdeps/linux/common/chdir.c b/libc/sysdeps/linux/common/chdir.c index ff4ba527b..230f86eb9 100644 --- a/libc/sysdeps/linux/common/chdir.c +++ b/libc/sysdeps/linux/common/chdir.c @@ -13,8 +13,9 @@ #define __NR___syscall_chdir __NR_chdir static inline _syscall1(int, __syscall_chdir, const char *, path); -int attribute_hidden __chdir(const char *path) +int chdir(const char *path) { return __syscall_chdir(path); } -strong_alias(__chdir,chdir) +libc_hidden_proto(chdir) +libc_hidden_def(chdir) diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c index bf368cf5e..d6be1e130 100644 --- a/libc/sysdeps/linux/common/chmod.c +++ b/libc/sysdeps/linux/common/chmod.c @@ -13,8 +13,9 @@ #define __NR___syscall_chmod __NR_chmod static inline _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode); -int attribute_hidden __chmod(const char *path, mode_t mode) +int chmod(const char *path, mode_t mode) { return __syscall_chmod(path, mode); } -strong_alias(__chmod,chmod) +libc_hidden_proto(chmod) +libc_hidden_def(chmod) diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c index 7aff495d0..985426444 100644 --- a/libc/sysdeps/linux/common/clock_getres.c +++ b/libc/sysdeps/linux/common/clock_getres.c @@ -19,8 +19,6 @@ * */ -#define sysconf __sysconf - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -29,6 +27,8 @@ #ifdef __NR_clock_getres _syscall2(int, clock_getres, clockid_t, clock_id, struct timespec*, res); #else +libc_hidden_proto(sysconf) + int clock_getres(clockid_t clock_id, struct timespec* res) { long clk_tck; diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c index 33863a828..e72432b3c 100644 --- a/libc/sysdeps/linux/common/clock_gettime.c +++ b/libc/sysdeps/linux/common/clock_gettime.c @@ -20,8 +20,6 @@ * */ -#define gettimeofday __gettimeofday - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -30,6 +28,8 @@ #ifdef __NR_clock_gettime _syscall2(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp); #else +libc_hidden_proto(gettimeofday) + int clock_gettime(clockid_t clock_id, struct timespec* tp) { struct timeval tv; diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c index e2ec03f78..88d5df93e 100644 --- a/libc/sysdeps/linux/common/clock_settime.c +++ b/libc/sysdeps/linux/common/clock_settime.c @@ -19,8 +19,6 @@ * */ -#define settimeofday __settimeofday - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -29,6 +27,8 @@ #ifdef __NR_clock_settime _syscall2(int, clock_settime, clockid_t, clock_id, const struct timespec*, tp); #else +libc_hidden_proto(settimeofday) + int clock_settime(clockid_t clock_id, const struct timespec* tp) { struct timeval tv; diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c index 2e9c2073d..38381a223 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -10,7 +10,8 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___close __NR_close -attribute_hidden _syscall1(int, __close, int, fd); -strong_alias(__close,close) -weak_alias(__close,__libc_close) +#define __NR___libc_close __NR_close +_syscall1(int, __libc_close, int, fd); +strong_alias(__libc_close,close) +libc_hidden_proto(close) +libc_hidden_def(close) diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c index 771f5172b..a2352efe4 100644 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c @@ -21,8 +21,8 @@ #include <features.h> #include <sys/socket.h> -struct cmsghdr attribute_hidden * -__cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg) +struct cmsghdr * +__cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg) { if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ @@ -38,4 +38,5 @@ __cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg) return NULL; return cmsg; } -strong_alias(__cmsg_nxthdr_internal,__cmsg_nxthdr) +libc_hidden_proto(__cmsg_nxthdr) +libc_hidden_def(__cmsg_nxthdr) diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c index 759f5bed8..0bf20f175 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define open64 __open64 - #include <features.h> #include <fcntl.h> #include <sys/types.h> @@ -37,7 +35,7 @@ # undef __USE_FILE_OFFSET64 #endif -#undef creat +libc_hidden_proto(open64) /* Create FILE with protections MODE. */ int creat64 (const char *file, mode_t mode) diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h index b4108cc53..cd791306e 100644 --- a/libc/sysdeps/linux/common/dl-osinfo.h +++ b/libc/sysdeps/linux/common/dl-osinfo.h @@ -7,8 +7,6 @@ #ifndef _DL_OSINFO_H #define _DL_OSINFO_H 1 -#define gettimeofday __gettimeofday - #include <features.h> #ifdef __UCLIBC_HAS_SSP__ @@ -22,9 +20,14 @@ # include <sys/time.h> # ifdef IS_IN_libc -# define OPEN __open -# define READ __read -# define CLOSE __close +#include <fcntl.h> +libc_hidden_proto(open) +libc_hidden_proto(read) +libc_hidden_proto(close) +libc_hidden_proto(gettimeofday) +# define OPEN open +# define READ read +# define CLOSE close # define GETTIMEOFDAY gettimeofday # else # define OPEN _dl_open diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c index 71164aa0b..c7bd115aa 100644 --- a/libc/sysdeps/linux/common/dup2.c +++ b/libc/sysdeps/linux/common/dup2.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___dup2 __NR_dup2 -attribute_hidden _syscall2(int, __dup2, int, oldfd, int, newfd); -strong_alias(__dup2,dup2) +_syscall2(int, dup2, int, oldfd, int, newfd); +libc_hidden_proto(dup2) +libc_hidden_def(dup2) diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c index 8a95746ee..bbc7b1dec 100644 --- a/libc/sysdeps/linux/common/execve.c +++ b/libc/sysdeps/linux/common/execve.c @@ -16,8 +16,9 @@ static inline _syscall3(int, __syscall_execve, const char *, filename, char *const *, argv, char *const *, envp); -int attribute_hidden __execve(const char * filename, char *const * argv, char *const * envp) +int execve(const char * filename, char *const * argv, char *const * envp) { return __syscall_execve(filename, argv, envp); } -strong_alias(__execve,execve) +libc_hidden_proto(execve) +libc_hidden_def(execve) diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c index f4692cc2c..3da6e1d58 100644 --- a/libc/sysdeps/linux/common/fchdir.c +++ b/libc/sysdeps/linux/common/fchdir.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___fchdir __NR_fchdir -attribute_hidden _syscall1(int, __fchdir, int, fd); -strong_alias(__fchdir,fchdir) +_syscall1(int, fchdir, int, fd); +libc_hidden_proto(fchdir) +libc_hidden_def(fchdir) diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 899cbaf63..23c6fedff 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -12,9 +12,10 @@ #ifdef __ARCH_HAS_MMU__ #ifdef __NR_fork -#define __NR___fork __NR_fork -attribute_hidden _syscall0(pid_t, __fork); -strong_alias(__fork,fork) -weak_alias(__fork,__libc_fork) +#define __NR___libc_fork __NR_fork +_syscall0(pid_t, __libc_fork); +strong_alias(__libc_fork,fork) +libc_hidden_proto(fork) +libc_hidden_def(fork) #endif #endif diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c index af3f9a13b..0a8c81df6 100644 --- a/libc/sysdeps/linux/common/fstat.c +++ b/libc/sysdeps/linux/common/fstat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_fstat64 doesnt exist */ #define fstat64 __hidefstat64 -#define __fstat64 __hide__fstat64 #include "syscalls.h" #include <unistd.h> @@ -18,14 +17,12 @@ #include "xstatconv.h" #undef fstat64 -#undef __fstat64 #define __NR___syscall_fstat __NR_fstat -#undef __fstat #undef fstat static inline _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf); -int attribute_hidden __fstat(int fd, struct stat *buf) +int fstat(int fd, struct stat *buf) { int result; struct kernel_stat kbuf; @@ -36,9 +33,11 @@ int attribute_hidden __fstat(int fd, struct stat *buf) } return result; } -strong_alias(__fstat,fstat) +libc_hidden_proto(fstat) +libc_hidden_def(fstat) #if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__fstat,__fstat64) -weak_alias(__fstat,fstat64) +strong_alias(fstat,fstat64) +libc_hidden_proto(fstat64) +libc_hidden_def(fstat64) #endif diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 0d8bbdb43..fc91cbaf9 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -18,8 +18,7 @@ static inline _syscall2(int, __syscall_fstat64, int, filedes, struct kernel_stat64 *, buf); -#undef fstat64 -int attribute_hidden __fstat64(int fd, struct stat64 *buf) +int fstat64(int fd, struct stat64 *buf) { int result; struct kernel_stat64 kbuf; @@ -30,6 +29,7 @@ int attribute_hidden __fstat64(int fd, struct stat64 *buf) } return result; } -strong_alias(__fstat64,fstat64) +libc_hidden_proto(fstat64) +libc_hidden_def(fstat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c index 9a7cf303b..c88162e6d 100644 --- a/libc/sysdeps/linux/common/fstatfs.c +++ b/libc/sysdeps/linux/common/fstatfs.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/vfs.h> -#define __NR___fstatfs __NR_fstatfs -attribute_hidden _syscall2(int, __fstatfs, int, fd, struct statfs *, buf); -strong_alias(__fstatfs,fstatfs) +_syscall2(int, fstatfs, int, fd, struct statfs *, buf); +libc_hidden_proto(fstatfs) +libc_hidden_def(fstatfs) diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index e6f610751..ab382bd87 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -12,4 +12,4 @@ #define __NR___libc_fsync __NR_fsync _syscall1(int, __libc_fsync, int, fd); -weak_alias(__libc_fsync, fsync) +strong_alias(__libc_fsync, fsync) diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c index a25fd0285..1d4e62d26 100644 --- a/libc/sysdeps/linux/common/ftruncate.c +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -10,4 +10,5 @@ #include "syscalls.h" #include <unistd.h> _syscall2(int, ftruncate, int, fd, __off_t, length); -hidden_strong_alias(ftruncate, __ftruncate) +libc_hidden_proto(ftruncate) +libc_hidden_def(ftruncate) diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index 51392a1aa..5516f3b6f 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -12,8 +12,6 @@ * the main directory of this archive for more details. */ -#define ftruncate __ftruncate - #include <features.h> #include <unistd.h> #include <errno.h> @@ -65,6 +63,8 @@ int ftruncate64 (int fd, __off64_t length) #else /* __NR_ftruncate64 */ +libc_hidden_proto(ftruncate) + int ftruncate64 (int fd, __off64_t length) { __off_t x = (__off_t) length; diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index a44647d67..63b195ec2 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -1,8 +1,10 @@ -/* These functions find the absolute path to the current working directory. */ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ -#define opendir __opendir -#define closedir __closedir -#define readdir __readdir +/* These functions find the absolute path to the current working directory. */ #include <stdlib.h> #include <errno.h> @@ -11,6 +13,15 @@ #include <string.h> #include <sys/syscall.h> +libc_hidden_proto(strcat) +libc_hidden_proto(strcpy) +libc_hidden_proto(strncpy) +libc_hidden_proto(strlen) +libc_hidden_proto(opendir) +libc_hidden_proto(readdir) +libc_hidden_proto(closedir) +libc_hidden_proto(stat) + #ifdef __NR_getcwd #define __NR___syscall_getcwd __NR_getcwd @@ -43,7 +54,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path int slow_search = (sizeof(ino_t) != sizeof(d->d_ino)); #endif - if (__stat(path_buf, &st) < 0) { + if (stat(path_buf, &st) < 0) { goto oops; } #ifdef FAST_DIR_SEARCH_POSSIBLE @@ -51,13 +62,13 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path slow_search = 1; #endif - slen = __strlen(path_buf); + slen = strlen(path_buf); ptr = path_buf + slen - 1; if (*ptr != '/') { if (slen + 2 > path_size) { goto oops; } - __strcpy(++ptr, "/"); + strcpy(++ptr, "/"); slen++; } slen++; @@ -71,11 +82,11 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path #ifdef FAST_DIR_SEARCH_POSSIBLE if (slow_search || this_ino == d->d_ino) { #endif - if (slen + __strlen(d->d_name) > path_size) { + if (slen + strlen(d->d_name) > path_size) { goto oops; } - __strcpy(ptr + 1, d->d_name); - if (__stat(path_buf, &st) < 0) + strcpy(ptr + 1, d->d_name); + if (stat(path_buf, &st) < 0) continue; if (st.st_ino == this_ino && st.st_dev == this_dev) { closedir(dp); @@ -101,7 +112,7 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_ dev_t this_dev; ino_t this_ino; - if (__stat(path_buf, &st) < 0) { + if (stat(path_buf, &st) < 0) { if (errno != EFAULT) goto oops; return 0; @@ -112,13 +123,13 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_ if (path_size < 2) { goto oops; } - __strcpy(path_buf, "/"); + strcpy(path_buf, "/"); return path_buf; } - if (__strlen(path_buf) + 4 > path_size) { + if (strlen(path_buf) + 4 > path_size) { goto oops; } - __strcat(path_buf, "/.."); + strcat(path_buf, "/.."); if (recurser(path_buf, path_size, root_dev, root_ino) == 0) return 0; @@ -140,16 +151,16 @@ int __syscall_getcwd(char * buf, unsigned long size) len = -1; /* get stat for root to have a valid parameters for the terminating condition */ - if (__stat("/", &st) < 0) { + if (stat("/", &st) < 0) { /* root dir not found! */ return -1; } /* start with actual dir */ - if (buf) __strncpy(buf, ".", size); + if (buf) strncpy(buf, ".", size); cwd = recurser(buf, size, st.st_dev, st.st_ino); if (cwd) { - len = __strlen(buf); + len = strlen(buf); __set_errno(olderrno); } return len; @@ -157,7 +168,7 @@ int __syscall_getcwd(char * buf, unsigned long size) #endif -char attribute_hidden *__getcwd(char *buf, size_t size) +char *getcwd(char *buf, size_t size) { int ret; char *path; @@ -189,4 +200,5 @@ char attribute_hidden *__getcwd(char *buf, size_t size) free (path); return NULL; } -strong_alias(__getcwd,getcwd) +libc_hidden_proto(getcwd) +libc_hidden_def(getcwd) diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 4db513a62..4b85d2c62 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -28,6 +28,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(lseek) + #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif @@ -75,7 +78,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes) /* Our heuristic failed. We read too many entries. Reset the stream. */ assert (last_offset != -1); - __lseek(fd, last_offset, SEEK_SET); + lseek(fd, last_offset, SEEK_SET); if ((char *) dp == buf) { /* The buffer the user passed in is too small to hold even @@ -91,7 +94,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes) dp->d_off = kdp->d_off; dp->d_reclen = new_reclen; dp->d_type = DT_UNKNOWN; - __memcpy (dp->d_name, kdp->d_name, + memcpy (dp->d_name, kdp->d_name, kdp->d_reclen - offsetof (struct kernel_dirent, d_name)); dp = (struct dirent *) ((char *) dp + new_reclen); kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen); diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index f65e9e70b..c734fbbb6 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -29,6 +29,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(lseek64) + #if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 #ifndef offsetof @@ -80,7 +83,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) /* Our heuristic failed. We read too many entries. Reset the stream. */ assert (last_offset != -1); - __lseek64(fd, last_offset, SEEK_SET); + lseek64(fd, last_offset, SEEK_SET); if ((char *) dp == buf) { /* The buffer the user passed in is too small to hold even @@ -96,7 +99,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) dp->d_off = kdp->d_off; dp->d_reclen = new_reclen; dp->d_type = DT_UNKNOWN; - __memcpy (dp->d_name, kdp->d_name, + memcpy (dp->d_name, kdp->d_name, kdp->d_reclen - offsetof (struct kernel_dirent64, d_name)); dp = (struct dirent64 *) ((char *) dp + new_reclen); kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen); diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index a4285322b..3b470db05 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -17,14 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getcwd __getcwd - #include <features.h> #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> #include <string.h> +libc_hidden_proto(strdup) +libc_hidden_proto(getcwd) +libc_hidden_proto(getenv) +libc_hidden_proto(stat) +libc_hidden_proto(stat64) + /* Return a malloc'd string containing the current directory name. If the environment variable `PWD' is set, and its value is correct, that value is used. */ @@ -39,19 +43,19 @@ get_current_dir_name (void) struct stat dotstat, pwdstat; #endif - pwd = __getenv ("PWD"); + pwd = getenv ("PWD"); if (pwd != NULL #if defined __UCLIBC_HAS_LFS__ - && __stat64 (".", &dotstat) == 0 - && __stat64 (pwd, &pwdstat) == 0 + && stat64 (".", &dotstat) == 0 + && stat64 (pwd, &pwdstat) == 0 #else - && __stat (".", &dotstat) == 0 - && __stat (pwd, &pwdstat) == 0 + && stat (".", &dotstat) == 0 + && stat (pwd, &pwdstat) == 0 #endif && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) /* The PWD value is correct. Use it. */ - return __strdup (pwd); + return strdup (pwd); return getcwd ((char *) NULL, 0); } diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c index aa4215f84..04077b197 100644 --- a/libc/sysdeps/linux/common/getdnnm.c +++ b/libc/sysdeps/linux/common/getdnnm.c @@ -1,4 +1,8 @@ -#define uname __uname +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdlib.h> #include <string.h> @@ -7,9 +11,12 @@ #define __USE_GNU #include <sys/utsname.h> +libc_hidden_proto(strlen) +libc_hidden_proto(strcpy) +libc_hidden_proto(uname) -int attribute_hidden -__getdomainname(char *name, size_t len) +int +getdomainname(char *name, size_t len) { struct utsname uts; @@ -20,11 +27,12 @@ __getdomainname(char *name, size_t len) if (uname(&uts) == -1) return -1; - if (__strlen(uts.domainname)+1 > len) { + if (strlen(uts.domainname)+1 > len) { __set_errno(EINVAL); return -1; } - __strcpy(name, uts.domainname); + strcpy(name, uts.domainname); return 0; } -strong_alias(__getdomainname,getdomainname) +libc_hidden_proto(getdomainname) +libc_hidden_def(getdomainname) diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c index de3af63d7..4408273b7 100644 --- a/libc/sysdeps/linux/common/getdtablesize.c +++ b/libc/sysdeps/linux/common/getdtablesize.c @@ -16,18 +16,18 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define getrlimit __getrlimit - #include <stdlib.h> #include <unistd.h> #include <sys/resource.h> #include <limits.h> +libc_hidden_proto(getrlimit) + #define __LOCAL_OPEN_MAX 256 /* Return the maximum number of file descriptors the current process could possibly have. */ -int attribute_hidden __getdtablesize (void) +int getdtablesize (void) { struct rlimit ru; @@ -36,4 +36,5 @@ int attribute_hidden __getdtablesize (void) returns -1. */ return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur; } -strong_alias(__getdtablesize,getdtablesize) +libc_hidden_proto(getdtablesize) +libc_hidden_def(getdtablesize) diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c index bed60f052..4379ddd0b 100644 --- a/libc/sysdeps/linux/common/getegid.c +++ b/libc/sysdeps/linux/common/getegid.c @@ -7,22 +7,23 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define getgid __getgid - #include "syscalls.h" #include <unistd.h> #ifdef __NR_getegid #define __NR___syscall_getegid __NR_getegid static inline _syscall0(int, __syscall_getegid); -gid_t attribute_hidden __getegid(void) +gid_t getegid(void) { return (__syscall_getegid()); } #else -gid_t attribute_hidden __getegid(void) +libc_hidden_proto(getgid) + +gid_t getegid(void) { return (getgid()); } #endif -strong_alias(__getegid,getegid) +libc_hidden_proto(getegid) +libc_hidden_def(getegid) diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c index 3936739b3..c267d1483 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -7,22 +7,23 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define getuid __getuid - #include "syscalls.h" #include <unistd.h> #ifdef __NR_geteuid #define __NR___syscall_geteuid __NR_geteuid static inline _syscall0(int, __syscall_geteuid); -uid_t attribute_hidden __geteuid(void) +uid_t geteuid(void) { return (__syscall_geteuid()); } #else -uid_t attribute_hidden __geteuid(void) +libc_hidden_proto(getuid) + +uid_t geteuid(void) { return (getuid()); } #endif -strong_alias(__geteuid,geteuid) +libc_hidden_proto(geteuid) +libc_hidden_def(geteuid) diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c index eba29afa2..48c9af17c 100644 --- a/libc/sysdeps/linux/common/getgid.c +++ b/libc/sysdeps/linux/common/getgid.c @@ -16,8 +16,9 @@ #endif static inline _syscall0(int, __syscall_getgid); -gid_t attribute_hidden __getgid(void) +gid_t getgid(void) { return (__syscall_getgid()); } -strong_alias(__getgid,getgid) +libc_hidden_proto(getgid) +libc_hidden_def(getgid) diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c index 83d92627e..081f001f1 100644 --- a/libc/sysdeps/linux/common/getgroups.c +++ b/libc/sysdeps/linux/common/getgroups.c @@ -7,20 +7,20 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define sysconf __sysconf - #include "syscalls.h" #include <stdlib.h> #include <unistd.h> #include <grp.h> +libc_hidden_proto(sysconf) + #define MIN(a,b) (((a)<(b))?(a):(b)) #define __NR___syscall_getgroups __NR_getgroups static inline _syscall2(int, __syscall_getgroups, int, size, __kernel_gid_t *, list); -int attribute_hidden __getgroups(int size, gid_t groups[]) +int getgroups(int size, gid_t groups[]) { if (unlikely(size < 0)) { ret_error: @@ -47,4 +47,5 @@ ret_error: return ngids; } } -strong_alias(__getgroups,getgroups) +libc_hidden_proto(getgroups) +libc_hidden_def(getgroups) diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c index cb6e5efce..c932d239c 100644 --- a/libc/sysdeps/linux/common/gethstnm.c +++ b/libc/sysdeps/linux/common/gethstnm.c @@ -1,12 +1,20 @@ -#define uname __uname +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <string.h> #include <unistd.h> #include <sys/utsname.h> #include <errno.h> -int attribute_hidden -__gethostname(char *name, size_t len) +libc_hidden_proto(strlen) +libc_hidden_proto(strcpy) +libc_hidden_proto(uname) + +int +gethostname(char *name, size_t len) { struct utsname uts; @@ -17,11 +25,12 @@ __gethostname(char *name, size_t len) if (uname(&uts) == -1) return -1; - if (__strlen(uts.nodename)+1 > len) { + if (strlen(uts.nodename)+1 > len) { __set_errno(EINVAL); return -1; } - __strcpy(name, uts.nodename); + strcpy(name, uts.nodename); return 0; } -strong_alias(__gethostname,gethostname) +libc_hidden_proto(gethostname) +libc_hidden_def(gethostname) diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c index 517040d46..44456c0e7 100644 --- a/libc/sysdeps/linux/common/getpagesize.c +++ b/libc/sysdeps/linux/common/getpagesize.c @@ -19,14 +19,16 @@ #include <unistd.h> #include <features.h> #include <sys/param.h> -extern size_t __pagesize_internal attribute_hidden; + +extern size_t __pagesize; +libc_hidden_proto(__pagesize) /* Return the system page size. */ /* couldn't make __getpagesize hidden, because shm.h uses it in a macro */ -int attribute_hidden __getpagesize_internal(void) +int __getpagesize(void) { - if (__pagesize_internal != 0) - return __pagesize_internal; + if (__pagesize != 0) + return __pagesize; #ifdef EXEC_PAGESIZE return EXEC_PAGESIZE; @@ -41,6 +43,6 @@ int attribute_hidden __getpagesize_internal(void) #endif /* NBPG. */ #endif /* EXEC_PAGESIZE. */ } -strong_alias(__getpagesize_internal, __getpagesize) -weak_alias(__getpagesize_internal, getpagesize) - +strong_alias(__getpagesize,getpagesize) +libc_hidden_proto(getpagesize) +libc_hidden_def(getpagesize) diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c index 8de8516dc..adb8beb06 100644 --- a/libc/sysdeps/linux/common/getpgid.c +++ b/libc/sysdeps/linux/common/getpgid.c @@ -12,8 +12,7 @@ #define __NR___syscall_getpgid __NR_getpgid static inline _syscall1(__kernel_pid_t, __syscall_getpgid, __kernel_pid_t, pid); -pid_t __getpgid(pid_t pid) +pid_t getpgid(pid_t pid) { return (__syscall_getpgid(pid)); } -weak_alias(__getpgid, getpgid) diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c index 6a6a9e129..ecb29851e 100644 --- a/libc/sysdeps/linux/common/getpid.c +++ b/libc/sysdeps/linux/common/getpid.c @@ -11,10 +11,10 @@ #include <unistd.h> #if defined (__alpha__) -#define __NR___getpid __NR_getxpid +#define __NR_getpid __NR_getxpid #endif -#define __NR___getpid __NR_getpid -attribute_hidden _syscall0(pid_t, __getpid); -strong_alias(__getpid, getpid) -/* not used in libpthread */ -/* weak_alias(__getpid, __libc_getpid) */ +#define __NR___libc_getpid __NR_getpid +_syscall0(pid_t, __libc_getpid); +strong_alias(__libc_getpid, getpid) +libc_hidden_proto(getpid) +libc_hidden_def(getpid) diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c index 3f695402d..bde7a3d85 100644 --- a/libc/sysdeps/linux/common/getpriority.c +++ b/libc/sysdeps/linux/common/getpriority.c @@ -17,7 +17,7 @@ static inline _syscall2(int, __syscall_getpriority, /* The return value of __syscall_getpriority is biased by this value * to avoid returning negative values. */ #define PZERO 20 -int attribute_hidden __getpriority(enum __priority_which which, id_t who) +int getpriority(enum __priority_which which, id_t who) { int res; @@ -26,4 +26,5 @@ int attribute_hidden __getpriority(enum __priority_which which, id_t who) res = PZERO - res; return res; } -strong_alias(__getpriority,getpriority) +libc_hidden_proto(getpriority) +libc_hidden_def(getpriority) diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index fef907a03..804410b34 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -16,7 +16,7 @@ static inline _syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, struct rlimit *, rlim); -int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { return (__ugetrlimit(resource, rlimits)); } @@ -28,7 +28,7 @@ int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rl static inline _syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim); -int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { int result; @@ -47,4 +47,5 @@ int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rl } #endif -strong_alias(__getrlimit,getrlimit) +libc_hidden_proto(getrlimit) +libc_hidden_def(getrlimit) diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index 76c3196ad..6f670c001 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getrlimit __getrlimit - #include <features.h> #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -36,6 +34,8 @@ #include <sys/types.h> #include <sys/resource.h> +libc_hidden_proto(getrlimit) + #if defined __UCLIBC_HAS_LFS__ /* Put the soft and hard limits for RESOURCE in *RLIMITS. diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c index 3e9c2d8ba..91d327098 100644 --- a/libc/sysdeps/linux/common/getsid.c +++ b/libc/sysdeps/linux/common/getsid.c @@ -13,8 +13,9 @@ #define __NR___syscall_getsid __NR_getsid static inline _syscall1(__kernel_pid_t, __syscall_getsid, __kernel_pid_t, pid); -pid_t attribute_hidden __getsid(pid_t pid) +pid_t getsid(pid_t pid) { return (__syscall_getsid(pid)); } -strong_alias(__getsid,getsid) +libc_hidden_proto(getsid) +libc_hidden_def(getsid) diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 6c2613f01..175691f89 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/time.h> -#define __NR___gettimeofday __NR_gettimeofday -attribute_hidden _syscall2(int, __gettimeofday, struct timeval *, tv, struct timezone *, tz); -strong_alias(__gettimeofday,gettimeofday) +_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +libc_hidden_proto(gettimeofday) +libc_hidden_def(gettimeofday) diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index 7c81ccf48..610c34edc 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -17,8 +17,9 @@ static inline _syscall0(int, __syscall_getuid); -uid_t attribute_hidden __getuid(void) +uid_t getuid(void) { return (__syscall_getuid()); } -strong_alias(__getuid,getuid) +libc_hidden_proto(getuid) +libc_hidden_def(getuid) diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c index 29293f359..e9ea707ab 100644 --- a/libc/sysdeps/linux/common/ioctl.c +++ b/libc/sysdeps/linux/common/ioctl.c @@ -11,11 +11,13 @@ #include <stdarg.h> #include <sys/ioctl.h> +libc_hidden_proto(ioctl) + #define __NR___syscall_ioctl __NR_ioctl static inline _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg); -int attribute_hidden __ioctl(int fd, unsigned long int request, ...) +int ioctl(int fd, unsigned long int request, ...) { void *arg; va_list list; @@ -26,4 +28,4 @@ int attribute_hidden __ioctl(int fd, unsigned long int request, ...) va_end(list); return __syscall_ioctl(fd, request, arg); } -strong_alias(__ioctl,ioctl) +libc_hidden_def(ioctl) diff --git a/libc/sysdeps/linux/common/kill.c b/libc/sysdeps/linux/common/kill.c index 2d1d9ae8a..2a6bfce8e 100644 --- a/libc/sysdeps/linux/common/kill.c +++ b/libc/sysdeps/linux/common/kill.c @@ -14,8 +14,9 @@ #define __NR___syscall_kill __NR_kill static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig); -int attribute_hidden __kill(pid_t pid, int sig) +int kill(pid_t pid, int sig) { return (__syscall_kill(pid, sig)); } -strong_alias(__kill,kill) +libc_hidden_proto(kill) +libc_hidden_def(kill) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index a2ffd6196..b48641a1a 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -33,7 +33,6 @@ #include <sys/types.h> #include <sys/syscall.h> -#undef lseek64 #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__ #ifndef INLINE_SYSCALL @@ -43,20 +42,21 @@ static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi, off_t, offset_lo, loff_t *, result, int, whence); #endif -loff_t attribute_hidden __lseek64(int fd, loff_t offset, int whence) +loff_t __libc_lseek64(int fd, loff_t offset, int whence) { loff_t result; return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32), (off_t) (offset & 0xffffffff), &result, whence) ?: result); } #else -extern __off_t __lseek(int fildes, off_t offset, int whence) attribute_hidden; -loff_t __lseek64(int fd, loff_t offset, int whence) +extern __off_t __libc_lseek(int fildes, off_t offset, int whence); +libc_hidden_proto(__libc_lseek) +loff_t __libc_lseek64(int fd, loff_t offset, int whence) { - return(loff_t)(__lseek(fd, (off_t) (offset), whence)); + return(loff_t)(__libc_lseek(fd, (off_t) (offset), whence)); } #endif -strong_alias(__lseek64,lseek64) -//strong_alias(__lseek64,_llseek) -//strong_alias(__lseek64,llseek) -weak_alias(__lseek64,__libc_lseek64) +strong_alias(__libc_lseek64,lseek64) +libc_hidden_proto(lseek64) +libc_hidden_def(lseek64) +//strong_alias(__libc_lseek64,_llseek) diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 5b4eff5f5..b2fdde9c9 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -20,9 +20,10 @@ #include <setjmp.h> #include <signal.h> +libc_hidden_proto(sigprocmask) extern void __longjmp (__jmp_buf __env, int val); - +libc_hidden_proto(__longjmp) /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp @@ -36,14 +37,14 @@ void __libc_longjmp (sigjmp_buf env, int val) if (env[0].__mask_was_saved) /* Restore the saved signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, + (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask, (sigset_t *) NULL); /* Call the machine-dependent function to restore machine state. */ __longjmp (env[0].__jmpbuf, val ?: 1); } -weak_alias (__libc_longjmp, longjmp) -weak_alias (__libc_longjmp, _longjmp) -weak_alias (__libc_longjmp, siglongjmp) -weak_alias (__libc_longjmp, __libc_siglongjmp) +strong_alias(__libc_longjmp,longjmp) +strong_alias(__libc_longjmp,siglongjmp) +strong_alias(__libc_longjmp,__libc_siglongjmp) +/* weak_alias (__libc_longjmp, _longjmp) */ diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 4eb51d322..2ed5e4a14 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -10,9 +10,11 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___lseek __NR_lseek -#undef __lseek -#undef lseek -attribute_hidden _syscall3(__off_t, __lseek, int, fildes, __off_t, offset, int, whence); -strong_alias(__lseek,lseek) -weak_alias(__lseek,__libc_lseek) +#define __NR___libc_lseek __NR_lseek +_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence); +libc_hidden_proto(__libc_lseek) +libc_hidden_def(__libc_lseek) + +strong_alias(__libc_lseek,lseek) +libc_hidden_proto(lseek) +libc_hidden_def(lseek) diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c index d7feac273..9509c489d 100644 --- a/libc/sysdeps/linux/common/lstat.c +++ b/libc/sysdeps/linux/common/lstat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_lstat64 doesnt exist */ #define lstat64 __hidelstat64 -#define __lstat64 __hide__lstat64 #include "syscalls.h" #include <unistd.h> @@ -18,15 +17,13 @@ #include "xstatconv.h" #undef lstat64 -#undef __lstat64 #define __NR___syscall_lstat __NR_lstat -#undef __lstat #undef lstat static inline _syscall2(int, __syscall_lstat, const char *, file_name, struct kernel_stat *, buf); -int attribute_hidden __lstat(const char *file_name, struct stat *buf) +int lstat(const char *file_name, struct stat *buf) { int result; struct kernel_stat kbuf; @@ -37,9 +34,11 @@ int attribute_hidden __lstat(const char *file_name, struct stat *buf) } return result; } -strong_alias(__lstat,lstat) +libc_hidden_proto(lstat) +libc_hidden_def(lstat) #if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__lstat,__lstat64) -weak_alias(lstat,lstat64) +strong_alias(lstat,lstat64) +libc_hidden_proto(lstat64) +libc_hidden_def(lstat64) #endif diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index 99b655a0c..b56184f82 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -15,11 +15,10 @@ #include "xstatconv.h" #define __NR___syscall_lstat64 __NR_lstat64 -#undef lstat64 static inline _syscall2(int, __syscall_lstat64, const char *, file_name, struct kernel_stat64 *, buf); -int attribute_hidden __lstat64(const char *file_name, struct stat64 *buf) +int lstat64(const char *file_name, struct stat64 *buf) { int result; struct kernel_stat64 kbuf; @@ -30,6 +29,7 @@ int attribute_hidden __lstat64(const char *file_name, struct stat64 *buf) } return result; } -strong_alias(__lstat64,lstat64) +libc_hidden_proto(lstat64) +libc_hidden_def(lstat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/mkdir.c b/libc/sysdeps/linux/common/mkdir.c index 5e96cf599..819793f87 100644 --- a/libc/sysdeps/linux/common/mkdir.c +++ b/libc/sysdeps/linux/common/mkdir.c @@ -14,8 +14,9 @@ static inline _syscall2(int, __syscall_mkdir, const char *, pathname, __kernel_mode_t, mode); -int attribute_hidden __mkdir(const char *pathname, mode_t mode) +int mkdir(const char *pathname, mode_t mode) { return (__syscall_mkdir(pathname, mode)); } -strong_alias(__mkdir,mkdir) +libc_hidden_proto(mkdir) +libc_hidden_def(mkdir) diff --git a/libc/sysdeps/linux/common/mkfifo.c b/libc/sysdeps/linux/common/mkfifo.c index db7f8fc42..dddfe8c7b 100644 --- a/libc/sysdeps/linux/common/mkfifo.c +++ b/libc/sysdeps/linux/common/mkfifo.c @@ -20,13 +20,13 @@ by Erik Andersen <andersee@debian.org> */ -#define mknod __mknod - #include <errno.h> #include <stddef.h> #include <sys/stat.h> #include <sys/types.h> +libc_hidden_proto(mknod) + /* Create a named pipe (FIFO) named PATH with protections MODE. */ int mkfifo (const char *path, mode_t mode) diff --git a/libc/sysdeps/linux/common/mknod.c b/libc/sysdeps/linux/common/mknod.c index d66747178..f914af5d7 100644 --- a/libc/sysdeps/linux/common/mknod.c +++ b/libc/sysdeps/linux/common/mknod.c @@ -15,7 +15,7 @@ static inline _syscall3(int, __syscall_mknod, const char *, path, __kernel_mode_t, mode, __kernel_dev_t, dev); -int attribute_hidden __mknod(const char *path, mode_t mode, dev_t dev) +int mknod(const char *path, mode_t mode, dev_t dev) { /* We must convert the dev_t value to a __kernel_dev_t */ __kernel_dev_t k_dev; @@ -23,4 +23,5 @@ int attribute_hidden __mknod(const char *path, mode_t mode, dev_t dev) k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff); return __syscall_mknod(path, mode, k_dev); } -strong_alias(__mknod,mknod) +libc_hidden_proto(mknod) +libc_hidden_def(mknod) diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c index 3cd3eee4d..eadecfeee 100644 --- a/libc/sysdeps/linux/common/mmap.c +++ b/libc/sysdeps/linux/common/mmap.c @@ -14,7 +14,7 @@ #ifdef __NR_mmap #define __NR__mmap __NR_mmap static inline _syscall1(__ptr_t, _mmap, unsigned long *, buffer); -attribute_hidden __ptr_t __mmap(__ptr_t addr, size_t len, int prot, +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) { unsigned long buffer[6]; @@ -27,5 +27,6 @@ attribute_hidden __ptr_t __mmap(__ptr_t addr, size_t len, int prot, buffer[5] = (unsigned long) offset; return (__ptr_t) _mmap(buffer); } -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) #endif diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c index f0380b1ad..c0bc2b53a 100644 --- a/libc/sysdeps/linux/common/mmap64.c +++ b/libc/sysdeps/linux/common/mmap64.c @@ -19,14 +19,11 @@ /* Massivly hacked up for uClibc by Erik Andersen */ -#define mmap __mmap - #include <features.h> #include <errno.h> #include <unistd.h> #include <sys/mman.h> - #if defined __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -45,6 +42,8 @@ #if ! defined __NR_mmap2 || ! defined _syscall6 +libc_hidden_proto(mmap) + /* * This version is a stub that just chops off everything at the mmap 32 bit * mmap() address space... You will probably need to add in an arch specific diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c index 618681ad3..47ed7e350 100644 --- a/libc/sysdeps/linux/common/modify_ldt.c +++ b/libc/sysdeps/linux/common/modify_ldt.c @@ -11,5 +11,5 @@ #ifdef __NR_modify_ldt _syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount); -weak_alias(modify_ldt, __modify_ldt) +/*weak_alias(modify_ldt, __modify_ldt)*/ #endif diff --git a/libc/sysdeps/linux/common/mremap.c b/libc/sysdeps/linux/common/mremap.c index f4a4670d2..16359193b 100644 --- a/libc/sysdeps/linux/common/mremap.c +++ b/libc/sysdeps/linux/common/mremap.c @@ -10,7 +10,7 @@ #include "syscalls.h" #include <unistd.h> #include <sys/mman.h> -#define __NR___mremap __NR_mremap -attribute_hidden _syscall4(__ptr_t, __mremap, __ptr_t, old_address, size_t, old_size, size_t, +_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t, new_size, int, may_move); -strong_alias(__mremap,mremap) +libc_hidden_proto(mremap) +libc_hidden_def(mremap) diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 8de9f346e..044652720 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -13,4 +13,4 @@ #define __NR___libc_msync __NR_msync _syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); -weak_alias(__libc_msync, msync) +strong_alias(__libc_msync,msync) diff --git a/libc/sysdeps/linux/common/munmap.c b/libc/sysdeps/linux/common/munmap.c index be631060a..cd76eb297 100644 --- a/libc/sysdeps/linux/common/munmap.c +++ b/libc/sysdeps/linux/common/munmap.c @@ -10,6 +10,6 @@ #include "syscalls.h" #include <unistd.h> #include <sys/mman.h> -#define __NR___munmap __NR_munmap -attribute_hidden _syscall2(int, __munmap, void *, start, size_t, length); -strong_alias(__munmap,munmap) +_syscall2(int, munmap, void *, start, size_t, length); +libc_hidden_proto(munmap) +libc_hidden_def(munmap) diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 3f5ffbaa3..0032f6623 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -13,5 +13,6 @@ #define __NR___libc_nanosleep __NR_nanosleep _syscall2(int, __libc_nanosleep, const struct timespec *, req, struct timespec *, rem); -hidden_weak_alias(__libc_nanosleep,__nanosleep) -weak_alias(__libc_nanosleep,nanosleep) +strong_alias(__libc_nanosleep,nanosleep) +libc_hidden_proto(nanosleep) +libc_hidden_def(nanosleep) diff --git a/libc/sysdeps/linux/common/nice.c b/libc/sysdeps/linux/common/nice.c index 20f7996a7..75e065e65 100644 --- a/libc/sysdeps/linux/common/nice.c +++ b/libc/sysdeps/linux/common/nice.c @@ -8,13 +8,12 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define getpriority __getpriority -#define setpriority __setpriority - #include "syscalls.h" #include <unistd.h> #include <sys/resource.h> +libc_hidden_proto(getpriority) + #ifdef __NR_nice #define __NR___syscall_nice __NR_nice @@ -24,6 +23,8 @@ static inline _syscall1(int, __syscall_nice, int, incr); #include <limits.h> +libc_hidden_proto(setpriority) + static inline int int_add_no_wrap(int a, int b) { int s = a + b; diff --git a/libc/sysdeps/linux/common/ntp_gettime.c b/libc/sysdeps/linux/common/ntp_gettime.c index 0c4d1549f..f32e05444 100644 --- a/libc/sysdeps/linux/common/ntp_gettime.c +++ b/libc/sysdeps/linux/common/ntp_gettime.c @@ -16,17 +16,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define adjtimex __adjtimex - #include <sys/timex.h> +libc_hidden_proto(adjtimex) + int ntp_gettime(struct ntptimeval *ntv) { struct timex tntx; int result; tntx.modes = 0; - result = __adjtimex(&tntx); + result = adjtimex(&tntx); ntv->time = tntx.time; ntv->maxerror = tntx.maxerror; ntv->esterror = tntx.esterror; diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 648f7d053..14cf65750 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -14,13 +14,11 @@ #include <string.h> #include <sys/param.h> -#undef __open -#undef open #define __NR___syscall_open __NR_open static inline _syscall3(int, __syscall_open, const char *, file, int, flags, __kernel_mode_t, mode); -int attribute_hidden __open(const char *file, int flags, ...) +int __libc_open(const char *file, int flags, ...) { /* gcc may warn about mode being uninitialized. * Just ignore that, since gcc is wrong. */ @@ -35,10 +33,14 @@ int attribute_hidden __open(const char *file, int flags, ...) } return __syscall_open(file, flags, mode); } -strong_alias(__open,open) -weak_alias(__open,__libc_open) +libc_hidden_proto(__libc_open) +libc_hidden_def(__libc_open) + +strong_alias(__libc_open,open) +libc_hidden_proto(open) +libc_hidden_def(open) int creat(const char *file, mode_t mode) { - return __open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); + return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); } diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index f577d9507..fbe99b0d9 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -26,10 +26,12 @@ #endif #ifdef __UCLIBC_HAS_LFS__ +extern int __libc_open (__const char *__file, int __oflag, ...) __nonnull ((1)); +libc_hidden_proto(__libc_open) + /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ -#undef open64 -int attribute_hidden __open64 (const char *file, int oflag, ...) +int __libc_open64 (const char *file, int oflag, ...) { int mode = 0; @@ -41,8 +43,10 @@ int attribute_hidden __open64 (const char *file, int oflag, ...) va_end (arg); } - return __open(file, oflag | O_LARGEFILE, mode); + return __libc_open(file, oflag | O_LARGEFILE, mode); } -strong_alias(__open64,open64) -weak_alias(__open64,__libc_open64) + +strong_alias(__libc_open64,open64) +libc_hidden_proto(open64) +libc_hidden_def(open64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index a017ef611..1028a7a63 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -7,9 +7,6 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define __sigpause __sigpause_internal -#define sigblock __sigblock - #include "syscalls.h" #include <unistd.h> @@ -18,9 +15,12 @@ _syscall0(int, __libc_pause); #else #include <signal.h> +libc_hidden_proto(__sigpause) +libc_hidden_proto(sigblock) + int __libc_pause(void) { return (__sigpause(sigblock(0), 0)); } #endif -weak_alias(__libc_pause, pause) +strong_alias(__libc_pause,pause) diff --git a/libc/sysdeps/linux/common/pipe.c b/libc/sysdeps/linux/common/pipe.c index 2045b8d64..93d52b88f 100644 --- a/libc/sysdeps/linux/common/pipe.c +++ b/libc/sysdeps/linux/common/pipe.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___pipe __NR_pipe -attribute_hidden _syscall1(int, __pipe, int *, filedes); -strong_alias(__pipe,pipe) +_syscall1(int, pipe, int *, filedes); +libc_hidden_proto(pipe) +libc_hidden_def(pipe) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index c957f1edf..c76df966f 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -17,15 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getdtablesize __getdtablesize -#define select __select - #include "syscalls.h" #include <sys/poll.h> #ifdef __NR_poll -#define __NR___poll __NR_poll -attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, +_syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout); #else @@ -37,6 +33,11 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, #include <sys/param.h> #include <unistd.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(getdtablesize) +libc_hidden_proto(select) + /* uClinux 2.0 doesn't have poll, emulate it using select */ /* Poll the file descriptors described by the NFDS structures starting at @@ -45,7 +46,7 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, Returns the number of file descriptors with events, zero if timed out, or -1 for errors. */ -int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) +int poll(struct pollfd *fds, nfds_t nfds, int timeout) { static int max_fd_size; struct timeval tv; @@ -65,9 +66,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) /* We can't call FD_ZERO, since FD_ZERO only works with sets of exactly __FD_SETSIZE size. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); for (f = fds; f < &fds[nfds]; ++f) { @@ -89,13 +90,13 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) nwset = alloca (nbytes); nxset = alloca (nbytes); - __memset ((char *) nrset + bytes, 0, nbytes - bytes); - __memset ((char *) nwset + bytes, 0, nbytes - bytes); - __memset ((char *) nxset + bytes, 0, nbytes - bytes); + memset ((char *) nrset + bytes, 0, nbytes - bytes); + memset ((char *) nwset + bytes, 0, nbytes - bytes); + memset ((char *) nxset + bytes, 0, nbytes - bytes); - rset = __memcpy (nrset, rset, bytes); - wset = __memcpy (nwset, wset, bytes); - xset = __memcpy (nxset, xset, bytes); + rset = memcpy (nrset, rset, bytes); + wset = memcpy (nwset, wset, bytes); + xset = memcpy (nxset, xset, bytes); bytes = nbytes; } @@ -129,9 +130,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval sngl_tv; /* Clear the original set. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); /* This means we don't wait for input. */ sngl_tv.tv_sec = 0; @@ -148,9 +149,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) { int n; - __memset (sngl_rset, 0, bytes); - __memset (sngl_wset, 0, bytes); - __memset (sngl_xset, 0, bytes); + memset (sngl_rset, 0, bytes); + memset (sngl_wset, 0, bytes); + memset (sngl_xset, 0, bytes); if (f->events & POLLIN) FD_SET (f->fd, sngl_rset); @@ -204,4 +205,5 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) } #endif -strong_alias(__poll,poll) +libc_hidden_proto(poll) +libc_hidden_def(poll) diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 5662a440c..72419be7b 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -8,12 +8,8 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -/* need to hide the posix_fadvise64 prototype or the weak_alias() - * will fail when __NR_fadvise64_64 doesnt exist */ -#define posix_fadvise64 __hide_posix_fadvise64 #include "syscalls.h" #include <fcntl.h> -#undef posix_fadvise64 #ifdef __NR_fadvise64 #define __NR_posix_fadvise __NR_fadvise64 @@ -21,7 +17,7 @@ _syscall4(int, posix_fadvise, int, fd, off_t, offset, off_t, len, int, advice); #if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6) -weak_alias(posix_fadvise, posix_fadvise64) +strong_alias(posix_fadvise,posix_fadvise64) #endif #else diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index 5c5cf9906..e5f23d509 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -52,7 +52,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) #endif #elif !defined __NR_fadvise64 -/* This is declared as a weak alias in posix_fadvise.c if __NR_fadvise64 +/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64 * is defined. */ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c index 7183ac9a7..c622b22d2 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -40,6 +40,12 @@ #include <unistd.h> #include <stdint.h> +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(lseek64) +#else +libc_hidden_proto(lseek) +#endif + #ifdef __NR_pread #define __NR___syscall_pread __NR_pread @@ -50,7 +56,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset))); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) @@ -59,7 +65,7 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ @@ -75,7 +81,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset))); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) @@ -84,7 +90,7 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ @@ -100,11 +106,11 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek(fd, 0, SEEK_CUR)) == (off_t) -1) + if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) return -1; /* Set to wanted position. */ - if (__lseek (fd, offset, SEEK_SET) == (off_t) -1) + if (lseek (fd, offset, SEEK_SET) == (off_t) -1) return -1; if (do_pwrite==1) { @@ -118,7 +124,7 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Now we have to restore the position. If this fails we * have to return this as an error. */ save_errno = errno; - if (__lseek(fd, old_offset, SEEK_SET) == (off_t) -1) + if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) { if (result == -1) __set_errno(save_errno); @@ -138,11 +144,11 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) + if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) return -1; /* Set to wanted position. */ - if (__lseek64(fd, offset, SEEK_SET) == (off64_t) -1) + if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) return -1; if (do_pwrite==1) { @@ -155,7 +161,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Now we have to restore the position. */ save_errno = errno; - if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { + if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { if (result == -1) __set_errno (save_errno); return -1; @@ -171,14 +177,14 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pread */ @@ -190,14 +196,13 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) *just cast it to get rid of warnings */ return(__fake_pread_write(fd, (void*)buf, count, offset, 1)); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, (void*)buf, count, offset, 1)); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pwrite */ - diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c index 6490bccbc..912533e55 100644 --- a/libc/sysdeps/linux/common/read.c +++ b/libc/sysdeps/linux/common/read.c @@ -10,7 +10,8 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___read __NR_read -attribute_hidden _syscall3(ssize_t, __read, int, fd, __ptr_t, buf, size_t, count); -strong_alias(__read,read) -weak_alias(__read,__libc_read) +#define __NR___libc_read __NR_read +_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count); +strong_alias(__libc_read,read) +libc_hidden_proto(read) +libc_hidden_def(read) diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c index 45db1a64f..d1587154d 100644 --- a/libc/sysdeps/linux/common/readlink.c +++ b/libc/sysdeps/linux/common/readlink.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___readlink __NR_readlink -attribute_hidden _syscall3(int, __readlink, const char *, path, char *, buf, size_t, bufsiz); -strong_alias(__readlink,readlink) +_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz); +libc_hidden_proto(readlink) +libc_hidden_def(readlink) diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c index 2f2c8a335..706fa0fd3 100644 --- a/libc/sysdeps/linux/common/rmdir.c +++ b/libc/sysdeps/linux/common/rmdir.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___rmdir __NR_rmdir -attribute_hidden _syscall1(int, __rmdir, const char *, pathname); -strong_alias(__rmdir,rmdir) +_syscall1(int, rmdir, const char *, pathname); +libc_hidden_proto(rmdir) +libc_hidden_def(rmdir) diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index d8507335b..bdc8c68a7 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -19,29 +19,31 @@ #include <unistd.h> #include <errno.h> +libc_hidden_proto(brk) + /* Defined in brk.c. */ extern void *__curbrk; -extern int __brk (void *addr) attribute_hidden; /* Extend the process's data space by INCREMENT. If INCREMENT is negative, shrink data space by - INCREMENT. Return start of new space allocated, or -1 for errors. */ -void attribute_hidden * __sbrk (intptr_t increment) +void * sbrk (intptr_t increment) { void *oldbrk; if (__curbrk == NULL) - if (__brk (0) < 0) /* Initialize the break. */ + if (brk (0) < 0) /* Initialize the break. */ return (void *) -1; if (increment == 0) return __curbrk; oldbrk = __curbrk; - if (__brk (oldbrk + increment) < 0) + if (brk (oldbrk + increment) < 0) return (void *) -1; return oldbrk; } -strong_alias(__sbrk,sbrk) +libc_hidden_proto(sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c index 36f88229a..19e14b99a 100644 --- a/libc/sysdeps/linux/common/select.c +++ b/libc/sysdeps/linux/common/select.c @@ -11,10 +11,10 @@ #include <unistd.h> #ifdef __NR__newselect -#define __NR___select __NR__newselect -#else -#define __NR___select __NR_select +#undef __NR_select +#define __NR_select __NR__newselect #endif -attribute_hidden _syscall5(int, __select, int, n, fd_set *, readfds, fd_set *, writefds, +_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds, fd_set *, exceptfds, struct timeval *, timeout); -strong_alias(__select,select) +libc_hidden_proto(select) +libc_hidden_def(select) diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c index d3175dad5..dcd207132 100644 --- a/libc/sysdeps/linux/common/setegid.c +++ b/libc/sysdeps/linux/common/setegid.c @@ -1,5 +1,8 @@ -#define setresgid __setresgid -#define setregid __setregid +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define _GNU_SOURCE #include <unistd.h> @@ -9,6 +12,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(setresgid) +libc_hidden_proto(setregid) + int setegid(gid_t gid) { int result; diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c index f5ed35743..aeb6356e5 100644 --- a/libc/sysdeps/linux/common/seteuid.c +++ b/libc/sysdeps/linux/common/seteuid.c @@ -1,5 +1,8 @@ -#define setresuid __setresuid -#define setreuid __setreuid +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define _GNU_SOURCE #include <unistd.h> @@ -9,7 +12,10 @@ #include <sys/types.h> #include <sys/syscall.h> -int attribute_hidden __seteuid(uid_t uid) +libc_hidden_proto(setresuid) +libc_hidden_proto(setreuid) + +int seteuid(uid_t uid) { int result; @@ -29,4 +35,4 @@ int attribute_hidden __seteuid(uid_t uid) return result; } -strong_alias(__seteuid,seteuid) +libc_hidden_proto(seteuid) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index 49d85156f..a41578d62 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -7,18 +7,18 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define sysconf __sysconf - #include "syscalls.h" #include <stdlib.h> #include <unistd.h> #include <grp.h> +libc_hidden_proto(sysconf) + #define __NR___syscall_setgroups __NR_setgroups static inline _syscall2(int, __syscall_setgroups, size_t, size, const __kernel_gid_t *, list); -int attribute_hidden __setgroups(size_t size, const gid_t *groups) +int setgroups(size_t size, const gid_t *groups) { if (size > (size_t) sysconf(_SC_NGROUPS_MAX)) { ret_error: @@ -47,4 +47,5 @@ ret_error: return i; } } -strong_alias(__setgroups,setgroups) +libc_hidden_proto(setgroups) +libc_hidden_def(setgroups) diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c index be51cb5c5..f34a9f39c 100644 --- a/libc/sysdeps/linux/common/setitimer.c +++ b/libc/sysdeps/linux/common/setitimer.c @@ -9,7 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -#define __NR___setitimer __NR_setitimer -attribute_hidden _syscall3(int, __setitimer, __itimer_which_t, which, +_syscall3(int, setitimer, __itimer_which_t, which, const struct itimerval *, new, struct itimerval *, old); -strong_alias(__setitimer,setitimer) +libc_hidden_proto(setitimer) +libc_hidden_def(setitimer) diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c index 6d73f08ec..0453fbdfb 100644 --- a/libc/sysdeps/linux/common/setpgid.c +++ b/libc/sysdeps/linux/common/setpgid.c @@ -14,8 +14,9 @@ static inline _syscall2(int, __syscall_setpgid, __kernel_pid_t, pid, __kernel_pid_t, pgid); -int attribute_hidden __setpgid(pid_t pid, pid_t pgid) +int setpgid(pid_t pid, pid_t pgid) { return (__syscall_setpgid(pid, pgid)); } -strong_alias(__setpgid,setpgid) +libc_hidden_proto(setpgid) +libc_hidden_def(setpgid) diff --git a/libc/sysdeps/linux/common/setpgrp.c b/libc/sysdeps/linux/common/setpgrp.c index 966bb4da6..38300dc2e 100644 --- a/libc/sysdeps/linux/common/setpgrp.c +++ b/libc/sysdeps/linux/common/setpgrp.c @@ -1,8 +1,14 @@ -#define setpgid __setpgid +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <syscall.h> #include <unistd.h> +libc_hidden_proto(setpgid) + int setpgrp(void) { return setpgid(0,0); diff --git a/libc/sysdeps/linux/common/setpriority.c b/libc/sysdeps/linux/common/setpriority.c index 06476d88f..7347786af 100644 --- a/libc/sysdeps/linux/common/setpriority.c +++ b/libc/sysdeps/linux/common/setpriority.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/resource.h> -#define __NR___setpriority __NR_setpriority -attribute_hidden _syscall3(int, __setpriority, __priority_which_t, which, id_t, who, int, prio); -strong_alias(__setpriority,setpriority) +_syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio); +libc_hidden_proto(setpriority) +libc_hidden_def(setpriority) diff --git a/libc/sysdeps/linux/common/setregid.c b/libc/sysdeps/linux/common/setregid.c index cfd375744..043afffc9 100644 --- a/libc/sysdeps/linux/common/setregid.c +++ b/libc/sysdeps/linux/common/setregid.c @@ -14,7 +14,7 @@ static inline _syscall2(int, __syscall_setregid, __kernel_gid_t, rgid, __kernel_gid_t, egid); -int attribute_hidden __setregid(gid_t rgid, gid_t egid) +int setregid(gid_t rgid, gid_t egid) { if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) || ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) { @@ -23,4 +23,4 @@ int attribute_hidden __setregid(gid_t rgid, gid_t egid) } return (__syscall_setregid(rgid, egid)); } -strong_alias(__setregid,setregid) +libc_hidden_proto(setregid) diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c index fbfa98be3..82087d1c1 100644 --- a/libc/sysdeps/linux/common/setresgid.c +++ b/libc/sysdeps/linux/common/setresgid.c @@ -14,7 +14,7 @@ static inline _syscall3(int, __syscall_setresgid, __kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid); -int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid) +int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) || ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) @@ -24,5 +24,6 @@ int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid) } return (__syscall_setresgid(rgid, egid, sgid)); } -strong_alias(__setresgid,setresgid) +libc_hidden_proto(setresgid) +libc_hidden_def(setresgid) #endif diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c index 6ed1423f5..7d34c4027 100644 --- a/libc/sysdeps/linux/common/setresuid.c +++ b/libc/sysdeps/linux/common/setresuid.c @@ -14,7 +14,7 @@ static inline _syscall3(int, __syscall_setresuid, __kernel_uid_t, rgid, __kernel_uid_t, egid, __kernel_uid_t, sgid); -int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid) +int setresuid(uid_t ruid, uid_t euid, uid_t suid) { if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) || ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) @@ -24,5 +24,6 @@ int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid) } return (__syscall_setresuid(ruid, euid, suid)); } -strong_alias(__setresuid,setresuid) +libc_hidden_proto(setresuid) +libc_hidden_def(setresuid) #endif diff --git a/libc/sysdeps/linux/common/setreuid.c b/libc/sysdeps/linux/common/setreuid.c index 15ab5c01a..93684d047 100644 --- a/libc/sysdeps/linux/common/setreuid.c +++ b/libc/sysdeps/linux/common/setreuid.c @@ -14,7 +14,7 @@ static inline _syscall2(int, __syscall_setreuid, __kernel_uid_t, ruid, __kernel_uid_t, euid); -int attribute_hidden __setreuid(uid_t ruid, uid_t euid) +int setreuid(uid_t ruid, uid_t euid) { if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) || ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) { @@ -23,4 +23,5 @@ int attribute_hidden __setreuid(uid_t ruid, uid_t euid) } return (__syscall_setreuid(ruid, euid)); } -strong_alias(__setreuid,setreuid) +libc_hidden_proto(setreuid) +libc_hidden_def(setreuid) diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index 9c5466a09..08e955e05 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -18,7 +18,7 @@ #define RMIN(x, y) ((x) < (y) ? (x) : (y)) static inline _syscall2(int, __syscall_setrlimit, int, resource, const struct rlimit *, rlim); -int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) +int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) { struct rlimit rlimits_small; @@ -37,9 +37,9 @@ int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlim #include <unistd.h> struct rlimit; -#define __NR___setrlimit __NR_setrlimit -attribute_hidden _syscall2(int, __setrlimit, unsigned int, resource, +_syscall2(int, setrlimit, unsigned int, resource, const struct rlimit *, rlim); #endif -strong_alias(__setrlimit,setrlimit) +libc_hidden_proto(setrlimit) +libc_hidden_def(setrlimit) diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index d59057c90..b0d84de53 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define setrlimit __setrlimit - #include <features.h> #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -38,6 +36,8 @@ #if defined __UCLIBC_HAS_LFS__ +libc_hidden_proto(setrlimit) + /* Set the soft and hard limits for RESOURCE to *RLIMITS. Only the super-user can increase hard limits. Return 0 if successful, -1 if not (and sets errno). */ diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c index b3e1e8706..6b63e3a31 100644 --- a/libc/sysdeps/linux/common/setsid.c +++ b/libc/sysdeps/linux/common/setsid.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___setsid __NR_setsid -attribute_hidden _syscall0(pid_t, __setsid); -strong_alias(__setsid,setsid) +_syscall0(pid_t, setsid); +libc_hidden_proto(setsid) +libc_hidden_def(setsid) diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c index 4e88b3edb..7f4c336a2 100644 --- a/libc/sysdeps/linux/common/settimeofday.c +++ b/libc/sysdeps/linux/common/settimeofday.c @@ -9,7 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -#define __NR___settimeofday __NR_settimeofday -attribute_hidden _syscall2(int, __settimeofday, const struct timeval *, tv, +attribute_hidden _syscall2(int, settimeofday, const struct timeval *, tv, const struct timezone *, tz); -strong_alias(__settimeofday,settimeofday) +libc_hidden_proto(settimeofday) +libc_hidden_def(settimeofday) diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index 7a18648e8..6ca040c59 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -19,7 +19,7 @@ static inline _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset, size_t, size); -int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -44,7 +44,7 @@ static inline _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset); -int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -62,4 +62,5 @@ int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * old } #endif -strong_alias(__sigprocmask,sigprocmask) +libc_hidden_proto(sigprocmask) +libc_hidden_def(sigprocmask) diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index be69c62c2..be90d7e87 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -15,7 +15,7 @@ #define __NR___rt_sigsuspend __NR_rt_sigsuspend static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size); -int attribute_hidden __sigsuspend(const sigset_t * mask) +int sigsuspend(const sigset_t * mask) { return __rt_sigsuspend(mask, _NSIG / 8); } @@ -24,9 +24,10 @@ int attribute_hidden __sigsuspend(const sigset_t * mask) static inline _syscall3(int, __syscall_sigsuspend, int, a, unsigned long int, b, unsigned long int, c); -int attribute_hidden __sigsuspend(const sigset_t * set) +int sigsuspend(const sigset_t * set) { return __syscall_sigsuspend(0, 0, set->__val[0]); } #endif -strong_alias(__sigsuspend,sigsuspend) +libc_hidden_proto(sigsuspend) +libc_hidden_def(sigsuspend) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index ecd9dd8d7..33d84e5eb 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -26,19 +26,25 @@ # define SSP_SIGTYPE SIGABRT #endif -#define openlog __openlog -#define syslog __syslog -#define closelog __closelog -#define sigfillset __sigfillset_internal -#define sigdelset __sigdelset_internal -#define sigaction __sigaction -#define kill __kill - #include <string.h> #include <unistd.h> #include <signal.h> #include <sys/syslog.h> +libc_hidden_proto(memset) +libc_hidden_proto(strlen) +libc_hidden_proto(sigaction) +libc_hidden_proto(sigfillset) +libc_hidden_proto(sigdelset) +libc_hidden_proto(sigprocmask) +libc_hidden_proto(write) +libc_hidden_proto(openlog) +libc_hidden_proto(syslog) +libc_hidden_proto(closelog) +libc_hidden_proto(kill) +libc_hidden_proto(getpid) +libc_hidden_proto(_exit) + static void block_signals(void) { struct sigaction sa; @@ -47,10 +53,10 @@ static void block_signals(void) sigfillset(&mask); sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */ - __sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ + sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */ /* Make the default handler associated with the signal handler */ - __memset(&sa, 0, sizeof(struct sigaction)); + memset(&sa, 0, sizeof(struct sigaction)); sigfillset(&sa.sa_mask); /* Block all signals */ sa.sa_flags = 0; sa.sa_handler = SIG_DFL; @@ -59,10 +65,10 @@ static void block_signals(void) static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) { - __write(fd, msg1, __strlen(msg1)); - __write(fd, msg2, __strlen(msg2)); - __write(fd, msg3, __strlen(msg3)); - __write(fd, "()\n", 3); + write(fd, msg1, strlen(msg1)); + write(fd, msg2, strlen(msg2)); + write(fd, msg3, strlen(msg3)); + write(fd, "()\n", 3); openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); closelog(); @@ -70,8 +76,8 @@ static void ssp_write(int fd, const char *msg1, const char *msg2, const char *ms static attribute_noreturn void terminate(void) { - (void) kill(__getpid(), SSP_SIGTYPE); - _exit_internal(127); + (void) kill(getpid(), SSP_SIGTYPE); + _exit(127); } void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused))); diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c index 7cc6131b3..51e353f96 100644 --- a/libc/sysdeps/linux/common/stat.c +++ b/libc/sysdeps/linux/common/stat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_stat64 doesnt exist */ #define stat64 __hidestat64 -#define __stat64 __hide__stat64 #include "syscalls.h" #include <unistd.h> @@ -18,15 +17,13 @@ #include "xstatconv.h" #undef stat64 -#undef __stat64 #define __NR___syscall_stat __NR_stat -#undef __stat #undef stat static inline _syscall2(int, __syscall_stat, const char *, file_name, struct kernel_stat *, buf); -int attribute_hidden __stat(const char *file_name, struct stat *buf) +int stat(const char *file_name, struct stat *buf) { int result; struct kernel_stat kbuf; @@ -37,9 +34,11 @@ int attribute_hidden __stat(const char *file_name, struct stat *buf) } return result; } -strong_alias(__stat,stat) +libc_hidden_proto(stat) +libc_hidden_def(stat) #if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__stat,__stat64) -weak_alias(__stat,stat64) +strong_alias(stat,stat64) +libc_hidden_proto(stat64) +libc_hidden_def(stat64) #endif diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index dcd9163fb..e46cf8a25 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -18,8 +18,7 @@ static inline _syscall2(int, __syscall_stat64, const char *, file_name, struct kernel_stat64 *, buf); -#undef stat64 -int attribute_hidden __stat64(const char *file_name, struct stat64 *buf) +int stat64(const char *file_name, struct stat64 *buf) { int result; struct kernel_stat64 kbuf; @@ -30,6 +29,7 @@ int attribute_hidden __stat64(const char *file_name, struct stat64 *buf) } return result; } -strong_alias(__stat64,stat64) +libc_hidden_proto(stat64) +libc_hidden_def(stat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c index f8aa9d3ba..d931707f4 100644 --- a/libc/sysdeps/linux/common/statfs.c +++ b/libc/sysdeps/linux/common/statfs.c @@ -16,8 +16,9 @@ static inline _syscall2(int, __syscall_statfs, const char *, path, struct statfs *, buf); -int attribute_hidden __statfs(const char *path, struct statfs * buf) +int statfs(const char *path, struct statfs * buf) { return __syscall_statfs(path, buf); } -strong_alias(__statfs,statfs) +libc_hidden_proto(statfs) +libc_hidden_def(statfs) diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index 02ebd5570..a4dc1c742 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -7,16 +7,15 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define gettimeofday __gettimeofday - #include "syscalls.h" #include <time.h> #include <sys/time.h> #ifdef __NR_time -#define __NR___time __NR_time -attribute_hidden _syscall1(time_t, __time, time_t *, t); +_syscall1(time_t, time, time_t *, t); #else -time_t attribute_hidden __time(time_t * t) +libc_hidden_proto(gettimeofday) + +time_t time(time_t * t) { time_t result; struct timeval tv; @@ -32,4 +31,5 @@ time_t attribute_hidden __time(time_t * t) return result; } #endif -strong_alias(__time,time) +libc_hidden_proto(time) +libc_hidden_def(time) diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c index 0fefdca10..fa751a03b 100644 --- a/libc/sysdeps/linux/common/times.c +++ b/libc/sysdeps/linux/common/times.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/times.h> -#define __NR___times __NR_times -attribute_hidden _syscall1(clock_t, __times, struct tms *, buf); -strong_alias(__times,times) +_syscall1(clock_t, times, struct tms *, buf); +libc_hidden_proto(times) +libc_hidden_def(times) diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c index dd69bcb3e..d0b04ebee 100644 --- a/libc/sysdeps/linux/common/truncate.c +++ b/libc/sysdeps/linux/common/truncate.c @@ -10,4 +10,5 @@ #include "syscalls.h" #include <unistd.h> _syscall2(int, truncate, const char *, path, __off_t, length); -hidden_strong_alias(truncate, __truncate) +libc_hidden_proto(truncate) +libc_hidden_def(truncate) diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 06b076c4f..df6c9e4d5 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -12,8 +12,6 @@ * the main directory of this archive for more details. */ -#define truncate __truncate - #include <features.h> #include <unistd.h> #include <errno.h> @@ -66,6 +64,8 @@ int truncate64 (const char * path, __off64_t length) #else /* __NR_truncate64 */ +libc_hidden_proto(truncate) + int truncate64 (const char * path, __off64_t length) { __off_t x = (__off_t) length; @@ -82,4 +82,3 @@ int truncate64 (const char * path, __off64_t length) #endif /* __NR_truncate64 */ #endif /* __UCLIBC_HAS_LFS__ */ - diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c index b8e09fc8f..64bb45515 100644 --- a/libc/sysdeps/linux/common/ulimit.c +++ b/libc/sysdeps/linux/common/ulimit.c @@ -18,10 +18,6 @@ * */ -#define sysconf __sysconf -#define getrlimit __getrlimit -#define setrlimit __setrlimit - #define _GNU_SOURCE #define _LARGEFILE64_SOURCE #include <features.h> @@ -48,6 +44,10 @@ _syscall2(long, ulimit, int, cmd, int, arg); #include <errno.h> #include <sys/resource.h> +libc_hidden_proto(sysconf) +libc_hidden_proto(getrlimit) +libc_hidden_proto(setrlimit) + long int ulimit(int cmd, ...) { va_list va; diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c index 3d252edc7..936b862c0 100644 --- a/libc/sysdeps/linux/common/uname.c +++ b/libc/sysdeps/linux/common/uname.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/utsname.h> -#define __NR___uname __NR_uname -attribute_hidden _syscall1(int, __uname, struct utsname *, buf); -strong_alias(__uname,uname) +_syscall1(int, uname, struct utsname *, buf); +libc_hidden_proto(uname) +libc_hidden_def(uname) diff --git a/libc/sysdeps/linux/common/unlink.c b/libc/sysdeps/linux/common/unlink.c index 4d9c3cda9..37c145226 100644 --- a/libc/sysdeps/linux/common/unlink.c +++ b/libc/sysdeps/linux/common/unlink.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___unlink __NR_unlink -attribute_hidden _syscall1(int, __unlink, const char *, pathname); -strong_alias(__unlink,unlink) +_syscall1(int, unlink, const char *, pathname); +libc_hidden_proto(unlink) +libc_hidden_def(unlink) diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c index 8087863f7..a01da3697 100644 --- a/libc/sysdeps/linux/common/utime.c +++ b/libc/sysdeps/linux/common/utime.c @@ -7,18 +7,18 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define utimes __utimes -#define gettimeofday __gettimeofday - #include "syscalls.h" #include <utime.h> #ifdef __NR_utime -#define __NR___utime __NR_utime -attribute_hidden _syscall2(int, __utime, const char *, file, const struct utimbuf *, times); +attribute_hidden _syscall2(int, utime, const char *, file, const struct utimbuf *, times); #else #include <stdlib.h> #include <sys/time.h> -int attribute_hidden __utime(const char *file, const struct utimbuf *times) + +libc_hidden_proto(utimes) +libc_hidden_proto(gettimeofday) + +int utime(const char *file, const struct utimbuf *times) { struct timeval timevals[2]; @@ -36,4 +36,5 @@ int attribute_hidden __utime(const char *file, const struct utimbuf *times) return utimes(file, timevals); } #endif -strong_alias(__utime,utime) +libc_hidden_proto(utime) +libc_hidden_def(utime) diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c index ca45204c7..4dfcfb30a 100644 --- a/libc/sysdeps/linux/common/utimes.c +++ b/libc/sysdeps/linux/common/utimes.c @@ -7,17 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define utime __utime - #include "syscalls.h" #include <utime.h> #ifdef __NR_utimes -#define __NR___utimes __NR_utimes -attribute_hidden _syscall2(int, __utimes, const char *, file, const struct timeval *, tvp); +_syscall2(int, utimes, const char *, file, const struct timeval *, tvp); #else #include <stdlib.h> #include <sys/time.h> -int attribute_hidden __utimes(const char *file, const struct timeval tvp[2]) + +libc_hidden_proto(utime) + +int utimes(const char *file, const struct timeval tvp[2]) { struct utimbuf buf, *times; @@ -31,4 +31,5 @@ int attribute_hidden __utimes(const char *file, const struct timeval tvp[2]) return utime(file, times); } #endif -strong_alias(__utimes,utimes) +libc_hidden_proto(utimes) +libc_hidden_def(utimes) diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index d0a4d9a0e..df00b27c3 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -2,10 +2,11 @@ #include <unistd.h> #include <sys/types.h> -extern __pid_t __fork (void) __THROW attribute_hidden; +libc_hidden_proto(fork) -pid_t attribute_hidden __vfork(void) +pid_t vfork(void) { - return __fork(); + return fork(); } -strong_alias(__vfork,vfork) +libc_hidden_proto(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index b2a6d2295..471650e04 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -1,4 +1,8 @@ -#define wait4 __wait4 +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdlib.h> #include <syscall.h> @@ -6,10 +10,12 @@ #include <sys/wait.h> #include <sys/resource.h> +libc_hidden_proto(wait4) + /* Wait for a child to die. When one does, put its status in *STAT_LOC * and return its process ID. For errors, return (pid_t) -1. */ -__pid_t wait (__WAIT_STATUS_DEFN stat_loc) +__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc) { - return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); + return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); } -weak_alias(wait,__libc_wait) +strong_alias(__libc_wait,wait) diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c index 4b4d6aef1..5de975c25 100644 --- a/libc/sysdeps/linux/common/wait3.c +++ b/libc/sysdeps/linux/common/wait3.c @@ -1,10 +1,15 @@ -#define wait4 __wait4 +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <syscall.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/resource.h> +libc_hidden_proto(wait4) /* Wait for a child to exit. When one does, put its status in *STAT_LOC and * return its process ID. For errors return (pid_t) -1. If USAGE is not nil, diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c index b5a2c5933..9acca8ff8 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -14,8 +14,9 @@ static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid, int *, status, int, opts, struct rusage *, rusage); -pid_t attribute_hidden __wait4(pid_t pid, int *status, int opts, struct rusage *rusage) +pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage) { return (__syscall_wait4(pid, status, opts, rusage)); } -strong_alias(__wait4,wait4) +libc_hidden_proto(wait4) +libc_hidden_def(wait4) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index 612917fcf..aeeafc7c5 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -1,4 +1,8 @@ -#define wait4 __wait4 +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <stdlib.h> #include <sys/types.h> @@ -6,9 +10,12 @@ #include <sys/wait.h> #include <sys/resource.h> -__pid_t attribute_hidden __waitpid(__pid_t pid, int *wait_stat, int options) +libc_hidden_proto(wait4) + +__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) { - return __wait4(pid, wait_stat, options, NULL); + return wait4(pid, wait_stat, options, NULL); } -strong_alias(__waitpid,waitpid) -weak_alias(__waitpid,__libc_waitpid) +strong_alias(__libc_waitpid,waitpid) +libc_hidden_proto(waitpid) +libc_hidden_def(waitpid) diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index 8a1d57a82..814e68cc6 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -10,12 +10,13 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___write __NR_write -attribute_hidden _syscall3(ssize_t, __write, int, fd, const __ptr_t, buf, size_t, count); -strong_alias(__write,write) -weak_alias(__write,__libc_write) +#define __NR___libc_write __NR_write +_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count); +strong_alias(__libc_write,write) +libc_hidden_proto(write) +libc_hidden_def(write) #if 0 /* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o * which is a blatent GNU libc-ism... */ -weak_alias(__libc_write, __write) +strong_alias(__libc_write,__write) #endif diff --git a/libc/sysdeps/linux/cris/brk.c b/libc/sysdeps/linux/cris/brk.c index 10965d3b9..8b5aa680c 100644 --- a/libc/sysdeps/linux/cris/brk.c +++ b/libc/sysdeps/linux/cris/brk.c @@ -7,7 +7,7 @@ extern void * __curbrk; extern int __init_brk (void); -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { /* @@ -29,4 +29,5 @@ int attribute_hidden __brk(void * end_data_seg) return -1; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/cris/clone.S b/libc/sysdeps/linux/cris/clone.S index 19ba71996..046073b58 100644 --- a/libc/sysdeps/linux/cris/clone.S +++ b/libc/sysdeps/linux/cris/clone.S @@ -25,7 +25,7 @@ .syntax no_register_prefix .text -ENTRY (__clone) +ENTRY (clone) /* Sanity check arguments: No NULL function pointers. Allow a NULL stack pointer though; it makes the kernel allocate stack. */ test.d r10 @@ -69,7 +69,7 @@ ENTRY (__clone) jsr r0 SETUP_PIC - PLTCALL (_exit_internal) + PLTCALL (HIDDEN_JUMPTARGET(_exit)) /* Die horribly. */ test.d [6809] @@ -83,7 +83,4 @@ ENTRY (__clone) 1: movs.w -EINVAL,r10 /* Drop through into the ordinary error handler. */ -PSEUDO_END (__clone) - -.globl clone - clone = __clone +PSEUDO_END (clone) diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index 4dd8e0269..11b546127 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -8,4 +8,6 @@ SYSCALL__ (__libc_fork, 0) R0&-1==R0, and the child gets R0&0==0. */ /* i dunno what the blurb above is useful for. we just return. */ __asm__("ret\n\tnop"); -weak_alias(__libc_fork, fork) +strong_alias(__libc_fork,fork) +libc_hidden_proto(fork) +libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/cris/sbrk.c b/libc/sysdeps/linux/cris/sbrk.c index 3683435bf..9eb9a2a0e 100644 --- a/libc/sysdeps/linux/cris/sbrk.c +++ b/libc/sysdeps/linux/cris/sbrk.c @@ -9,8 +9,8 @@ extern void * __curbrk; extern int __init_brk (void); -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { void * tmp = __curbrk + increment; @@ -34,4 +34,5 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_proto(sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/cris/setjmp.S b/libc/sysdeps/linux/cris/setjmp.S index a5ea0e2d8..2d959cbed 100644 --- a/libc/sysdeps/linux/cris/setjmp.S +++ b/libc/sysdeps/linux/cris/setjmp.S @@ -65,12 +65,3 @@ weak_extern (__setjmp) weak_extern (_setjmp) weak_extern (setjmp) */ - - - - - - - - - diff --git a/libc/sysdeps/linux/e1/longjmp.c b/libc/sysdeps/linux/e1/longjmp.c index 89d6b76d9..306638937 100644 --- a/libc/sysdeps/linux/e1/longjmp.c +++ b/libc/sysdeps/linux/e1/longjmp.c @@ -40,10 +40,12 @@ void longjmp(jmp_buf state, int value ) #undef _state_ } +libc_hidden_proto(sigprocmask) + void siglongjmp(sigjmp_buf state, int value ) { if( state->__mask_was_saved ) - __sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); + sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL); if(!value) state->__jmpbuf->ReturnValue = 1; diff --git a/libc/sysdeps/linux/frv/brk.c b/libc/sysdeps/linux/frv/brk.c index d6063fc27..443c03b25 100644 --- a/libc/sysdeps/linux/frv/brk.c +++ b/libc/sysdeps/linux/frv/brk.c @@ -9,7 +9,7 @@ extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +20,5 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/frv/clone.S b/libc/sysdeps/linux/frv/clone.S index b714b45b1..eff281499 100644 --- a/libc/sysdeps/linux/frv/clone.S +++ b/libc/sysdeps/linux/frv/clone.S @@ -25,10 +25,10 @@ #include <bits/errno.h> .text - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ -__clone: +clone: /* Sanity check arguments. */ cmp.p gr8, gr0, icc0 cmp gr9, gr0, icc1 @@ -75,11 +75,8 @@ __clone: breakpoints work.*/ mov.p gr17, gr15 - call _exit_internal + call HIDDEN_JUMPTARGET(_exit) /* Should never get here. */ jmpl @(gr0, gr0) - .size __clone,.-__clone - -.weak clone - clone = __clone + .size clone,.-clone diff --git a/libc/sysdeps/linux/frv/fstat.c b/libc/sysdeps/linux/frv/fstat.c index ce6b68e66..bf031bbbc 100644 --- a/libc/sysdeps/linux/frv/fstat.c +++ b/libc/sysdeps/linux/frv/fstat.c @@ -41,5 +41,7 @@ #include <bits/stat.h> #define __NR___syscall_fstat __NR_fstat -_syscall2(int, __syscall_fstat, int, fd, struct stat *, buf); -strong_alias(__syscall_fstat, fstat) +attribute_hidden _syscall2(int, __syscall_fstat, int, fd, struct stat *, buf); +strong_alias(__syscall_fstat,fstat) +libc_hidden_proto(fstat) +libc_hidden_def(fstat) diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c index 27000bf83..744c5915a 100644 --- a/libc/sysdeps/linux/frv/fstat64.c +++ b/libc/sysdeps/linux/frv/fstat64.c @@ -42,6 +42,8 @@ #if defined __UCLIBC_HAS_LFS__ #define __NR___syscall_fstat64 __NR_fstat64 -_syscall2(int, __syscall_fstat64, int, fd, struct stat64 *, buf); -strong_alias(__syscall_fstat64, fstat64) +attribute_hidden _syscall2(int, __syscall_fstat64, int, fd, struct stat64 *, buf); +strong_alias(__syscall_fstat64,fstat64) +libc_hidden_proto(fstat64) +libc_hidden_def(fstat64) #endif diff --git a/libc/sysdeps/linux/frv/lstat.c b/libc/sysdeps/linux/frv/lstat.c index b9f0350c4..63c547c1b 100644 --- a/libc/sysdeps/linux/frv/lstat.c +++ b/libc/sysdeps/linux/frv/lstat.c @@ -41,5 +41,7 @@ #include <bits/stat.h> #define __NR___syscall_lstat __NR_lstat -_syscall2(int, __syscall_lstat, const char *, file_name, struct stat *, buf); -strong_alias(__syscall_lstat, lstat) +attribute_hidden _syscall2(int, __syscall_lstat, const char *, file_name, struct stat *, buf); +strong_alias(__syscall_lstat,lstat) +libc_hidden_proto(lstat) +libc_hidden_def(lstat) diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c index 8f9413a8d..ea8abf892 100644 --- a/libc/sysdeps/linux/frv/lstat64.c +++ b/libc/sysdeps/linux/frv/lstat64.c @@ -42,6 +42,8 @@ #if defined __UCLIBC_HAS_LFS__ #define __NR___syscall_lstat64 __NR_lstat64 -_syscall2(int, __syscall_lstat64, const char *, file_name, struct stat64 *, buf); -strong_alias(__syscall_lstat64, lstat64) +attribute_hidden _syscall2(int, __syscall_lstat64, const char *, file_name, struct stat64 *, buf); +strong_alias(__syscall_lstat64,lstat64) +libc_hidden_proto(lstat64) +libc_hidden_def(lstat64) #endif diff --git a/libc/sysdeps/linux/frv/mmap.c b/libc/sysdeps/linux/frv/mmap.c index fa801bb5f..01dcfb627 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 attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) +__ptr_t 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,4 +46,5 @@ __ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, i } return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); } -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/frv/sbrk.c b/libc/sysdeps/linux/frv/sbrk.c index e9faf7db0..7ccefdf58 100644 --- a/libc/sysdeps/linux/frv/sbrk.c +++ b/libc/sysdeps/linux/frv/sbrk.c @@ -9,8 +9,8 @@ extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr) attribute_hidden; -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,4 +23,5 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_proto(sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/frv/stat.c b/libc/sysdeps/linux/frv/stat.c index 4a54b130f..0d531e998 100644 --- a/libc/sysdeps/linux/frv/stat.c +++ b/libc/sysdeps/linux/frv/stat.c @@ -41,5 +41,7 @@ #include <bits/stat.h> #define __NR___syscall_stat __NR_stat -_syscall2(int, __syscall_stat, const char *, file_name, struct stat *, buf); -strong_alias(__syscall_stat, stat) +attribute_hidden _syscall2(int, __syscall_stat, const char *, file_name, struct stat *, buf); +strong_alias(__syscall_stat,stat) +libc_hidden_proto(stat) +libc_hidden_def(stat) diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c index ecfe808cc..3c702d885 100644 --- a/libc/sysdeps/linux/frv/stat64.c +++ b/libc/sysdeps/linux/frv/stat64.c @@ -42,6 +42,8 @@ #if defined __UCLIBC_HAS_LFS__ #define __NR___syscall_stat64 __NR_stat64 -_syscall2(int, __syscall_stat64, const char *, file_name, struct stat64 *, buf); -strong_alias(__syscall_stat64, stat64) +attribute_hidden _syscall2(int, __syscall_stat64, const char *, file_name, struct stat64 *, buf); +strong_alias(__syscall_stat64,stat64) +libc_hidden_proto(stat64) +libc_hidden_def(stat64) #endif diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index b5ecc09af..9a70e22ac 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -24,11 +24,10 @@ #include <bits/errno.h> .text - .globl __vfork - .hidden __vfork - .type __vfork,@function + .globl vfork + .type vfork,@function /* int vfork(void) */ -__vfork: +vfork: setlos.p #__NR_vfork, gr7 setlos #-4096, gr4 tra gr0, gr0 @@ -41,6 +40,6 @@ __vfork: ldd @(gr14, gr15), gr14 jmpl @(gr14, gr0) - .size __vfork,.-__vfork + .size vfork,.-vfork -strong_alias(__vfork,vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/h8300/brk.c b/libc/sysdeps/linux/h8300/brk.c index d69f9a2d3..0bba5de99 100644 --- a/libc/sysdeps/linux/h8300/brk.c +++ b/libc/sysdeps/linux/h8300/brk.c @@ -9,7 +9,7 @@ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -31,4 +31,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/h8300/clone.S b/libc/sysdeps/linux/h8300/clone.S index 7d100b6c4..554a29703 100644 --- a/libc/sysdeps/linux/h8300/clone.S +++ b/libc/sysdeps/linux/h8300/clone.S @@ -19,9 +19,7 @@ .text .globl _clone -.globl ___clone _clone: -___clone: /* Sanity check arguments. */ mov.l #-EINVAL,er3 mov.l er0,er0 /* no NULL function pointers */ @@ -68,11 +66,3 @@ thread_start: mov.l er0,er1 mov.l #__NR_exit,er0 trapa #0 - -#if defined(__HAVE_ELF__) - .weak clone - clone = __clone -#else - .set clone,__clone -#endif - diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S index e101bf5ed..94e946912 100644 --- a/libc/sysdeps/linux/h8300/vfork.S +++ b/libc/sysdeps/linux/h8300/vfork.S @@ -38,3 +38,4 @@ fix_errno: dec.l #1,er0 jmp @er1 /* don't return, just jmp directly */ +libc_hidden_def(_vork) diff --git a/libc/sysdeps/linux/hppa/__longjmp.S b/libc/sysdeps/linux/hppa/__longjmp.S index 62026635f..750863e95 100644 --- a/libc/sysdeps/linux/hppa/__longjmp.S +++ b/libc/sysdeps/linux/hppa/__longjmp.S @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #define _SETJMP_H #define _ASM #include <bits/setjmp.h> @@ -69,3 +70,5 @@ __longjmp: bv,n %r0(%r2) .procend + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index f50360aa5..0ac8236c8 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -23,8 +23,8 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int attribute_hidden -__brk (void *addr) +int +brk (void *addr) { void *newbrk; @@ -38,4 +38,5 @@ __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/hppa/clone.S b/libc/sysdeps/linux/hppa/clone.S index 8395cdada..f6e5568d0 100644 --- a/libc/sysdeps/linux/hppa/clone.S +++ b/libc/sysdeps/linux/hppa/clone.S @@ -29,9 +29,9 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text -.global __clone -.type __clone,%function -__clone: +.global clone +.type clone,%function +clone: /* FIXME: I have no idea how profiling works on hppa. */ /* Sanity check arguments. */ @@ -90,13 +90,10 @@ thread_start: bl $$dyncall,%r31 copy %r31,%rp - bl _exit_internal,%rp + bl HIDDEN_JUMPTARGET(_exit),%rp copy %ret0,%arg0 /* Die horribly. */ iitlbp %r0,(%r0) -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/hppa/mmap.c b/libc/sysdeps/linux/hppa/mmap.c index f14f1b6f9..b69f0a2f2 100644 --- a/libc/sysdeps/linux/hppa/mmap.c +++ b/libc/sysdeps/linux/hppa/mmap.c @@ -13,7 +13,7 @@ #include <sys/mman.h> #include <sys/syscall.h> -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot, +_syscall6(void *, mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/i386/__longjmp.S b/libc/sysdeps/linux/i386/__longjmp.S index 52f53bb68..d73a7cda2 100644 --- a/libc/sysdeps/linux/i386/__longjmp.S +++ b/libc/sysdeps/linux/i386/__longjmp.S @@ -17,6 +17,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -38,3 +39,5 @@ __longjmp: /* Jump to saved PC. */ jmp *%edx .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 5790e2fca..cf7e19be8 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -25,7 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *__unbounded newbrk, *__unbounded scratch; @@ -46,4 +46,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S index 35a4e5b7f..14fc25ca1 100644 --- a/libc/sysdeps/linux/i386/clone.S +++ b/libc/sysdeps/linux/i386/clone.S @@ -42,9 +42,9 @@ #define CTID TLS+PTR_SIZE .text -.global __clone -.type __clone,%function -__clone: +.global clone +.type clone,%function +clone: /* Sanity check arguments. */ movl $-EINVAL,%eax @@ -120,7 +120,4 @@ __clone: __error: jmp __syscall_error -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/i386/mmap.S b/libc/sysdeps/linux/i386/mmap.S index 4c4723dff..fe7a7986c 100644 --- a/libc/sysdeps/linux/i386/mmap.S +++ b/libc/sysdeps/linux/i386/mmap.S @@ -21,13 +21,10 @@ #include <bits/errno.h> #include <sys/syscall.h> -.global mmap -.set mmap,__mmap .text -.global __mmap -.hidden __mmap -.type __mmap,%function -__mmap: +.global mmap +.type mmap,%function +mmap: /* Save registers. */ movl %ebx, %edx @@ -49,4 +46,6 @@ __mmap: /* Successful; return the syscall's value. */ ret -.size __mmap,.-__mmap +.size mmap,.-mmap + +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c index 335fc9a27..e3162ab46 100644 --- a/libc/sysdeps/linux/i386/sigaction.c +++ b/libc/sysdeps/linux/i386/sigaction.c @@ -29,6 +29,8 @@ #if defined __NR_rt_sigaction +libc_hidden_proto(memcpy) + extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; extern void restore (void) asm ("__restore") attribute_hidden; @@ -48,7 +50,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; kact.sa_flags = act->sa_flags | SA_RESTORER; @@ -63,7 +65,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } @@ -121,8 +123,9 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) -weak_alias(__libc_sigaction,sigaction) +strong_alias(__libc_sigaction,sigaction) +libc_hidden_proto(sigaction) +libc_hidden_def(sigaction) #endif diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index 18a8e5dfa..1f0e9d8ab 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -9,18 +9,17 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) +strong_alias(fork,vfork) +strong_alias(vfork,__libc_fork) #else .text -.global __vfork -.hidden __vfork -.type __vfork,%function +.global vfork +.type vfork,%function .align 1<<4 -__vfork: +vfork: popl %ecx movl $__NR_vfork,%eax int $0x80 @@ -29,6 +28,6 @@ __vfork: jae __syscall_error ret -.size __vfork,.-__vfork +.size vfork,.-vfork #endif -strong_alias(__vfork,vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/m68k/__longjmp.S b/libc/sysdeps/linux/m68k/__longjmp.S index d218f2ef5..81079f48c 100644 --- a/libc/sysdeps/linux/m68k/__longjmp.S +++ b/libc/sysdeps/linux/m68k/__longjmp.S @@ -22,3 +22,4 @@ __longjmp: movel %a0@(JB_PC), %sp@ rts +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c index 4c33549cc..5204c7493 100644 --- a/libc/sysdeps/linux/m68k/brk.c +++ b/libc/sysdeps/linux/m68k/brk.c @@ -7,7 +7,7 @@ /* This must be initialized data because commons can't have aliases. */ void * __curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -28,4 +28,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/m68k/clone.S b/libc/sysdeps/linux/m68k/clone.S index 916488146..1c4176c3f 100644 --- a/libc/sysdeps/linux/m68k/clone.S +++ b/libc/sysdeps/linux/m68k/clone.S @@ -13,9 +13,9 @@ .text .align 4 -.type __clone,@function -.globl __clone; -__clone: +.type clone,@function +.globl clone; +clone: /* Sanity check arguments. */ movel #-EINVAL, %d0 movel 4(%sp), %d1 /* no NULL function pointers */ @@ -73,10 +73,3 @@ thread_start: movel #__NR_exit, %d0 trap #0 /*jsr exit*/ - -#if defined(__HAVE_ELF__) - .weak clone - clone = __clone -#else - .set clone,__clone -#endif diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index e58b9e949..d5e26ddd2 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -11,13 +11,12 @@ .text .align 2 .globl errno - .globl __vfork + .globl vfork #ifdef __HAVE_ELF__ - .hidden __vfork - .type __vfork,@function + .type vfork,@function #endif -__vfork: +vfork: movl %sp@+, %a1 /* save the return address for later */ movl IMM __NR_vfork,%d0 trap #0 @@ -36,5 +35,5 @@ fix_errno: movl IMM -1, %d0 jmp %a1@ /* don't return, just jmp directly */ -.size __vfork,.-__vfork -strong_alias(__vfork,vfork) +.size vfork,.-vfork +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/microblaze/__longjmp.S b/libc/sysdeps/linux/microblaze/__longjmp.S index e87a6f6a3..a58418ae9 100644 --- a/libc/sysdeps/linux/microblaze/__longjmp.S +++ b/libc/sysdeps/linux/microblaze/__longjmp.S @@ -45,3 +45,5 @@ C_END(__longjmp) .weak C_SYMBOL_NAME(__sigprocmask) C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/microblaze/longjmp.S b/libc/sysdeps/linux/microblaze/longjmp.S index 2d9adebe5..1d0b9b2b6 100644 --- a/libc/sysdeps/linux/microblaze/longjmp.S +++ b/libc/sysdeps/linux/microblaze/longjmp.S @@ -51,3 +51,5 @@ C_SYMBOL_NAME(siglongjmp) = C_SYMBOL_NAME(__longjmp) .weak C_SYMBOL_NAME(__sigprocmask) C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/microblaze/mmap.c b/libc/sysdeps/linux/microblaze/mmap.c index fbfcca3a8..592161789 100644 --- a/libc/sysdeps/linux/microblaze/mmap.c +++ b/libc/sysdeps/linux/microblaze/mmap.c @@ -7,3 +7,5 @@ _syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index e264d36f9..b641fedf1 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -27,7 +27,7 @@ .global C_SYMBOL_NAME(errno) -C_ENTRY (__vfork): +C_ENTRY (vfork): addi r12, r0, SYS_vfork bralid r17, 0x08; nop @@ -39,7 +39,6 @@ C_ENTRY (__vfork): swi r3, r0, C_SYMBOL_NAME(errno); rtsd r15, 8 // error return nop -C_END(__vfork) +C_END(vfork) -.weak C_SYMBOL_NAME(vfork) -C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/mips/__longjmp.c b/libc/sysdeps/linux/mips/__longjmp.c index 5be2e974b..fb042218b 100644 --- a/libc/sysdeps/linux/mips/__longjmp.c +++ b/libc/sysdeps/linux/mips/__longjmp.c @@ -82,3 +82,5 @@ void __longjmp (__jmp_buf env, int val_arg) /* Avoid `volatile function does return' warnings. */ for (;;); } +libc_hidden_proto(__longjmp) +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/mips/brk.c b/libc/sysdeps/linux/mips/brk.c index ba6765ca7..29479f621 100644 --- a/libc/sysdeps/linux/mips/brk.c +++ b/libc/sysdeps/linux/mips/brk.c @@ -23,7 +23,7 @@ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -48,4 +48,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/mips/clone.S b/libc/sysdeps/linux/mips/clone.S index 9c12075b3..f3b3aadb2 100644 --- a/libc/sysdeps/linux/mips/clone.S +++ b/libc/sysdeps/linux/mips/clone.S @@ -29,12 +29,12 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text -.globl __clone ; +.globl clone ; .align 2; - .type __clone,@function; - .ent __clone, 0; + .type clone,@function; + .ent clone, 0; -__clone: +clone: .frame sp, 4*SZREG, sp #ifdef __PIC__ .set noreorder @@ -106,8 +106,5 @@ __thread_start: /* Call _exit rather than doing it inline for breakpoint purposes. */ move a0,v0 - jal _exit_internal + jal HIDDEN_JUMPTARGET(_exit) .end __thread_start - -.weak clone; - clone = __clone diff --git a/libc/sysdeps/linux/mips/mmap.c b/libc/sysdeps/linux/mips/mmap.c index 25a3ef5bd..125523eef 100644 --- a/libc/sysdeps/linux/mips/mmap.c +++ b/libc/sysdeps/linux/mips/mmap.c @@ -14,7 +14,7 @@ #endif #endif -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6 (__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot, +_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/mips/pipe.S b/libc/sysdeps/linux/mips/pipe.S index fb8f7ef7f..b5664f791 100644 --- a/libc/sysdeps/linux/mips/pipe.S +++ b/libc/sysdeps/linux/mips/pipe.S @@ -8,10 +8,8 @@ #include <asm/regdef.h> .globl pipe - .globl __pipe - .hidden __pipe - .ent __pipe, 0 -__pipe: + .ent pipe, 0 +pipe: addiu sp,sp,-24 sw a0,16(sp) li v0,__NR_pipe @@ -29,6 +27,5 @@ __pipe: 2: addiu sp,sp,24 j ra - .end __pipe - .size __pipe,.-__pipe - .weak pipe; pipe = __pipe + .end pipe + .size pipe,.-pipe diff --git a/libc/sysdeps/linux/mips/pipe.c b/libc/sysdeps/linux/mips/pipe.c index fbc73b489..65e335964 100644 --- a/libc/sysdeps/linux/mips/pipe.c +++ b/libc/sysdeps/linux/mips/pipe.c @@ -6,7 +6,7 @@ #include <unistd.h> #include <syscall.h> -int attribute_hidden __pipe(int *fd) +int pipe(int *fd) { register long int res __asm__ ("$2"); // v0 register long int res2 __asm__ ("$3"); // v1 @@ -21,4 +21,3 @@ int attribute_hidden __pipe(int *fd) fd[1] = res2; return(0); } -strong_alias(__pipe,pipe) diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c index 5baba30d2..4ee81d4d9 100644 --- a/libc/sysdeps/linux/mips/pread_write.c +++ b/libc/sysdeps/linux/mips/pread_write.c @@ -60,7 +60,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset))); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) @@ -69,7 +69,7 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* !__mips64 */ @@ -97,7 +97,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset))); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) @@ -106,7 +106,7 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* !__mips64 */ #endif /* __NR_pwrite */ diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c index b2982678b..5e2d6ccde 100644 --- a/libc/sysdeps/linux/mips/sigaction.c +++ b/libc/sysdeps/linux/mips/sigaction.c @@ -30,6 +30,8 @@ #if defined __NR_rt_sigaction +libc_hidden_proto(memcpy) + /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) @@ -39,7 +41,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER # if _MIPS_SIM == _ABIO32 @@ -57,7 +59,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER oact->sa_restorer = koact.sa_restorer; @@ -112,6 +114,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) -weak_alias(__libc_sigaction,sigaction) +strong_alias(__libc_sigaction,sigaction) +libc_hidden_proto(sigaction) +libc_hidden_def(sigaction) #endif diff --git a/libc/sysdeps/linux/nios/__longjmp.S b/libc/sysdeps/linux/nios/__longjmp.S index 1b4fa6a56..d7d1cdd86 100644 --- a/libc/sysdeps/linux/nios/__longjmp.S +++ b/libc/sysdeps/linux/nios/__longjmp.S @@ -100,10 +100,4 @@ __longjmp_done: jmp %o7 ; and kinda return there. mov %o0,%g1 ; (delay slot) return value - - - - - - - +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/nios/brk.c b/libc/sysdeps/linux/nios/brk.c index 2e785b734..9c9f2d80f 100644 --- a/libc/sysdeps/linux/nios/brk.c +++ b/libc/sysdeps/linux/nios/brk.c @@ -25,7 +25,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; register int g1 asm("%g1") = __NR_brk; @@ -42,4 +42,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/nios/clone.S b/libc/sysdeps/linux/nios/clone.S index c4799c5b2..39eb54035 100644 --- a/libc/sysdeps/linux/nios/clone.S +++ b/libc/sysdeps/linux/nios/clone.S @@ -28,10 +28,10 @@ .text .align 2 - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function -__clone: +clone: save %sp,-16 MOVIP %l0, -EINVAL @@ -74,7 +74,7 @@ CLONE_ERROR_LABEL: ret restore - .size __clone, .-__clone + .size clone, .-clone .type __thread_start,@function @@ -86,6 +86,3 @@ __thread_start: nop .size __thread_start, .-__thread_start - -.weak clone - clone = __clone diff --git a/libc/sysdeps/linux/nios/vfork.S b/libc/sysdeps/linux/nios/vfork.S index cf95c5a34..3ac3da9b3 100644 --- a/libc/sysdeps/linux/nios/vfork.S +++ b/libc/sysdeps/linux/nios/vfork.S @@ -22,11 +22,11 @@ .text .align 2 - .globl __vfork + .globl vfork #if defined __HAVE_ELF__ - .type __vfork,@function + .type vfork,@function #endif -__vfork: +vfork: MOVIP %g1, __NR_vfork trap 63 @@ -50,5 +50,5 @@ fix_errno: ret restore -.size __vfork,.-__vfork -strong_alias(__vfork,vfork) +.size vfork,.-vfork +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/nios2/__longjmp.S b/libc/sysdeps/linux/nios2/__longjmp.S index 96eeaadc0..4b6508e5d 100644 --- a/libc/sysdeps/linux/nios2/__longjmp.S +++ b/libc/sysdeps/linux/nios2/__longjmp.S @@ -47,3 +47,4 @@ __longjmp: ret .size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/nios2/brk.c b/libc/sysdeps/linux/nios2/brk.c index e5a4c5d07..921cd771b 100644 --- a/libc/sysdeps/linux/nios2/brk.c +++ b/libc/sysdeps/linux/nios2/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; register int r2 asm("r2") = TRAP_ID_SYSCALL; @@ -44,4 +44,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S index ba514c40b..4afcb7d75 100644 --- a/libc/sysdeps/linux/nios2/clone.S +++ b/libc/sysdeps/linux/nios2/clone.S @@ -18,10 +18,10 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: addi sp,sp,-8 mov r8,r4 stw ra,4(sp) @@ -65,9 +65,6 @@ CLONE_OK: addi sp,sp,8 ret -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone #endif diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S index fa7ff9916..f8b3179d0 100644 --- a/libc/sysdeps/linux/nios2/vfork.S +++ b/libc/sysdeps/linux/nios2/vfork.S @@ -18,11 +18,10 @@ #ifdef __NR_fork .text -.global __vfork -.hidden __vfork -.type __vfork,%function +.global vfork +.type vfork,%function .align 4 -__vfork: +vfork: movui r2, TRAP_ID_SYSCALL movui r3, __NR_vfork trap @@ -48,6 +47,6 @@ fix_errno: addi sp, sp, 8 ret -.size __vfork,.-__vfork -strong_alias(__vfork,vfork) +.size vfork,.-vfork +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/powerpc/__longjmp.S b/libc/sysdeps/linux/powerpc/__longjmp.S index 874354e5a..83f094c15 100644 --- a/libc/sysdeps/linux/powerpc/__longjmp.S +++ b/libc/sysdeps/linux/powerpc/__longjmp.S @@ -80,3 +80,5 @@ FP( lfd fp31,((JB_FPRS+17*2)*4)(r3)) mr r3,r4 blr .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S index b718c0de4..bf42784cb 100644 --- a/libc/sysdeps/linux/powerpc/brk.S +++ b/libc/sysdeps/linux/powerpc/brk.S @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include "ppc_asm.h" #define _ERRNO_H 1 #include <bits/errno.h> @@ -25,12 +26,11 @@ #ifdef __NR_brk .comm __curbrk,4,4 .text - .globl __brk - .hidden __brk - .type __brk,@function + .globl brk + .type brk,@function .align 2 -__brk: +brk: stwu r1,-16(r1) stw r3,8(r1) li 0, __NR_brk; @@ -55,8 +55,7 @@ __brk: b __syscall_error - .size __brk,.-__brk + .size brk,.-brk - .weak brk - brk=__brk +libc_hidden_def(brk) #endif diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S index 9e8a1ca53..b5b4d17a2 100644 --- a/libc/sysdeps/linux/powerpc/clone.S +++ b/libc/sysdeps/linux/powerpc/clone.S @@ -30,11 +30,11 @@ int flags [r5], void *arg [r6]); */ #ifdef __NR_clone - .globl __clone - .type __clone,@function + .globl clone + .type clone,@function .align 2 -__clone: +clone: /* Check for child_stack == NULL || fn == NULL. */ cmpwi cr0,r4,0 cmpwi cr1,r3,0 @@ -78,7 +78,7 @@ __clone: mr r3,r31 bctrl /* Call _exit with result from procedure. */ - b _exit_internal + b HIDDEN_JUMPTARGET(_exit) .Lparent: /* Parent. Restore registers & return. */ @@ -93,7 +93,5 @@ __clone: b __syscall_error - .size __clone,.-__clone - .weak clone - clone=__clone + .size clone,.-clone #endif diff --git a/libc/sysdeps/linux/powerpc/ioctl.c b/libc/sysdeps/linux/powerpc/ioctl.c index bb8842bb6..211bb3b25 100644 --- a/libc/sysdeps/linux/powerpc/ioctl.c +++ b/libc/sysdeps/linux/powerpc/ioctl.c @@ -16,15 +16,15 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define tcsetattr __tcsetattr -#define tcgetattr __tcgetattr - #include <stdarg.h> #include <termios.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/syscall.h> +libc_hidden_proto(tcsetattr) +libc_hidden_proto(tcgetattr) + /* The user-visible size of struct termios has changed. Catch ioctl calls using the new-style struct termios, and translate them to old-style. */ @@ -33,7 +33,7 @@ static inline _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg); -int attribute_hidden __ioctl (int fd, unsigned long int request, ...) +int ioctl (int fd, unsigned long int request, ...) { void *arg; va_list ap; @@ -69,4 +69,5 @@ int attribute_hidden __ioctl (int fd, unsigned long int request, ...) return result; } -strong_alias(__ioctl,ioctl) +libc_hidden_proto(ioctl) +libc_hidden_def(ioctl) diff --git a/libc/sysdeps/linux/powerpc/mmap.c b/libc/sysdeps/linux/powerpc/mmap.c index cac08ba65..8003c8bbc 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 attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, int fd, +void * mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { unsigned long __sc_ret, __sc_err; @@ -45,4 +45,5 @@ void attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, __syscall_return (void *); } -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c index 8115d4d01..1cf7f690b 100644 --- a/libc/sysdeps/linux/powerpc/pread_write.c +++ b/libc/sysdeps/linux/powerpc/pread_write.c @@ -33,7 +33,6 @@ # undef __USE_FILE_OFFSET64 #endif - #include <errno.h> #include <sys/types.h> #include <sys/syscall.h> @@ -52,14 +51,14 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd, buf, count, (off64_t)offset)); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__syscall_pread(fd, buf, count, offset)); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ @@ -73,20 +72,25 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd, buf, count, (off64_t)offset)); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__syscall_pwrite(fd, buf, count, offset)); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ #if ! defined __NR_pread || ! defined __NR_pwrite +libc_hidden_proto(lseek) +libc_hidden_proto(lseek64) +libc_hidden_proto(read) +libc_hidden_proto(write) + static ssize_t __fake_pread_write(int fd, void *buf, size_t count, off_t offset, int do_pwrite) { @@ -96,11 +100,11 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek(fd, 0, SEEK_CUR)) == (off_t) -1) + if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) return -1; /* Set to wanted position. */ - if (__lseek (fd, offset, SEEK_SET) == (off_t) -1) + if (lseek (fd, offset, SEEK_SET) == (off_t) -1) return -1; if (do_pwrite==1) { @@ -114,7 +118,7 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* Now we have to restore the position. If this fails we * have to return this as an error. */ save_errno = errno; - if (__lseek(fd, old_offset, SEEK_SET) == (off_t) -1) + if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) { if (result == -1) __set_errno(save_errno); @@ -134,11 +138,11 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Since we must not change the file pointer preserve the * value so that we can restore it later. */ - if ((old_offset=__lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) + if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) return -1; /* Set to wanted position. */ - if (__lseek64(fd, offset, SEEK_SET) == (off64_t) -1) + if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) return -1; if (do_pwrite==1) { @@ -151,7 +155,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Now we have to restore the position. */ save_errno = errno; - if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { + if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { if (result == -1) __set_errno (save_errno); return -1; @@ -167,14 +171,14 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, buf, count, offset, 0)); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pread */ @@ -184,14 +188,13 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__fake_pread_write(fd, buf, count, offset, 1)); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) { return(__fake_pread_write64(fd, (void*)buf, count, offset, 1)); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pwrite */ - diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 7cf5eaa16..5b4bcc069 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -4,23 +4,22 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) +strong_alias(fork,vfork) +strong_alias(vfork,__libc_fork) #else .text -.global __vfork -.hidden __vfork -.type __vfork,@function +.global vfork +.type vfork,@function .type __syscall_error,@function -__vfork: +vfork: li 0, __NR_vfork sc bnslr+ b __syscall_error -.size __vfork,.-__vfork +.size vfork,.-vfork #endif -strong_alias(__vfork,vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.c b/libc/sysdeps/linux/powerpc/vfork.c index 39f992513..92e9f8d63 100644 --- a/libc/sysdeps/linux/powerpc/vfork.c +++ b/libc/sysdeps/linux/powerpc/vfork.c @@ -9,7 +9,7 @@ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret -pid_t attribute_hidden __vfork(void) +pid_t vfork(void) { unsigned long __sc_ret, __sc_err; register unsigned long __sc_0 __asm__ ("r0"); @@ -46,4 +46,5 @@ pid_t attribute_hidden __vfork(void) __syscall_return (pid_t); } -strong_alias(__vfork,vfork) +libc_hidden_proto(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/sh/__longjmp.S b/libc/sysdeps/linux/sh/__longjmp.S index 9e310a283..a9a7cba8a 100644 --- a/libc/sysdeps/linux/sh/__longjmp.S +++ b/libc/sysdeps/linux/sh/__longjmp.S @@ -61,7 +61,8 @@ __longjmp: rts ldc.l @r4+, gbr #endif -.size __longjmp,.-__longjmp; +.size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) .weak __sigprocmask __sigprocmask = sigprocmask diff --git a/libc/sysdeps/linux/sh/brk.c b/libc/sysdeps/linux/sh/brk.c index d6063fc27..443c03b25 100644 --- a/libc/sysdeps/linux/sh/brk.c +++ b/libc/sysdeps/linux/sh/brk.c @@ -9,7 +9,7 @@ extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +20,5 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S index 7824d4771..80c623b81 100644 --- a/libc/sysdeps/linux/sh/clone.S +++ b/libc/sysdeps/linux/sh/clone.S @@ -38,9 +38,9 @@ .text .align 4 -.type __clone,@function -.globl __clone; -__clone: +.type clone,@function +.globl clone; +clone: /* sanity check arguments. */ tst r4, r4 bt 0f @@ -118,10 +118,7 @@ __clone: #endif .align 2 .L1: - .long PLTJMP(_exit_internal) -.size __clone,.-__clone; - -.globl clone; - clone = __clone + .long PLTJMP( HIDDEN_JUMPTARGET(_exit)) +.size clone,.-clone; #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c index ee3afcd74..7c729564a 100644 --- a/libc/sysdeps/linux/sh/longjmp.c +++ b/libc/sysdeps/linux/sh/longjmp.c @@ -25,6 +25,7 @@ #include <signal.h> extern int __longjmp(char *env, int val); +libc_hidden_proto(__longjmp) /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp diff --git a/libc/sysdeps/linux/sh/mmap.c b/libc/sysdeps/linux/sh/mmap.c index 5424942b6..cefc532a2 100644 --- a/libc/sysdeps/linux/sh/mmap.c +++ b/libc/sysdeps/linux/sh/mmap.c @@ -31,6 +31,6 @@ #include <sys/syscall.h> -#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) +_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/sh/pipe.c b/libc/sysdeps/linux/sh/pipe.c index a15034599..bfa54b7c9 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 attribute_hidden __pipe(int *fd) +int pipe(int *fd) { long __res, __res2; __asm__ __volatile__ ( @@ -27,4 +27,3 @@ int attribute_hidden __pipe(int *fd) fd[1] = __res2; return(0); } -strong_alias(__pipe,pipe) diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c index 55b234855..23454e035 100644 --- a/libc/sysdeps/linux/sh/pread_write.c +++ b/libc/sysdeps/linux/sh/pread_write.c @@ -58,7 +58,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset))); } -weak_alias (__libc_pread, pread) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) @@ -67,7 +67,7 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ @@ -91,7 +91,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) { return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset))); } -weak_alias (__libc_pwrite, pwrite) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) @@ -100,7 +100,7 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ diff --git a/libc/sysdeps/linux/sh/sbrk.c b/libc/sysdeps/linux/sh/sbrk.c index e9faf7db0..7ccefdf58 100644 --- a/libc/sysdeps/linux/sh/sbrk.c +++ b/libc/sysdeps/linux/sh/sbrk.c @@ -9,8 +9,8 @@ extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr) attribute_hidden; -void attribute_hidden * -__sbrk(intptr_t increment) +void * +sbrk(intptr_t increment) { if (__init_brk () == 0) { @@ -23,4 +23,5 @@ __sbrk(intptr_t increment) } return ((void *) -1); } -strong_alias(__sbrk,sbrk) +libc_hidden_proto(sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index f3c20a9d6..5c6a356e6 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -32,12 +32,11 @@ and the process ID of the new process to the old process. */ .text -.globl __vfork -.hidden __vfork -.type __vfork,@function +.globl vfork +.type vfork,@function .align 4 -__vfork: +vfork: mov.w .L2, r3 trapa #0x10 mov r0, r1 @@ -107,8 +106,7 @@ __vfork: .L3: .word __NR_fork -.size __vfork, .-__vfork -strong_alias(__vfork,vfork) +.size vfork, .-vfork +libc_hidden_def(vfork) #include "syscall_error.S" - diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c index d6063fc27..443c03b25 100644 --- a/libc/sysdeps/linux/sh64/brk.c +++ b/libc/sysdeps/linux/sh64/brk.c @@ -9,7 +9,7 @@ extern void * __curbrk; extern int __init_brk (void); extern void *_brk(void *ptr) attribute_hidden; -int attribute_hidden __brk(void * end_data_seg) +int brk(void * end_data_seg) { if (__init_brk () == 0) { @@ -20,4 +20,5 @@ int attribute_hidden __brk(void * end_data_seg) } return -1; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sparc/__longjmp.S b/libc/sysdeps/linux/sparc/__longjmp.S index 06828e61e..fa60264ef 100644 --- a/libc/sysdeps/linux/sparc/__longjmp.S +++ b/libc/sysdeps/linux/sparc/__longjmp.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include <sys/syscall.h> #define _ASM 1 @@ -83,3 +84,5 @@ __longjmp: mov %g2, %o0 /* Delay slot: set return value. */ .size __longjmp,.-__longjmp + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/sparc/brk.c b/libc/sysdeps/linux/sparc/brk.c index 9e178e34f..21464f740 100644 --- a/libc/sysdeps/linux/sparc/brk.c +++ b/libc/sysdeps/linux/sparc/brk.c @@ -26,7 +26,7 @@ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *newbrk; @@ -47,4 +47,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S index e9e6b17dd..0e41ee0cb 100644 --- a/libc/sysdeps/linux/sparc/clone.S +++ b/libc/sysdeps/linux/sparc/clone.S @@ -20,16 +20,17 @@ /* clone() is even more special than fork() as it mucks with stacks and invokes a function in the right context after its all over. */ +#include <features.h> #include <asm/unistd.h> /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: save %sp,-96,%sp /* sanity check arguments */ @@ -52,17 +53,14 @@ __clone: __error: jmp __syscall_error -.size __clone,.-__clone +.size clone,.-clone .type __thread_start,%function __thread_start: call %i0 mov %i3,%o0 - call _exit_internal,0 + call HIDDEN_JUMPTARGET(_exit),0 nop .size __thread_start,.-__thread_start - -.weak clone - clone = __clone diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index dfa109dcd..f726e5aef 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -23,12 +23,11 @@ #include <sys/syscall.h> .text -.global __fork -.hidden __fork -.type __fork,%function +.global fork +.type fork,%function .align 4 -__fork: +fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -45,6 +44,6 @@ __fork: retl and %o0, %o1, %o0 -.size __fork,.-__fork -strong_alias(__fork,fork) -weak_alias(fork,__libc_fork) +.size fork,.-fork +libc_hidden_def(fork) +strong_alias(fork,__libc_fork) diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index ad6b97e96..b509f65a4 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -25,18 +25,17 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) +strong_alias(fork,vfork) +strong_alias(vfork,__libc_fork) #else .text -.global __vfork -.hidden __vfork -.type __vfork,%function +.global vfork +.type vfork,%function .align 4 -__vfork: +vfork: mov __NR_vfork, %g1 ta 0x10 bcc,a 9000f @@ -53,6 +52,6 @@ __vfork: retl and %o0, %o1, %o0 -.size __vfork,.-__vfork +.size vfork,.-vfork #endif /* __NR_vfork */ -strong_alias(__vfork,vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/v850/__longjmp.S b/libc/sysdeps/linux/v850/__longjmp.S index f91086189..98d99bc1e 100644 --- a/libc/sysdeps/linux/v850/__longjmp.S +++ b/libc/sysdeps/linux/v850/__longjmp.S @@ -11,6 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ +#include <features.h> #define _SETJMP_H #define _ASM #include <bits/setjmp.h> @@ -40,3 +41,4 @@ C_END(__longjmp) .weak C_SYMBOL_NAME(__sigprocmask) C_SYMBOL_NAME(__sigprocmask) = C_SYMBOL_NAME(sigprocmask) +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/v850/mmap.c b/libc/sysdeps/linux/v850/mmap.c index a9cb0bcab..f075ac77c 100644 --- a/libc/sysdeps/linux/v850/mmap.c +++ b/libc/sysdeps/linux/v850/mmap.c @@ -7,3 +7,5 @@ _syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset); +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/v850/vfork.S b/libc/sysdeps/linux/v850/vfork.S index e5058a49a..ace1bd16b 100644 --- a/libc/sysdeps/linux/v850/vfork.S +++ b/libc/sysdeps/linux/v850/vfork.S @@ -11,6 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ +#include <features.h> #define _ERRNO_H 1 #include <bits/errno.h> #define _SYSCALL_H @@ -25,7 +26,7 @@ .global C_SYMBOL_NAME(errno) -C_ENTRY (__vfork): +C_ENTRY (vfork): addi SYS_vfork, r0, r12 trap 0 addi -125, r0, r11 // minimum err value @@ -36,7 +37,6 @@ C_ENTRY (__vfork): subr r0, r10 st.w r10, 0[r11] jmp [lp] // error return -C_END(__vfork) +C_END(vfork) -.weak C_SYMBOL_NAME(vfork) -C_SYMBOL_NAME(vfork) = C_SYMBOL_NAME(__vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/x86_64/__longjmp.S b/libc/sysdeps/linux/x86_64/__longjmp.S index aa47b7233..1ff6e0169 100644 --- a/libc/sysdeps/linux/x86_64/__longjmp.S +++ b/libc/sysdeps/linux/x86_64/__longjmp.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #define _ASM #define _SETJMP_H #include <bits/setjmp.h> @@ -43,3 +44,4 @@ __longjmp: movq (JB_RSP*8)(%rdi),%rsp jmpq *%rdx .size __longjmp,.-__longjmp +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/x86_64/brk.c b/libc/sysdeps/linux/x86_64/brk.c index a00e2361e..8d85bcb3d 100644 --- a/libc/sysdeps/linux/x86_64/brk.c +++ b/libc/sysdeps/linux/x86_64/brk.c @@ -24,7 +24,7 @@ /* This must be initialized data because commons can't have aliases. */ void *__curbrk = 0; -int attribute_hidden __brk (void *addr) +int brk (void *addr) { void *__unbounded newbrk; @@ -42,4 +42,5 @@ int attribute_hidden __brk (void *addr) return 0; } -strong_alias(__brk,brk) +libc_hidden_proto(brk) +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S index 0ae999722..bea2e3a7a 100644 --- a/libc/sysdeps/linux/x86_64/clone.S +++ b/libc/sysdeps/linux/x86_64/clone.S @@ -50,10 +50,10 @@ .text -.global __clone -.type __clone,%function +.global clone +.type clone,%function .align 4 -__clone: +clone: /* Sanity check arguments. */ movq $-EINVAL,%rax testq %rdi,%rdi /* no NULL function pointers */ @@ -109,9 +109,6 @@ __clone: call *%rax /* Call exit with return value from function call. */ movq %rax, %rdi - call _exit_internal + call HIDDEN_JUMPTARGET(_exit) -.size __clone,.-__clone - -.weak clone - clone = __clone +.size clone,.-clone diff --git a/libc/sysdeps/linux/x86_64/mmap.c b/libc/sysdeps/linux/x86_64/mmap.c index f14f1b6f9..b69f0a2f2 100644 --- a/libc/sysdeps/linux/x86_64/mmap.c +++ b/libc/sysdeps/linux/x86_64/mmap.c @@ -13,7 +13,7 @@ #include <sys/mman.h> #include <sys/syscall.h> -#define __NR___mmap __NR_mmap -attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot, +_syscall6(void *, mmap, void *, start, size_t, length, int, prot, int, flags, int, fd, off_t, offset); -strong_alias(__mmap,mmap) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c index 250c8b5c6..7a2d1ce28 100644 --- a/libc/sysdeps/linux/x86_64/sigaction.c +++ b/libc/sysdeps/linux/x86_64/sigaction.c @@ -23,11 +23,8 @@ #include <signal.h> #include <string.h> - #include <sys/syscall.h> - - /* The difference here is that the sigaction structure used in the kernel is not the same as we use in the libc. Therefore we must translate it here. */ @@ -42,6 +39,8 @@ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; extern void restore (void) asm ("__restore") attribute_hidden; +libc_hidden_proto(memcpy) + /* 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. */ /* psm: couldn't use __sigaction, if building w/ disabled hidden, @@ -54,7 +53,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { kact.k_sa_handler = act->sa_handler; - __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags | SA_RESTORER; kact.sa_restorer = &restore_rt; @@ -67,7 +66,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); if (oact && result >= 0) { oact->sa_handler = koact.k_sa_handler; - __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; oact->sa_restorer = koact.sa_restorer; } @@ -121,8 +120,9 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) #endif #ifndef LIBC_SIGACTION -hidden_weak_alias(__libc_sigaction,__sigaction) -weak_alias(__libc_sigaction,sigaction) +strong_alias(__libc_sigaction,sigaction) +libc_hidden_proto(sigaction) +libc_hidden_def(sigaction) #endif /* NOTE: Please think twice before making any changes to the bits of diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index 996f1289e..3315e337a 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -26,18 +26,17 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -hidden_strong_alias(__fork,__vfork) -weak_alias(vfork,__libc_fork) +strong_alias(fork,vfork) +strong_alias(vfork,__libc_fork) #else .text -.global __vfork -.hidden __vfork -.type __vfork,%function +.global vfork +.type vfork,%function .align 16 -__vfork: +vfork: /* Pop the return PC value into RDI. We need a register that is preserved by the syscall and that we're allowed to destroy. */ @@ -56,7 +55,7 @@ __vfork: /* Normal return. */ ret -.size __vfork,.-__vfork +.size vfork,.-vfork #endif /* __NR_vfork */ -strong_alias(__vfork,vfork) +libc_hidden_def(vfork) diff --git a/libc/termios/Makefile.in b/libc/termios/Makefile.in index 415f32192..77f15c6fa 100644 --- a/libc/termios/Makefile.in +++ b/libc/termios/Makefile.in @@ -6,36 +6,14 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # -CSRC:=tcgetattr.c tcgetsid.c tcsetattr.c ttyname.c - -MSRC:= termios.c -MOBJ:= tcdrain.o tcflow.o tcflush.o tcsendbreak.o tcsetpgrp.o tcgetpgrp.o \ - isatty.o cfgetospeed.o cfgetispeed.o cfsetospeed.o cfsetispeed.o \ - cfmakeraw.o cfsetspeed.o - TERMIOS_DIR:=$(top_srcdir)libc/termios TERMIOS_OUT:=$(top_builddir)libc/termios -TERMIOS_SRC:=$(patsubst %.c,$(TERMIOS_DIR)/%.c,$(CSRC)) -TERMIOS_OBJ:=$(patsubst %.c,$(TERMIOS_OUT)/%.o,$(CSRC)) - -TERMIOS_MSRC:=$(patsubst %.c,$(TERMIOS_DIR)/%.c,$(MSRC)) -TERMIOS_MOBJ:=$(patsubst %.o,$(TERMIOS_OUT)/%.o,$(MOBJ)) -TERMIOS_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(TERMIOS_MOBJ)))) - -TERMIOS_OBJS:=$(TERMIOS_OBJ) $(TERMIOS_MOBJ) - -$(TERMIOS_MOBJ): $(TERMIOS_MSRC) - $(compile.m) - -$(TERMIOS_MOBJ:.o=.os): $(TERMIOS_MSRC) - $(compile.m) - -libc-a-y+=$(TERMIOS_OBJS) -libc-so-y+=$(TERMIOS_OBJS:.o=.os) +TERMIOS_SRC:=$(wildcard $(TERMIOS_DIR)/*.c) +TERMIOS_OBJ:=$(patsubst $(TERMIOS_DIR)/%.c,$(TERMIOS_OUT)/%.o,$(TERMIOS_SRC)) -CFLAGS-multi-y+=$(TERMIOS_DEF) -libc-multi-y+=$(TERMIOS_SRC) $(TERMIOS_MSRC) +libc-a-y+=$(TERMIOS_OBJ) +libc-so-y+=$(TERMIOS_OBJ:.o=.os) objclean-y+=termios_objclean diff --git a/libc/termios/cfmakeraw.c b/libc/termios/cfmakeraw.c new file mode 100644 index 000000000..bf2012489 --- /dev/null +++ b/libc/termios/cfmakeraw.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <termios.h> + +/* Set *T to indicate raw mode. */ +void cfmakeraw (struct termios *t) +{ + t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + t->c_oflag &= ~OPOST; + t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + t->c_cflag &= ~(CSIZE|PARENB); + t->c_cflag |= CS8; + t->c_cc[VMIN] = 1; /* read returns when one char is available. */ + t->c_cc[VTIME] = 0; +} diff --git a/libc/termios/cfsetspeed.c b/libc/termios/cfsetspeed.c new file mode 100644 index 000000000..e71c5e461 --- /dev/null +++ b/libc/termios/cfsetspeed.c @@ -0,0 +1,164 @@ +/* Copyright (C) 1992,93,96,97,98,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <termios.h> +#include <errno.h> +#include <stddef.h> + +libc_hidden_proto(cfsetispeed) +libc_hidden_proto(cfsetospeed) + +struct speed_struct +{ + speed_t value; + speed_t internal; +}; + +static const struct speed_struct speeds[] = + { +#ifdef B0 + { 0, B0 }, +#endif +#ifdef B50 + { 50, B50 }, +#endif +#ifdef B75 + { 75, B75 }, +#endif +#ifdef B110 + { 110, B110 }, +#endif +#ifdef B134 + { 134, B134 }, +#endif +#ifdef B150 + { 150, B150 }, +#endif +#ifdef B200 + { 200, B200 }, +#endif +#ifdef B300 + { 300, B300 }, +#endif +#ifdef B600 + { 600, B600 }, +#endif +#ifdef B1200 + { 1200, B1200 }, +#endif +#ifdef B1200 + { 1200, B1200 }, +#endif +#ifdef B1800 + { 1800, B1800 }, +#endif +#ifdef B2400 + { 2400, B2400 }, +#endif +#ifdef B4800 + { 4800, B4800 }, +#endif +#ifdef B9600 + { 9600, B9600 }, +#endif +#ifdef B19200 + { 19200, B19200 }, +#endif +#ifdef B38400 + { 38400, B38400 }, +#endif +#ifdef B57600 + { 57600, B57600 }, +#endif +#ifdef B76800 + { 76800, B76800 }, +#endif +#ifdef B115200 + { 115200, B115200 }, +#endif +#ifdef B153600 + { 153600, B153600 }, +#endif +#ifdef B230400 + { 230400, B230400 }, +#endif +#ifdef B307200 + { 307200, B307200 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif +#ifdef B500000 + { 500000, B500000 }, +#endif +#ifdef B576000 + { 576000, B576000 }, +#endif +#ifdef B921600 + { 921600, B921600 }, +#endif +#ifdef B1000000 + { 1000000, B1000000 }, +#endif +#ifdef B1152000 + { 1152000, B1152000 }, +#endif +#ifdef B1500000 + { 1500000, B1500000 }, +#endif +#ifdef B2000000 + { 2000000, B2000000 }, +#endif +#ifdef B2500000 + { 2500000, B2500000 }, +#endif +#ifdef B3000000 + { 3000000, B3000000 }, +#endif +#ifdef B3500000 + { 3500000, B3500000 }, +#endif +#ifdef B4000000 + { 4000000, B4000000 }, +#endif + }; + + +/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */ +int cfsetspeed (struct termios *termios_p, speed_t speed) +{ + size_t cnt; + + for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt) + if (speed == speeds[cnt].internal) + { + cfsetispeed (termios_p, speed); + cfsetospeed (termios_p, speed); + return 0; + } + else if (speed == speeds[cnt].value) + { + cfsetispeed (termios_p, speeds[cnt].internal); + cfsetospeed (termios_p, speeds[cnt].internal); + return 0; + } + + __set_errno (EINVAL); + + return -1; +} diff --git a/libc/termios/isatty.c b/libc/termios/isatty.c new file mode 100644 index 000000000..7532f334b --- /dev/null +++ b/libc/termios/isatty.c @@ -0,0 +1,32 @@ +/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <unistd.h> +#include <termios.h> + +libc_hidden_proto(isatty) +libc_hidden_proto(tcgetattr) + +/* Return 1 if FD is a terminal, 0 if not. */ +int isatty (int fd) +{ + struct termios term; + + return tcgetattr (fd, &term) == 0; +} +libc_hidden_def(isatty) diff --git a/libc/termios/speed.c b/libc/termios/speed.c new file mode 100644 index 000000000..52647b9cc --- /dev/null +++ b/libc/termios/speed.c @@ -0,0 +1,97 @@ +/* `struct termios' speed frobnication functions. Linux version. + Copyright (C) 1991,1992,1993,1995,1996,1997,1998,2000,2002,2003 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <stddef.h> +#include <errno.h> +#include <termios.h> + +libc_hidden_proto(cfsetispeed) +libc_hidden_proto(cfsetospeed) + +/* This is a gross hack around a kernel bug. If the cfsetispeed functions + is called with the SPEED argument set to zero this means use the same + speed as for output. But we don't have independent input and output + speeds and therefore cannot record this. + + We use an unused bit in the `c_iflag' field to keep track of this + use of `cfsetispeed'. The value here must correspond to the one used + in `tcsetattr.c'. */ +#define IBAUD0 020000000000 + + +/* Return the output baud rate stored in *TERMIOS_P. */ +speed_t cfgetospeed (const struct termios *termios_p) +{ + return termios_p->c_cflag & (CBAUD | CBAUDEX); +} + +/* Return the input baud rate stored in *TERMIOS_P. + Although for Linux there is no difference between input and output + speed, the numerical 0 is a special case for the input baud rate. It + should set the input baud rate to the output baud rate. */ +speed_t cfgetispeed (const struct termios *termios_p) +{ + return ((termios_p->c_iflag & IBAUD0) + ? 0 : termios_p->c_cflag & (CBAUD | CBAUDEX)); +} + +/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ +int cfsetospeed (struct termios *termios_p, speed_t speed) +{ + if ((speed & ~CBAUD) != 0 + && (speed < B57600 || speed > __MAX_BAUD)) + { + __set_errno (EINVAL); + return -1; + } + + termios_p->c_cflag &= ~(CBAUD | CBAUDEX); + termios_p->c_cflag |= speed; + + return 0; +} +libc_hidden_def (cfsetospeed) + + +/* Set the input baud rate stored in *TERMIOS_P to SPEED. + Although for Linux there is no difference between input and output + speed, the numerical 0 is a special case for the input baud rate. It + should set the input baud rate to the output baud rate. */ +int cfsetispeed (struct termios *termios_p, speed_t speed) +{ + if ((speed & ~CBAUD) != 0 + && (speed < B57600 || speed > __MAX_BAUD)) + { + __set_errno (EINVAL); + return -1; + } + + if (speed == 0) + termios_p->c_iflag |= IBAUD0; + else + { + termios_p->c_iflag &= ~IBAUD0; + termios_p->c_cflag &= ~(CBAUD | CBAUDEX); + termios_p->c_cflag |= speed; + } + + return 0; +} +libc_hidden_def (cfsetispeed) diff --git a/libc/termios/tcdrain.c b/libc/termios/tcdrain.c new file mode 100644 index 000000000..62bbd9179 --- /dev/null +++ b/libc/termios/tcdrain.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1995, 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <termios.h> +#include <sys/ioctl.h> + +libc_hidden_proto(ioctl) + +/* Wait for pending output to be written on FD. */ +int __libc_tcdrain (int fd) +{ + return ioctl(fd, TCSBRK, 1); +} +weak_alias (__libc_tcdrain, tcdrain) diff --git a/libc/termios/tcflow.c b/libc/termios/tcflow.c new file mode 100644 index 000000000..63f96a860 --- /dev/null +++ b/libc/termios/tcflow.c @@ -0,0 +1,30 @@ +/* tcflow -- Suspend or restart transmission on termios file descriptor. + Copyright (C) 1993,1997,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <termios.h> +#include <sys/ioctl.h> + +libc_hidden_proto(ioctl) + +/* Suspend or restart transmission on FD. */ +int tcflow (int fd, int action) +{ + return ioctl (fd, TCXONC, action); +} diff --git a/libc/termios/tcflush.c b/libc/termios/tcflush.c new file mode 100644 index 000000000..159231fb1 --- /dev/null +++ b/libc/termios/tcflush.c @@ -0,0 +1,31 @@ +/* tcflush -- Flush pending data on termios file descriptor. Linux version. + Copyright (C) 1993,1997,2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <termios.h> +#include <sys/ioctl.h> + +libc_hidden_proto(ioctl) + +/* Flush pending data on FD. */ +int +tcflush (int fd, int queue_selector) +{ + return ioctl (fd, TCFLSH, queue_selector); +} diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c index 3fd6d29d6..bc160248d 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define mempcpy __mempcpy - #include <features.h> #define __USE_GNU #include <string.h> @@ -26,18 +24,24 @@ #include <sys/ioctl.h> #include <sys/types.h> +libc_hidden_proto(ioctl) +libc_hidden_proto(memset) +libc_hidden_proto(memcpy) +libc_hidden_proto(mempcpy) +libc_hidden_proto(tcgetattr) + /* The difference here is that the termios structure used in the kernel is not the same as we use in the libc. Therefore we must translate it here. */ #include "kernel_termios.h" /* Put the state of FD into *TERMIOS_P. */ -int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) +int 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; @@ -55,18 +59,18 @@ int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0 || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1) { - __memset (mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + memset (mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)), _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t)); #if 0 - __memset ( (__memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + memset ( (memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)) + (__KERNEL_NCCS * sizeof (cc_t))) , _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t)); #endif } else { size_t cnt; - __memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], + memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt) @@ -75,4 +79,4 @@ int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) return retval; } -strong_alias(__tcgetattr,tcgetattr) +libc_hidden_def(tcgetattr) diff --git a/libc/termios/tcgetpgrp.c b/libc/termios/tcgetpgrp.c new file mode 100644 index 000000000..241670770 --- /dev/null +++ b/libc/termios/tcgetpgrp.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <sys/ioctl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> + +libc_hidden_proto(tcgetpgrp) +libc_hidden_proto(ioctl) + +/* Return the foreground process group ID of FD. */ +pid_t tcgetpgrp (int fd) +{ + int pgrp; + + if (ioctl (fd, TIOCGPGRP, &pgrp) < 0) + return (pid_t) -1; + return (pid_t) pgrp; +} +libc_hidden_def (tcgetpgrp) diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c index e4ba87ac5..c37023e8b 100644 --- a/libc/termios/tcgetsid.c +++ b/libc/termios/tcgetsid.c @@ -2,22 +2,19 @@ This file is part of the GNU C Library. 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. */ - -#define getsid __getsid -#define tcgetpgrp __tcgetpgrp + 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 <termios.h> @@ -26,6 +23,9 @@ #define __USE_XOPEN_EXTENDED #include <unistd.h> +libc_hidden_proto(ioctl) +libc_hidden_proto(getsid) +libc_hidden_proto(tcgetpgrp) /* Return the session ID of FD. */ pid_t tcgetsid (int fd) @@ -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/tcsendbrk.c b/libc/termios/tcsendbrk.c new file mode 100644 index 000000000..ae04cb947 --- /dev/null +++ b/libc/termios/tcsendbrk.c @@ -0,0 +1,48 @@ +/* Send break to terminal. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <stddef.h> +#include <termios.h> +#include <sys/ioctl.h> + +libc_hidden_proto(ioctl) + +/* Send zero bits on FD. */ +int +tcsendbreak (int fd, int duration) +{ + /* The break lasts 0.25 to 0.5 seconds if DURATION is zero, + 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); + +#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); +#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 + send a '\0') to send the break, but for now just return an error. */ + __set_errno (EINVAL); + return -1; +#endif +} diff --git a/libc/termios/tcsetattr.c b/libc/termios/tcsetattr.c index 3afa1012c..847023f86 100644 --- a/libc/termios/tcsetattr.c +++ b/libc/termios/tcsetattr.c @@ -22,6 +22,10 @@ #include <sys/ioctl.h> #include <sys/types.h> +libc_hidden_proto(tcsetattr) +libc_hidden_proto(memcpy) +libc_hidden_proto(ioctl) + /* The difference here is that the termios structure used in the kernel is not the same as we use in the libc. Therefore we must translate it here. */ @@ -47,7 +51,7 @@ /* Set the state of FD to *TERMIOS_P. */ -int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct termios *termios_p) +int tcsetattr (int fd, int optional_actions, const struct termios *termios_p) { struct __kernel_termios k_termios; unsigned long int cmd; @@ -80,17 +84,17 @@ int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct ter #ifdef _HAVE_C_OSPEED k_termios.c_ospeed = termios_p->c_ospeed; #endif - __memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], + 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 @@ -114,4 +118,4 @@ int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct ter return retval; } -strong_alias(__tcsetattr,tcsetattr) +libc_hidden_def(tcsetattr) diff --git a/libc/termios/tcsetpgrp.c b/libc/termios/tcsetpgrp.c new file mode 100644 index 000000000..9bf1cdaef --- /dev/null +++ b/libc/termios/tcsetpgrp.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 <sys/types.h> +#include <sys/ioctl.h> +#include <errno.h> +#include <unistd.h> + +libc_hidden_proto(ioctl) + +/* 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); +} diff --git a/libc/termios/termios.c b/libc/termios/termios.c deleted file mode 100644 index 680796e16..000000000 --- a/libc/termios/termios.c +++ /dev/null @@ -1,327 +0,0 @@ -/* Copyright (C) 1992, 1993, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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. - - 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. - - 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. - - - About the only thing remaining here fromthe original Linux-8086 C library - version by Robert de Bath <robert@mayday.compulink.co.uk>, is the general - layout. All else has been recently stolen from GNU libc, since that was - much more current. - */ - -#define tcgetattr __tcgetattr - -#include <errno.h> -#include <stddef.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <unistd.h> -#include <termios.h> - -#ifdef L_isatty -/* Return 1 if FD is a terminal, 0 if not. */ - -int attribute_hidden __isatty(int fd) -{ - struct termios term; - return (tcgetattr (fd, &term) == 0); -} -strong_alias(__isatty,isatty) -#endif - -#ifdef L_tcdrain -/* Wait for pending output to be written on FD. */ -int __libc_tcdrain (int fd) -{ - /* With an argument of 1, TCSBRK waits for the output to drain. */ - return __ioctl(fd, TCSBRK, 1); -} -weak_alias(__libc_tcdrain, tcdrain) -#endif - -#ifdef L_tcflow -/* Suspend or restart transmission on FD. */ -int tcflow ( int fd, int action) -{ - return __ioctl(fd, TCXONC, action); -} -#endif - -#ifdef L_tcflush -/* Flush pending data on FD. */ -int tcflush ( int fd, int queue_selector) -{ - return __ioctl(fd, TCFLSH, queue_selector); -} -#endif - -#ifdef L_tcsendbreak -/* Send zero bits on FD. */ -int tcsendbreak( int fd, int duration) -{ - /* The break lasts 0.25 to 0.5 seconds if DURATION is zero, - 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); - -#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); -#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 - send a '\0') to send the break, but for now just return an error. */ - __set_errno (EINVAL); - return -1; -#endif -} -#endif - -#ifdef L_tcsetpgrp -/* 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); -} -#endif - -#ifdef L_tcgetpgrp -/* Return the foreground process group ID of FD. */ -pid_t attribute_hidden __tcgetpgrp ( int fd) -{ - int pgrp; - - if (__ioctl (fd, TIOCGPGRP, &pgrp) < 0) - return (pid_t) -1; - return (pid_t) pgrp; -} -strong_alias(__tcgetpgrp,tcgetpgrp) -#endif - -/* This is a gross hack around a kernel bug. If the cfsetispeed functions is - * called with the SPEED argument set to zero this means use the same speed as - * for output. But we don't have independent input and output speeds and - * therefore cannot record this. - * - * We use an unused bit in the `c_iflag' field to keep track of this use of - * `cfsetispeed'. The value here must correspond to the one used in - * `tcsetattr.c'. */ -#define IBAUD0 020000000000 - -#ifdef L_cfgetospeed -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t cfgetospeed ( const struct termios *termios_p) -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} -#endif - -#ifdef L_cfgetispeed - -/* Return the input baud rate stored in *TERMIOS_P. - * Although for Linux there is no difference between input and output - * speed, the numerical 0 is a special case for the input baud rate. It - * should set the input baud rate to the output baud rate. */ -speed_t cfgetispeed (const struct termios *termios_p) -{ - return ((termios_p->c_iflag & IBAUD0) - ? 0 : termios_p->c_cflag & (CBAUD | CBAUDEX)); -} -#endif - -#ifdef L_cfsetospeed -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int attribute_hidden __cfsetospeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 - && (speed < B57600 || speed > B460800)) - { - __set_errno(EINVAL); - return -1; - } - - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - - return 0; -} -strong_alias(__cfsetospeed,cfsetospeed) -#endif - -#ifdef L_cfsetispeed -/* Set the input baud rate stored in *TERMIOS_P to SPEED. - * Although for Linux there is no difference between input and output - * speed, the numerical 0 is a special case for the input baud rate. It - * should set the input baud rate to the output baud rate. */ -int attribute_hidden __cfsetispeed ( struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 - && (speed < B57600 || speed > B460800)) - { - __set_errno(EINVAL); - return -1; - } - - if (speed == 0) - termios_p->c_iflag |= IBAUD0; - else - { - termios_p->c_iflag &= ~IBAUD0; - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - } - - return 0; -} -strong_alias(__cfsetispeed,cfsetispeed) -#endif - -#ifdef L_cfsetspeed - -extern int __cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW attribute_hidden; -extern int __cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW attribute_hidden; - -struct speed_struct -{ - speed_t value; - speed_t internal; -}; - -static const struct speed_struct speeds[] = - { -#ifdef B0 - { 0, B0 }, -#endif -#ifdef B50 - { 50, B50 }, -#endif -#ifdef B75 - { 75, B75 }, -#endif -#ifdef B110 - { 110, B110 }, -#endif -#ifdef B134 - { 134, B134 }, -#endif -#ifdef B150 - { 150, B150 }, -#endif -#ifdef B200 - { 200, B200 }, -#endif -#ifdef B300 - { 300, B300 }, -#endif -#ifdef B600 - { 600, B600 }, -#endif -#ifdef B1200 - { 1200, B1200 }, -#endif -#ifdef B1200 - { 1200, B1200 }, -#endif -#ifdef B1800 - { 1800, B1800 }, -#endif -#ifdef B2400 - { 2400, B2400 }, -#endif -#ifdef B4800 - { 4800, B4800 }, -#endif -#ifdef B9600 - { 9600, B9600 }, -#endif -#ifdef B19200 - { 19200, B19200 }, -#endif -#ifdef B38400 - { 38400, B38400 }, -#endif -#ifdef B57600 - { 57600, B57600 }, -#endif -#ifdef B76800 - { 76800, B76800 }, -#endif -#ifdef B115200 - { 115200, B115200 }, -#endif -#ifdef B153600 - { 153600, B153600 }, -#endif -#ifdef B230400 - { 230400, B230400 }, -#endif -#ifdef B307200 - { 307200, B307200 }, -#endif -#ifdef B460800 - { 460800, B460800 }, -#endif - }; - - -/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */ -int cfsetspeed (struct termios *termios_p, speed_t speed) -{ - size_t cnt; - - for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt) - if (speed == speeds[cnt].internal) - { - __cfsetispeed (termios_p, speed); - __cfsetospeed (termios_p, speed); - return 0; - } - else if (speed == speeds[cnt].value) - { - __cfsetispeed (termios_p, speeds[cnt].internal); - __cfsetospeed (termios_p, speeds[cnt].internal); - return 0; - } - - __set_errno (EINVAL); - - return -1; -} -#endif - -#ifdef L_cfmakeraw -/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. -*/ -#include <termios.h> - -/* Set *T to indicate raw mode. */ -void -cfmakeraw (struct termios *t) -{ - t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); - t->c_cflag |= CS8; - t->c_cc[VMIN] = 1; /* read returns when one char is available. */ - t->c_cc[VTIME] = 0; -} -#endif - diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index 271c9a4ab..001681caa 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -1,17 +1,11 @@ -#define opendir __opendir -#define closedir __closedir -#define readdir __readdir -#define isatty __isatty - -#include <string.h> -#include <errno.h> -#include <assert.h> -#include <unistd.h> -#include <dirent.h> -#include <sys/stat.h> - -/* Jan 1, 2004 Manuel Novoa III +/* + * Copyright (C) Jan 1, 2004 Manuel Novoa III + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +/* * Kept the same approach, but rewrote the code for the most part. * Fixed some minor issues plus (as I recall) one SUSv3 errno case. */ @@ -29,6 +23,24 @@ * * If you change this, also change _SC_TTY_NAME_MAX in libc/unistd/sysconf.c */ + +#include <string.h> +#include <errno.h> +#include <assert.h> +#include <unistd.h> +#include <dirent.h> +#include <sys/stat.h> + +libc_hidden_proto(ttyname_r) +libc_hidden_proto(fstat) +libc_hidden_proto(lstat) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(opendir) +libc_hidden_proto(closedir) +libc_hidden_proto(readdir) +libc_hidden_proto(isatty) + #define TTYNAME_BUFLEN 32 static const char dirlist[] = @@ -39,7 +51,7 @@ static const char dirlist[] = "\011/dev/pts/\0" /* and try /dev/pts next */ "\005/dev/\0"; /* and try walking through /dev last */ -int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) +int ttyname_r(int fd, char *ubuf, size_t ubuflen) { struct dirent *d; struct stat st; @@ -51,7 +63,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) size_t len; char buf[TTYNAME_BUFLEN]; - if (__fstat(fd, &st) < 0) { + if (fstat(fd, &st) < 0) { return errno; } @@ -66,7 +78,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) assert(len + 2 <= TTYNAME_BUFLEN); /* dirname + 1 char + nul */ - __strcpy(buf, p); + strcpy(buf, p); s = buf + len; len = (TTYNAME_BUFLEN-2) - len; /* Available non-nul space. */ @@ -77,13 +89,13 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) while ((d = readdir(fp)) != NULL) { /* This should never trigger for standard names, but we * check it to be safe. */ - if (__strlen(d->d_name) > len) { /* Too big? */ + if (strlen(d->d_name) > len) { /* Too big? */ continue; } - __strcpy(s, d->d_name); + strcpy(s, d->d_name); - if ((__lstat(buf, &dst) == 0) + if ((lstat(buf, &dst) == 0) #if 0 /* Stupid filesystems like cramfs fail to guarantee that * st_ino and st_dev uniquely identify a file, contrary to @@ -98,8 +110,8 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) /* We treat NULL buf as ERANGE rather than EINVAL. */ rv = ERANGE; - if (ubuf && (__strlen(buf) <= ubuflen)) { - __strcpy(ubuf, buf); + if (ubuf && (strlen(buf) <= ubuflen)) { + strcpy(ubuf, buf); rv = 0; } goto DONE; @@ -114,11 +126,11 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) return rv; } -strong_alias(__ttyname_r,ttyname_r) +libc_hidden_def(ttyname_r) char *ttyname(int fd) { static char name[TTYNAME_BUFLEN]; - return __ttyname_r(fd, name, TTYNAME_BUFLEN) ? NULL : name; + return ttyname_r(fd, name, TTYNAME_BUFLEN) ? NULL : name; } diff --git a/libc/unistd/confstr.c b/libc/unistd/confstr.c index bfaecb198..8d1c8d303 100644 --- a/libc/unistd/confstr.c +++ b/libc/unistd/confstr.c @@ -21,6 +21,8 @@ #include <unistd.h> #include <string.h> +libc_hidden_proto(memcpy) + #define CS_PATH "/bin:/usr/bin" /* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes @@ -48,10 +50,10 @@ size_t confstr ( int name, char *buf, size_t len) if (len > 0 && buf != NULL) { if (string_len <= len) - __memcpy (buf, string, string_len); + memcpy (buf, string, string_len); else { - __memcpy (buf, string, len - 1); + memcpy (buf, string, len - 1); buf[len - 1] = '\0'; } } diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 4c18e55fa..77e10dd76 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -1,32 +1,44 @@ /* vi: set sw=4 ts=4: */ /* daemon implementation for uClibc * - * Copyright (c) 1991, 1993 + * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * - * Modified for uClibc by Erik Andersen <andersee@debian.org> - * - * This program 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. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * This program 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. + * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * Original copyright notice is retained at the end of this file. + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ -#define dup2 __dup2 -#define setsid __setsid -#define chdir __chdir -#define fork __fork +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * Modified for uClibc by Erik Andersen <andersee@debian.org> + */ #include <stdio.h> #include <features.h> @@ -35,6 +47,13 @@ #include <unistd.h> #if defined __ARCH_HAS_MMU__ +libc_hidden_proto(open) +libc_hidden_proto(close) +libc_hidden_proto(_exit) +libc_hidden_proto(dup2) +libc_hidden_proto(setsid) +libc_hidden_proto(chdir) +libc_hidden_proto(fork) int daemon( int nochdir, int noclose ) { @@ -46,7 +65,7 @@ int daemon( int nochdir, int noclose ) case 0: break; default: - _exit_internal(0); + _exit(0); } if (setsid() == -1) @@ -55,54 +74,19 @@ int daemon( int nochdir, int noclose ) /* Make certain we are not a session leader, or else we * might reacquire a controlling terminal */ if (fork()) - _exit_internal(0); + _exit(0); if (!nochdir) chdir("/"); - if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > 2) - __close(fd); + close(fd); } return(0); } #endif - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change - * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> - * - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - - diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index e61ff1988..08ef742d3 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -30,10 +30,6 @@ * to free the storage allocated for the copy. Better ideas anyone? */ -#define mmap __mmap -#define munmap __munmap -#define execve __execve - #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -44,7 +40,17 @@ #include <unistd.h> #include <sys/mman.h> -extern char *__strchrnul(const char *s, int c); +libc_hidden_proto(execl) +libc_hidden_proto(execvp) + +libc_hidden_proto(memcpy) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(strchrnul) +libc_hidden_proto(execve) +libc_hidden_proto(mmap) +libc_hidden_proto(munmap) +libc_hidden_proto(getenv) /**********************************************************************/ #if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) @@ -68,12 +74,12 @@ extern char *__strchrnul(const char *s, int c); # define EXEC_ALLOC(SIZE,VAR) __exec_alloc((VAR = (SIZE))) # define EXEC_FREE(PTR,VAR) __exec_free((PTR),(VAR)) -extern void *__exec_alloc(size_t size); -extern void __exec_free(void *ptr, size_t size); +extern void *__exec_alloc(size_t size) attribute_hidden; +extern void __exec_free(void *ptr, size_t size) attribute_hidden; # ifdef L___exec_alloc -void *__exec_alloc(size_t size) +void attribute_hidden *__exec_alloc(size_t size) { void *p; @@ -82,7 +88,7 @@ void *__exec_alloc(size_t size) return (p != MAP_FAILED) ? p : NULL; } -void __exec_free(void *ptr, size_t size) +void attribute_hidden __exec_free(void *ptr, size_t size) { if (ptr) { munmap(ptr, size); @@ -95,7 +101,7 @@ void __exec_free(void *ptr, size_t size) /**********************************************************************/ #ifdef L_execl -int attribute_hidden __execl(const char *path, const char *arg, ...) +int execl(const char *path, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ int n; @@ -126,7 +132,7 @@ int attribute_hidden __execl(const char *path, const char *arg, ...) return n; } -strong_alias(__execl,execl) +libc_hidden_def(execl) #endif /**********************************************************************/ @@ -179,8 +185,6 @@ int execle(const char *path, const char *arg, ...) /**********************************************************************/ #ifdef L_execlp -extern int __execvp(const char *path, char *const argv[]) attribute_hidden; - int execlp(const char *file, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ @@ -206,7 +210,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); @@ -222,7 +226,7 @@ int execlp(const char *file, const char *arg, ...) * /bin, and then /usr/bin. */ static const char default_path[] = ":/bin:/usr/bin"; -int attribute_hidden __execvp(const char *path, char *const argv[]) +int execvp(const char *path, char *const argv[]) { char *buf = NULL; char *p; @@ -239,7 +243,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) return -1; } - if (__strchr(path, '/')) { + if (strchr(path, '/')) { execve(path, argv, __environ); CHECK_ENOEXEC: if (errno == ENOEXEC) { @@ -252,12 +256,12 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2); nargv[0] = argv[0]; nargv[1] = (char *)path; - __memcpy(nargv+2, argv+1, n*sizeof(char *)); + memcpy(nargv+2, argv+1, n*sizeof(char *)); execve("/bin/sh", nargv, __environ); EXEC_FREE(nargv, size2); } } else { - if ((p = __getenv("PATH")) != NULL) { + if ((p = getenv("PATH")) != NULL) { if (!*p) { goto BAD; } @@ -265,7 +269,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) p = (char *) default_path; } - plen = __strlen(path); + plen = strlen(path); if (plen > (FILENAME_MAX - 1)) { ALL_TOO_LONG: __set_errno(ENAMETOOLONG); @@ -276,11 +280,11 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) if ((buf = EXEC_ALLOC(FILENAME_MAX, size)) != NULL) { int seen_small = 0; s0 = buf + len; - __memcpy(s0, path, plen+1); + memcpy(s0, path, plen+1); do { s = s0; - e = __strchrnul(p, ':'); + e = strchrnul(p, ':'); if (e > p) { plen = e - p; if (e[-1] != '/') { @@ -290,7 +294,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) goto NEXT; } s -= plen; - __memcpy(s, p, plen); + memcpy(s, p, plen); s[plen-1] = '/'; } @@ -319,7 +323,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) return -1; } -strong_alias(__execvp,execvp) +libc_hidden_def(execvp) #endif /**********************************************************************/ diff --git a/libc/unistd/fpathconf.c b/libc/unistd/fpathconf.c index 5404e7b01..9cb66a927 100644 --- a/libc/unistd/fpathconf.c +++ b/libc/unistd/fpathconf.c @@ -32,6 +32,8 @@ //#include "linux_fsinfo.h" +libc_hidden_proto(fstat) +libc_hidden_proto(fstatfs) /* The Linux kernel headers mention this as a kind of generic value. */ #define LINUX_LINK_MAX 127 @@ -53,7 +55,7 @@ long int fpathconf(int fd, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (__fstatfs (fd, &fsbuf) < 0) + if (fstatfs (fd, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -127,7 +129,7 @@ long int fpathconf(int fd, int name) struct statfs buf; int save_errno = errno; - if (__fstatfs (fd, &buf) < 0) + if (fstatfs (fd, &buf) < 0) { if (errno == ENOSYS) { @@ -201,7 +203,7 @@ long int fpathconf(int fd, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (__fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/getlogin.c b/libc/unistd/getlogin.c index 0747a49f6..f2ee1d355 100644 --- a/libc/unistd/getlogin.c +++ b/libc/unistd/getlogin.c @@ -23,35 +23,40 @@ #include <stdlib.h> #include <string.h> +libc_hidden_proto(strcpy) +libc_hidden_proto(strncpy) +libc_hidden_proto(getenv) + /* uClibc makes it policy to not mess with the utmp file whenever * possible, since I consider utmp a complete waste of time. Since * getlogin() should never be used for security purposes, we kindly let * the user specify whatever they want via the LOGNAME environment * variable, or we return NULL if getenv() fails to find anything */ -extern char attribute_hidden * __getlogin(void) +char * getlogin(void) { - return (__getenv("LOGNAME")); + return (getenv("LOGNAME")); } -strong_alias(__getlogin,getlogin) +libc_hidden_proto(getlogin) +libc_hidden_def(getlogin) int getlogin_r(char *name, size_t len) { - char * foo = __getenv("LOGNAME"); + char * foo = getenv("LOGNAME"); if (! foo) return -1; - __strncpy(name, foo, len); + strncpy(name, foo, len); name[len-1] = '\0'; return 0; } char *cuserid(char *s) { - char *name = __getlogin(); + char *name = getlogin(); if (s) { - return(__strcpy(s, name ? name : "")); + return(strcpy(s, name ? name : "")); } return name; } diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c index d9ee18c43..a73cdbc0a 100644 --- a/libc/unistd/getopt-susv3.c +++ b/libc/unistd/getopt-susv3.c @@ -35,6 +35,8 @@ #include <string.h> #include <stdio.h> +libc_hidden_proto(fprintf) + #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Enable gettext awareness. #endif /* __UCLIBC_MJN3_ONLY__ */ diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 2cf5dbb73..d9c458595 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -34,6 +34,13 @@ #include <libintl.h> #endif +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strncmp) +libc_hidden_proto(getenv) +libc_hidden_proto(fprintf) + #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Enable gettext awareness. #endif /* __UCLIBC_MJN3_ONLY__ */ @@ -149,7 +156,7 @@ static enum } ordering; # include <string.h> -# define my_index __strchr +# define my_index strchr /* Handle permutation of arguments. */ @@ -247,7 +254,7 @@ static const char *_getopt_initialize (attribute_unused int argc, attribute_unus ordering = REQUIRE_ORDER; ++optstring; } - else if (__getenv ("POSIXLY_CORRECT") != NULL) + else if (getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; @@ -371,7 +378,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ - if (optind != argc && !__strcmp (argv[optind], "--")) + if (optind != argc && !strcmp (argv[optind], "--")) { optind++; @@ -447,10 +454,10 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!__strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) - == (unsigned int) __strlen (p->name)) + == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -479,7 +486,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; @@ -517,7 +524,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optopt = pfound->val; return '?'; @@ -535,12 +542,12 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -651,9 +658,9 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!__strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) == __strlen (p->name)) + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -678,7 +685,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optind++; return '?'; } @@ -700,7 +707,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * argv[0], pfound->name); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); return '?'; } } @@ -716,11 +723,11 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 834fba9d9..5833bc317 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -16,21 +16,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define setvbuf __setvbuf -#define tcsetattr __tcsetattr -#define tcgetattr __tcgetattr -#define fileno __fileno -#define fflush __fflush -#define fgets __fgets -#define fputs __fputs - #include <stdio.h> #include <string.h> #include <termios.h> #include <unistd.h> #include <string.h> -extern int __putc(int c, FILE *stream) attribute_hidden; +libc_hidden_proto(strlen) +libc_hidden_proto(tcsetattr) +libc_hidden_proto(tcgetattr) +libc_hidden_proto(setvbuf) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fileno) +libc_hidden_proto(fflush) +libc_hidden_proto(fgets) +libc_hidden_proto(fputs) +libc_hidden_proto(fputc) +libc_hidden_proto(putc) +libc_hidden_proto(__fputc_unlocked) /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is @@ -90,7 +94,7 @@ getpass (prompt) fgets (buf, PWD_BUFFER_SIZE-1, in); if (buf != NULL) { - nread = __strlen(buf); + nread = strlen(buf); if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') @@ -99,7 +103,7 @@ getpass (prompt) buf[nread - 1] = '\0'; if (tty_changed) /* Write the newline that was not echoed. */ - __putc('\n', out); + putc('\n', out); } } diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c index bebfbc4ed..c6c078f6f 100644 --- a/libc/unistd/getsubopt.c +++ b/libc/unistd/getsubopt.c @@ -18,12 +18,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define memchr __memchr - +#define _GNU_SOURCE #include <stdlib.h> #include <string.h> -extern char *__strchrnul(const char *s, int c); +libc_hidden_proto(memchr) +libc_hidden_proto(memcmp) +libc_hidden_proto(strchrnul) /* Parse comma separated suboption from *OPTIONP and match against strings in TOKENS. If found return index and set *VALUEP to @@ -40,7 +41,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) return -1; /* Find end of next token. */ - endp = __strchrnul (*optionp, ','); + endp = strchrnul (*optionp, ','); /* Find start of value. */ vstart = memchr (*optionp, '=', endp - *optionp); @@ -50,7 +51,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) /* Try to match the characters between *OPTIONP and VSTART against one of the TOKENS. */ for (cnt = 0; tokens[cnt] != NULL; ++cnt) - if (__memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 + if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 && tokens[cnt][vstart - *optionp] == '\0') { /* We found the current option in TOKENS. */ diff --git a/libc/unistd/pathconf.c b/libc/unistd/pathconf.c index 579b99be0..f41cf69ba 100644 --- a/libc/unistd/pathconf.c +++ b/libc/unistd/pathconf.c @@ -36,6 +36,8 @@ //#include "linux_fsinfo.h" +libc_hidden_proto(statfs) +libc_hidden_proto(stat) /* The Linux kernel headers mention this as a kind of generic value. */ #define LINUX_LINK_MAX 127 @@ -57,7 +59,7 @@ long int pathconf(const char *path, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (__statfs (path, &fsbuf) < 0) + if (statfs (path, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -131,7 +133,7 @@ long int pathconf(const char *path, int name) struct statfs buf; int save_errno = errno; - if (__statfs (path, &buf) < 0) + if (statfs (path, &buf) < 0) { if (errno == ENOSYS) { @@ -205,7 +207,7 @@ long int pathconf(const char *path, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (__stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 3d3d516ab..92944af18 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -18,19 +18,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define sigaction __sigaction -#define nanosleep __nanosleep - #include <errno.h> #include <time.h> #include <signal.h> #include <unistd.h> +libc_hidden_proto(sleep) + +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) +//libc_hidden_proto(__sigaddset) +//libc_hidden_proto(__sigemptyset) +//libc_hidden_proto(__sigismember) +libc_hidden_proto(nanosleep) + #if 0 /* This is a quick and dirty, but not 100% compliant with * the stupid SysV SIGCHLD vs. SIG_IGN behaviour. It is * fine unless you are messing with SIGCHLD... */ -unsigned int attribute_hidden __sleep (unsigned int sec) +unsigned int sleep (unsigned int sec) { unsigned int res; struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 }; @@ -44,7 +50,7 @@ unsigned int attribute_hidden __sleep (unsigned int sec) /* We are going to use the `nanosleep' syscall of the kernel. But the kernel does not implement the sstupid SysV SIGCHLD vs. SIG_IGN behaviour for this syscall. Therefore we have to emulate it here. */ -unsigned int attribute_hidden __sleep (unsigned int seconds) +unsigned int sleep (unsigned int seconds) { struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 }; sigset_t set, oset; @@ -59,7 +65,7 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) in libc. We block SIGCHLD first. */ if (__sigemptyset (&set) < 0 || __sigaddset (&set, SIGCHLD) < 0 - || __sigprocmask (SIG_BLOCK, &set, &oset)) + || sigprocmask (SIG_BLOCK, &set, &oset)) return -1; /* If SIGCHLD is already blocked, we don't have to do anything. */ @@ -76,7 +82,7 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) { saved_errno = errno; /* Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); return -1; } @@ -88,13 +94,13 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) saved_errno = errno; /* Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); } else { /* We should unblock SIGCHLD. Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); result = nanosleep (&ts, &ts); } } @@ -108,4 +114,4 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) return result; } #endif -strong_alias(__sleep,sleep) +libc_hidden_def(sleep) diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index c80a9e94e..6f362819c 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -16,9 +16,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define getpagesize __getpagesize_internal -#define getdtablesize __getdtablesize - #define _XOPEN_SOURCE 500 #include <features.h> #include <errno.h> @@ -36,6 +33,9 @@ #include <regex.h> #endif +libc_hidden_proto(getpagesize) +libc_hidden_proto(getdtablesize) + #ifndef __UCLIBC_CLK_TCK_CONST #error __UCLIBC_CLK_TCK_CONST not defined! #endif @@ -71,7 +71,7 @@ #endif /* _UCLIBC_GENERATE_SYSCONF_ARCH */ /* Get the value of the system variable NAME. */ -long int attribute_hidden __sysconf(int name) +long int sysconf(int name) { switch (name) { @@ -883,4 +883,5 @@ long int attribute_hidden __sysconf(int name) #endif } } -strong_alias(__sysconf,sysconf) +libc_hidden_proto(sysconf) +libc_hidden_def(sysconf) diff --git a/libc/unistd/ualarm.c b/libc/unistd/ualarm.c index 3bcb8e463..ef023e8f3 100644 --- a/libc/unistd/ualarm.c +++ b/libc/unistd/ualarm.c @@ -1,4 +1,8 @@ -#define setitimer __setitimer +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define _GNU_SOURCE #include <time.h> @@ -6,6 +10,8 @@ #include <sys/types.h> #include <unistd.h> +libc_hidden_proto(setitimer) + useconds_t ualarm(useconds_t value, useconds_t interval) { struct itimerval otimer; diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index bc29cf247..51330ae78 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -30,10 +30,6 @@ * November 2002, Erik Andersen <andersen@codepoet.org> */ -#define __fsetlocking __fsetlocking_internal -#define fileno __fileno -#define fgets_unlocked __fgets_unlocked - #define _GNU_SOURCE #include <sys/param.h> #include <sys/file.h> @@ -45,6 +41,13 @@ #include <unistd.h> #include <paths.h> +libc_hidden_proto(fstat) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(__fsetlocking) +libc_hidden_proto(fileno) +libc_hidden_proto(fgets_unlocked) + /* * Local shells should NOT be added here. They should be added in * /etc/shells. @@ -104,7 +107,7 @@ static char ** initshells(void) if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) return (char **) validsh; - if (__fstat(fileno(fp), &statb) == -1) { + if (fstat(fileno(fp), &statb) == -1) { goto cleanup; } if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) { diff --git a/libc/unistd/usleep.c b/libc/unistd/usleep.c index db8b8710c..09bb09f41 100644 --- a/libc/unistd/usleep.c +++ b/libc/unistd/usleep.c @@ -1,10 +1,16 @@ -#define nanosleep __nanosleep +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <time.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> +libc_hidden_proto(nanosleep) + int usleep (__useconds_t usec) { const struct timespec ts = { |