From a585ba226b0adfc310a49bb5045c3a3096da3da3 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 6 Aug 2002 04:30:03 +0000 Subject: * sysdeps/posix/system.c (do_system): New function, guts broken out of __libc_system. (__libc_system): Call it, putting just the line == NULL test here. * include/libc-symbols.h (__hidden_proto): Add extern keywords so variables work right. * elf/dl-open.c (dl_open_worker): Use _ macro instead of gettext. * elf/dl-close.c (_dl_close): Likewise. * include/netinet/in.h: Use libc_hidden_proto for bindresvport, in6addr_any, in6addr_loopback. Remove decls for bindresvport_internal, in6addr_any_internal, in6addr_loopback_internal. * sunrpc/svc_udp.c (svcudp_bufcreate): Nix INTUSE for bindresvport. * sunrpc/svc_tcp.c (svctcp_create): Likewise. * sunrpc/clnt_udp.c (clntudp_bufcreate): Likewise. * sunrpc/bindrsvprt.c: Change INTDEF to libc_hidden_def. * inet/in6_addr.c: Change INTVARDEF to libc_hidden_def. * sysdeps/posix/getaddrinfo.c (gaih_inet): Nix INTUSE for in6addr_loopback. * inet/gethstbyad_r.c (PREPROCESS): Nix INTUSE for in6addr_any. * include/netinet/ether.h: Use libc_hidden_proto for ether_ntoa_r, ether_aton_r. * inet/ether_aton_r.c: Add libc_hidden_def. * inet/ether_ntoa_r.c: Likewise. * include/rpc/auth.h: Use libc_hidden_proto for getnetname, netname2user, host2netname. * sunrpc/netname.c: Add libc_hidden_def. * include/netdb.h: Use libc_hidden_proto for innetgr, rcmd_af, rexec_af, rresvport_af, ruserok_af. * inet/rcmd.c: Add libc_hidden_def. * inet/getnetgrent_r.c: Likewise. --- ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ elf/dl-close.c | 2 +- elf/dl-open.c | 2 +- include/libc-symbols.h | 4 ++-- include/netdb.h | 6 ++++++ include/netinet/ether.h | 27 +++++++++++++++------------ include/netinet/in.h | 11 ++++++----- include/rpc/auth.h | 4 ++++ inet/ether_aton_r.c | 3 ++- inet/ether_ntoa_r.c | 3 ++- inet/gethstbyad_r.c | 2 +- inet/getnetgrent_r.c | 1 + inet/in6_addr.c | 4 ++-- inet/rcmd.c | 4 ++++ sunrpc/bindrsvprt.c | 2 +- sunrpc/clnt_udp.c | 2 +- sunrpc/netname.c | 3 +++ sunrpc/svc_tcp.c | 2 +- sunrpc/svc_udp.c | 2 +- sysdeps/posix/getaddrinfo.c | 3 +-- sysdeps/posix/system.c | 22 ++++++++++++++-------- 21 files changed, 105 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a4a2dc..344557b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,41 @@ 2002-08-05 Roland McGrath + * sysdeps/posix/system.c (do_system): New function, guts broken out of + __libc_system. + (__libc_system): Call it, putting just the line == NULL test here. + + * include/libc-symbols.h (__hidden_proto): Add extern keywords so + variables work right. + + * elf/dl-open.c (dl_open_worker): Use _ macro instead of gettext. + * elf/dl-close.c (_dl_close): Likewise. + + * include/netinet/in.h: Use libc_hidden_proto for bindresvport, + in6addr_any, in6addr_loopback. Remove decls for + bindresvport_internal, in6addr_any_internal, in6addr_loopback_internal. + * sunrpc/svc_udp.c (svcudp_bufcreate): Nix INTUSE for bindresvport. + * sunrpc/svc_tcp.c (svctcp_create): Likewise. + * sunrpc/clnt_udp.c (clntudp_bufcreate): Likewise. + * sunrpc/bindrsvprt.c: Change INTDEF to libc_hidden_def. + * inet/in6_addr.c: Change INTVARDEF to libc_hidden_def. + * sysdeps/posix/getaddrinfo.c (gaih_inet): Nix INTUSE for + in6addr_loopback. + * inet/gethstbyad_r.c (PREPROCESS): Nix INTUSE for in6addr_any. + + * include/netinet/ether.h: Use libc_hidden_proto for ether_ntoa_r, + ether_aton_r. + * inet/ether_aton_r.c: Add libc_hidden_def. + * inet/ether_ntoa_r.c: Likewise. + + * include/rpc/auth.h: Use libc_hidden_proto for getnetname, + netname2user, host2netname. + * sunrpc/netname.c: Add libc_hidden_def. + + * include/netdb.h: Use libc_hidden_proto for innetgr, rcmd_af, + rexec_af, rresvport_af, ruserok_af. + * inet/rcmd.c: Add libc_hidden_def. + * inet/getnetgrent_r.c: Likewise. + * include/rpc/svc.h: Use libc_hidden_proto for xprt_register, xprt_unregister. * sunrpc/svc.c: Add libc_hidden_def. diff --git a/elf/dl-close.c b/elf/dl-close.c index 342a256..b7b267e 100644 --- a/elf/dl-close.c +++ b/elf/dl-close.c @@ -354,7 +354,7 @@ _dl_close (void *_map) counter. */ if (any_tls) if (__builtin_expect (++GL(dl_tls_generation) == 0, 0)) - __libc_fatal (gettext ("TLS generation counter wrapped! Please send report with the 'glibcbug' script.")); + __libc_fatal (_("TLS generation counter wrapped! Please send report with the 'glibcbug' script.")); #endif /* Notify the debugger those objects are finalized and gone. */ diff --git a/elf/dl-open.c b/elf/dl-open.c index 8605687..5540055 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -433,7 +433,7 @@ dl_open_worker (void *a) /* Bump the generation number if necessary. */ if (any_tls) if (__builtin_expect (++GL(dl_tls_generation) == 0, 0)) - __libc_fatal (gettext ("TLS generation counter wrapped! Please send report with the 'glibcbug' script.")); + __libc_fatal (_("TLS generation counter wrapped! Please send report with the 'glibcbug' script.")); #endif /* Run the initializer functions of new objects. */ diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 0360232..dcc4712 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -450,8 +450,8 @@ # endif # define hidden_proto(name) __hidden_proto (name, __GI_##name) # define __hidden_proto(name, internal) \ - __typeof (name) internal; \ - __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ + extern __typeof (name) internal; \ + extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ __hidden_proto_hiddenattr; # define __hidden_asmname(name) \ __hidden_asmname1 (__USER_LABEL_PREFIX__, name) diff --git a/include/netdb.h b/include/netdb.h index 1f2ab03..a767ca6 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -21,6 +21,12 @@ __set_h_errno (int __err) # define __set_h_errno(x) (h_errno = (x)) # endif /* _LIBC_REENTRANT */ +libc_hidden_proto (innetgr) +libc_hidden_proto (rcmd_af) +libc_hidden_proto (rexec_af) +libc_hidden_proto (rresvport_af) +libc_hidden_proto (ruserok_af) + /* Document internal interfaces. */ extern int __gethostent_r (struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, diff --git a/include/netinet/ether.h b/include/netinet/ether.h index 98947aa..bf01654 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -1,6 +1,9 @@ #ifndef _NETINET_ETHER_H #include +libc_hidden_proto (ether_aton_r) +libc_hidden_proto (ether_ntoa_r) + /* Because the `ethers' lookup does not fit so well in the scheme we define a dummy struct here which helps us to use the available functions. */ @@ -15,18 +18,18 @@ extern int _nss_files_parse_etherent (char *line, struct etherent *result, struct parser_data *data, size_t datalen, int *errnop); -#define DECLARE_NSS_PROTOTYPES(service) \ -extern enum nss_status _nss_ ## service ## _setetherent (int __stayopen); \ -extern enum nss_status _nss_ ## service ## _endetherent (void); \ -extern enum nss_status _nss_ ## service ## _getetherent_r \ - (struct etherent *result, char *buffer, \ - size_t buflen, int *errnop); \ -extern enum nss_status _nss_ ## service ## _gethostton_r \ - (const char *name, struct etherent *eth, \ - char *buffer, size_t buflen, int *errnop); \ -extern enum nss_status _nss_ ## service ## _getntohost_r \ - (const struct ether_addr *addr, \ - struct etherent *eth, \ +#define DECLARE_NSS_PROTOTYPES(service) \ +extern enum nss_status _nss_ ## service ## _setetherent (int __stayopen); \ +extern enum nss_status _nss_ ## service ## _endetherent (void); \ +extern enum nss_status _nss_ ## service ## _getetherent_r \ + (struct etherent *result, char *buffer, \ + size_t buflen, int *errnop); \ +extern enum nss_status _nss_ ## service ## _gethostton_r \ + (const char *name, struct etherent *eth, \ + char *buffer, size_t buflen, int *errnop); \ +extern enum nss_status _nss_ ## service ## _getntohost_r \ + (const struct ether_addr *addr, \ + struct etherent *eth, \ char *buffer, size_t buflen, int *errnop); DECLARE_NSS_PROTOTYPES (files) diff --git a/include/netinet/in.h b/include/netinet/in.h index 356cc96..876f1a4 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -1,8 +1,9 @@ +#ifndef _NETINET_IN_H + #include -extern const struct in6_addr in6addr_any_internal attribute_hidden; -extern const struct in6_addr in6addr_loopback_internal attribute_hidden; +libc_hidden_proto (bindresvport) +libc_hidden_proto (in6addr_loopback) +libc_hidden_proto (in6addr_any) -/* Bind socket to a privileged IP port. */ -extern int bindresvport_internal (int __sockfd, - struct sockaddr_in *__sock_in) attribute_hidden; +#endif diff --git a/include/rpc/auth.h b/include/rpc/auth.h index a32f86d..d0a6dd6 100644 --- a/include/rpc/auth.h +++ b/include/rpc/auth.h @@ -1,6 +1,10 @@ #ifndef _RPC_AUTH_H #include +libc_hidden_proto (getnetname) +libc_hidden_proto (netname2user) +libc_hidden_proto (host2netname) + /* Now define the internal interfaces. */ struct key_netstarg; extern int key_setnet (struct key_netstarg *arg); diff --git a/inet/ether_aton_r.c b/inet/ether_aton_r.c index b2dadd2..1e9f15a 100644 --- a/inet/ether_aton_r.c +++ b/inet/ether_aton_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996,97,98,99,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -61,3 +61,4 @@ ether_aton_r (const char *asc, struct ether_addr *addr) return addr; } +libc_hidden_def (ether_aton_r) diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c index 453240b..c5f347c 100644 --- a/inet/ether_ntoa_r.c +++ b/inet/ether_ntoa_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996,97,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -31,3 +31,4 @@ ether_ntoa_r (const struct ether_addr *addr, char *buf) addr->ether_addr_octet[4], addr->ether_addr_octet[5]); return buf; } +libc_hidden_def (ether_ntoa_r) diff --git a/inet/gethstbyad_r.c b/inet/gethstbyad_r.c index 4d6436f..020ac48 100644 --- a/inet/gethstbyad_r.c +++ b/inet/gethstbyad_r.c @@ -33,7 +33,7 @@ be performed. */ #define PREPROCESS \ if (len == sizeof (struct in6_addr) \ - && __builtin_expect (memcmp (&INTUSE(in6addr_any), addr, \ + && __builtin_expect (memcmp (&in6addr_any, addr, \ sizeof (struct in6_addr)), 1) == 0) \ { \ *h_errnop = HOST_NOT_FOUND; \ diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index 5618758..cab2feb 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -426,3 +426,4 @@ innetgr (const char *netgroup, const char *host, const char *user, return result == 1; } +libc_hidden_def (innetgr) diff --git a/inet/in6_addr.c b/inet/in6_addr.c index 0faf797..347d22e 100644 --- a/inet/in6_addr.c +++ b/inet/in6_addr.c @@ -21,7 +21,7 @@ const struct in6_addr in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; -INTVARDEF(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 } } }; -INTVARDEF(in6addr_loopback) +libc_hidden_def (in6addr_loopback) diff --git a/inet/rcmd.c b/inet/rcmd.c index 8ad6f31..fe77e99 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -398,6 +398,7 @@ bad: freeaddrinfo(res); return -1; } +libc_hidden_def (rcmd_af) int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) @@ -458,6 +459,7 @@ rresvport_af(alport, family) __set_errno (EAGAIN); return -1; } +libc_hidden_def (rresvport_af) int rresvport(alport) @@ -494,6 +496,8 @@ ruserok_af(rhost, superuser, ruser, luser, af) freeaddrinfo(res0); return (ret); } +libc_hidden_def (ruserok_af) + int ruserok(rhost, superuser, ruser, luser) const char *rhost, *ruser, *luser; diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c index ba3309a..3745187 100644 --- a/sunrpc/bindrsvprt.c +++ b/sunrpc/bindrsvprt.c @@ -83,4 +83,4 @@ bindresvport (int sd, struct sockaddr_in *sin) return res; } -INTDEF (bindresvport) +libc_hidden_def (bindresvport) diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index 8f6d269..f906173 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -191,7 +191,7 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, goto fooy; } /* attempt to bind to prov port */ - (void) INTUSE(bindresvport) (*sockp, (struct sockaddr_in *) 0); + (void) bindresvport (*sockp, (struct sockaddr_in *) 0); /* the sockets rpc controls are non-blocking */ (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock); #ifdef IP_RECVERR diff --git a/sunrpc/netname.c b/sunrpc/netname.c index 7fae673..9deb6d2 100644 --- a/sunrpc/netname.c +++ b/sunrpc/netname.c @@ -115,6 +115,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host, sprintf (netname, "%s.%s@%s", OPSYS, hostname, domainname); return 1; } +libc_hidden_def (host2netname) int getnetname (char name[MAXNETNAMELEN + 1]) @@ -129,6 +130,7 @@ getnetname (char name[MAXNETNAMELEN + 1]) dummy = user2netname (name, uid, NULL); return (dummy); } +libc_hidden_def (getnetname) /* Type of the lookup function for netname2user. */ typedef int (*netname2user_function) (const char netname[MAXNETNAMELEN + 1], @@ -174,6 +176,7 @@ netname2user (const char netname[MAXNETNAMELEN + 1], uid_t * uidp, gid_t * gidp, return status == NSS_STATUS_SUCCESS; } +libc_hidden_def (netname2user) int netname2host (const char netname[MAXNETNAMELEN + 1], char *hostname, diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c index 3c5d6a4..4decfa4 100644 --- a/sunrpc/svc_tcp.c +++ b/sunrpc/svc_tcp.c @@ -159,7 +159,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) } __bzero ((char *) &addr, sizeof (addr)); addr.sin_family = AF_INET; - if (INTUSE(bindresvport) (sock, &addr)) + if (bindresvport (sock, &addr)) { addr.sin_port = 0; (void) __bind (sock, (struct sockaddr *) &addr, len); diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c index 669aaeb..0410e9c 100644 --- a/sunrpc/svc_udp.c +++ b/sunrpc/svc_udp.c @@ -132,7 +132,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) } __bzero ((char *) &addr, sizeof (addr)); addr.sin_family = AF_INET; - if (INTUSE(bindresvport) (sock, &addr)) + if (bindresvport (sock, &addr)) { addr.sin_port = 0; (void) __bind (sock, (struct sockaddr *) &addr, len); diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index dc3c89f..cdd1d88 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -539,8 +539,7 @@ gaih_inet (const char *name, const struct gaih_service *service, { at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) - memcpy (at->addr, &INTUSE(in6addr_loopback), - sizeof (struct in6_addr)); + memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr)); atr = at->next; } diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c index e72b977..d7e0bcf 100644 --- a/sysdeps/posix/system.c +++ b/sysdeps/posix/system.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-99,2000,02 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,8 +33,8 @@ #define SHELL_NAME "sh" /* Name to give it. */ /* Execute LINE as a shell command, returning its status. */ -int -__libc_system (const char *line) +static int +do_system (const char *line) { int status, save; pid_t pid; @@ -43,11 +43,6 @@ __libc_system (const char *line) sigset_t block, omask; #endif - if (line == NULL) - /* Check that we have a command processor available. It might - not be available after a chroot(), for example. */ - return __libc_system ("exit 0") == 0; - sa.sa_handler = SIG_IGN; sa.sa_flags = 0; __sigemptyset (&sa.sa_mask); @@ -154,4 +149,15 @@ __libc_system (const char *line) return status; } + +int +__libc_system (const char *line) +{ + if (line == NULL) + /* Check that we have a command processor available. It might + not be available after a chroot(), for example. */ + return do_system ("exit 0") == 0; + + return do_system (line); +} weak_alias (__libc_system, system) -- cgit v1.1