From 21237865a7b9e4898516678382a98163a9248592 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 7 Dec 2005 00:50:06 +0000 Subject: Hide *clnt|pmap|svc* and some rpc. inet/rpc is full of relocs ... --- libc/inet/rpc/auth_unix.c | 2 +- libc/inet/rpc/clnt_generic.c | 4 + libc/inet/rpc/clnt_perror.c | 211 +++++++++++++++++++++--------------------- libc/inet/rpc/clnt_raw.c | 3 +- libc/inet/rpc/clnt_simple.c | 2 + libc/inet/rpc/clnt_tcp.c | 5 +- libc/inet/rpc/clnt_udp.c | 17 ++-- libc/inet/rpc/clnt_unix.c | 5 +- libc/inet/rpc/get_myaddress.c | 6 +- libc/inet/rpc/getrpcent.c | 103 +++++++++++---------- libc/inet/rpc/pmap_clnt.c | 14 ++- libc/inet/rpc/pmap_getmaps.c | 3 + libc/inet/rpc/pmap_getport.c | 2 + libc/inet/rpc/pmap_rmt.c | 15 +-- libc/inet/rpc/rcmd.c | 2 +- libc/inet/rpc/rexec.c | 10 +- libc/inet/rpc/rpc_prot.c | 3 + libc/inet/rpc/svc.c | 139 +++++++++++++++------------- libc/inet/rpc/svc_run.c | 4 +- libc/inet/rpc/svc_simple.c | 4 + libc/inet/rpc/svc_tcp.c | 4 +- libc/inet/rpc/svc_udp.c | 19 ++-- libc/inet/rpc/svc_unix.c | 4 +- libc/inet/rpc/xdr.c | 22 ++--- 24 files changed, 317 insertions(+), 286 deletions(-) (limited to 'libc/inet/rpc') diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index 9c16774fd..ca4e89bab 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -322,7 +322,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/clnt_generic.c b/libc/inet/rpc/clnt_generic.c index 3e2998477..1b30d2e1c 100644 --- a/libc/inet/rpc/clnt_generic.c +++ b/libc/inet/rpc/clnt_generic.c @@ -30,6 +30,10 @@ * Copyright (C) 1987, Sun Microsystems, Inc. */ +#define clnttcp_create __clnttcp_create +#define clntudp_create __clntudp_create +#define clntunix_create __clntunix_create + #define __FORCE_GLIBC #include diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c index 6561e2631..9173f17af 100644 --- a/libc/inet/rpc/clnt_perror.c +++ b/libc/inet/rpc/clnt_perror.c @@ -71,105 +71,6 @@ _buf (void) return buf; } -/* - * Print reply error info - */ -char * -clnt_sperror (CLIENT * rpch, const char *msg) -{ - char chrbuf[1024]; - struct rpc_err e; - char *err; - char *str = _buf (); - char *strstart = str; - int len; - - if (str == NULL) - return NULL; - CLNT_GETERR (rpch, &e); - - len = sprintf (str, "%s: ", msg); - str += len; - - (void) __strcpy(str, clnt_sperrno(e.re_status)); - str += __strlen(str); - - switch (e.re_status) - { - case RPC_SUCCESS: - case RPC_CANTENCODEARGS: - case RPC_CANTDECODERES: - case RPC_TIMEDOUT: - case RPC_PROGUNAVAIL: - case RPC_PROCUNAVAIL: - case RPC_CANTDECODEARGS: - case RPC_SYSTEMERROR: - case RPC_UNKNOWNHOST: - case RPC_UNKNOWNPROTO: - case RPC_PMAPFAILURE: - case RPC_PROGNOTREGISTERED: - case RPC_FAILED: - break; - - case RPC_CANTSEND: - case RPC_CANTRECV: - 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"), - 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); - - if (err != NULL) - { - (void) __strcpy(str, err); - str += __strlen(str); - } - else - { - 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"), - 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); - str += len; - break; - } - *str = '\n'; - *++str = '\0'; - return (strstart); -} - -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)); - else -#endif - (void) fputs (clnt_sperror (rpch, msg), stderr); -} - - struct rpc_errtab { enum clnt_stat status; @@ -275,8 +176,8 @@ static const struct rpc_errtab rpc_errlist[] = /* * This interface for use by clntrpc */ -char * -clnt_sperrno (enum clnt_stat stat) +char attribute_hidden * +__clnt_sperrno (enum clnt_stat stat) { size_t i; @@ -289,18 +190,118 @@ clnt_sperrno (enum clnt_stat stat) } return _("RPC: (unknown error code)"); } +strong_alias(__clnt_sperrno,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 chrbuf[1024]; + struct rpc_err e; + char *err; + char *str = _buf (); + char *strstart = str; + int len; + + if (str == NULL) + return NULL; + CLNT_GETERR (rpch, &e); + + len = sprintf (str, "%s: ", msg); + str += len; + + (void) __strcpy(str, __clnt_sperrno(e.re_status)); + str += __strlen(str); + + switch (e.re_status) + { + case RPC_SUCCESS: + case RPC_CANTENCODEARGS: + case RPC_CANTDECODERES: + case RPC_TIMEDOUT: + case RPC_PROGUNAVAIL: + case RPC_PROCUNAVAIL: + case RPC_CANTDECODEARGS: + case RPC_SYSTEMERROR: + case RPC_UNKNOWNHOST: + case RPC_UNKNOWNPROTO: + case RPC_PMAPFAILURE: + case RPC_PROGNOTREGISTERED: + case RPC_FAILED: + break; + + case RPC_CANTSEND: + case RPC_CANTRECV: + 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"), + 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); + + if (err != NULL) + { + (void) __strcpy(str, err); + str += __strlen(str); + } + else + { + 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"), + 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); + str += len; + break; + } + *str = '\n'; + *++str = '\0'; + return (strstart); } +strong_alias(__clnt_sperror,clnt_sperror) +void attribute_hidden +__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)); + else +#endif + (void) fputs (__clnt_sperror (rpch, msg), stderr); +} +strong_alias(__clnt_perror,clnt_perror) char attribute_hidden * __clnt_spcreateerror (const char *msg) @@ -316,7 +317,7 @@ __clnt_spcreateerror (const char *msg) ce = &get_rpc_createerr (); len = sprintf (str, "%s: ", msg); cp = str + len; - (void) __strcpy(cp, clnt_sperrno (ce->cf_stat)); + (void) __strcpy(cp, __clnt_sperrno (ce->cf_stat)); cp += __strlen(cp); switch (ce->cf_stat) @@ -325,7 +326,7 @@ __clnt_spcreateerror (const char *msg) (void) __strcpy(cp, " - "); cp += __strlen(cp); - (void) __strcpy(cp, clnt_sperrno (ce->cf_error.re_status)); + (void) __strcpy(cp, __clnt_sperrno (ce->cf_error.re_status)); cp += __strlen(cp); break; diff --git a/libc/inet/rpc/clnt_raw.c b/libc/inet/rpc/clnt_raw.c index 41143496a..1dbbbb8a8 100644 --- a/libc/inet/rpc/clnt_raw.c +++ b/libc/inet/rpc/clnt_raw.c @@ -44,6 +44,7 @@ static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro"; #define authnone_create __authnone_create #define xdrmem_create __xdrmem_create +#define svc_getreq __svc_getreq #define __FORCE_GLIBC #include @@ -116,7 +117,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 dede4a028..9105fc266 100644 --- a/libc/inet/rpc/clnt_simple.c +++ b/libc/inet/rpc/clnt_simple.c @@ -38,6 +38,8 @@ 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 __FORCE_GLIBC #include diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index c04265d8f..99c5751eb 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -122,8 +122,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 * -clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, +CLIENT attribute_hidden * +__clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp, u_int sendsz, u_int recvsz) { CLIENT *h; @@ -239,6 +239,7 @@ fooy: mem_free ((caddr_t) h, sizeof (CLIENT)); return ((CLIENT *) NULL); } +strong_alias(__clnttcp_create,clnttcp_create) static enum clnt_stat clnttcp_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index 4aba505b2..81fe9f7bc 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -129,8 +129,8 @@ struct cu_data * sendsz and recvsz are the maximum allowable packet sizes that can be * sent and received. */ -CLIENT * -clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, +CLIENT attribute_hidden * +__clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version, struct timeval wait, int *sockp, u_int sendsz, u_int recvsz) { @@ -227,19 +227,16 @@ fooy: mem_free ((caddr_t) cl, sizeof (CLIENT)); return (CLIENT *) NULL; } +strong_alias(__clntudp_bufcreate,clntudp_bufcreate) -CLIENT * -clntudp_create (raddr, program, version, wait, sockp) - struct sockaddr_in *raddr; - u_long program; - u_long version; - struct timeval wait; - int *sockp; +CLIENT attribute_hidden * +__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) static int is_network_up (int sock) diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index 3af68d9c8..3dbcc8d36 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -120,8 +120,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 * -clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, +CLIENT attribute_hidden * +__clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, int *sockp, u_int sendsz, u_int recvsz) { CLIENT *h; @@ -218,6 +218,7 @@ fooy: mem_free ((caddr_t) h, sizeof (CLIENT)); return (CLIENT *) NULL; } +strong_alias(__clntunix_create,clntunix_create) static enum clnt_stat clntunix_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c index ef2c2f52e..684e4d7ec 100644 --- a/libc/inet/rpc/get_myaddress.c +++ b/libc/inet/rpc/get_myaddress.c @@ -67,14 +67,14 @@ get_myaddress (struct sockaddr_in *addr) if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - perror ("get_myaddress: socket"); + __perror ("get_myaddress: socket"); exit (1); } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) { - perror (_("get_myaddress: ioctl (get interface configuration)")); + __perror (_("get_myaddress: ioctl (get interface configuration)")); exit (1); } @@ -85,7 +85,7 @@ get_myaddress (struct sockaddr_in *addr) ifreq = *ifr; if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) { - perror ("get_myaddress: ioctl"); + __perror ("get_myaddress: ioctl"); exit (1); } if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET) diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index 47a0b0c13..bc6ab7057 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -73,41 +73,26 @@ static struct rpcdata *_rpcdata(void) return d; } -struct rpcent *getrpcbynumber(register int number) +void attribute_hidden __endrpcent(void) { register struct rpcdata *d = _rpcdata(); - register struct rpcent *rpc; if (d == NULL) - return NULL; - setrpcent(0); - while ((rpc = getrpcent())) { - if (rpc->r_number == number) - break; + return; + if (d->stayopen) + return; + if (d->current) { + free(d->current); + d->current = NULL; } - endrpcent(); - return rpc; -} - -struct rpcent *getrpcbyname(const char *name) -{ - struct rpcent *rpc; - char **rp; - - 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) - return rpc; - } + if (d->rpcf) { + fclose(d->rpcf); + d->rpcf = NULL; } - endrpcent(); - return NULL; } +strong_alias(__endrpcent,endrpcent) -void setrpcent(int f) +void attribute_hidden __setrpcent(int f) { register struct rpcdata *d = _rpcdata(); @@ -122,24 +107,7 @@ void setrpcent(int f) d->current = NULL; d->stayopen |= f; } - -void endrpcent() -{ - register struct rpcdata *d = _rpcdata(); - - if (d == NULL) - return; - if (d->stayopen) - return; - if (d->current) { - free(d->current); - d->current = NULL; - } - if (d->rpcf) { - fclose(d->rpcf); - d->rpcf = NULL; - } -} +strong_alias(__setrpcent,setrpcent) static struct rpcent *interpret(struct rpcdata *); @@ -150,7 +118,7 @@ static struct rpcent *__get_next_rpcent(struct rpcdata *d) return interpret(d); } -struct rpcent *getrpcent() +struct rpcent attribute_hidden *__getrpcent(void) { register struct rpcdata *d = _rpcdata(); @@ -160,6 +128,43 @@ struct rpcent *getrpcent() return NULL; return __get_next_rpcent(d); } +strong_alias(__getrpcent,getrpcent) + +struct rpcent attribute_hidden *__getrpcbynumber(register int number) +{ + register struct rpcdata *d = _rpcdata(); + register struct rpcent *rpc; + + if (d == NULL) + return NULL; + __setrpcent(0); + while ((rpc = __getrpcent())) { + if (rpc->r_number == number) + break; + } + __endrpcent(); + return rpc; +} +strong_alias(__getrpcbynumber,getrpcbynumber) + +struct rpcent attribute_hidden *__getrpcbyname(const char *name) +{ + struct rpcent *rpc; + char **rp; + + __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) + return rpc; + } + } + __endrpcent(); + return NULL; +} +strong_alias(__getrpcbyname,getrpcbyname) #ifdef __linux__ static char *firstwhite(char *s) @@ -319,7 +324,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; } @@ -329,7 +334,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; } @@ -339,7 +344,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/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 39d846f3b..666745442 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -34,6 +34,9 @@ * Client interface to pmap rpc service. */ +#define clnt_perror __clnt_perror +#define clntudp_bufcreate __clntudp_bufcreate + #define __FORCE_GLIBC #include @@ -64,14 +67,14 @@ __get_myaddress (struct sockaddr_in *addr) if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { - perror ("__get_myaddress: socket"); + __perror ("__get_myaddress: socket"); exit (1); } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0) { - perror (_("__get_myaddress: ioctl (get interface configuration)")); + __perror (_("__get_myaddress: ioctl (get interface configuration)")); exit (1); } @@ -82,7 +85,7 @@ __get_myaddress (struct sockaddr_in *addr) ifreq = *ifr; if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0) { - perror ("__get_myaddress: ioctl"); + __perror ("__get_myaddress: ioctl"); exit (1); } if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET) @@ -148,8 +151,8 @@ strong_alias(__pmap_set,pmap_set) * Remove the mapping between program,version and port. * Calls the pmap service remotely to do the un-mapping. */ -bool_t -pmap_unset (u_long program, u_long version) +bool_t attribute_hidden +__pmap_unset (u_long program, u_long version) { struct sockaddr_in myaddress; int socket = -1; @@ -172,3 +175,4 @@ pmap_unset (u_long program, u_long version) /* (void)__close(socket); CLNT_DESTROY already closed it */ return rslt; } +strong_alias(__pmap_unset,pmap_unset) diff --git a/libc/inet/rpc/pmap_getmaps.c b/libc/inet/rpc/pmap_getmaps.c index 4ec2d40e9..84736e03e 100644 --- a/libc/inet/rpc/pmap_getmaps.c +++ b/libc/inet/rpc/pmap_getmaps.c @@ -39,6 +39,9 @@ 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 #include #include diff --git a/libc/inet/rpc/pmap_getport.c b/libc/inet/rpc/pmap_getport.c index 79492747b..1981cfaa1 100644 --- a/libc/inet/rpc/pmap_getport.c +++ b/libc/inet/rpc/pmap_getport.c @@ -38,6 +38,8 @@ 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 #include #include diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 5a78ba2c9..d612bec4d 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; #define authunix_create_default __authunix_create_default #define xdrmem_create __xdrmem_create #define inet_makeaddr __inet_makeaddr +#define clntudp_create __clntudp_create #define __FORCE_GLIBC #include @@ -189,7 +190,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf) ifc.ifc_buf = buf; 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; @@ -198,7 +199,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf) ifreq = *ifr; 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) && @@ -268,14 +269,14 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) */ 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; } @@ -326,7 +327,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; } @@ -351,7 +352,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; @@ -364,7 +365,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; } diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index 43fe44cc2..bd95a7e0c 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -173,7 +173,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)); diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c index b93cf7644..e5e8d42de 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -87,7 +87,7 @@ __rexec_af(char **ahost, int rport, const char *name, const char *pass, const ch retry: 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) { @@ -97,7 +97,7 @@ retry: timo *= 2; goto retry; } - perror(res0->ai_canonname); + __perror(res0->ai_canonname); return (-1); } if (fd2p == 0) { @@ -115,7 +115,7 @@ retry: listen(s2, 1); sa2len = sizeof (sa2); if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) { - perror("getsockname"); + __perror("getsockname"); (void) __close(s2); goto bad; } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) { @@ -134,7 +134,7 @@ retry: s3 = accept(s2, (struct sockaddr *)&from, &len); __close(s2); if (s3 < 0) { - perror("accept"); + __perror("accept"); port = 0; goto bad; } @@ -154,7 +154,7 @@ retry: free ((char *) pass); if (__read(s, &c, 1) != 1) { - perror(*ahost); + __perror(*ahost); goto bad; } if (c != 0) { diff --git a/libc/inet/rpc/rpc_prot.c b/libc/inet/rpc/rpc_prot.c index c64ddf8f0..bbe7b57f2 100644 --- a/libc/inet/rpc/rpc_prot.c +++ b/libc/inet/rpc/rpc_prot.c @@ -44,6 +44,9 @@ 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 __FORCE_GLIBC #include diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index faccab58e..727abcbd8 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -37,6 +37,7 @@ */ #define pmap_set __pmap_set +#define pmap_unset __pmap_unset #define _authenticate _authenticate_internal #define _rpc_dtablesize _rpc_dtablesize_internal @@ -174,8 +175,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 -svc_register (SVCXPRT * xprt, rpcprog_t prog, rpcvers_t vers, +bool_t attribute_hidden +__svc_register (SVCXPRT * xprt, rpcprog_t prog, rpcvers_t vers, void (*dispatch) (struct svc_req *, SVCXPRT *), rpcproc_t protocol) { @@ -205,10 +206,11 @@ pmap_it: return TRUE; } +strong_alias(__svc_register,svc_register) /* Remove a service program from the callout list. */ -void -svc_unregister (rpcprog_t prog, rpcvers_t vers) +void attribute_hidden +__svc_unregister (rpcprog_t prog, rpcvers_t vers) { struct svc_callout *prev; register struct svc_callout *s; @@ -226,6 +228,7 @@ 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) /* ******************* REPLY GENERATION ROUTINES ************ */ @@ -260,8 +263,8 @@ svcerr_noproc (register SVCXPRT *xprt) } /* Can't decode args error reply */ -void -svcerr_decode (register SVCXPRT *xprt) +void attribute_hidden +__svcerr_decode (register SVCXPRT *xprt) { struct rpc_msg rply; @@ -271,6 +274,7 @@ svcerr_decode (register SVCXPRT *xprt) rply.acpted_rply.ar_stat = GARBAGE_ARGS; SVC_REPLY (xprt, &rply); } +strong_alias(__svcerr_decode,svcerr_decode) /* Some system error */ void @@ -307,8 +311,8 @@ svcerr_weakauth (SVCXPRT *xprt) } /* Program unavailable error reply */ -void -svcerr_noprog (register SVCXPRT *xprt) +void attribute_hidden +__svcerr_noprog (register SVCXPRT *xprt) { struct rpc_msg rply; @@ -318,10 +322,11 @@ svcerr_noprog (register SVCXPRT *xprt) rply.acpted_rply.ar_stat = PROG_UNAVAIL; SVC_REPLY (xprt, &rply); } +strong_alias(__svcerr_noprog,svcerr_noprog) /* Program version mismatch error reply */ -void -svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, +void attribute_hidden +__svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, rpcvers_t high_vers) { struct rpc_msg rply; @@ -334,6 +339,7 @@ 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) /* ******************* SERVER INPUT STUFF ******************* */ @@ -353,58 +359,8 @@ svcerr_progvers (register SVCXPRT *xprt, rpcvers_t low_vers, * is mallocated in kernel land. */ -void -svc_getreq (int rdfds) -{ - fd_set readfds; - - FD_ZERO (&readfds); - readfds.fds_bits[0] = rdfds; - svc_getreqset (&readfds); -} - -void -svc_getreqset (fd_set *readfds) -{ - register u_int32_t mask; - register u_int32_t *maskp; - register int setsize; - register int sock; - register int bit; - - setsize = _rpc_dtablesize (); - 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); -} - -void -svc_getreq_poll (struct pollfd *pfdp, int pollretval) -{ - register int i; - register int fds_found; - - for (i = fds_found = 0; i < svc_max_pollfd && fds_found < pollretval; ++i) - { - register struct pollfd *p = &pfdp[i]; - - if (p->fd != -1 && p->revents) - { - /* fd has input waiting */ - ++fds_found; - - if (p->revents & POLLNVAL) - xprt_unregister (xports[p->fd]); - else - svc_getreq_common (p->fd); - } - } -} - - -void -svc_getreq_common (const int fd) +void attribute_hidden +__svc_getreq_common (const int fd) { enum xprt_stat stat; struct rpc_msg msg; @@ -478,9 +434,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: @@ -492,6 +448,59 @@ svc_getreq_common (const int fd) } while (stat == XPRT_MOREREQS); } +strong_alias(__svc_getreq_common,svc_getreq_common) + +void attribute_hidden +__svc_getreqset (fd_set *readfds) +{ + register u_int32_t mask; + register u_int32_t *maskp; + register int setsize; + register int sock; + register int bit; + + setsize = _rpc_dtablesize (); + 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); +} +strong_alias(__svc_getreqset,svc_getreqset) + +void attribute_hidden +__svc_getreq (int rdfds) +{ + fd_set readfds; + + FD_ZERO (&readfds); + readfds.fds_bits[0] = rdfds; + __svc_getreqset (&readfds); +} +strong_alias(__svc_getreq,svc_getreq) + +void attribute_hidden +__svc_getreq_poll (struct pollfd *pfdp, int pollretval) +{ + register int i; + register int fds_found; + + for (i = fds_found = 0; i < svc_max_pollfd && fds_found < pollretval; ++i) + { + register struct pollfd *p = &pfdp[i]; + + if (p->fd != -1 && p->revents) + { + /* fd has input waiting */ + ++fds_found; + + if (p->revents & POLLNVAL) + xprt_unregister (xports[p->fd]); + else + __svc_getreq_common (p->fd); + } + } +} +strong_alias(__svc_getreq_poll,svc_getreq_poll) #ifdef __UCLIBC_HAS_THREADS__ @@ -500,7 +509,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_run.c b/libc/inet/rpc/svc_run.c index c0d3b34f0..b46320871 100644 --- a/libc/inet/rpc/svc_run.c +++ b/libc/inet/rpc/svc_run.c @@ -31,6 +31,8 @@ * Wait for input, call server program. */ +#define svc_getreq_poll __svc_getreq_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 @@ -80,7 +82,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 e9a43b97a..e0509be70 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -39,6 +39,10 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; */ #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 __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index 20deb8719..58c8ed1fd 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -159,7 +159,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) { 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; @@ -174,7 +174,7 @@ 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); return (SVCXPRT *) NULL; diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index ab6f96ee1..019e40273 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -115,10 +115,8 @@ struct svcudp_data * see (svc.h, xprt_register). * The routines returns NULL if a problem occurred. */ -SVCXPRT * -svcudp_bufcreate (sock, sendsz, recvsz) - int sock; - u_int sendsz, recvsz; +SVCXPRT attribute_hidden * +__svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) { bool_t madesock = FALSE; SVCXPRT *xprt; @@ -132,7 +130,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) { 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; @@ -146,7 +144,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) } if (getsockname (sock, (struct sockaddr *) &addr, &len) != 0) { - perror (_("svcudp_create - cannot getsockname")); + __perror (_("svcudp_create - cannot getsockname")); if (madesock) (void) __close (sock); return (SVCXPRT *) NULL; @@ -206,14 +204,15 @@ svcudp_bufcreate (sock, sendsz, recvsz) xprt_register (xprt); return xprt; } +strong_alias(__svcudp_bufcreate,svcudp_bufcreate) -SVCXPRT * -svcudp_create (sock) - int sock; +SVCXPRT attribute_hidden * +__svcudp_create (int sock) { - return svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE); + return __svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE); } +strong_alias(__svcudp_create,svcudp_create) static enum xprt_stat svcudp_stat (xprt) diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c index bc4cb2c20..0b7d964fd 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -154,7 +154,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) { 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; @@ -170,7 +170,7 @@ 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); return (SVCXPRT *) NULL; diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c index 46e214431..c608cd27f 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -519,12 +519,8 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) * *cpp is a pointer to the bytes, *sizep is the count. * If *cpp is NULL maxsize bytes are allocated */ -bool_t -xdr_bytes (xdrs, cpp, sizep, maxsize) - XDR *xdrs; - char **cpp; - u_int *sizep; - u_int maxsize; +bool_t attribute_hidden +__xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int nodesize; @@ -581,6 +577,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize) } return FALSE; } +strong_alias(__xdr_bytes,xdr_bytes) /* * Implemented here due to commonality of the object. @@ -591,7 +588,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); } /* @@ -605,13 +602,8 @@ xdr_netobj (xdrs, np) * routine may be called. * If there is no specific or default routine an error is returned. */ -bool_t -xdr_union (xdrs, dscmp, unp, choices, dfault) - XDR *xdrs; - enum_t *dscmp; /* enum to decide which arm to work on */ - char *unp; /* the union itself */ - const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */ - xdrproc_t dfault; /* default xdr routine */ +bool_t attribute_hidden +__xdr_union (XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault) { enum_t dscm; @@ -640,7 +632,7 @@ xdr_union (xdrs, dscmp, unp, choices, dfault) return ((dfault == NULL_xdrproc_t) ? FALSE : (*dfault) (xdrs, unp, LASTUNSIGNED)); } - +strong_alias(__xdr_union,xdr_union) /* * Non-portable xdr primitives. -- cgit v1.2.3