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 |