summaryrefslogtreecommitdiffstats
path: root/libc/inet
diff options
context:
space:
mode:
Diffstat (limited to 'libc/inet')
-rw-r--r--libc/inet/Makefile.in4
-rw-r--r--libc/inet/addr.c3
-rw-r--r--libc/inet/getaddrinfo.c1
-rw-r--r--libc/inet/getnetent.c1
-rw-r--r--libc/inet/getproto.c1
-rw-r--r--libc/inet/getservice.c1
-rw-r--r--libc/inet/in6_addr.c2
-rw-r--r--libc/inet/ntop.c6
-rw-r--r--libc/inet/resolv.c27
-rw-r--r--libc/inet/rpc/auth_none.c10
-rw-r--r--libc/inet/rpc/auth_unix.c17
-rw-r--r--libc/inet/rpc/clnt_perror.c7
-rw-r--r--libc/inet/rpc/clnt_raw.c13
-rw-r--r--libc/inet/rpc/clnt_tcp.c6
-rw-r--r--libc/inet/rpc/clnt_udp.c6
-rw-r--r--libc/inet/rpc/clnt_unix.c6
-rw-r--r--libc/inet/rpc/get_myaddress.c6
-rw-r--r--libc/inet/rpc/getrpcent.c1
-rw-r--r--libc/inet/rpc/pmap_clnt.c6
-rw-r--r--libc/inet/rpc/pmap_getport.c5
-rw-r--r--libc/inet/rpc/rcmd.c13
-rw-r--r--libc/inet/rpc/rpc_private.h5
-rw-r--r--libc/inet/rpc/rpc_thread.c30
-rw-r--r--libc/inet/rpc/ruserpass.c24
-rw-r--r--libc/inet/rpc/svc_auth.c2
-rw-r--r--libc/inet/rpc/svc_auth_unix.c2
-rw-r--r--libc/inet/rpc/svc_raw.c12
-rw-r--r--libc/inet/rpc/svc_simple.c7
-rw-r--r--libc/inet/rpc/svc_tcp.c5
-rw-r--r--libc/inet/rpc/svc_udp.c3
-rw-r--r--libc/inet/rpc/svc_unix.c5
-rw-r--r--libc/inet/rpc/xdr.c2
-rw-r--r--libc/inet/rpc/xdr_array.c1
-rw-r--r--libc/inet/rpc/xdr_mem.c2
-rw-r--r--libc/inet/rpc/xdr_rec.c4
-rw-r--r--libc/inet/rpc/xdr_reference.c1
-rw-r--r--libc/inet/rpc/xdr_stdio.c5
-rw-r--r--libc/inet/socketcalls.c1
38 files changed, 151 insertions, 102 deletions
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index 56954385d..1d1be7eb9 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -9,8 +9,8 @@
include $(top_srcdir)libc/inet/rpc/Makefile.in
CSRC:= getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \
- inet_net.c ntop.c herror.c if_nametoindex.c gai_strerror.c getaddrinfo.c \
- in6_addr.c ether_addr.c ntohl.c
+ inet_net.c ntop.c herror.c if_index.c gai_strerror.c getaddrinfo.c \
+ in6_addr.c ether_addr.c ntohl.c opensock.c ifaddrs.c
MSRC1:= addr.c
MOBJ1:= inet_aton.o inet_addr.o inet_ntoa.o inet_makeaddr.o inet_lnaof.o \
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index da40dea0c..6be41f81d 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -16,9 +16,6 @@
* Changed to use _int10tostr.
*/
-/* for some reason this does not work here */
-#define memmove __memmove
-
#define _GNU_SOURCE
#define __FORCE_GLIBC
#include <features.h>
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index a85e2ff5e..ee5fdc5f7 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -51,6 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define inet_pton __inet_pton
#define inet_ntop __inet_ntop
#define strtoul __strtoul
+#define if_nametoindex __if_nametoindex
#if 0
#define uname __uname
#define stpcpy __stpcpy
diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c
index edbae55b0..cd5f63ad5 100644
--- a/libc/inet/getnetent.c
+++ b/libc/inet/getnetent.c
@@ -17,6 +17,7 @@
#define inet_network __inet_network
#define rewind __rewind
+#define fgets __fgets
#define __FORCE_GLIBC
#include <features.h>
diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c
index 0c0e2c468..008b0d606 100644
--- a/libc/inet/getproto.c
+++ b/libc/inet/getproto.c
@@ -54,6 +54,7 @@
#define strpbrk __strpbrk
#define atoi __atoi
#define rewind __rewind
+#define fgets __fgets
#define __FORCE_GLIBC
#define _GNU_SOURCE
diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c
index 79cdf7434..f3916de86 100644
--- a/libc/inet/getservice.c
+++ b/libc/inet/getservice.c
@@ -54,6 +54,7 @@
#define strpbrk __strpbrk
#define atoi __atoi
#define rewind __rewind
+#define fgets __fgets
#define __FORCE_GLIBC
#define _GNU_SOURCE
diff --git a/libc/inet/in6_addr.c b/libc/inet/in6_addr.c
index de90555c9..7e52d2e39 100644
--- a/libc/inet/in6_addr.c
+++ b/libc/inet/in6_addr.c
@@ -27,7 +27,7 @@ const struct in6_addr __in6addr_any =
weak_alias (__in6addr_any, in6addr_any)
const struct in6_addr __in6addr_loopback =
{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
-weak_alias(__in6addr_loopback, in6addr_loopback);
+weak_alias(__in6addr_loopback, in6addr_loopback)
#endif /* __UCLIBC_HAS_IPV6__ */
diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c
index 91fa2b899..6f3a8ccec 100644
--- a/libc/inet/ntop.c
+++ b/libc/inet/ntop.c
@@ -246,10 +246,10 @@ inet_pton4(const char *src, u_char *dst)
/* We cannot use the macro version of tolower() or very bad
* things happen when '*src++' gets evaluated multiple times.
- * So * undef it here so we get the function version of tolower
+ * So undef it here so we get the function version of tolower
* instead.
*/
-#undef tolower
+#undef __tolower
static int
inet_pton6(const char *src, u_char *dst)
@@ -271,7 +271,7 @@ inet_pton6(const char *src, u_char *dst)
curtok = src;
saw_xdigit = 0;
val = 0;
- while ((ch = tolower (*src++)) != '\0') {
+ while ((ch = __tolower (*src++)) != '\0') {
const char *pch;
pch = __strchr(xdigits, ch);
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index f983229a4..0f6cd3532 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -149,6 +149,7 @@
#define recv __recv
#define send __send
#define snprintf __snprintf
+#define fgets __fgets
#define __FORCE_GLIBC
#include <features.h>
@@ -1136,7 +1137,7 @@ struct hostent *gethostbyname2(const char *name, int family)
#ifdef L_res_init
-int res_init(void)
+int attribute_hidden __res_init_internal(void)
{
__close_nameservers();
__open_nameservers();
@@ -1180,6 +1181,7 @@ int res_init(void)
return(0);
}
+strong_alias(__res_init_internal,res_init)
void res_close( void )
{
@@ -1231,7 +1233,6 @@ __res_state (void)
return __resp;
}
# endif
-hidden_def (__res_state)
#endif
@@ -1241,7 +1242,11 @@ hidden_def (__res_state)
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
-int res_query(const char *dname, int class, int type,
+int __res_init_internal (void) __THROW attribute_hidden;
+int __res_querydomain_internal (const char *, const char *, int, int,
+ u_char *, int) __THROW attribute_hidden;
+
+int attribute_hidden __res_query_internal(const char *dname, int class, int type,
unsigned char *answer, int anslen)
{
int i;
@@ -1282,6 +1287,7 @@ int res_query(const char *dname, int class, int type,
free(packet);
return i;
}
+strong_alias(__res_query_internal,res_query)
/*
* Formulate a normal query, send, and retrieve answer in supplied buffer.
@@ -1301,7 +1307,7 @@ int res_search(name, class, type, answer, anslen)
int trailing_dot, ret, saved_herrno;
int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
- if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && res_init() == -1)) {
+ if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && __res_init_internal() == -1)) {
h_errno = NETDB_INTERNAL;
return (-1);
}
@@ -1321,7 +1327,7 @@ int res_search(name, class, type, answer, anslen)
*/
saved_herrno = -1;
if (dots >= _res.ndots) {
- ret = res_querydomain(name, NULL, class, type, answer, anslen);
+ ret = __res_querydomain_internal(name, NULL, class, type, answer, anslen);
if (ret > 0)
return (ret);
saved_herrno = h_errno;
@@ -1342,7 +1348,7 @@ int res_search(name, class, type, answer, anslen)
*domain && !done;
domain++) {
- ret = res_querydomain(name, *domain, class, type,
+ ret = __res_querydomain_internal(name, *domain, class, type,
answer, anslen);
if (ret > 0)
return (ret);
@@ -1398,7 +1404,7 @@ int res_search(name, class, type, answer, anslen)
* name or whether it ends with a dot.
*/
if (!tried_as_is) {
- ret = res_querydomain(name, NULL, class, type, answer, anslen);
+ ret = __res_querydomain_internal(name, NULL, class, type, answer, anslen);
if (ret > 0)
return (ret);
}
@@ -1424,7 +1430,7 @@ int res_search(name, class, type, answer, anslen)
* Perform a call on res_query on the concatenation of name and domain,
* removing a trailing dot from name if domain is NULL.
*/
-int res_querydomain(name, domain, class, type, answer, anslen)
+int attribute_hidden __res_querydomain_internal(name, domain, class, type, answer, anslen)
const char *name, *domain;
int class, type; /* class and type of query */
u_char *answer; /* buffer to put answer */
@@ -1434,7 +1440,7 @@ int res_querydomain(name, domain, class, type, answer, anslen)
const char *longname = nbuf;
size_t n, d;
- if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && res_init() == -1)) {
+ if ((!name || !answer) || ((_res.options & RES_INIT) == 0 && __res_init_internal() == -1)) {
h_errno = NETDB_INTERNAL;
return (-1);
}
@@ -1468,8 +1474,9 @@ int res_querydomain(name, domain, class, type, answer, anslen)
}
snprintf(nbuf, sizeof(nbuf), "%s.%s", name, domain);
}
- return (res_query(longname, class, type, answer, anslen));
+ return (__res_query_internal(longname, class, type, answer, anslen));
}
+strong_alias(__res_querydomain_internal,res_querydomain)
/* res_mkquery */
/* res_send */
diff --git a/libc/inet/rpc/auth_none.c b/libc/inet/rpc/auth_none.c
index b2e23924c..cb30c40a7 100644
--- a/libc/inet/rpc/auth_none.c
+++ b/libc/inet/rpc/auth_none.c
@@ -105,7 +105,7 @@ strong_alias(__authnone_create,authnone_create)
/*ARGSUSED */
static bool_t
-authnone_marshal (AUTH *client, XDR *xdrs)
+authnone_marshal (AUTH *client attribute_unused, XDR *xdrs)
{
struct authnone_private_s *ap;
@@ -116,23 +116,23 @@ authnone_marshal (AUTH *client, XDR *xdrs)
}
static void
-authnone_verf (AUTH *auth)
+authnone_verf (AUTH *auth attribute_unused)
{
}
static bool_t
-authnone_validate (AUTH *auth, struct opaque_auth *oa)
+authnone_validate (AUTH *auth attribute_unused, struct opaque_auth *oa attribute_unused)
{
return TRUE;
}
static bool_t
-authnone_refresh (AUTH *auth)
+authnone_refresh (AUTH *auth attribute_unused)
{
return FALSE;
}
static void
-authnone_destroy (AUTH *auth)
+authnone_destroy (AUTH *auth attribute_unused)
{
}
diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c
index 85fb98a63..bb14df068 100644
--- a/libc/inet/rpc/auth_unix.c
+++ b/libc/inet/rpc/auth_unix.c
@@ -47,6 +47,7 @@
#define xdr_authunix_parms __xdr_authunix_parms
#define xdr_opaque_auth __xdr_opaque_auth
#define gettimeofday __gettimeofday
+#define fputs __fputs
#define __FORCE_GLIBC
#include <features.h>
@@ -182,7 +183,14 @@ __authunix_create_default (void)
uid_t uid;
gid_t gid;
int max_nr_groups = sysconf (_SC_NGROUPS_MAX);
- gid_t gids[max_nr_groups];
+ gid_t *gids = NULL;
+ AUTH *ret_auth;
+
+ if (max_nr_groups) {
+ gids = (gid_t*)malloc(sizeof(*gids) * max_nr_groups);
+ if (gids == NULL)
+ abort ();
+ }
if (gethostname (machname, MAX_MACHINE_NAME) == -1)
abort ();
@@ -195,7 +203,10 @@ __authunix_create_default (void)
/* This braindamaged Sun code forces us here to truncate the
list of groups to NGRPS members since the code in
authuxprot.c transforms a fixed array. Grrr. */
- return __authunix_create (machname, uid, gid, MIN (NGRPS, len), gids);
+ ret_auth = __authunix_create (machname, uid, gid, MIN (NGRPS, len), gids);
+ if (gids)
+ free (gids);
+ return ret_auth;
}
strong_alias(__authunix_create_default,authunix_create_default)
@@ -204,7 +215,7 @@ strong_alias(__authunix_create_default,authunix_create_default)
*/
static void
-authunix_nextverf (AUTH *auth)
+authunix_nextverf (AUTH *auth attribute_unused)
{
/* no action necessary */
}
diff --git a/libc/inet/rpc/clnt_perror.c b/libc/inet/rpc/clnt_perror.c
index 611ca998c..eba539c95 100644
--- a/libc/inet/rpc/clnt_perror.c
+++ b/libc/inet/rpc/clnt_perror.c
@@ -37,6 +37,9 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
* Copyright (C) 1984, Sun Microsystems, Inc.
*
*/
+
+#define fputs __fputs
+
#define __FORCE_GLIBC
#include <features.h>
@@ -245,7 +248,7 @@ __clnt_sperror (CLIENT * rpch, const char *msg)
case RPC_CANTSEND:
case RPC_CANTRECV:
- strerror_r (e.re_errno, chrbuf, sizeof chrbuf);
+ __glibc_strerror_r_internal (e.re_errno, chrbuf, sizeof chrbuf);
len = __sprintf (str, "; errno = %s", chrbuf);
str += len;
break;
@@ -335,7 +338,7 @@ __clnt_spcreateerror (const char *msg)
(void) __strcpy(cp, " - ");
cp += __strlen(cp);
- strerror_r (ce->cf_error.re_errno, chrbuf, sizeof chrbuf);
+ __glibc_strerror_r_internal (ce->cf_error.re_errno, chrbuf, sizeof chrbuf);
(void) __strcpy(cp, chrbuf);
cp += __strlen(cp);
break;
diff --git a/libc/inet/rpc/clnt_raw.c b/libc/inet/rpc/clnt_raw.c
index aa7b44bb4..37b99ecb1 100644
--- a/libc/inet/rpc/clnt_raw.c
+++ b/libc/inet/rpc/clnt_raw.c
@@ -147,7 +147,7 @@ clntraw_call (h, proc, xargs, argsp, xresults, resultsp, timeout)
caddr_t argsp;
xdrproc_t xresults;
caddr_t resultsp;
- struct timeval timeout;
+ struct timeval timeout attribute_unused;
{
struct clntraw_private_s *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -222,16 +222,13 @@ call_again:
}
static void
-clntraw_geterr (CLIENT *cl, struct rpc_err *err)
+clntraw_geterr (CLIENT *cl attribute_unused, struct rpc_err *err attribute_unused)
{
}
static bool_t
-clntraw_freeres (cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- caddr_t res_ptr;
+clntraw_freeres (CLIENT *cl attribute_unused, xdrproc_t xdr_res, caddr_t res_ptr)
{
struct clntraw_private_s *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -252,12 +249,12 @@ clntraw_abort (void)
}
static bool_t
-clntraw_control (CLIENT *cl, int i, char *c)
+clntraw_control (CLIENT *cl attribute_unused, int i attribute_unused, char *c attribute_unused)
{
return FALSE;
}
static void
-clntraw_destroy (CLIENT *cl)
+clntraw_destroy (CLIENT *cl attribute_unused)
{
}
diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c
index c415a447d..8dcb4682a 100644
--- a/libc/inet/rpc/clnt_tcp.c
+++ b/libc/inet/rpc/clnt_tcp.c
@@ -63,6 +63,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
#define connect __connect
#define bindresvport __bindresvport
#define poll __poll
+#define fputs __fputs
#define __FORCE_GLIBC
#include <features.h>
@@ -81,6 +82,11 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
extern u_long _create_xid (void) attribute_hidden;
+#undef get_rpc_createerr
+extern struct rpc_createerr *__rpc_thread_createerr_internal (void)
+ __attribute__ ((__const__)) attribute_hidden;
+#define get_rpc_createerr() (*__rpc_thread_createerr_internal ())
+
#define MCALL_MSG_SIZE 24
struct ct_data
diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c
index 2a9f7b135..bd93fd022 100644
--- a/libc/inet/rpc/clnt_udp.c
+++ b/libc/inet/rpc/clnt_udp.c
@@ -53,6 +53,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
#define sendto __sendto
#define recvmsg __recvmsg
#define poll __poll
+#define fputs __fputs
#define __FORCE_GLIBC
#include <features.h>
@@ -80,6 +81,11 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
extern u_long _create_xid (void) attribute_hidden;
+#undef get_rpc_createerr
+extern struct rpc_createerr *__rpc_thread_createerr_internal (void)
+ __attribute__ ((__const__)) attribute_hidden;
+#define get_rpc_createerr() (*__rpc_thread_createerr_internal ())
+
/*
* UDP bases client side rpc operations
*/
diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c
index c97edba42..e0483b4e2 100644
--- a/libc/inet/rpc/clnt_unix.c
+++ b/libc/inet/rpc/clnt_unix.c
@@ -62,6 +62,7 @@
#define recvmsg __recvmsg
#define sendmsg __sendmsg
#define poll __poll
+#define fputs __fputs
#define __FORCE_GLIBC
#include <features.h>
@@ -81,6 +82,11 @@
extern u_long _create_xid (void) attribute_hidden;
+#undef get_rpc_createerr
+extern struct rpc_createerr *__rpc_thread_createerr_internal (void)
+ __attribute__ ((__const__)) attribute_hidden;
+#define get_rpc_createerr() (*__rpc_thread_createerr_internal ())
+
#define MCALL_MSG_SIZE 24
struct ct_data
diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c
index bdbafa44d..45fbe359f 100644
--- a/libc/inet/rpc/get_myaddress.c
+++ b/libc/inet/rpc/get_myaddress.c
@@ -68,14 +68,14 @@ get_myaddress (struct sockaddr_in *addr)
if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
{
__perror ("get_myaddress: socket");
- exit (1);
+ __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)"));
- exit (1);
+ __exit (1);
}
again:
@@ -86,7 +86,7 @@ get_myaddress (struct sockaddr_in *addr)
if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
{
__perror ("get_myaddress: ioctl");
- exit (1);
+ __exit (1);
}
if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET)
&& (!(ifreq.ifr_flags & IFF_LOOPBACK) ||
diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c
index c2e101510..100469879 100644
--- a/libc/inet/rpc/getrpcent.c
+++ b/libc/inet/rpc/getrpcent.c
@@ -35,6 +35,7 @@
#define atoi __atoi
#define rewind __rewind
+#define fgets __fgets
#define __FORCE_GLIBC
#include <features.h>
diff --git a/libc/inet/rpc/pmap_clnt.c b/libc/inet/rpc/pmap_clnt.c
index 49cd93f4b..0c233dd19 100644
--- a/libc/inet/rpc/pmap_clnt.c
+++ b/libc/inet/rpc/pmap_clnt.c
@@ -69,14 +69,14 @@ __get_myaddress (struct sockaddr_in *addr)
if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
{
__perror ("__get_myaddress: socket");
- exit (1);
+ __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)"));
- exit (1);
+ __exit (1);
}
again:
@@ -87,7 +87,7 @@ __get_myaddress (struct sockaddr_in *addr)
if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
{
__perror ("__get_myaddress: ioctl");
- exit (1);
+ __exit (1);
}
if ((ifreq.ifr_flags & IFF_UP) && (ifr->ifr_addr.sa_family == AF_INET)
&& ((ifreq.ifr_flags & IFF_LOOPBACK) || (loopback == 0)))
diff --git a/libc/inet/rpc/pmap_getport.c b/libc/inet/rpc/pmap_getport.c
index 1981cfaa1..b47baf35c 100644
--- a/libc/inet/rpc/pmap_getport.c
+++ b/libc/inet/rpc/pmap_getport.c
@@ -45,6 +45,11 @@ static char sccsid[] = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
#include <rpc/pmap_clnt.h>
#include <sys/socket.h>
+#undef get_rpc_createerr
+extern struct rpc_createerr *__rpc_thread_createerr_internal (void)
+ __attribute__ ((__const__)) attribute_hidden;
+#define get_rpc_createerr() (*__rpc_thread_createerr_internal ())
+
static const struct timeval timeout =
{5, 0};
static const struct timeval tottimeout =
diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c
index c2eed87d4..c7a5be0db 100644
--- a/libc/inet/rpc/rcmd.c
+++ b/libc/inet/rpc/rcmd.c
@@ -81,6 +81,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
extern int __rresvport(int *alport) attribute_hidden;
+extern int __getc_unlocked (FILE *__stream) attribute_hidden;
/* some forward declarations */
static int __ivaliduser2(FILE *hostf, u_int32_t raddr,
@@ -169,7 +170,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
sigsetmask(oldmask); /* sigsetmask */
return -1;
}
- fcntl(s, F_SETOWN, pid); /* __fcntl */
+ __fcntl(s, F_SETOWN, pid); /* __fcntl */
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr_list[0], &sin.sin_addr,
MIN (sizeof (sin.sin_addr), hp->h_length));
@@ -385,7 +386,7 @@ iruserfopen (char *file, uid_t okuser)
root, if writeable by anyone but the owner, or if hardlinked
anywhere, quit. */
cp = NULL;
- if (lstat (file, &st))
+ if (__lstat (file, &st))
cp = "lstat failed";
else if (!S_ISREG (st.st_mode))
cp = "not regular file";
@@ -394,7 +395,7 @@ iruserfopen (char *file, uid_t okuser)
res = fopen (file, "r");
if (!res)
cp = "cannot open";
- else if (fstat (fileno (res), &st) < 0)
+ else if (__fstat (fileno (res), &st) < 0)
cp = "fstat failed";
else if (st.st_uid && st.st_uid != okuser)
cp = "bad owner";
@@ -664,15 +665,15 @@ __ivaliduser2(hostf, raddr, luser, ruser, rhost)
/* Skip lines that are too long. */
if (__strchr (p, '\n') == NULL) {
- int ch = getc_unlocked (hostf);
+ int ch = __getc_unlocked (hostf);
while (ch != '\n' && ch != EOF)
- ch = getc_unlocked (hostf);
+ ch = __getc_unlocked (hostf);
continue;
}
for (;*p && !isspace(*p); ++p) {
- *p = tolower (*p);
+ *p = __tolower (*p);
}
/* Next we want to find the permitted name for the remote user. */
diff --git a/libc/inet/rpc/rpc_private.h b/libc/inet/rpc/rpc_private.h
index 69ee1cb53..d899b401d 100644
--- a/libc/inet/rpc/rpc_private.h
+++ b/libc/inet/rpc/rpc_private.h
@@ -4,6 +4,11 @@
/* Now define the internal interfaces. */
extern u_long _create_xid (void) attribute_hidden;
+#undef get_rpc_createerr
+extern struct rpc_createerr *__rpc_thread_createerr_internal (void)
+ __attribute__ ((__const__)) attribute_hidden;
+#define get_rpc_createerr() (*__rpc_thread_createerr_internal ())
+
/*
* Multi-threaded support
* Group all global and static variables into a single spot.
diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c
index 02c9c76fa..12b7f2216 100644
--- a/libc/inet/rpc/rpc_thread.c
+++ b/libc/inet/rpc/rpc_thread.c
@@ -7,6 +7,7 @@
#ifdef __UCLIBC_HAS_THREADS__
#include <bits/libc-tsd.h>
+#include <bits/libc-lock.h>
/* Variable used in non-threaded applications or for the first thread. */
static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
@@ -40,25 +41,6 @@ __rpc_thread_destroy (void)
}
}
-
-/* XXX: maybe turn this into a normal __pthread_once() via pthreads/weaks.c ? */
-extern int weak_function __pthread_once (pthread_once_t *__once_control,
- void (*__init_routine) (void));
-
-# define __libc_once_define(CLASS, NAME) \
- CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
-
-/* Call handler iff the first call. */
-#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
- do { \
- if (__pthread_once != NULL) \
- __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \
- else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \
- INIT_FUNCTION (); \
- (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \
- } \
- } while (0)
-
/*
* Initialize RPC multi-threaded operation
*/
@@ -116,8 +98,8 @@ __rpc_thread_svc_fdset_internal (void)
}
strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset)
-struct rpc_createerr *
-__rpc_thread_createerr (void)
+struct rpc_createerr attribute_hidden *
+__rpc_thread_createerr_internal (void)
{
struct rpc_thread_variables *tvp;
@@ -126,6 +108,8 @@ __rpc_thread_createerr (void)
return &rpc_createerr;
return &tvp->rpc_createerr_s;
}
+#undef __rpc_thread_createerr
+strong_alias(__rpc_thread_createerr_internal,__rpc_thread_createerr)
struct pollfd attribute_hidden **
__rpc_thread_svc_pollfd_internal (void)
@@ -164,11 +148,13 @@ fd_set attribute_hidden * __rpc_thread_svc_fdset_internal (void)
}
strong_alias(__rpc_thread_svc_fdset_internal,__rpc_thread_svc_fdset)
-struct rpc_createerr * __rpc_thread_createerr (void)
+struct rpc_createerr attribute_hidden * __rpc_thread_createerr_internal (void)
{
extern struct rpc_createerr rpc_createerr;
return &(rpc_createerr);
}
+#undef __rpc_thread_createerr
+strong_alias(__rpc_thread_createerr_internal,__rpc_thread_createerr)
struct pollfd attribute_hidden ** __rpc_thread_svc_pollfd_internal (void)
{
diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c
index b7bc36864..728ea5bb7 100644
--- a/libc/inet/rpc/ruserpass.c
+++ b/libc/inet/rpc/ruserpass.c
@@ -50,6 +50,8 @@
#include <string.h>
#include <unistd.h>
+extern int __getc_unlocked (FILE *__stream) attribute_hidden;
+
#define _(X) (X)
/* #include "ftp_var.h" */
@@ -182,7 +184,7 @@ next:
break;
case PASSWD:
if (__strcmp(*aname, "anonymous") &&
- fstat(fileno(cfile), &stb) >= 0 &&
+ __fstat(fileno(cfile), &stb) >= 0 &&
(stb.st_mode & 077) != 0) {
__printf(_("Error: .netrc file is readable by others."));
__printf(_("Remove password or make file unreadable by others."));
@@ -201,7 +203,7 @@ next:
break;
case ACCOUNT:
#if 0
- if (fstat(fileno(cfile), &stb) >= 0
+ if (__fstat(fileno(cfile), &stb) >= 0
&& (stb.st_mode & 077) != 0) {
__printf("Error: .netrc file is readable by others.");
__printf("Remove account or make file unreadable by others.");
@@ -219,7 +221,7 @@ next:
(void) fclose(cfile);
return (0);
}
- while ((c=getc_unlocked(cfile)) != EOF && c == ' '
+ while ((c=__getc_unlocked(cfile)) != EOF && c == ' '
|| c == '\t');
if (c == EOF || c == '\n') {
__printf("Missing macdef name argument.\n");
@@ -231,7 +233,7 @@ next:
}
tmp = macros[macnum].mac_name;
*tmp++ = c;
- for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF &&
+ for (i=0; i < 8 && (c=__getc_unlocked(cfile)) != EOF &&
!isspace(c); ++i) {
*tmp++ = c;
}
@@ -241,7 +243,7 @@ next:
}
*tmp = '\0';
if (c != '\n') {
- while ((c=getc_unlocked(cfile)) != EOF
+ while ((c=__getc_unlocked(cfile)) != EOF
&& c != '\n');
}
if (c == EOF) {
@@ -256,7 +258,7 @@ next:
}
tmp = macros[macnum].mac_start;
while (tmp != macbuf + 4096) {
- if ((c=getc_unlocked(cfile)) == EOF) {
+ if ((c=__getc_unlocked(cfile)) == EOF) {
__printf("Macro definition missing null line terminator.\n");
goto bad;
}
@@ -300,24 +302,24 @@ token()
if (feof_unlocked(cfile) || ferror_unlocked(cfile))
return (0);
- while ((c = getc_unlocked(cfile)) != EOF &&
+ while ((c = __getc_unlocked(cfile)) != EOF &&
(c == '\n' || c == '\t' || c == ' ' || c == ','))
continue;
if (c == EOF)
return (0);
cp = tokval;
if (c == '"') {
- while ((c = getc_unlocked(cfile)) != EOF && c != '"') {
+ while ((c = __getc_unlocked(cfile)) != EOF && c != '"') {
if (c == '\\')
- c = getc_unlocked(cfile);
+ c = __getc_unlocked(cfile);
*cp++ = c;
}
} else {
*cp++ = c;
- while ((c = getc_unlocked(cfile)) != EOF
+ while ((c = __getc_unlocked(cfile)) != EOF
&& c != '\n' && c != '\t' && c != ' ' && c != ',') {
if (c == '\\')
- c = getc_unlocked(cfile);
+ c = __getc_unlocked(cfile);
*cp++ = c;
}
}
diff --git a/libc/inet/rpc/svc_auth.c b/libc/inet/rpc/svc_auth.c
index bcead0608..812463396 100644
--- a/libc/inet/rpc/svc_auth.c
+++ b/libc/inet/rpc/svc_auth.c
@@ -118,7 +118,7 @@ _authenticate_internal (register struct svc_req *rqst, struct rpc_msg *msg)
strong_alias(_authenticate_internal,_authenticate)
static enum auth_stat
-_svcauth_null (struct svc_req *rqst, struct rpc_msg *msg)
+_svcauth_null (struct svc_req *rqst attribute_unused, struct rpc_msg *msg attribute_unused)
{
return AUTH_OK;
}
diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c
index 0562a42fe..abddc6ea8 100644
--- a/libc/inet/rpc/svc_auth_unix.c
+++ b/libc/inet/rpc/svc_auth_unix.c
@@ -152,7 +152,7 @@ done:
*/
/*ARGSUSED */
enum auth_stat
-_svcauth_short (struct svc_req *rqst, struct rpc_msg *msg)
+_svcauth_short (struct svc_req *rqst attribute_unused, struct rpc_msg *msg attribute_unused)
{
return AUTH_REJECTEDCRED;
}
diff --git a/libc/inet/rpc/svc_raw.c b/libc/inet/rpc/svc_raw.c
index 8a4cc5981..986350882 100644
--- a/libc/inet/rpc/svc_raw.c
+++ b/libc/inet/rpc/svc_raw.c
@@ -102,14 +102,14 @@ svcraw_create (void)
}
static enum xprt_stat
-svcraw_stat (SVCXPRT *xprt)
+svcraw_stat (SVCXPRT *xprt attribute_unused)
{
return XPRT_IDLE;
}
static bool_t
svcraw_recv (xprt, msg)
- SVCXPRT *xprt;
+ SVCXPRT *xprt attribute_unused;
struct rpc_msg *msg;
{
struct svcraw_private_s *srp = svcraw_private;
@@ -126,7 +126,7 @@ svcraw_recv (xprt, msg)
}
static bool_t
-svcraw_reply (SVCXPRT *xprt, struct rpc_msg *msg)
+svcraw_reply (SVCXPRT *xprt attribute_unused, struct rpc_msg *msg)
{
struct svcraw_private_s *srp = svcraw_private;
XDR *xdrs;
@@ -143,7 +143,7 @@ svcraw_reply (SVCXPRT *xprt, struct rpc_msg *msg)
}
static bool_t
-svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcraw_getargs (SVCXPRT *xprt attribute_unused, xdrproc_t xdr_args, caddr_t args_ptr)
{
struct svcraw_private_s *srp = svcraw_private;
@@ -153,7 +153,7 @@ svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
}
static bool_t
-svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcraw_freeargs (SVCXPRT *xprt attribute_unused, xdrproc_t xdr_args, caddr_t args_ptr)
{
struct svcraw_private_s *srp = svcraw_private;
XDR *xdrs;
@@ -166,6 +166,6 @@ svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
}
static void
-svcraw_destroy (SVCXPRT *xprt)
+svcraw_destroy (SVCXPRT *xprt attribute_unused)
{
}
diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c
index 6b8fe7103..825235450 100644
--- a/libc/inet/rpc/svc_simple.c
+++ b/libc/inet/rpc/svc_simple.c
@@ -44,6 +44,7 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
#define svcudp_create __svcudp_create
#define pmap_unset __pmap_unset
#define asprintf __asprintf
+#define fputs __fputs
#define __FORCE_GLIBC
#define _GNU_SOURCE
@@ -159,7 +160,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
if (svc_sendreply (transp_l, (xdrproc_t)xdr_void, (char *) NULL) == FALSE)
{
__write (STDERR_FILENO, "xxx\n", 4);
- exit (1);
+ __exit (1);
}
return;
}
@@ -184,7 +185,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
(void) asprintf (&buf,
_("trouble replying to prog %d\n"),
pl->p_prognum);
- exit (1);
+ __exit (1);
}
/* free the decoded arguments */
(void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf);
@@ -198,5 +199,5 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
#endif
fputs (buf, stderr);
free (buf);
- exit (1);
+ __exit (1);
}
diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c
index 1972bcf99..4a2556159 100644
--- a/libc/inet/rpc/svc_tcp.c
+++ b/libc/inet/rpc/svc_tcp.c
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
#define poll __poll
#define accept __accept
#define listen __listen
+#define fputs __fputs
#define __FORCE_GLIBC
#define _GNU_SOURCE
@@ -264,7 +265,7 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
}
static bool_t
-rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg)
+rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg attribute_unused)
{
int sock;
struct tcp_rendezvous *r;
@@ -290,7 +291,7 @@ again:
}
static enum xprt_stat
-rendezvous_stat (SVCXPRT *xprt)
+rendezvous_stat (SVCXPRT *xprt attribute_unused)
{
return XPRT_IDLE;
}
diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c
index 62719ee33..82f279814 100644
--- a/libc/inet/rpc/svc_udp.c
+++ b/libc/inet/rpc/svc_udp.c
@@ -52,6 +52,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
#define sendto __sendto
#define recvmsg __recvmsg
#define sendmsg __sendmsg
+#define fputs __fputs
#define __FORCE_GLIBC
#define _GNU_SOURCE
@@ -227,7 +228,7 @@ strong_alias(__svcudp_create,svcudp_create)
static enum xprt_stat
svcudp_stat (xprt)
- SVCXPRT *xprt;
+ SVCXPRT *xprt attribute_unused;
{
return XPRT_IDLE;
diff --git a/libc/inet/rpc/svc_unix.c b/libc/inet/rpc/svc_unix.c
index 95a65ad1f..d71485f0a 100644
--- a/libc/inet/rpc/svc_unix.c
+++ b/libc/inet/rpc/svc_unix.c
@@ -55,6 +55,7 @@
#define poll __poll
#define accept __accept
#define listen __listen
+#define fputs __fputs
#define __FORCE_GLIBC
#include <features.h>
@@ -263,7 +264,7 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
}
static bool_t
-rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg)
+rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg attribute_unused)
{
int sock;
struct unix_rendezvous *r;
@@ -292,7 +293,7 @@ again:
}
static enum xprt_stat
-rendezvous_stat (SVCXPRT *xprt)
+rendezvous_stat (SVCXPRT *xprt attribute_unused)
{
return XPRT_IDLE;
}
diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c
index 12315fdb5..1474c1e08 100644
--- a/libc/inet/rpc/xdr.c
+++ b/libc/inet/rpc/xdr.c
@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
* xdr.
*/
+#define fputs __fputs
+
#define __FORCE_GLIBC
#define _GNU_SOURCE
#include <features.h>
diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c
index a4e50fa8d..5432a5d01 100644
--- a/libc/inet/rpc/xdr_array.c
+++ b/libc/inet/rpc/xdr_array.c
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
*/
#define xdr_u_int __xdr_u_int
+#define fputs __fputs
#define __FORCE_GLIBC
#define _GNU_SOURCE
diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c
index 56908c434..4b6a4817e 100644
--- a/libc/inet/rpc/xdr_mem.c
+++ b/libc/inet/rpc/xdr_mem.c
@@ -93,7 +93,7 @@ strong_alias(__xdrmem_create,xdrmem_create)
*/
static void
-xdrmem_destroy (XDR *xdrs)
+xdrmem_destroy (XDR *xdrs attribute_unused)
{
}
diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c
index a8d95e162..15381a6cc 100644
--- a/libc/inet/rpc/xdr_rec.c
+++ b/libc/inet/rpc/xdr_rec.c
@@ -44,6 +44,8 @@
* The other 31 bits encode the byte length of the fragment.
*/
+#define fputs __fputs
+
#define __FORCE_GLIBC
#define _GNU_SOURCE
#include <features.h>
@@ -317,7 +319,7 @@ xdrrec_getpos (const XDR *xdrs)
RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
long pos;
- pos = lseek ((int) (long) rstrm->tcp_handle, (long) 0, 1);
+ pos = __lseek ((int) (long) rstrm->tcp_handle, (long) 0, 1);
if (pos != -1)
switch (xdrs->x_op)
{
diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c
index 478c8e906..de310b08a 100644
--- a/libc/inet/rpc/xdr_reference.c
+++ b/libc/inet/rpc/xdr_reference.c
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
*/
#define xdr_bool __xdr_bool
+#define fputs __fputs
#define __FORCE_GLIBC
#define _GNU_SOURCE
diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c
index bd9ee4f1b..5c8aec6f9 100644
--- a/libc/inet/rpc/xdr_stdio.c
+++ b/libc/inet/rpc/xdr_stdio.c
@@ -39,6 +39,9 @@
#define fread __fread
#define fwrite __fwrite
+#define fseek __fseek
+#define fflush __fflush
+#define ftell __ftell
#include <rpc/types.h>
#include <stdio.h>
@@ -160,7 +163,7 @@ xdrstdio_setpos (XDR *xdrs, u_int pos)
}
static int32_t *
-xdrstdio_inline (XDR *xdrs, int len)
+xdrstdio_inline (XDR *xdrs attribute_unused, int len attribute_unused)
{
/*
* Must do some work to implement this: must insure
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index d6ec86e94..db2da8c5b 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -158,7 +158,6 @@ strong_alias(__listen,listen)
#ifdef __NR_recv
#define __NR___libc_recv __NR_recv
_syscall4(ssize_t, __libc_recv, int, sockfd, __ptr_t, buffer, size_t, len, int, flags);
-weak_alias(__libc_recv, recv);
#elif defined(__NR_socketcall)
/* recv, recvfrom added by bir7@leland.stanford.edu */
ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)