diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
commit | af0172162f7c653cad6a11ed1c1a5459bc154465 (patch) | |
tree | 70031dad1e7286d58762da7b9e3d3f93d043c278 /libc/inet | |
parent | c8609543a9a8bf6559c2931dbbef6b3c41b3fbf2 (diff) |
hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing headers, other jump relocs removed
Diffstat (limited to 'libc/inet')
63 files changed, 1607 insertions, 1321 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 |