diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 5 | ||||
-rw-r--r-- | lib/libc/net/getnetbydns.c | 20 | ||||
-rw-r--r-- | lib/libc/net/getnetbyht.c | 7 | ||||
-rw-r--r-- | lib/libc/net/getnetbynis.c | 11 | ||||
-rw-r--r-- | lib/libc/net/getnetnamadr.c | 11 | ||||
-rw-r--r-- | lib/libc/net/netdb_private.h | 8 |
6 files changed, 37 insertions, 25 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index a7ab128..5d6ca2f 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -135,7 +135,7 @@ TAILQ_HEAD(policyhead, policyqueue); static const struct afd { int a_af; int a_addrlen; - int a_socklen; + socklen_t a_socklen; int a_off; const char *a_addrany; const char *a_loopback; @@ -1352,6 +1352,9 @@ get_ai(pai, afd, addr) memset(ai->ai_addr, 0, (size_t)afd->a_socklen); ai->ai_addr->sa_len = afd->a_socklen; ai->ai_addrlen = afd->a_socklen; +#if __LONG_BIT == 64 + ai->__ai_pad0 = 0; /* ABI compatibility */ +#endif ai->ai_addr->sa_family = ai->ai_family = afd->a_af; p = (char *)(void *)(ai->ai_addr); #ifdef FAITH diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c index e4f0ae8..5eca268 100644 --- a/lib/libc/net/getnetbydns.c +++ b/lib/libc/net/getnetbydns.c @@ -259,6 +259,9 @@ getnetanswer(querybuf *answer, int anslen, int net_i, struct netent *ne, break; } ne->n_aliases++; +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif return 0; } h_errno = TRY_AGAIN; @@ -268,7 +271,7 @@ getnetanswer(querybuf *answer, int anslen, int net_i, struct netent *ne, int _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) { - unsigned long net; + uint32_t net; int net_type; struct netent *ne; struct netent_data *ned; @@ -276,9 +279,9 @@ _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) int nn, anslen, error; querybuf *buf; char qbuf[MAXDNAME]; - unsigned long net2; + uint32_t net2; - net = va_arg(ap, unsigned long); + net = va_arg(ap, uint32_t); net_type = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); @@ -327,12 +330,13 @@ _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) error = getnetanswer(buf, anslen, BYADDR, ne, ned); free(buf); if (error == 0) { - unsigned u_net = net; /* maybe net should be unsigned ? */ - /* Strip trailing zeros */ - while ((u_net & 0xff) == 0 && u_net != 0) - u_net >>= 8; - ne->n_net = u_net; + while ((net & 0xff) == 0 && net != 0) + net >>= 8; + ne->n_net = net; +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif return NS_SUCCESS; } return NS_NOTFOUND; diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index fb6ee4d..f4dcd98 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -122,6 +122,9 @@ again: if (p != NULL) *p++ = '\0'; ne->n_net = inet_network(cp); +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; if (p != NULL) { @@ -191,13 +194,13 @@ found: int _ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) { - unsigned long net; + uint32_t net; int type; struct netent *ne; struct netent_data *ned; int error; - net = va_arg(ap, unsigned long); + net = va_arg(ap, uint32_t); type = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); diff --git a/lib/libc/net/getnetbynis.c b/lib/libc/net/getnetbynis.c index 4725cfb..70785ac 100644 --- a/lib/libc/net/getnetbynis.c +++ b/lib/libc/net/getnetbynis.c @@ -99,6 +99,9 @@ _getnetbynis(const char *name, char *map, int af, struct netent *ne, cp++; ne->n_net = inet_network(cp); +#if __LONG_BIT == 64 + ne->__n_pad0 = 0; /* ABI compatibility */ +#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; @@ -149,22 +152,22 @@ _nis_getnetbyname(void *rval, void *cb_data, va_list ap) } -int +int _nis_getnetbyaddr(void *rval, void *cb_data, va_list ap) { #ifdef YP - unsigned long addr; + uint32_t addr; int af; struct netent *ne; struct netent_data *ned; char *str, *cp; - unsigned long net2; + uint32_t net2; int nn; unsigned int netbr[4]; char buf[MAXDNAME]; int error; - addr = va_arg(ap, unsigned long); + addr = va_arg(ap, uint32_t); af = va_arg(ap, int); ne = va_arg(ap, struct netent *); ned = va_arg(ap, struct netent_data *); diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c index 7b8aaa6..eb8c9ae 100644 --- a/lib/libc/net/getnetnamadr.c +++ b/lib/libc/net/getnetnamadr.c @@ -120,7 +120,8 @@ getnetbyname_r(const char *name, struct netent *ne, struct netent_data *ned) } int -getnetbyaddr_r(u_long addr, int af, struct netent *ne, struct netent_data *ned) +getnetbyaddr_r(uint32_t addr, int af, struct netent *ne, + struct netent_data *ned) { int rval; @@ -164,13 +165,17 @@ getnetbyname(const char *name) } struct netent * -getnetbyaddr(u_long addr, int af) +#if __LONG_BIT == 64 +getnetbyaddr(u_long addr, int af) /* ABI compatibility */ +#else +getnetbyaddr(uint32_t addr, int af) +#endif { struct netdata *nd; if ((nd = __netdata_init()) == NULL) return NULL; - if (getnetbyaddr_r(addr, af, &nd->net, &nd->data) != 0) + if (getnetbyaddr_r((uint32_t)addr, af, &nd->net, &nd->data) != 0) return NULL; return &nd->net; } diff --git a/lib/libc/net/netdb_private.h b/lib/libc/net/netdb_private.h index e5a55ec..0b32780 100644 --- a/lib/libc/net/netdb_private.h +++ b/lib/libc/net/netdb_private.h @@ -28,14 +28,8 @@ #ifndef _NETDB_PRIVATE_H_ #define _NETDB_PRIVATE_H_ -#include <sys/_types.h> #include <stdio.h> /* XXX: for FILE */ -#ifndef _UINT32_T_DECLARED -typedef __uint32_t uint32_t; -#define _UINT32_T_DECLARED -#endif - #define _MAXALIASES 35 #define _MAXLINELEN 1024 #define _MAXADDRS 35 @@ -155,7 +149,7 @@ int gethostbyname_r(const char *, struct hostent *, struct hostent_data *); int gethostbyname2_r(const char *, int, struct hostent *, struct hostent_data *); int gethostent_r(struct hostent *, struct hostent_data *); -int getnetbyaddr_r(unsigned long addr, int af, struct netent *, +int getnetbyaddr_r(uint32_t addr, int af, struct netent *, struct netent_data *); int getnetbyname_r(const char *, struct netent *, struct netent_data *); int getnetent_r(struct netent *, struct netent_data *); |