diff options
Diffstat (limited to 'libc')
61 files changed, 746 insertions, 552 deletions
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index c467fed69..e896e3449 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -45,7 +45,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* 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 #if 0 +#define uname __uname #define stpcpy __stpcpy /* strdupa is using these */ #define memcpy __memcpy @@ -767,8 +771,8 @@ static struct gaih gaih[] = { PF_UNSPEC, NULL } }; -int -getaddrinfo (const char *name, const char *service, +int attribute_hidden +__getaddrinfo (const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) { int i = 0, j = 0, last_i = 0; @@ -866,6 +870,7 @@ getaddrinfo (const char *name, const char *service, return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } +strong_alias(__getaddrinfo,getaddrinfo) void freeaddrinfo (struct addrinfo *ai) diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index a5ebcb3e9..adb83a5ca 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -91,7 +91,7 @@ static void __initbuf(void) } } -void setprotoent(int f) +void attribute_hidden __setprotoent(int f) { LOCK; if (protof == NULL) @@ -101,8 +101,9 @@ void setprotoent(int f) proto_stayopen |= f; UNLOCK; } +strong_alias(__setprotoent,setprotoent) -void endprotoent(void) +void attribute_hidden __endprotoent(void) { LOCK; if (protof) { @@ -112,8 +113,9 @@ void endprotoent(void) proto_stayopen = 0; UNLOCK; } +strong_alias(__endprotoent,endprotoent) -int getprotoent_r(struct protoent *result_buf, +int attribute_hidden __getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) { @@ -189,18 +191,19 @@ again: UNLOCK; return 0; } +strong_alias(__getprotoent_r,getprotoent_r) struct protoent * getprotoent(void) { struct protoent *result; __initbuf(); - getprotoent_r(&proto, static_aliases, SBUFSIZE, &result); + __getprotoent_r(&proto, static_aliases, SBUFSIZE, &result); return result; } -int getprotobyname_r(const char *name, +int attribute_hidden __getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) @@ -209,8 +212,8 @@ int getprotobyname_r(const char *name, int ret; LOCK; - setprotoent(proto_stayopen); - while (!(ret=getprotoent_r(result_buf, buf, buflen, result))) { + __setprotoent(proto_stayopen); + while (!(ret=__getprotoent_r(result_buf, buf, buflen, result))) { if (__strcmp(result_buf->p_name, name) == 0) break; for (cp = result_buf->p_aliases; *cp != 0; cp++) @@ -219,10 +222,11 @@ int getprotobyname_r(const char *name, } found: if (!proto_stayopen) - endprotoent(); + __endprotoent(); UNLOCK; return *result?0:ret; } +strong_alias(__getprotobyname_r,getprotobyname_r) struct protoent * getprotobyname(const char *name) @@ -230,12 +234,12 @@ struct protoent * getprotobyname(const char *name) struct protoent *result; __initbuf(); - getprotobyname_r(name, &proto, static_aliases, SBUFSIZE, &result); + __getprotobyname_r(name, &proto, static_aliases, SBUFSIZE, &result); return result; } -int getprotobynumber_r (int proto_num, +int attribute_hidden __getprotobynumber_r (int proto_num, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result) @@ -243,22 +247,23 @@ int getprotobynumber_r (int proto_num, int ret; LOCK; - setprotoent(proto_stayopen); - while (!(ret=getprotoent_r(result_buf, buf, buflen, result))) + __setprotoent(proto_stayopen); + while (!(ret=__getprotoent_r(result_buf, buf, buflen, result))) if (result_buf->p_proto == proto_num) break; if (!proto_stayopen) - endprotoent(); + __endprotoent(); UNLOCK; return *result?0:ret; } +strong_alias(__getprotobynumber_r,getprotobynumber_r) struct protoent * getprotobynumber(int proto_num) { struct protoent *result; __initbuf(); - getprotobynumber_r(proto_num, &proto, static_aliases, + __getprotobynumber_r(proto_num, &proto, static_aliases, SBUFSIZE, &result); return result; } diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c index 1a3e05113..bc9576e74 100644 --- a/libc/inet/hostid.c +++ b/libc/inet/hostid.c @@ -1,5 +1,7 @@ #define geteuid __geteuid #define getuid __getuid +#define gethostbyname __gethostbyname +#define gethostname __gethostname #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 31f5456e7..af38c14a5 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -138,6 +138,8 @@ #define strstr __strstr #define random __random #define getservbyport __getservbyport +#define getdomainname __getdomainname +#define uname __uname #define __FORCE_GLIBC #include <features.h> @@ -159,6 +161,14 @@ #include <sys/utsname.h> #include <sys/un.h> +extern int __gethostbyname_r (__const char *__restrict __name, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop) attribute_hidden; + +extern struct hostent *__gethostbyaddr (__const void *__addr, __socklen_t __len, + int __type) attribute_hidden; #define MAX_RECURSE 5 #define REPLY_TIMEOUT 10 #define MAX_RETRIES 3 @@ -1069,7 +1079,7 @@ void attribute_hidden __close_nameservers(void) #ifdef L_gethostbyname -struct hostent *gethostbyname(const char *name) +struct hostent attribute_hidden *__gethostbyname(const char *name) { static struct hostent h; static char buf[sizeof(struct in_addr) + @@ -1077,18 +1087,29 @@ struct hostent *gethostbyname(const char *name) sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno); + __gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno); return hp; } +strong_alias(__gethostbyname,gethostbyname) #endif #ifdef L_gethostbyname2 +#ifndef __UCLIBC_HAS_IPV6__ +extern struct hostent *__gethostbyname (__const char *__name) attribute_hidden; +#else +extern int __gethostbyname2_r (__const char *__restrict __name, int __af, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop) attribute_hidden; +#endif + struct hostent *gethostbyname2(const char *name, int family) { #ifndef __UCLIBC_HAS_IPV6__ - return family == AF_INET ? gethostbyname(name) : (struct hostent*)0; + return family == AF_INET ? __gethostbyname(name) : (struct hostent*)0; #else /* __UCLIBC_HAS_IPV6__ */ static struct hostent h; static char buf[sizeof(struct in6_addr) + @@ -1096,7 +1117,7 @@ struct hostent *gethostbyname2(const char *name, int family) sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno); + __gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno); return hp; #endif /* __UCLIBC_HAS_IPV6__ */ @@ -1106,22 +1127,11 @@ struct hostent *gethostbyname2(const char *name, int family) #ifdef L_res_init -#undef _res struct __res_state _res; -struct __res_state * weak_const_function __res_state (void) -{ - return &_res; -} - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include <tls.h> -__thread struct __res_state *__resp = &_res; -#endif - int res_init(void) { - struct __res_state *rp = __res_state(); + struct __res_state *rp = &(_res); __close_nameservers(); __open_nameservers(); @@ -1416,7 +1426,14 @@ int res_querydomain(name, domain, class, type, answer, anslen) #endif #ifdef L_gethostbyaddr -struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type) +extern int __gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len, + int __type, + struct hostent *__restrict __result_buf, + char *__restrict __buf, size_t __buflen, + struct hostent **__restrict __result, + int *__restrict __h_errnop) attribute_hidden; + +struct hostent attribute_hidden *__gethostbyaddr (const void *addr, socklen_t len, int type) { static struct hostent h; static char buf[ @@ -1428,10 +1445,11 @@ struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type) sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */]; struct hostent *hp; - gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno); + __gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno); return hp; } +strong_alias(__gethostbyaddr,gethostbyaddr) #endif @@ -1546,7 +1564,7 @@ int attribute_hidden __read_etc_hosts_r(FILE * fp, const char * name, int type, } else { /* GET_HOSTS_BYNAME */ for (i = 1; i < aliases; i++) - if (strcasecmp(name, alias[i]) == 0) + if (__strcasecmp(name, alias[i]) == 0) break; if (i >= aliases) continue; @@ -1717,7 +1735,7 @@ int attribute_hidden __get_hosts_byaddr_r(const char * addr, int len, int type, # define min(x,y) (((x) > (y)) ? (y) : (x)) #endif /* min */ -int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, +int attribute_hidden __getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) { @@ -1758,12 +1776,12 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (!(flags & NI_NUMERICHOST)) { #ifdef __UCLIBC_HAS_IPV6__ if (sa->sa_family == AF_INET6) - h = gethostbyaddr ((const void *) + h = __gethostbyaddr ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), sizeof(struct in6_addr), AF_INET6); else #endif /* __UCLIBC_HAS_IPV6__ */ - h = gethostbyaddr ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), + h = __gethostbyaddr ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), sizeof(struct in_addr), AF_INET); if (h) { @@ -1903,12 +1921,13 @@ int getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, errno = serrno; return 0; } +strong_alias(__getnameinfo,getnameinfo) #endif #ifdef L_gethostbyname_r -int gethostbyname_r(const char * name, +int attribute_hidden __gethostbyname_r(const char * name, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, @@ -2057,18 +2076,19 @@ int gethostbyname_r(const char * name, *h_errnop = NETDB_SUCCESS; return NETDB_SUCCESS; } +strong_alias(__gethostbyname_r,gethostbyname_r) #endif #ifdef L_gethostbyname2_r -int gethostbyname2_r(const char *name, int family, +int attribute_hidden __gethostbyname2_r(const char *name, int family, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, int * h_errnop) { #ifndef __UCLIBC_HAS_IPV6__ - return family == (AF_INET)? gethostbyname_r(name, result_buf, + return family == (AF_INET)? __gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop) : HOST_NOT_FOUND; #else /* __UCLIBC_HAS_IPV6__ */ struct in6_addr *in; @@ -2081,7 +2101,7 @@ int gethostbyname2_r(const char *name, int family, char ** __nameserverXX; if (family == AF_INET) - return gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop); + return __gethostbyname_r(name, result_buf, buf, buflen, result, h_errnop); if (family != AF_INET6) return EINVAL; @@ -2199,10 +2219,11 @@ int gethostbyname2_r(const char *name, int family, return NETDB_SUCCESS; #endif /* __UCLIBC_HAS_IPV6__ */ } +strong_alias(__gethostbyname2_r,gethostbyname2_r) #endif #ifdef L_gethostbyaddr_r -int gethostbyaddr_r (const void *addr, socklen_t len, int type, +int attribute_hidden __gethostbyaddr_r (const void *addr, socklen_t len, int type, struct hostent * result_buf, char * buf, size_t buflen, struct hostent ** result, @@ -2383,6 +2404,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type, *h_errnop = NETDB_SUCCESS; return NETDB_SUCCESS; } +strong_alias(__gethostbyaddr_r,gethostbyaddr_r) #endif #ifdef L_res_comp diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c index 9d1d42d03..b2e23924c 100644 --- a/libc/inet/rpc/auth_none.c +++ b/libc/inet/rpc/auth_none.c @@ -36,6 +36,7 @@ */ #define xdrmem_create __xdrmem_create +#define xdr_opaque_auth __xdr_opaque_auth #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index 9c16774fd..87852f36e 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -41,7 +41,11 @@ #define sysconf __sysconf #define getegid __getegid #define geteuid __geteuid +#define getgroups __getgroups +#define gethostname __gethostname #define xdrmem_create __xdrmem_create +#define xdr_authunix_parms __xdr_authunix_parms +#define xdr_opaque_auth __xdr_opaque_auth #define __FORCE_GLIBC #include <features.h> @@ -322,7 +326,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/authunix_prot.c b/libc/inet/rpc/authunix_prot.c index b033c568a..32da3256d 100644 --- a/libc/inet/rpc/authunix_prot.c +++ b/libc/inet/rpc/authunix_prot.c @@ -34,6 +34,11 @@ * XDR for UNIX style authentication parameters for RPC */ +#define xdr_string __xdr_string +#define xdr_u_int __xdr_u_int +#define xdr_array __xdr_array +#define xdr_u_long __xdr_u_long + #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/auth.h> @@ -43,8 +48,8 @@ * XDR for unix authentication parameters. * Unfortunately, none of these can be declared const. */ -bool_t -xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) +bool_t attribute_hidden +__xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) { if (xdr_u_long (xdrs, &(p->aup_time)) && xdr_string (xdrs, &(p->aup_machname), MAX_MACHINE_NAME) @@ -63,3 +68,4 @@ xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) } return FALSE; } +strong_alias(__xdr_authunix_parms,xdr_authunix_parms) diff --git a/libc/inet/rpc/clnt_generic.c b/libc/inet/rpc/clnt_generic.c index 3e2998477..518ca0fa8 100644 --- a/libc/inet/rpc/clnt_generic.c +++ b/libc/inet/rpc/clnt_generic.c @@ -30,6 +30,12 @@ * Copyright (C) 1987, Sun Microsystems, Inc. */ +#define clnttcp_create __clnttcp_create +#define clntudp_create __clntudp_create +#define clntunix_create __clntunix_create +#define getprotobyname_r __getprotobyname_r +#define gethostbyname_r __gethostbyname_r + #define __FORCE_GLIBC #include <features.h> 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..aa7b44bb4 100644 --- a/libc/inet/rpc/clnt_raw.c +++ b/libc/inet/rpc/clnt_raw.c @@ -44,6 +44,11 @@ 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 xdr_callhdr __xdr_callhdr +#define xdr_replymsg __xdr_replymsg +#define xdr_opaque_auth __xdr_opaque_auth +#define svc_getreq __svc_getreq +#define _seterr_reply __seterr_reply #define __FORCE_GLIBC #include <features.h> @@ -116,7 +121,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..7c17dc1f1 100644 --- a/libc/inet/rpc/clnt_simple.c +++ b/libc/inet/rpc/clnt_simple.c @@ -38,6 +38,9 @@ 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 gethostbyname_r __gethostbyname_r + #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index c04265d8f..f006c3383 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -52,8 +52,14 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrrec_endofrecord __xdrrec_endofrecord +#define xdrrec_skiprecord __xdrrec_skiprecord +#define xdr_callhdr __xdr_callhdr +#define xdr_replymsg __xdr_replymsg +#define xdr_opaque_auth __xdr_opaque_auth #define xdrmem_create __xdrmem_create #define pmap_getport __pmap_getport +#define _seterr_reply __seterr_reply #define __FORCE_GLIBC #include <features.h> @@ -122,8 +128,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 +245,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..c59a119b9 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -42,8 +42,11 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #define authnone_create __authnone_create #define xdrmem_create __xdrmem_create - +#define xdr_callhdr __xdr_callhdr +#define xdr_replymsg __xdr_replymsg +#define xdr_opaque_auth __xdr_opaque_auth #define pmap_getport __pmap_getport +#define _seterr_reply __seterr_reply #define __FORCE_GLIBC #include <features.h> @@ -69,7 +72,6 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include <sys/uio.h> #endif -extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); extern u_long _create_xid (void) attribute_hidden; /* @@ -129,8 +131,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 +229,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..efdd39005 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -48,9 +48,15 @@ #define authnone_create __authnone_create #define xdrrec_create __xdrrec_create +#define xdrrec_endofrecord __xdrrec_endofrecord +#define xdrrec_skiprecord __xdrrec_skiprecord +#define xdr_callhdr __xdr_callhdr +#define xdr_replymsg __xdr_replymsg +#define xdr_opaque_auth __xdr_opaque_auth #define xdrmem_create __xdrmem_create #define getegid __getegid #define geteuid __geteuid +#define _seterr_reply __seterr_reply #define __FORCE_GLIBC #include <features.h> @@ -120,8 +126,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 +224,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/getrpcport.c b/libc/inet/rpc/getrpcport.c index 518d190f8..48e58d9ab 100644 --- a/libc/inet/rpc/getrpcport.c +++ b/libc/inet/rpc/getrpcport.c @@ -36,6 +36,7 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; */ #define pmap_getport __pmap_getport +#define gethostbyname_r __gethostbyname_r #define __FORCE_GLIBC #include <features.h> diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c index 39d846f3b..dbd3e3198 100644 --- a/libc/inet/rpc/pmap_clnt.c +++ b/libc/inet/rpc/pmap_clnt.c @@ -34,6 +34,10 @@ * Client interface to pmap rpc service. */ +#define clnt_perror __clnt_perror +#define clntudp_bufcreate __clntudp_bufcreate +#define xdr_bool __xdr_bool + #define __FORCE_GLIBC #include <features.h> @@ -64,14 +68,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 +86,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 +152,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 +176,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 <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> 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 <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> diff --git a/libc/inet/rpc/pmap_prot.c b/libc/inet/rpc/pmap_prot.c index c065dadfe..388c8aeee 100644 --- a/libc/inet/rpc/pmap_prot.c +++ b/libc/inet/rpc/pmap_prot.c @@ -38,6 +38,8 @@ static char sccsid[] = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdr_u_long __xdr_u_long + #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/pmap_prot.h> diff --git a/libc/inet/rpc/pmap_prot2.c b/libc/inet/rpc/pmap_prot2.c index 7dad1604f..655400f0c 100644 --- a/libc/inet/rpc/pmap_prot2.c +++ b/libc/inet/rpc/pmap_prot2.c @@ -38,6 +38,9 @@ static char sccsid[] = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#define xdr_bool __xdr_bool +#define xdr_reference __xdr_reference + #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/pmap_prot.h> diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 5a78ba2c9..8a42d78ee 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -41,7 +41,12 @@ 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 xdr_callmsg __xdr_callmsg +#define xdr_replymsg __xdr_replymsg +#define xdr_reference __xdr_reference +#define xdr_u_long __xdr_u_long #define inet_makeaddr __inet_makeaddr +#define clntudp_create __clntudp_create #define __FORCE_GLIBC #include <features.h> @@ -68,6 +73,37 @@ extern u_long _create_xid (void) attribute_hidden; static const struct timeval timeout = {3, 0}; /* + * XDR remote call arguments + * written for XDR_ENCODE direction only + */ +bool_t attribute_hidden +__xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) +{ + u_int lenposition, argposition, position; + + if (xdr_u_long (xdrs, &(cap->prog)) && + xdr_u_long (xdrs, &(cap->vers)) && + xdr_u_long (xdrs, &(cap->proc))) + { + lenposition = XDR_GETPOS (xdrs); + if (!xdr_u_long (xdrs, &(cap->arglen))) + return FALSE; + argposition = XDR_GETPOS (xdrs); + if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) + return FALSE; + position = XDR_GETPOS (xdrs); + cap->arglen = (u_long) position - (u_long) argposition; + XDR_SETPOS (xdrs, lenposition); + if (!xdr_u_long (xdrs, &(cap->arglen))) + return FALSE; + XDR_SETPOS (xdrs, position); + return TRUE; + } + return FALSE; +} +strong_alias(__xdr_rmtcall_args,xdr_rmtcall_args) + +/* * pmapper remote-call-service interface. * This routine is used to call the pmapper remote call service * which will look up a service program in the port maps, and then @@ -101,7 +137,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p r.port_ptr = port_ptr; r.results_ptr = resp; r.xdr_results = xdrres; - stat = CLNT_CALL (client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, + stat = CLNT_CALL (client, PMAPPROC_CALLIT, (xdrproc_t)__xdr_rmtcall_args, (caddr_t)&a, (xdrproc_t)xdr_rmtcallres, (caddr_t)&r, tout); CLNT_DESTROY (client); @@ -117,36 +153,6 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p /* - * XDR remote call arguments - * written for XDR_ENCODE direction only - */ -bool_t -xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) -{ - u_int lenposition, argposition, position; - - if (xdr_u_long (xdrs, &(cap->prog)) && - xdr_u_long (xdrs, &(cap->vers)) && - xdr_u_long (xdrs, &(cap->proc))) - { - lenposition = XDR_GETPOS (xdrs); - if (!xdr_u_long (xdrs, &(cap->arglen))) - return FALSE; - argposition = XDR_GETPOS (xdrs); - if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) - return FALSE; - position = XDR_GETPOS (xdrs); - cap->arglen = (u_long) position - (u_long) argposition; - XDR_SETPOS (xdrs, lenposition); - if (!xdr_u_long (xdrs, &(cap->arglen))) - return FALSE; - XDR_SETPOS (xdrs, position); - return TRUE; - } - return FALSE; -} - -/* * XDR remote call results * written for XDR_DECODE direction only */ @@ -189,7 +195,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 +204,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 +274,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; } @@ -306,7 +312,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) r.xdr_results = xresults; r.results_ptr = resultsp; xdrmem_create (xdrs, outbuf, MAX_BROADCAST_SIZE, XDR_ENCODE); - if ((!xdr_callmsg (xdrs, &msg)) || (!xdr_rmtcall_args (xdrs, &a))) + if ((!xdr_callmsg (xdrs, &msg)) || (!__xdr_rmtcall_args (xdrs, &a))) { stat = RPC_CANTENCODEARGS; goto done_broad; @@ -326,7 +332,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 +357,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 +370,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..bbcc7b354 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -39,6 +39,10 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define sysconf __sysconf #define getline __getline #define geteuid __geteuid +#define seteuid __seteuid +#define getpwnam_r __getpwnam_r +#define gethostbyname __gethostbyname +#define gethostbyname_r __gethostbyname_r #define __FORCE_GLIBC #include <features.h> @@ -173,7 +177,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..98a8bf32e 100644 --- a/libc/inet/rpc/rexec.c +++ b/libc/inet/rpc/rexec.c @@ -27,6 +27,10 @@ * SUCH DAMAGE. */ +#define getnameinfo __getnameinfo +#define getaddrinfo __getaddrinfo +#define getsockname __getsockname + #define __FORCE_GLIBC #include <features.h> #include <sys/types.h> @@ -87,7 +91,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 +101,7 @@ retry: timo *= 2; goto retry; } - perror(res0->ai_canonname); + __perror(res0->ai_canonname); return (-1); } if (fd2p == 0) { @@ -115,7 +119,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 +138,7 @@ retry: s3 = accept(s2, (struct sockaddr *)&from, &len); __close(s2); if (s3 < 0) { - perror("accept"); + __perror("accept"); port = 0; goto bad; } @@ -154,7 +158,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_callmsg.c b/libc/inet/rpc/rpc_callmsg.c index 8934eed91..6368e5920 100644 --- a/libc/inet/rpc/rpc_callmsg.c +++ b/libc/inet/rpc/rpc_callmsg.c @@ -38,6 +38,12 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; * */ +#define xdr_enum __xdr_enum +#define xdr_opaque __xdr_opaque +#define xdr_u_int __xdr_u_int +#define xdr_u_long __xdr_u_long +#define xdr_opaque_auth __xdr_opaque_auth + #define __FORCE_GLIBC #include <features.h> @@ -48,8 +54,8 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; /* * XDR a call message */ -bool_t -xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) +bool_t attribute_hidden +__xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) { int32_t *buf; struct opaque_auth *oa; @@ -204,3 +210,4 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) return xdr_opaque_auth (xdrs, &(cmsg->rm_call.cb_verf)); return FALSE; } +strong_alias(__xdr_callmsg,xdr_callmsg) diff --git a/libc/inet/rpc/rpc_prot.c b/libc/inet/rpc/rpc_prot.c index c64ddf8f0..afc1dccd1 100644 --- a/libc/inet/rpc/rpc_prot.c +++ b/libc/inet/rpc/rpc_prot.c @@ -44,6 +44,12 @@ 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 xdr_enum __xdr_enum +#define xdr_opaque __xdr_opaque +#define xdr_u_long __xdr_u_long + #define __FORCE_GLIBC #include <features.h> @@ -57,8 +63,8 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; * XDR an opaque authentication struct * (see auth.h) */ -bool_t -xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) +bool_t attribute_hidden +__xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) { if (xdr_enum (xdrs, &(ap->oa_flavor))) @@ -66,6 +72,7 @@ xdr_opaque_auth (XDR *xdrs, struct opaque_auth *ap) &ap->oa_length, MAX_AUTH_BYTES); return FALSE; } +strong_alias(__xdr_opaque_auth,xdr_opaque_auth) /* * XDR a DES block @@ -85,7 +92,7 @@ bool_t xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar) { /* personalized union, rather than calling xdr_union */ - if (!xdr_opaque_auth (xdrs, &(ar->ar_verf))) + if (!__xdr_opaque_auth (xdrs, &(ar->ar_verf))) return FALSE; if (!xdr_enum (xdrs, (enum_t *) & (ar->ar_stat))) return FALSE; @@ -134,10 +141,8 @@ static const struct xdr_discrim reply_dscrm[3] = /* * XDR a reply message */ -bool_t -xdr_replymsg (xdrs, rmsg) - XDR *xdrs; - struct rpc_msg *rmsg; +bool_t attribute_hidden +__xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg) { if (xdr_u_long (xdrs, &(rmsg->rm_xid)) && xdr_enum (xdrs, (enum_t *) & (rmsg->rm_direction)) && @@ -147,6 +152,7 @@ xdr_replymsg (xdrs, rmsg) NULL_xdrproc_t); return FALSE; } +strong_alias(__xdr_replymsg,xdr_replymsg) /* @@ -154,10 +160,8 @@ xdr_replymsg (xdrs, rmsg) * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. * The rm_xid is not really static, but the user can easily munge on the fly. */ -bool_t -xdr_callhdr (xdrs, cmsg) - XDR *xdrs; - struct rpc_msg *cmsg; +bool_t attribute_hidden +__xdr_callhdr (XDR *xdrs, struct rpc_msg *cmsg) { cmsg->rm_direction = CALL; @@ -171,6 +175,7 @@ xdr_callhdr (xdrs, cmsg) return xdr_u_long (xdrs, &(cmsg->rm_call.cb_vers)); return FALSE; } +strong_alias(__xdr_callhdr,xdr_callhdr) /* ************************** Client utility routine ************* */ @@ -235,8 +240,8 @@ rejected (enum reject_stat rjct_stat, /* * given a reply message, fills in the error */ -void -_seterr_reply (struct rpc_msg *msg, +void attribute_hidden +__seterr_reply (struct rpc_msg *msg, struct rpc_err *error) { /* optimized for normal, SUCCESSful case */ @@ -280,3 +285,4 @@ _seterr_reply (struct rpc_msg *msg, break; } } +strong_alias(__seterr_reply,_seterr_reply) diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index b6fd482c5..3c48122ac 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -32,6 +32,7 @@ #define getuid __getuid #define getegid __getegid #define geteuid __geteuid +#define gethostname __gethostname #define __FORCE_GLIBC #include <features.h> @@ -149,18 +150,11 @@ next: * or official hostname. Also allow match of * incompletely-specified host in local domain. */ - if (strcasecmp(host, tokval) == 0) + if (__strcasecmp(host, tokval) == 0) goto match; -/* if (__strcasecmp(hostname, tokval) == 0) - goto match; - if ((tmp = __strchr(hostname, '.')) != NULL && - __strcasecmp(tmp, mydomain) == 0 && - __strncasecmp(hostname, tokval, tmp-hostname) == 0 && - tokval[tmp - hostname] == '\0') - goto match; */ if ((tmp = __strchr(host, '.')) != NULL && - strcasecmp(tmp, mydomain) == 0 && - strncasecmp(host, tokval, tmp - host) == 0 && + __strcasecmp(tmp, mydomain) == 0 && + __strncasecmp(host, tokval, tmp - host) == 0 && tokval[tmp - host] == '\0') goto match; continue; 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_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c index c84c42725..6c0f44f7d 100644 --- a/libc/inet/rpc/svc_auth_unix.c +++ b/libc/inet/rpc/svc_auth_unix.c @@ -39,6 +39,7 @@ */ #define xdrmem_create __xdrmem_create +#define xdr_authunix_parms __xdr_authunix_parms #define __FORCE_GLIBC #define _GNU_SOURCE diff --git a/libc/inet/rpc/svc_raw.c b/libc/inet/rpc/svc_raw.c index b55f0864f..8a4cc5981 100644 --- a/libc/inet/rpc/svc_raw.c +++ b/libc/inet/rpc/svc_raw.c @@ -41,6 +41,8 @@ static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro"; */ #define xdrmem_create __xdrmem_create +#define xdr_callmsg __xdr_callmsg +#define xdr_replymsg __xdr_replymsg #define __FORCE_GLIBC #include <features.h> 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..32b3cc995 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -42,7 +42,13 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; */ #define xdrrec_create __xdrrec_create +#define xdrrec_endofrecord __xdrrec_endofrecord +#define xdrrec_skiprecord __xdrrec_skiprecord +#define xdrrec_eof __xdrrec_eof +#define xdr_callmsg __xdr_callmsg +#define xdr_replymsg __xdr_replymsg #define xprt_register __xprt_register +#define getsockname __getsockname #define __FORCE_GLIBC #define _GNU_SOURCE @@ -159,7 +165,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 +180,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..197084144 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -41,6 +41,9 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; #define xprt_register __xprt_register #define xdrmem_create __xdrmem_create +#define xdr_callmsg __xdr_callmsg +#define xdr_replymsg __xdr_replymsg +#define getsockname __getsockname #define __FORCE_GLIBC #define _GNU_SOURCE @@ -115,10 +118,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 +133,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 +147,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 +207,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..79c27ac5f 100644 --- a/libc/inet/rpc/svc_unix.c +++ b/libc/inet/rpc/svc_unix.c @@ -38,9 +38,15 @@ */ #define xdrrec_create __xdrrec_create +#define xdrrec_endofrecord __xdrrec_endofrecord +#define xdrrec_skiprecord __xdrrec_skiprecord +#define xdrrec_eof __xdrrec_eof +#define xdr_callmsg __xdr_callmsg +#define xdr_replymsg __xdr_replymsg #define xprt_register __xprt_register #define getegid __getegid #define geteuid __geteuid +#define getsockname __getsockname #define __FORCE_GLIBC #include <features.h> @@ -154,7 +160,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 +176,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..3d36c4021 100644 --- a/libc/inet/rpc/xdr.c +++ b/libc/inet/rpc/xdr.c @@ -91,19 +91,41 @@ xdr_void (void) } /* - * XDR integers + * XDR long integers + * The definition of xdr_long() is kept for backward + * compatibility. Instead xdr_int() should be used. */ -bool_t -xdr_int (XDR *xdrs, int *ip) +bool_t attribute_hidden +__xdr_long (XDR *xdrs, long *lp) { -#if INT_MAX < LONG_MAX + if (xdrs->x_op == XDR_ENCODE + && (sizeof (int32_t) == sizeof (long) + || (int32_t) *lp == *lp)) + return XDR_PUTLONG (xdrs, lp); + + if (xdrs->x_op == XDR_DECODE) + return XDR_GETLONG (xdrs, lp); + + if (xdrs->x_op == XDR_FREE) + return TRUE; + + return FALSE; +} +strong_alias(__xdr_long,xdr_long) + +/* + * XDR short integers + */ +bool_t attribute_hidden +__xdr_short (XDR *xdrs, short *sp) +{ long l; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *ip; + l = (long) *sp; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: @@ -111,33 +133,30 @@ xdr_int (XDR *xdrs, int *ip) { return FALSE; } - *ip = (int) l; + *sp = (short) l; + return TRUE; + case XDR_FREE: return TRUE; } return FALSE; -#elif INT_MAX == LONG_MAX - return xdr_long (xdrs, (long *) ip); -#elif INT_MAX == SHRT_MAX - return xdr_short (xdrs, (short *) ip); -#else -#error unexpected integer sizes in_xdr_int() -#endif } +strong_alias(__xdr_short,xdr_short) /* - * XDR unsigned integers + * XDR integers */ -bool_t -xdr_u_int (XDR *xdrs, u_int *up) +bool_t attribute_hidden +__xdr_int (XDR *xdrs, int *ip) { -#if UINT_MAX < ULONG_MAX - u_long l; + +#if INT_MAX < LONG_MAX + long l; switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) * up; + l = (long) *ip; return XDR_PUTLONG (xdrs, &l); case XDR_DECODE: @@ -145,50 +164,28 @@ xdr_u_int (XDR *xdrs, u_int *up) { return FALSE; } - *up = (u_int) l; + *ip = (int) l; case XDR_FREE: return TRUE; } return FALSE; -#elif UINT_MAX == ULONG_MAX - return xdr_u_long (xdrs, (u_long *) up); -#elif UINT_MAX == USHRT_MAX - return xdr_short (xdrs, (short *) up); +#elif INT_MAX == LONG_MAX + return __xdr_long (xdrs, (long *) ip); +#elif INT_MAX == SHRT_MAX + return __xdr_short (xdrs, (short *) ip); #else -#error unexpected integer sizes in_xdr_u_int() +#error unexpected integer sizes in xdr_int() #endif } - -/* - * XDR long integers - * The definition of xdr_long() is kept for backward - * compatibility. Instead xdr_int() should be used. - */ -bool_t -xdr_long (XDR *xdrs, long *lp) -{ - - if (xdrs->x_op == XDR_ENCODE - && (sizeof (int32_t) == sizeof (long) - || (int32_t) *lp == *lp)) - return XDR_PUTLONG (xdrs, lp); - - if (xdrs->x_op == XDR_DECODE) - return XDR_GETLONG (xdrs, lp); - - if (xdrs->x_op == XDR_FREE) - return TRUE; - - return FALSE; -} +strong_alias(__xdr_int,xdr_int) /* * XDR unsigned long integers * The definition of xdr_u_long() is kept for backward * compatibility. Instead xdr_u_int() should be used. */ -bool_t -xdr_u_long (XDR *xdrs, u_long *ulp) +bool_t attribute_hidden +__xdr_u_long (XDR *xdrs, u_long *ulp) { switch (xdrs->x_op) { @@ -215,6 +212,42 @@ xdr_u_long (XDR *xdrs, u_long *ulp) } return FALSE; } +strong_alias(__xdr_u_long,xdr_u_long) + +/* + * XDR unsigned integers + */ +bool_t attribute_hidden +__xdr_u_int (XDR *xdrs, u_int *up) +{ +#if UINT_MAX < ULONG_MAX + u_long l; + + switch (xdrs->x_op) + { + case XDR_ENCODE: + l = (u_long) * up; + return XDR_PUTLONG (xdrs, &l); + + case XDR_DECODE: + if (!XDR_GETLONG (xdrs, &l)) + { + return FALSE; + } + *up = (u_int) l; + case XDR_FREE: + return TRUE; + } + return FALSE; +#elif UINT_MAX == ULONG_MAX + return __xdr_u_long (xdrs, (u_long *) up); +#elif UINT_MAX == USHRT_MAX + return __xdr_short (xdrs, (short *) up); +#else +#error unexpected integer sizes in xdr_u_int() +#endif +} +strong_alias(__xdr_u_int,xdr_u_int) /* * XDR hyper integers @@ -296,34 +329,6 @@ xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp) } /* - * XDR short integers - */ -bool_t -xdr_short (XDR *xdrs, short *sp) -{ - long l; - - switch (xdrs->x_op) - { - case XDR_ENCODE: - l = (long) *sp; - return XDR_PUTLONG (xdrs, &l); - - case XDR_DECODE: - if (!XDR_GETLONG (xdrs, &l)) - { - return FALSE; - } - *sp = (short) l; - return TRUE; - - case XDR_FREE: - return TRUE; - } - return FALSE; -} - -/* * XDR unsigned short integers */ bool_t @@ -361,7 +366,7 @@ xdr_char (XDR *xdrs, char *cp) int i; i = (*cp); - if (!xdr_int (xdrs, &i)) + if (!__xdr_int (xdrs, &i)) { return FALSE; } @@ -378,7 +383,7 @@ xdr_u_char (XDR *xdrs, u_char *cp) u_int u; u = (*cp); - if (!xdr_u_int (xdrs, &u)) + if (!__xdr_u_int (xdrs, &u)) { return FALSE; } @@ -389,8 +394,8 @@ xdr_u_char (XDR *xdrs, u_char *cp) /* * XDR booleans */ -bool_t -xdr_bool (XDR *xdrs, bool_t *bp) +bool_t attribute_hidden +__xdr_bool (XDR *xdrs, bool_t *bp) { long lb; @@ -413,12 +418,13 @@ xdr_bool (XDR *xdrs, bool_t *bp) } return FALSE; } +strong_alias(__xdr_bool,xdr_bool) /* * XDR enumerations */ -bool_t -xdr_enum (XDR *xdrs, enum_t *ep) +bool_t attribute_hidden +__xdr_enum (XDR *xdrs, enum_t *ep) { enum sizecheck { @@ -451,26 +457,27 @@ xdr_enum (XDR *xdrs, enum_t *ep) } return FALSE; #else - return xdr_long (xdrs, (long *) ep); + return __xdr_long (xdrs, (long *) ep); #endif } else if (sizeof (enum sizecheck) == sizeof (short)) { - return xdr_short (xdrs, (short *) ep); + return __xdr_short (xdrs, (short *) ep); } else { return FALSE; } } +strong_alias(__xdr_enum,xdr_enum) /* * XDR opaque data * Allows the specification of a fixed size sequence of opaque bytes. * cp points to the opaque object and cnt gives the byte length. */ -bool_t -xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) +bool_t attribute_hidden +__xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) { u_int rndup; static char crud[BYTES_PER_XDR_UNIT]; @@ -513,18 +520,15 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) } return FALSE; } +strong_alias(__xdr_opaque,xdr_opaque) /* * XDR counted bytes * *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; @@ -532,7 +536,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize) /* * first deal with the length since xdr bytes are counted */ - if (!xdr_u_int (xdrs, sizep)) + if (!__xdr_u_int (xdrs, sizep)) { return FALSE; } @@ -569,7 +573,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize) /* fall into ... */ case XDR_ENCODE: - return xdr_opaque (xdrs, sp, nodesize); + return __xdr_opaque (xdrs, sp, nodesize); case XDR_FREE: if (sp != NULL) @@ -581,6 +585,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 +596,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,20 +610,15 @@ 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; /* * we deal with the discriminator; it's an enum */ - if (!xdr_enum (xdrs, dscmp)) + if (!__xdr_enum (xdrs, dscmp)) { return FALSE; } @@ -640,7 +640,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. @@ -656,11 +656,8 @@ xdr_union (xdrs, dscmp, unp, choices, dfault) * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. */ -bool_t -xdr_string (xdrs, cpp, maxsize) - XDR *xdrs; - char **cpp; - u_int maxsize; +bool_t attribute_hidden +__xdr_string (XDR *xdrs, char **cpp, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int size; @@ -685,7 +682,7 @@ xdr_string (xdrs, cpp, maxsize) case XDR_DECODE: break; } - if (!xdr_u_int (xdrs, &size)) + if (!__xdr_u_int (xdrs, &size)) { return FALSE; } @@ -722,7 +719,7 @@ xdr_string (xdrs, cpp, maxsize) /* fall into ... */ case XDR_ENCODE: - return xdr_opaque (xdrs, sp, size); + return __xdr_opaque (xdrs, sp, size); case XDR_FREE: mem_free (sp, nodesize); @@ -741,7 +738,7 @@ xdr_wrapstring (xdrs, cpp) XDR *xdrs; char **cpp; { - if (xdr_string (xdrs, cpp, LASTUNSIGNED)) + if (__xdr_string (xdrs, cpp, LASTUNSIGNED)) { return TRUE; } diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c index 584174e22..a4e50fa8d 100644 --- a/libc/inet/rpc/xdr_array.c +++ b/libc/inet/rpc/xdr_array.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; * arrays. See xdr.h for more info on the interface to xdr. */ +#define xdr_u_int __xdr_u_int + #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -64,14 +66,8 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; * elsize is the size (in bytes) of each element, and elproc is the * xdr procedure to call to handle each element of the array. */ -bool_t -xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) - XDR *xdrs; - caddr_t *addrp; /* array pointer */ - u_int *sizep; /* number of elements */ - u_int maxsize; /* max numberof elements */ - u_int elsize; /* size in bytes of each element */ - xdrproc_t elproc; /* xdr routine to handle each element */ +bool_t attribute_hidden +__xdr_array (XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc) { u_int i; caddr_t target = *addrp; @@ -145,6 +141,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) } return stat; } +strong_alias(__xdr_array,xdr_array) /* * xdr_vector(): diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c index 749955401..a8d95e162 100644 --- a/libc/inet/rpc/xdr_rec.c +++ b/libc/inet/rpc/xdr_rec.c @@ -476,8 +476,8 @@ xdrrec_putint32 (XDR *xdrs, const int32_t *ip) * Before reading (deserializing from the stream, one should always call * this procedure to guarantee proper record alignment. */ -bool_t -xdrrec_skiprecord (XDR *xdrs) +bool_t attribute_hidden +__xdrrec_skiprecord (XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -492,14 +492,15 @@ xdrrec_skiprecord (XDR *xdrs) rstrm->last_frag = FALSE; return TRUE; } +strong_alias(__xdrrec_skiprecord,xdrrec_skiprecord) /* * Lookahead function. * Returns TRUE iff there is no more input in the buffer * after consuming the rest of the current record. */ -bool_t -xdrrec_eof (XDR *xdrs) +bool_t attribute_hidden +__xdrrec_eof (XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -515,6 +516,7 @@ xdrrec_eof (XDR *xdrs) return TRUE; return FALSE; } +strong_alias(__xdrrec_eof,xdrrec_eof) /* * The client must tell the package when an end-of-record has occurred. @@ -522,8 +524,8 @@ xdrrec_eof (XDR *xdrs) * (output) tcp stream. (This lets the package support batched or * pipelined procedure calls.) TRUE => immediate flush to tcp connection. */ -bool_t -xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) +bool_t attribute_hidden +__xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; u_long len; /* fragment length */ @@ -541,7 +543,7 @@ xdrrec_endofrecord (XDR *xdrs, bool_t sendnow) rstrm->out_finger += BYTES_PER_XDR_UNIT; return TRUE; } - +strong_alias(__xdrrec_endofrecord,xdrrec_endofrecord) /* * Internal useful routines diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c index 177c25059..478c8e906 100644 --- a/libc/inet/rpc/xdr_reference.c +++ b/libc/inet/rpc/xdr_reference.c @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; * "pointers". See xdr.h for more info on the interface to xdr. */ +#define xdr_bool __xdr_bool + #define __FORCE_GLIBC #define _GNU_SOURCE #include <features.h> @@ -66,12 +68,8 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; * size is the size of the referneced structure. * proc is the routine to handle the referenced structure. */ -bool_t -xdr_reference (xdrs, pp, size, proc) - XDR *xdrs; - caddr_t *pp; /* the pointer to work on */ - u_int size; /* size of the object pointed to */ - xdrproc_t proc; /* xdr routine to handle the object */ +bool_t attribute_hidden +__xdr_reference (XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) { caddr_t loc = *pp; bool_t stat; @@ -110,7 +108,7 @@ xdr_reference (xdrs, pp, size, proc) } return stat; } - +strong_alias(__xdr_reference,xdr_reference) /* * xdr_pointer(): @@ -151,5 +149,5 @@ xdr_pointer (xdrs, objpp, obj_size, xdr_obj) *objpp = NULL; return TRUE; } - return xdr_reference (xdrs, objpp, obj_size, xdr_obj); + return __xdr_reference (xdrs, objpp, obj_size, xdr_obj); } diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 2215d2d99..1dbffa3d1 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -98,9 +98,11 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) #ifdef L_getsockname #ifdef __NR_getsockname -_syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); +#define __NR___getsockname __NR_getsockname +attribute_hidden _syscall3(int, __getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen); +strong_alias(__getsockname,getsockname) #elif defined(__NR_socketcall) -int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) +int attribute_hidden __getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) { unsigned long args[3]; @@ -109,6 +111,7 @@ int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen) args[2] = (unsigned long) paddrlen; return __socketcall(SYS_GETSOCKNAME, args); } +strong_alias(__getsockname,getsockname) #endif #endif diff --git a/libc/misc/regex/_regex.h b/libc/misc/regex/_regex.h index cf3a5a2c1..01bb21158 100644 --- a/libc/misc/regex/_regex.h +++ b/libc/misc/regex/_regex.h @@ -4,42 +4,42 @@ #include <regex.h> /* Document internal interfaces. */ -extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax); +extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax) attribute_hidden; extern const char *__re_compile_pattern (const char *pattern, size_t length, - struct re_pattern_buffer *buffer); + struct re_pattern_buffer *buffer) attribute_hidden; -extern int __re_compile_fastmap (struct re_pattern_buffer *buffer); +extern int __re_compile_fastmap (struct re_pattern_buffer *buffer) attribute_hidden; extern int __re_search (struct re_pattern_buffer *buffer, const char *string, int length, int start, int range, - struct re_registers *regs); + struct re_registers *regs) attribute_hidden; extern int __re_search_2 (struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop); + int start, int range, struct re_registers *regs, int stop) attribute_hidden; extern int __re_match (struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs); + int length, int start, struct re_registers *regs) attribute_hidden; extern int __re_match_2 (struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop); + int start, struct re_registers *regs, int stop) attribute_hidden; extern void __re_set_registers (struct re_pattern_buffer *buffer, struct re_registers *regs, - unsigned num_regs, regoff_t *starts, regoff_t *ends); + unsigned num_regs, regoff_t *starts, regoff_t *ends) attribute_hidden; -extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags); +extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags) attribute_hidden; extern int __regexec (const regex_t *__preg, const char *__string, - size_t __nmatch, regmatch_t __pmatch[], int __eflags); + size_t __nmatch, regmatch_t __pmatch[], int __eflags) attribute_hidden; extern size_t __regerror (int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size); + char *__errbuf, size_t __errbuf_size) attribute_hidden; -extern void __regfree (regex_t *__preg); +extern void __regfree (regex_t *__preg) attribute_hidden; #endif diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index bf8958a66..5220ba57c 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -32,9 +32,18 @@ #include <stdint.h> #ifdef __UCLIBC_HAS_WCHAR__ #define RE_ENABLE_I18N +#define wcscoll __wcscoll +#define wcrtomb __wcrtomb +#define mbrtowc __mbrtowc +#define iswctype __iswctype +#define iswlower __iswlower +#define iswalnum __iswalnum #include <wchar.h> #include <wctype.h> +/* attribute_hidden produces text relocation */ +//extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW /*attribute_hidden*/; + extern size_t __wcrtomb (char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps) attribute_hidden; @@ -42,7 +51,7 @@ extern wint_t __btowc (int __c) attribute_hidden; extern wctype_t __wctype (__const char *__property) attribute_hidden; -extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; +//extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #endif #define memcmp __memcmp @@ -54,9 +63,10 @@ extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/; #define strlen __strlen #define strncpy __strncpy #define getenv __getenv +#define strcasecmp __strcasecmp extern void *__mempcpy (void *__restrict __dest, - __const void *__restrict __src, size_t __n) /*attribute_hidden*/; + __const void *__restrict __src, size_t __n) attribute_hidden; #endif /* Make sure noone compiles this code with a C++ compiler. */ diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 69b77c4c3..1f9d37780 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -28,6 +28,11 @@ #define wcslen __wcslen /* for some reason this does not work */ #define memcpy __memcpy +#define mbrtowc __mbrtowc +#define wcrtomb __wcrtomb +#define wcscoll __wcscoll +#define iswctype __iswctype +#define iswalnum __iswalnum /* To exclude some unwanted junk.... */ #undef _LIBC diff --git a/libc/misc/wchar/wstdio.c b/libc/misc/wchar/wstdio.c index 6d4c2732f..b0f259001 100644 --- a/libc/misc/wchar/wstdio.c +++ b/libc/misc/wchar/wstdio.c @@ -52,6 +52,7 @@ #define wcslen __wcslen #define wcsrtombs __wcsrtombs #define mbrtowc __mbrtowc +#define wcrtomb __wcrtomb #define _GNU_SOURCE #include <stdio.h> diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index aa2b97d60..77d7572da 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -46,6 +46,10 @@ extern wctype_t __wctype (__const char *__property) attribute_hidden; #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> +extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW; +extern wint_t __towupper_l(wint_t __wc, __locale_t __locale) __THROW; +//extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW attribute_hidden; +extern wint_t __towctrans_l(wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW; #endif /* __UCLIBC_HAS_XLOCALE__ */ /* We know wide char support is enabled. We wouldn't be here otherwise. */ @@ -177,10 +181,10 @@ enum { #ifdef __UCLIBC_DO_XLOCALE extern int __iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale) - __THROW; + __THROW attribute_hidden; #define ISW_FUNC_BODY(NAME) \ -int __PASTE3(__isw,NAME,_l) (wint_t wc, __locale_t l) \ +int attribute_hidden __PASTE3(__isw,NAME,_l) (wint_t wc, __locale_t l) \ { \ return __iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ } \ @@ -188,13 +192,14 @@ weak_alias(__PASTE3(__isw,NAME,_l), __PASTE3(isw,NAME,_l)) #else /* __UCLIBC_DO_XLOCALE */ -extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW; +extern int __iswctype (wint_t __wc, wctype_t __desc) __THROW attribute_hidden; #define ISW_FUNC_BODY(NAME) \ -int __PASTE2(isw,NAME) (wint_t wc) \ +int attribute_hidden __PASTE2(__isw,NAME) (wint_t wc) \ { \ return __iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ -} +} \ +weak_alias(__PASTE2(__isw,NAME), __PASTE2(isw,NAME)) #endif /* __UCLIBC_DO_XLOCALE */ /**********************************************************************/ @@ -510,7 +515,7 @@ strong_alias(__wctype,wctype) #warning REMINDER: Currently wctype_l simply calls wctype. #endif /* __UCLIBC_MJN3_ONLY__ */ -wctype_t __wctype_l (const char *property, __locale_t locale) +wctype_t attribute_hidden __wctype_l (const char *property, __locale_t locale) { return __wctype(property); } @@ -564,7 +569,7 @@ static const unsigned short int desc2flag[] = { #ifdef __UCLIBC_HAS_CTYPE_TABLES__ -int __iswctype(wint_t wc, wctype_t desc) +int attribute_hidden __iswctype(wint_t wc, wctype_t desc) { /* Note... wctype_t is unsigned. */ @@ -578,7 +583,7 @@ int __iswctype(wint_t wc, wctype_t desc) #else /* __UCLIBC_HAS_CTYPE_TABLES__ */ -int __iswctype(wint_t wc, wctype_t desc) +int attribute_hidden __iswctype(wint_t wc, wctype_t desc) { /* This is lame, but it is here just to get it working for now. */ @@ -637,14 +642,14 @@ int __iswctype(wint_t wc, wctype_t desc) #if defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) -int __iswctype(wint_t wc, wctype_t desc) +int attribute_hidden __iswctype(wint_t wc, wctype_t desc) { return __iswctype_l(wc, desc, __UCLIBC_CURLOCALE); } #else /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */ -int ISWCTYPE(wint_t wc, wctype_t desc) +int attribute_hidden ISWCTYPE(wint_t wc, wctype_t desc) { unsigned int sc, n, i0, i1; unsigned char d = __CTYPE_unclassified; diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c index 3c48b4ca0..aa4215f84 100644 --- a/libc/sysdeps/linux/common/getdnnm.c +++ b/libc/sysdeps/linux/common/getdnnm.c @@ -1,3 +1,5 @@ +#define uname __uname + #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -6,8 +8,8 @@ #include <sys/utsname.h> -int -getdomainname(char *name, size_t len) +int attribute_hidden +__getdomainname(char *name, size_t len) { struct utsname uts; @@ -25,3 +27,4 @@ getdomainname(char *name, size_t len) __strcpy(name, uts.domainname); return 0; } +strong_alias(__getdomainname,getdomainname) diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c index 8a23e9516..cb6e5efce 100644 --- a/libc/sysdeps/linux/common/gethstnm.c +++ b/libc/sysdeps/linux/common/gethstnm.c @@ -1,10 +1,12 @@ +#define uname __uname + #include <string.h> #include <unistd.h> #include <sys/utsname.h> #include <errno.h> -int -gethostname(char *name, size_t len) +int attribute_hidden +__gethostname(char *name, size_t len) { struct utsname uts; @@ -22,3 +24,4 @@ gethostname(char *name, size_t len) __strcpy(name, uts.nodename); return 0; } +strong_alias(__gethostname,gethostname) diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c index ca8b375fb..3f695402d 100644 --- a/libc/sysdeps/linux/common/getpriority.c +++ b/libc/sysdeps/linux/common/getpriority.c @@ -17,7 +17,7 @@ static inline _syscall2(int, __syscall_getpriority, /* The return value of __syscall_getpriority is biased by this value * to avoid returning negative values. */ #define PZERO 20 -int getpriority(enum __priority_which which, id_t who) +int attribute_hidden __getpriority(enum __priority_which which, id_t who) { int res; @@ -26,3 +26,4 @@ int getpriority(enum __priority_which which, id_t who) res = PZERO - res; return res; } +strong_alias(__getpriority,getpriority) diff --git a/libc/sysdeps/linux/common/nice.c b/libc/sysdeps/linux/common/nice.c index b21f63e08..20f7996a7 100644 --- a/libc/sysdeps/linux/common/nice.c +++ b/libc/sysdeps/linux/common/nice.c @@ -8,6 +8,9 @@ * GNU Library General Public License (LGPL) version 2 or later. */ +#define getpriority __getpriority +#define setpriority __setpriority + #include "syscalls.h" #include <unistd.h> #include <sys/resource.h> diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c index 100a34568..d3175dad5 100644 --- a/libc/sysdeps/linux/common/setegid.c +++ b/libc/sysdeps/linux/common/setegid.c @@ -1,3 +1,6 @@ +#define setresgid __setresgid +#define setregid __setregid + #define _GNU_SOURCE #include <unistd.h> #include <stdio.h> diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c index e970e0711..f5ed35743 100644 --- a/libc/sysdeps/linux/common/seteuid.c +++ b/libc/sysdeps/linux/common/seteuid.c @@ -1,3 +1,6 @@ +#define setresuid __setresuid +#define setreuid __setreuid + #define _GNU_SOURCE #include <unistd.h> #include <stdio.h> @@ -6,7 +9,7 @@ #include <sys/types.h> #include <sys/syscall.h> -int seteuid(uid_t uid) +int attribute_hidden __seteuid(uid_t uid) { int result; @@ -26,3 +29,4 @@ int seteuid(uid_t uid) return result; } +strong_alias(__seteuid,seteuid) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index d92840370..96428edb3 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -17,7 +17,7 @@ static inline _syscall2(int, __syscall_setgroups, size_t, size, const __kernel_gid_t *, list); -int setgroups(size_t n, const gid_t * groups) +int attribute_hidden __setgroups(size_t n, const gid_t * groups) { if (n > (size_t) sysconf(_SC_NGROUPS_MAX)) { __set_errno(EINVAL); @@ -36,3 +36,4 @@ int setgroups(size_t n, const gid_t * groups) return (__syscall_setgroups(n, kernel_groups)); } } +strong_alias(__setgroups,setgroups) diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c index 0373dc3f7..6d73f08ec 100644 --- a/libc/sysdeps/linux/common/setpgid.c +++ b/libc/sysdeps/linux/common/setpgid.c @@ -14,7 +14,8 @@ static inline _syscall2(int, __syscall_setpgid, __kernel_pid_t, pid, __kernel_pid_t, pgid); -int setpgid(pid_t pid, pid_t pgid) +int attribute_hidden __setpgid(pid_t pid, pid_t pgid) { return (__syscall_setpgid(pid, pgid)); } +strong_alias(__setpgid,setpgid) diff --git a/libc/sysdeps/linux/common/setpgrp.c b/libc/sysdeps/linux/common/setpgrp.c index 0fa8fccc3..966bb4da6 100644 --- a/libc/sysdeps/linux/common/setpgrp.c +++ b/libc/sysdeps/linux/common/setpgrp.c @@ -1,3 +1,5 @@ +#define setpgid __setpgid + #include <syscall.h> #include <unistd.h> diff --git a/libc/sysdeps/linux/common/setpriority.c b/libc/sysdeps/linux/common/setpriority.c index 287ea8dd3..06476d88f 100644 --- a/libc/sysdeps/linux/common/setpriority.c +++ b/libc/sysdeps/linux/common/setpriority.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <sys/resource.h> -_syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio); +#define __NR___setpriority __NR_setpriority +attribute_hidden _syscall3(int, __setpriority, __priority_which_t, which, id_t, who, int, prio); +strong_alias(__setpriority,setpriority) diff --git a/libc/sysdeps/linux/common/setregid.c b/libc/sysdeps/linux/common/setregid.c index 06c166182..cfd375744 100644 --- a/libc/sysdeps/linux/common/setregid.c +++ b/libc/sysdeps/linux/common/setregid.c @@ -14,7 +14,7 @@ static inline _syscall2(int, __syscall_setregid, __kernel_gid_t, rgid, __kernel_gid_t, egid); -int setregid(gid_t rgid, gid_t egid) +int attribute_hidden __setregid(gid_t rgid, gid_t egid) { if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) || ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) { @@ -23,3 +23,4 @@ int setregid(gid_t rgid, gid_t egid) } return (__syscall_setregid(rgid, egid)); } +strong_alias(__setregid,setregid) diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c index 312994583..fbfa98be3 100644 --- a/libc/sysdeps/linux/common/setresgid.c +++ b/libc/sysdeps/linux/common/setresgid.c @@ -14,7 +14,7 @@ static inline _syscall3(int, __syscall_setresgid, __kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid); -int setresgid(gid_t rgid, gid_t egid, gid_t sgid) +int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid) { if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) || ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U)) @@ -24,4 +24,5 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) } return (__syscall_setresgid(rgid, egid, sgid)); } +strong_alias(__setresgid,setresgid) #endif diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c index d979b8968..6ed1423f5 100644 --- a/libc/sysdeps/linux/common/setresuid.c +++ b/libc/sysdeps/linux/common/setresuid.c @@ -14,7 +14,7 @@ static inline _syscall3(int, __syscall_setresuid, __kernel_uid_t, rgid, __kernel_uid_t, egid, __kernel_uid_t, sgid); -int setresuid(uid_t ruid, uid_t euid, uid_t suid) +int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid) { if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) || ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) @@ -24,4 +24,5 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid) } return (__syscall_setresuid(ruid, euid, suid)); } +strong_alias(__setresuid,setresuid) #endif diff --git a/libc/sysdeps/linux/common/setreuid.c b/libc/sysdeps/linux/common/setreuid.c index 7275c94e9..15ab5c01a 100644 --- a/libc/sysdeps/linux/common/setreuid.c +++ b/libc/sysdeps/linux/common/setreuid.c @@ -14,7 +14,7 @@ static inline _syscall2(int, __syscall_setreuid, __kernel_uid_t, ruid, __kernel_uid_t, euid); -int setreuid(uid_t ruid, uid_t euid) +int attribute_hidden __setreuid(uid_t ruid, uid_t euid) { if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U)) || ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) { @@ -23,3 +23,4 @@ int setreuid(uid_t ruid, uid_t euid) } return (__syscall_setreuid(ruid, euid)); } +strong_alias(__setreuid,setreuid) diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c index b3c93e0af..3d252edc7 100644 --- a/libc/sysdeps/linux/common/uname.c +++ b/libc/sysdeps/linux/common/uname.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <sys/utsname.h> -_syscall1(int, uname, struct utsname *, buf); +#define __NR___uname __NR_uname +attribute_hidden _syscall1(int, __uname, struct utsname *, buf); +strong_alias(__uname,uname) |