From 1d88b533f61a8e86a0609fd906a86fecfadc6d1a Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sun, 10 Mar 2002 05:15:26 +0000 Subject: [PATCH] Misc tiny tweaks from Sarathy, good for threaded builds. p4raw-id: //depot/perl@15141 --- ext/Socket/Socket.xs | 5 +++-- hints/linux.sh | 2 +- pp_sys.c | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index 79e1dfd..d844775 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -263,8 +263,9 @@ inet_ntoa(ip_address_sv) addrlen, sizeof(addr)); /* We could use inet_ntoa() but that is broken * in HP-UX + GCC + 64bitint (returns "0.0.0.0"), - * so let's use this sprintf() workaround everywhere. */ - New(1138, addr_str, 4 * 3 + 3 + 1, char); + * so let's use this sprintf() workaround everywhere. + * This is also more threadsafe than using inet_ntoa(). */ + New(1138, addr_str, 4 * 3 + 3 + 1, char); /* IPv6? */ sprintf(addr_str, "%d.%d.%d.%d", ((addr.s_addr >> 24) & 0xFF), ((addr.s_addr >> 16) & 0xFF), diff --git a/hints/linux.sh b/hints/linux.sh index 971e491..90bcb78 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -249,7 +249,7 @@ esac cat > UU/usethreads.cbu <<'EOCBU' case "$usethreads" in $define|true|[yY]*) - ccflags="-D_REENTRANT $ccflags" + ccflags="-D_GNU_SOURCE -D_REENTRANT $ccflags" set `echo X "$libswanted "| sed -e 's/ c / pthread c /'` shift libswanted="$*" diff --git a/pp_sys.c b/pp_sys.c index 593fd6c..9bdc4d1 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4618,9 +4618,9 @@ PP(pp_ghostent) register char **elem; register SV *sv; #ifndef HAS_GETHOST_PROTOS /* XXX Do we need individual probes? */ - struct hostent *PerlSock_gethostbyaddr(Netdb_host_t, Netdb_hlen_t, int); - struct hostent *PerlSock_gethostbyname(Netdb_name_t); - struct hostent *PerlSock_gethostent(void); + struct hostent *gethostbyaddr(Netdb_host_t, Netdb_hlen_t, int); + struct hostent *gethostbyname(Netdb_name_t); + struct hostent *gethostent(void); #endif struct hostent *hent; unsigned long len; @@ -4727,9 +4727,9 @@ PP(pp_gnetent) register char **elem; register SV *sv; #ifndef HAS_GETNET_PROTOS /* XXX Do we need individual probes? */ - struct netent *PerlSock_getnetbyaddr(Netdb_net_t, int); - struct netent *PerlSock_getnetbyname(Netdb_name_t); - struct netent *PerlSock_getnetent(void); + struct netent *getnetbyaddr(Netdb_net_t, int); + struct netent *getnetbyname(Netdb_name_t); + struct netent *getnetent(void); #endif struct netent *nent; STRLEN n_a; @@ -4815,9 +4815,9 @@ PP(pp_gprotoent) register char **elem; register SV *sv; #ifndef HAS_GETPROTO_PROTOS /* XXX Do we need individual probes? */ - struct protoent *PerlSock_getprotobyname(Netdb_name_t); - struct protoent *PerlSock_getprotobynumber(int); - struct protoent *PerlSock_getprotoent(void); + struct protoent *getprotobyname(Netdb_name_t); + struct protoent *getprotobynumber(int); + struct protoent *getprotoent(void); #endif struct protoent *pent; STRLEN n_a; @@ -4898,9 +4898,9 @@ PP(pp_gservent) register char **elem; register SV *sv; #ifndef HAS_GETSERV_PROTOS /* XXX Do we need individual probes? */ - struct servent *PerlSock_getservbyname(Netdb_name_t, Netdb_name_t); - struct servent *PerlSock_getservbyport(int, Netdb_name_t); - struct servent *PerlSock_getservent(void); + struct servent *getservbyname(Netdb_name_t, Netdb_name_t); + struct servent *getservbyport(int, Netdb_name_t); + struct servent *getservent(void); #endif struct servent *sent; STRLEN n_a; -- 2.7.4