about summary refs log tree commit diff
path: root/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/auth_des.c8
-rw-r--r--sunrpc/auth_unix.c12
-rw-r--r--sunrpc/bindrsvprt.c4
-rw-r--r--sunrpc/clnt_gen.c2
-rw-r--r--sunrpc/clnt_perr.c26
-rw-r--r--sunrpc/clnt_simp.c2
-rw-r--r--sunrpc/clnt_tcp.c20
-rw-r--r--sunrpc/clnt_udp.c10
-rw-r--r--sunrpc/get_myaddr.c10
-rw-r--r--sunrpc/key_call.c34
-rw-r--r--sunrpc/netname.c6
-rw-r--r--sunrpc/openchild.c33
-rw-r--r--sunrpc/pmap_rmt.c18
-rw-r--r--sunrpc/rpc/auth.h10
-rw-r--r--sunrpc/rpc/clnt.h16
-rw-r--r--sunrpc/rpc/pmap_clnt.h3
-rw-r--r--sunrpc/rpc/svc.h22
-rw-r--r--sunrpc/rpc/xdr.h22
-rw-r--r--sunrpc/rpc_dtable.c12
-rw-r--r--sunrpc/rtime.c8
-rw-r--r--sunrpc/svc_run.c4
-rw-r--r--sunrpc/svc_simple.c6
-rw-r--r--sunrpc/svc_tcp.c24
-rw-r--r--sunrpc/svc_udp.c16
-rw-r--r--sunrpc/svcauth_des.c8
-rw-r--r--sunrpc/xdr_array.c2
-rw-r--r--sunrpc/xdr_rec.c7
-rw-r--r--sunrpc/xdr_ref.c7
-rw-r--r--sunrpc/xdr_stdio.c8
29 files changed, 197 insertions, 163 deletions
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index 8536e62b79..cd68c22ee9 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -243,7 +243,7 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
    * Figure out the "time", accounting for any time difference
    * with the server if necessary.
    */
-  gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL);
+  __gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL);
   ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
   ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
   if (ad->ad_timestamp.tv_usec >= MILLION)
@@ -371,8 +371,8 @@ authdes_validate (AUTH * auth, struct opaque_auth *rverf)
   /*
    * validate
    */
-  if (bcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp,
-	    sizeof (struct timeval)) != 0)
+  if (memcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp,
+	      sizeof (struct timeval)) != 0)
     {
       debug ("authdes_validate: verifier mismatch\n");
       return (FALSE);
@@ -449,7 +449,7 @@ synchronize (struct sockaddr *syncaddr, struct timeval *timep)
   if (rtime ((struct sockaddr_in *) syncaddr, timep, &timeout) < 0)
     return (FALSE);
 
-  gettimeofday (&mytime, (struct timezone *) NULL);
+  __gettimeofday (&mytime, (struct timezone *) NULL);
   timep->tv_sec -= mytime.tv_sec;
   if (mytime.tv_usec > timep->tv_usec)
     {
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index c4c001abf5..9314119a70 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -130,7 +130,7 @@ authunix_create (machname, uid, gid, len, aup_gids)
   /*
    * fill in param struct from the given params
    */
-  (void) gettimeofday (&now, (struct timezone *) 0);
+  (void) __gettimeofday (&now, (struct timezone *) 0);
   aup.aup_time = now.tv_sec;
   aup.aup_machname = machname;
   aup.aup_uid = uid;
@@ -175,13 +175,13 @@ authunix_create_default (void)
   int max_nr_groups = __sysconf (_SC_NGROUPS_MAX);
   gid_t gids[max_nr_groups];
 
-  if (gethostname (machname, MAX_MACHINE_NAME) == -1)
+  if (__gethostname (machname, MAX_MACHINE_NAME) == -1)
     abort ();
   machname[MAX_MACHINE_NAME] = 0;
-  uid = geteuid ();
-  gid = getegid ();
+  uid = __geteuid ();
+  gid = __getegid ();
 
-  if ((len = getgroups (max_nr_groups, gids)) < 0)
+  if ((len = __getgroups (max_nr_groups, gids)) < 0)
     abort ();
   /* This braindamaged Sun code forces us here to truncate the
      list of groups to NGRPS members since the code in
@@ -267,7 +267,7 @@ authunix_refresh (AUTH *auth)
     goto done;
 
   /* update the time and serialize in place */
-  (void) gettimeofday (&now, (struct timezone *) 0);
+  (void) __gettimeofday (&now, (struct timezone *) 0);
   aup.aup_time = now.tv_sec;
   xdrs.x_op = XDR_ENCODE;
   XDR_SETPOS (&xdrs, 0);
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index e1d53ce950..f646ffda70 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -61,7 +61,7 @@ bindresvport (int sd, struct sockaddr_in *sin)
   if (sin == (struct sockaddr_in *) 0)
     {
       sin = &myaddr;
-      bzero (sin, sizeof (*sin));
+      __bzero (sin, sizeof (*sin));
       sin->sin_family = AF_INET;
     }
   else if (sin->sin_family != AF_INET)
@@ -71,7 +71,7 @@ bindresvport (int sd, struct sockaddr_in *sin)
     }
   if (port == 0)
     {
-      port = (getpid () % NPORTS) + STARTPORT;
+      port = (__getpid () % NPORTS) + STARTPORT;
     }
   res = -1;
   __set_errno (EADDRINUSE);
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index c24442cb36..b1b35ca50a 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -89,7 +89,7 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
     }
   sin.sin_family = h->h_addrtype;
   sin.sin_port = 0;
-  bzero (sin.sin_zero, sizeof (sin.sin_zero));
+  __bzero (sin.sin_zero, sizeof (sin.sin_zero));
   bcopy (h->h_addr, (char *) &sin.sin_addr, h->h_length);
 
   prtbuflen = 1024;
diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c
index af0fe4313c..d756cb12ba 100644
--- a/sunrpc/clnt_perr.c
+++ b/sunrpc/clnt_perr.c
@@ -43,6 +43,11 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
 #include <rpc/auth.h>
 #include <rpc/clnt.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
+
 static char *auth_errmsg (enum auth_stat stat) internal_function;
 
 static char *buf;
@@ -96,8 +101,8 @@ clnt_sperror (CLIENT * rpch, const char *msg)
 
     case RPC_CANTSEND:
     case RPC_CANTRECV:
-      len = sprintf (str, "; errno = %s", strerror_r (e.re_errno,
-						      buf, sizeof buf));
+      len = sprintf (str, "; errno = %s", __strerror_r (e.re_errno,
+							buf, sizeof buf));
       str += len;
       break;
 
@@ -233,21 +238,14 @@ clnt_spcreateerror (const char *msg)
   switch (rpc_createerr.cf_stat)
     {
     case RPC_PMAPFAILURE:
-      cp = stpcpy (cp, " - ");
-      cp = stpcpy (cp, clnt_sperrno (rpc_createerr.cf_error.re_status));
+      cp = stpcpy (stpcpy (cp, " - "),
+		   clnt_sperrno (rpc_createerr.cf_error.re_status));
       break;
 
     case RPC_SYSTEMERROR:
-      cp = stpcpy (str, " - ");
-      if (rpc_createerr.cf_error.re_errno > 0
-	  && rpc_createerr.cf_error.re_errno < sys_nerr)
-	cp = stpcpy (str, strerror_r (rpc_createerr.cf_error.re_errno,
-				      buf, sizeof buf));
-      else
-	{
-	  len = sprintf (cp, _("Error %d"), rpc_createerr.cf_error.re_errno);
-	  cp += len;
-	}
+      cp = stpcpy (stpcpy (cp, " - "),
+		   __strerror_r (rpc_createerr.cf_error.re_errno,
+				 buf, sizeof buf));
       break;
     default:
       break;
diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c
index f528c3018b..bf9f690573 100644
--- a/sunrpc/clnt_simp.c
+++ b/sunrpc/clnt_simp.c
@@ -93,7 +93,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
       crp->valid = 0;
       if (crp->socket != RPC_ANYSOCK)
 	{
-	  (void) close (crp->socket);
+	  (void) __close (crp->socket);
 	  crp->socket = RPC_ANYSOCK;
 	}
       if (crp->client)
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index be74f0dc0e..07224e313b 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -155,16 +155,16 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
    */
   if (*sockp < 0)
     {
-      *sockp = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+      *sockp = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
       (void) bindresvport (*sockp, (struct sockaddr_in *) 0);
       if ((*sockp < 0)
-	  || (connect (*sockp, (struct sockaddr *) raddr,
-		       sizeof (*raddr)) < 0))
+	  || (__connect (*sockp, (struct sockaddr *) raddr,
+			 sizeof (*raddr)) < 0))
 	{
 	  rpc_createerr.cf_stat = RPC_SYSTEMERROR;
 	  rpc_createerr.cf_error.re_errno = errno;
 	  if (*sockp >= 0)
-	    (void) close (*sockp);
+	    (void) __close (*sockp);
 	  goto fooy;
 	}
       ct->ct_closeit = TRUE;
@@ -185,8 +185,8 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
   /*
    * Initialize call message
    */
-  (void) gettimeofday (&now, (struct timezone *) 0);
-  call_msg.rm_xid = getpid () ^ now.tv_sec ^ now.tv_usec;
+  (void) __gettimeofday (&now, (struct timezone *) 0);
+  call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
   call_msg.rm_direction = CALL;
   call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
   call_msg.rm_call.cb_prog = prog;
@@ -201,7 +201,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
     {
       if (ct->ct_closeit)
 	{
-	  (void) close (*sockp);
+	  (void) __close (*sockp);
 	}
       goto fooy;
     }
@@ -454,7 +454,7 @@ clnttcp_destroy (CLIENT *h)
 
   if (ct->ct_closeit)
     {
-      (void) close (ct->ct_sock);
+      (void) __close (ct->ct_sock);
     }
   XDR_DESTROY (&(ct->ct_xdrs));
   mem_free ((caddr_t) ct, sizeof (struct ct_data));
@@ -496,7 +496,7 @@ readtcp (char *ctptr, char *buf, int len)
 	}
       break;
     }
-  switch (len = read (ct->ct_sock, buf, len))
+  switch (len = __read (ct->ct_sock, buf, len))
     {
 
     case 0:
@@ -522,7 +522,7 @@ writetcp (char *ctptr, char *buf, int len)
 
   for (cnt = len; cnt > 0; cnt -= i, buf += i)
     {
-      if ((i = write (ct->ct_sock, buf, cnt)) == -1)
+      if ((i = __write (ct->ct_sock, buf, cnt)) == -1)
 	{
 	  ct->ct_error.re_errno = errno;
 	  ct->ct_error.re_status = RPC_CANTSEND;
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 1e2fe657d9..0842e5ac1a 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -143,7 +143,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
     }
   cu->cu_outbuf = &cu->cu_inbuf[recvsz];
 
-  (void) gettimeofday (&now, (struct timezone *) 0);
+  (void) __gettimeofday (&now, (struct timezone *) 0);
   if (raddr->sin_port == 0)
     {
       u_short port;
@@ -163,7 +163,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
   cu->cu_total.tv_usec = -1;
   cu->cu_sendsz = sendsz;
   cu->cu_recvsz = recvsz;
-  call_msg.rm_xid = getpid () ^ now.tv_sec ^ now.tv_usec;
+  call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
   call_msg.rm_direction = CALL;
   call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
   call_msg.rm_call.cb_prog = program;
@@ -179,7 +179,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
     {
       int dontblock = 1;
 
-      *sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+      *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
       if (*sockp < 0)
 	{
 	  rpc_createerr.cf_stat = RPC_SYSTEMERROR;
@@ -189,7 +189,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
       /* attempt to bind to prov port */
       (void) bindresvport (*sockp, (struct sockaddr_in *) 0);
       /* the sockets rpc controls are non-blocking */
-      (void) ioctl (*sockp, FIONBIO, (char *) &dontblock);
+      (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
       cu->cu_closeit = TRUE;
     }
   else
@@ -511,7 +511,7 @@ clntudp_destroy (CLIENT *cl)
 
   if (cu->cu_closeit)
     {
-      (void) close (cu->cu_sock);
+      (void) __close (cu->cu_sock);
     }
   XDR_DESTROY (&(cu->cu_outxdrs));
   mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
diff --git a/sunrpc/get_myaddr.c b/sunrpc/get_myaddr.c
index 86277d2390..820c7b3109 100644
--- a/sunrpc/get_myaddr.c
+++ b/sunrpc/get_myaddr.c
@@ -65,14 +65,14 @@ get_myaddress (struct sockaddr_in *addr)
   struct ifreq ifreq, *ifr;
   int len, loopback = 0;
 
-  if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
+  if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
     {
       perror ("get_myaddress: socket");
       exit (1);
     }
   ifc.ifc_len = sizeof (buf);
   ifc.ifc_buf = buf;
-  if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0)
+  if (__ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0)
     {
       perror (_("get_myaddress: ioctl (get interface configuration)"));
       exit (1);
@@ -83,7 +83,7 @@ get_myaddress (struct sockaddr_in *addr)
   for (len = ifc.ifc_len; len; len -= sizeof ifreq)
     {
       ifreq = *ifr;
-      if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
+      if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
 	{
           perror ("get_myaddress: ioctl");
           exit (1);
@@ -94,7 +94,7 @@ get_myaddress (struct sockaddr_in *addr)
 	{
 	  *addr = *((struct sockaddr_in *) &ifr->ifr_addr);
 	  addr->sin_port = htons (PMAPPORT);
-	  close (s);
+	  __close (s);
 	  return;
 	}
       ifr++;
@@ -104,5 +104,5 @@ get_myaddress (struct sockaddr_in *addr)
       loopback = 1;
       goto again;
     }
-  close (s);
+  __close (s);
 }
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index a497bc7cad..e59a8b7a37 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -200,7 +200,7 @@ key_gendes (des_block *key)
   sin.sin_family = AF_INET;
   sin.sin_port = 0;
   sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
-  bzero (sin.sin_zero, sizeof (sin.sin_zero));
+  __bzero (sin.sin_zero, sizeof (sin.sin_zero));
   socket = RPC_ANYSOCK;
   client = clntudp_bufcreate (&sin, (u_long) KEY_PROG, (u_long) KEY_VERS,
 			      trytimeout, &socket, RPCSMALLMSGSIZE,
@@ -211,7 +211,7 @@ key_gendes (des_block *key)
   stat = clnt_call (client, KEY_GEN, (xdrproc_t) xdr_void, NULL,
 		    (xdrproc_t) xdr_des_block, (caddr_t) key, tottimeout);
   clnt_destroy (client);
-  close (socket);
+  __close (socket);
   if (stat != RPC_SUCCESS)
     return -1;
 
@@ -286,21 +286,21 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
   if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL)
     {
       cryptkeyres *res;
-      res = (*__key_encryptsession_pk_LOCAL) (geteuid (), arg);
+      res = (*__key_encryptsession_pk_LOCAL) (__geteuid (), arg);
       *(cryptkeyres *) rslt = *res;
       return 1;
     }
   else if (proc == KEY_DECRYPT_PK && __key_decryptsession_pk_LOCAL)
     {
       cryptkeyres *res;
-      res = (*__key_decryptsession_pk_LOCAL) (geteuid (), arg);
+      res = (*__key_decryptsession_pk_LOCAL) (__geteuid (), arg);
       *(cryptkeyres *) rslt = *res;
       return 1;
     }
   else if (proc == KEY_GEN && __key_gendes_LOCAL)
     {
       des_block *res;
-      res = (*__key_gendes_LOCAL) (geteuid (), 0);
+      res = (*__key_gendes_LOCAL) (__geteuid (), 0);
       *(des_block *) rslt = *res;
       return 1;
     }
@@ -308,7 +308,7 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
   success = 1;
   sigemptyset (&mask);
   sigaddset (&mask, SIGCHLD);
-  sigprocmask (SIG_BLOCK, &mask, &oldmask);
+  __sigprocmask (SIG_BLOCK, &mask, &oldmask);
 
   /*
    * We are going to exec a set-uid program which makes our effective uid
@@ -316,15 +316,15 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
    * effective uid be the real uid for the setuid program, and
    * the real uid be the effective uid so that we can change things back.
    */
-  euid = geteuid ();
-  ruid = getuid ();
-  setreuid (euid, ruid);
+  euid = __geteuid ();
+  ruid = __getuid ();
+  __setreuid (euid, ruid);
   pid = _openchild (MESSENGER, &fargs, &frslt);
-  setreuid (ruid, euid);
+  __setreuid (ruid, euid);
   if (pid < 0)
     {
       debug ("open_streams");
-      sigprocmask(SIG_SETMASK, &oldmask, NULL);
+      __sigprocmask (SIG_SETMASK, &oldmask, NULL);
       return (0);
     }
   xdrstdio_create (&xdrargs, fargs, XDR_ENCODE);
@@ -345,23 +345,23 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
   fclose(frslt);
 
  wait_again:
-  if (wait4(pid, &status, 0, NULL) < 0)
+  if (__wait4 (pid, &status, 0, NULL) < 0)
     {
       if (errno == EINTR)
 	goto wait_again;
-      debug("wait4");
+      debug ("wait4");
       if (errno == ECHILD || errno == ESRCH)
-	perror("wait");
+	perror ("wait");
       else
 	success = 0;
     }
   else
     if (status.w_retcode)
       {
-	debug("wait4 1");
+	debug ("wait4 1");
 	success = 0;
       }
-  sigprocmask(SIG_SETMASK, &oldmask, NULL);
+  __sigprocmask (SIG_SETMASK, &oldmask, NULL);
 
-  return (success);
+  return success;
 }
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index 176967a905..1578108194 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -69,7 +69,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
   netname[0] = '\0';		/* make null first (no need for memset) */
 
   if (host == NULL)
-    gethostname (hostname, MAXHOSTNAMELEN);
+    __gethostname (hostname, MAXHOSTNAMELEN);
   else
     {
       strncpy (hostname, host, MAXHOSTNAMELEN);
@@ -122,7 +122,7 @@ getnetname (char name[MAXNETNAMELEN + 1])
   uid_t uid;
   int dummy;
 
-  uid = geteuid ();
+  uid = __geteuid ();
   if (uid == 0)
     dummy = host2netname (name, NULL, NULL);
   else
diff --git a/sunrpc/openchild.c b/sunrpc/openchild.c
index 11e06006b3..e30e5cc872 100644
--- a/sunrpc/openchild.c
+++ b/sunrpc/openchild.c
@@ -43,6 +43,11 @@
 #include <rpc/rpc.h>
 #include <rpc/clnt.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fflush(s) _IO_fflush (s)
+#endif
+
 /*
  * returns pid, or -1 for failure
  */
@@ -54,11 +59,11 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
   int pdto[2];
   int pdfrom[2];
 
-  if (pipe (pdto) < 0)
+  if (__pipe (pdto) < 0)
     goto error1;
-  if (pipe (pdfrom) < 0)
+  if (__pipe (pdfrom) < 0)
     goto error2;
-  switch (pid = fork ())
+  switch (pid = __fork ())
     {
     case -1:
       goto error3;
@@ -67,13 +72,13 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
       /*
        * child: read from pdto[0], write into pdfrom[1]
        */
-      close (0);
-      dup (pdto[0]);
-      close (1);
-      dup (pdfrom[1]);
+      __close (0);
+      __dup (pdto[0]);
+      __close (1);
+      __dup (pdfrom[1]);
       fflush (stderr);
       for (i = _rpc_dtablesize () - 1; i >= 3; i--)
-	close (i);
+	__close (i);
       fflush (stderr);
       execlp (command, command, 0);
       perror ("exec");
@@ -84,9 +89,9 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
        * parent: write into pdto[1], read from pdfrom[0]
        */
       *fto = fdopen (pdto[1], "w");
-      close (pdto[0]);
+      __close (pdto[0]);
       *ffrom = fdopen (pdfrom[0], "r");
-      close (pdfrom[1]);
+      __close (pdfrom[1]);
       break;
     }
   return pid;
@@ -95,11 +100,11 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
    * error cleanup and return
    */
 error3:
-  close (pdfrom[0]);
-  close (pdfrom[1]);
+  __close (pdfrom[0]);
+  __close (pdfrom[1]);
 error2:
-  close (pdto[0]);
-  close (pdto[1]);
+  __close (pdto[0]);
+  __close (pdto[1]);
 error1:
   return -1;
 }
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index b3c8fcba5e..768387c798 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -101,7 +101,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p
     {
       stat = RPC_FAILED;
     }
-  /* (void)close(socket); CLNT_DESTROY already closed it */
+  /* (void)__close(socket); CLNT_DESTROY already closed it */
   addr->sin_port = 0;
   return stat;
 }
@@ -180,7 +180,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
 
   ifc.ifc_len = UDPMSGSIZE;
   ifc.ifc_buf = buf;
-  if (ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0)
+  if (__ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0)
     {
       perror (_("broadcast: ioctl (get interface configuration)"));
       return (0);
@@ -189,7 +189,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
   for (i = 0, n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++)
     {
       ifreq = *ifr;
-      if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
+      if (__ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
 	{
 	  perror (_("broadcast: ioctl (get interface flags)"));
 	  continue;
@@ -200,7 +200,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
 	{
 	  sin = (struct sockaddr_in *) &ifr->ifr_addr;
 #ifdef SIOCGIFBRDADDR		/* 4.3BSD */
-	  if (ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0)
+	  if (__ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0)
 	    {
 	      addrs[i++] = inet_makeaddr (inet_netof
 	      /* Changed to pass struct instead of s_addr member
@@ -259,7 +259,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
    * initialization: create a socket, a broadcast address, and
    * preserialize the arguments into a send buffer.
    */
-  if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+  if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
     {
       perror (_("Cannot create socket for broadcast rpc"));
       stat = RPC_CANTSEND;
@@ -276,13 +276,13 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
   fd.fd = sock;
   fd.events = POLLIN;
   nets = getbroadcastnets (addrs, sock, inbuf);
-  bzero ((char *) &baddr, sizeof (baddr));
+  __bzero ((char *) &baddr, sizeof (baddr));
   baddr.sin_family = AF_INET;
   baddr.sin_port = htons (PMAPPORT);
   baddr.sin_addr.s_addr = htonl (INADDR_ANY);
 /*      baddr.sin_addr.S_un.S_addr = htonl(INADDR_ANY); */
-  (void) gettimeofday (&t, (struct timezone *) 0);
-  msg.rm_xid = xid = getpid () ^ t.tv_sec ^ t.tv_usec;
+  (void) __gettimeofday (&t, (struct timezone *) 0);
+  msg.rm_xid = xid = __getpid () ^ t.tv_sec ^ t.tv_usec;
   t.tv_usec = 0;
   msg.rm_direction = CALL;
   msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
@@ -405,7 +405,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
 	}
     }
 done_broad:
-  (void) close (sock);
+  (void) __close (sock);
   AUTH_DESTROY (unix_auth);
   return stat;
 }
diff --git a/sunrpc/rpc/auth.h b/sunrpc/rpc/auth.h
index aa2c6144a1..ae1346da0f 100644
--- a/sunrpc/rpc/auth.h
+++ b/sunrpc/rpc/auth.h
@@ -97,12 +97,12 @@ struct AUTH {
   struct opaque_auth ah_verf;
   union des_block ah_key;
   struct auth_ops {
-    void (*ah_nextverf) __P ((AUTH *));
-    int  (*ah_marshal) __P ((AUTH *, XDR *));	/* nextverf & serialize */
-    int  (*ah_validate) __P ((AUTH *, struct opaque_auth *));
+    void (*ah_nextverf) __PMT ((AUTH *));
+    int  (*ah_marshal) __PMT ((AUTH *, XDR *));	/* nextverf & serialize */
+    int  (*ah_validate) __PMT ((AUTH *, struct opaque_auth *));
 						/* validate verifier */
-    int  (*ah_refresh) __P ((AUTH *));		/* refresh credentials */
-    void (*ah_destroy) __P ((AUTH *));     	/* destroy this structure */
+    int  (*ah_refresh) __PMT ((AUTH *));	/* refresh credentials */
+    void (*ah_destroy) __PMT ((AUTH *));     	/* destroy this structure */
   } *ah_ops;
   caddr_t ah_private;
 };
diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h
index ed12add102..1570cba4c2 100644
--- a/sunrpc/rpc/clnt.h
+++ b/sunrpc/rpc/clnt.h
@@ -132,17 +132,17 @@ typedef struct CLIENT CLIENT;
 struct CLIENT {
   AUTH	*cl_auth;		 /* authenticator */
   struct clnt_ops {
-    enum clnt_stat (*cl_call) __P ((CLIENT *, u_long, xdrproc_t,
-				    caddr_t, xdrproc_t,
-				    caddr_t, struct timeval));
+    enum clnt_stat (*cl_call) __PMT ((CLIENT *, u_long, xdrproc_t,
+				      caddr_t, xdrproc_t,
+				      caddr_t, struct timeval));
 			       	/* call remote procedure */
-    void (*cl_abort) __P ((void));  /* abort a call */
-    void (*cl_geterr) __P ((CLIENT *, struct rpc_err *));
+    void (*cl_abort) __PMT ((void));  /* abort a call */
+    void (*cl_geterr) __PMT ((CLIENT *, struct rpc_err *));
 				/* get specific error code */
-    bool_t (*cl_freeres) __P ((CLIENT *, xdrproc_t, caddr_t));
+    bool_t (*cl_freeres) __PMT ((CLIENT *, xdrproc_t, caddr_t));
 				/* frees results */
-    void (*cl_destroy) __P ((CLIENT *)); /* destroy this structure */
-    bool_t (*cl_control) __P ((CLIENT *, int, char *));
+    void (*cl_destroy) __PMT ((CLIENT *)); /* destroy this structure */
+    bool_t (*cl_control) __PMT ((CLIENT *, int, char *));
 				/* the ioctl() of rpc */
   } *cl_ops;
   caddr_t cl_private;		/* private stuff */
diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h
index bef4be109e..d9800d4006 100644
--- a/sunrpc/rpc/pmap_clnt.h
+++ b/sunrpc/rpc/pmap_clnt.h
@@ -45,7 +45,8 @@
 
 __BEGIN_DECLS
 
-typedef bool_t (*resultproc_t) __P ((caddr_t resp, struct sockaddr_in *raddr));
+typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
+				       struct sockaddr_in *raddr));
 
 /*
  * Usage:
diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h
index 81366aedb6..a53bc1015f 100644
--- a/sunrpc/rpc/svc.h
+++ b/sunrpc/rpc/svc.h
@@ -78,18 +78,18 @@ struct SVCXPRT {
   int xp_sock;
   u_short xp_port;		/* associated port number */
   const struct xp_ops {
-    bool_t	(*xp_recv) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+    bool_t	(*xp_recv) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
 				/* receive incoming requests */
-    enum xprt_stat (*xp_stat) __P ((SVCXPRT *__xprt));
+    enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
 				/* get transport status */
-    bool_t	(*xp_getargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
-				    caddr_t args_ptr)); /* get arguments */
-    bool_t	(*xp_reply) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+    bool_t	(*xp_getargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+				      caddr_t args_ptr)); /* get arguments */
+    bool_t	(*xp_reply) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
 				/* send reply */
-    bool_t	(*xp_freeargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
-				     caddr_t args_ptr));
+    bool_t	(*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+				       caddr_t args_ptr));
 				/* free mem allocated for args */
-    void	(*xp_destroy) __P ((SVCXPRT *__xprt));
+    void	(*xp_destroy) __PMT ((SVCXPRT *__xprt));
 				/* destroy this struct */
   } *xp_ops;
   int		xp_addrlen;	 /* length of remote address */
@@ -156,9 +156,9 @@ struct svc_req {
 };
 
 #ifndef __DISPATCH_FN_T
-#define __DISPATCH_FN_T                                                 
-typedef void (*__dispatch_fn_t) __P((struct svc_req*, SVCXPRT*));
-#endif                                                               
+#define __DISPATCH_FN_T
+typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
+#endif
 
 /*
  * Service registration
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index bf8c2c4081..a4e66c9fc2 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -117,22 +117,23 @@ struct XDR
     enum xdr_op x_op;		/* operation; fast additional param */
     struct xdr_ops
       {
-	bool_t (*x_getlong) __P ((XDR * __xdrs, long *__lp));
+	bool_t (*x_getlong) __PMT ((XDR * __xdrs, long *__lp));
 	/* get a long from underlying stream */
-	bool_t (*x_putlong) __P ((XDR * __xdrs, __const long *__lp));
+	bool_t (*x_putlong) __PMT ((XDR * __xdrs, __const long *__lp));
 	/* put a long to " */
-	bool_t (*x_getbytes) __P ((XDR * __xdrs, caddr_t __addr, u_int __len));
+	bool_t (*x_getbytes) __PMT ((XDR * __xdrs, caddr_t __addr,
+				     u_int __len));
 	/* get some bytes from " */
-	bool_t (*x_putbytes) __P ((XDR * __xdrs, __const char *__addr,
-				   u_int __len));
+	bool_t (*x_putbytes) __PMT ((XDR * __xdrs, __const char *__addr,
+				     u_int __len));
 	/* put some bytes to " */
-	u_int (*x_getpostn) __P ((__const XDR * __xdrs));
+	u_int (*x_getpostn) __PMT ((__const XDR * __xdrs));
 	/* returns bytes off from beginning */
-	bool_t (*x_setpostn) __P ((XDR * __xdrs, u_int pos));
+	bool_t (*x_setpostn) __PMT ((XDR * __xdrs, u_int pos));
 	/* lets you reposition the stream */
-	long *(*x_inline) __P ((XDR * __xdrs, int len));
+	long *(*x_inline) __PMT ((XDR * __xdrs, int len));
 	/* buf quick ptr to buffered data */
-	void (*x_destroy) __P ((XDR * __xdrs));
+	void (*x_destroy) __PMT ((XDR * __xdrs));
 	/* free privates of this xdr_stream */
       }
      *x_ops;
@@ -151,8 +152,7 @@ struct XDR
  * allocate dynamic storage of the appropriate size and return it.
  * bool_t       (*xdrproc_t)(XDR *, caddr_t *);
  */
-typedef
-bool_t (*xdrproc_t) __P ((XDR *, void *,...));
+typedef bool_t (*xdrproc_t) __PMT ((XDR *, void *,...));
 
 /*
  * Operations defined on a XDR handle
diff --git a/sunrpc/rpc_dtable.c b/sunrpc/rpc_dtable.c
index 26bf1a204a..90e5b1e9cb 100644
--- a/sunrpc/rpc_dtable.c
+++ b/sunrpc/rpc_dtable.c
@@ -6,23 +6,23 @@
  * may copy or modify Sun RPC without charge, but are not authorized
  * to license or distribute it to anyone else except as part of a product or
  * program developed by the user.
- * 
+ *
  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- * 
+ *
  * Sun RPC is provided with no support and without any obligation on the
  * part of Sun Microsystems, Inc. to assist in its use, correction,
  * modification or enhancement.
- * 
+ *
  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  * OR ANY PART THEREOF.
- * 
+ *
  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  * or profits or other special, indirect and consequential damages, even if
  * Sun has been advised of the possibility of such damages.
- * 
+ *
  * Sun Microsystems, Inc.
  * 2550 Garcia Avenue
  * Mountain View, California  94043
@@ -43,7 +43,7 @@ _rpc_dtablesize (void)
   static int size;
 
   if (size == 0)
-    size = getdtablesize ();
+    size = __getdtablesize ();
 
   return size;
 }
diff --git a/sunrpc/rtime.c b/sunrpc/rtime.c
index ca2790a2dc..09a8948624 100644
--- a/sunrpc/rtime.c
+++ b/sunrpc/rtime.c
@@ -65,7 +65,7 @@ do_close (int s)
   int save;
 
   save = errno;
-  close (s);
+  __close (s);
   __set_errno (save);
 }
 
@@ -87,7 +87,7 @@ rtime (struct sockaddr_in *addrp, struct timeval *timep,
   else
     type = SOCK_DGRAM;
 
-  s = socket (AF_INET, type, 0);
+  s = __socket (AF_INET, type, 0);
   if (s < 0)
     return (-1);
 
@@ -124,12 +124,12 @@ rtime (struct sockaddr_in *addrp, struct timeval *timep,
     }
   else
     {
-      if (connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0)
+      if (__connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0)
 	{
 	  do_close (s);
 	  return -1;
 	}
-      res = read (s, (char *) &thetime, sizeof (thetime));
+      res = __read (s, (char *) &thetime, sizeof (thetime));
       do_close (s);
       if (res < 0)
 	return (-1);
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c
index 021484d864..1a76b10183 100644
--- a/sunrpc/svc_run.c
+++ b/sunrpc/svc_run.c
@@ -70,8 +70,8 @@ svc_run (void)
 #else
       readfds = svc_fds;
 #endif /* def FD_SETSIZE */
-      switch (select (_rpc_dtablesize (), &readfds, (fd_set *)NULL,
-		      (fd_set *)NULL, (struct timeval *) 0))
+      switch (__select (_rpc_dtablesize (), &readfds, (fd_set *)NULL,
+			(fd_set *)NULL, (struct timeval *) 0))
 	{
 	case -1:
 	  if (errno == EINTR)
diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c
index cc28f6a7e3..405860e6c0 100644
--- a/sunrpc/svc_simple.c
+++ b/sunrpc/svc_simple.c
@@ -45,6 +45,10 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
 #include <sys/socket.h>
 #include <netdb.h>
 
+#ifdef USE_IN_LIBIO
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
+
 static struct proglst
   {
     char *(*p_progname) (char *);
@@ -129,7 +133,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp)
     if (pl->p_prognum == prog && pl->p_procnum == proc)
       {
 	/* decode arguments into a CLEAN buffer */
-	bzero (xdrbuf, sizeof (xdrbuf));	/* required ! */
+	__bzero (xdrbuf, sizeof (xdrbuf));	/* required ! */
 	if (!svc_getargs (transp, pl->p_inproc, xdrbuf))
 	  {
 	    svcerr_decode (transp);
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index e162c02751..75fa8705b6 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -49,6 +49,11 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
 #include <errno.h>
 #include <stdlib.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
+
 /*
  * Ops vector for TCP/IP based rpc service handle
  */
@@ -134,14 +139,14 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
 
   if (sock == RPC_ANYSOCK)
     {
-      if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+      if ((sock = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
 	{
 	  perror (_("svctcp_.c - udp socket creation problem"));
 	  return (SVCXPRT *) NULL;
 	}
       madesock = TRUE;
     }
-  bzero ((char *) &addr, sizeof (addr));
+  __bzero ((char *) &addr, sizeof (addr));
   addr.sin_family = AF_INET;
   if (bindresvport (sock, &addr))
     {
@@ -153,7 +158,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
     {
       perror (_("svctcp_.c - cannot getsockname or listen"));
       if (madesock)
-	(void) close (sock);
+	(void) __close (sock);
       return (SVCXPRT *) NULL;
     }
   r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r));
@@ -237,8 +242,7 @@ rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg)
   r = (struct tcp_rendezvous *) xprt->xp_p1;
 again:
   len = sizeof (struct sockaddr_in);
-  if ((sock = accept (xprt->xp_sock, (struct sockaddr *) &addr,
-		      &len)) < 0)
+  if ((sock = accept (xprt->xp_sock, (struct sockaddr *) &addr, &len)) < 0)
     {
       if (errno == EINTR)
 	goto again;
@@ -265,7 +269,7 @@ svctcp_destroy (SVCXPRT *xprt)
   struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1;
 
   xprt_unregister (xprt);
-  (void) close (xprt->xp_sock);
+  (void) __close (xprt->xp_sock);
   if (xprt->xp_port != 0)
     {
       /* a rendezvouser socket */
@@ -318,8 +322,8 @@ readtcp (char *xprtptr, char *buf, int len)
 #else
       readfds |= (1 << sock);
 #endif /* def FD_SETSIZE */
-      if (select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
-		  (fd_set *) NULL, &timeout) <= 0)
+      if (__select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
+		    (fd_set *) NULL, &timeout) <= 0)
 	{
 	  if (errno == EINTR)
 	    continue;
@@ -336,7 +340,7 @@ readtcp (char *xprtptr, char *buf, int len)
       svc_getreqset (&readfds);
     }
 
-  if ((len = read (sock, buf, len)) > 0)
+  if ((len = __read (sock, buf, len)) > 0)
     return len;
 
 fatal_err:
@@ -356,7 +360,7 @@ writetcp (char *xprtptr, char * buf, int len)
 
   for (cnt = len; cnt > 0; cnt -= i, buf += i)
     {
-      if ((i = write (xprt->xp_sock, buf, cnt)) < 0)
+      if ((i = __write (xprt->xp_sock, buf, cnt)) < 0)
 	{
 	  ((struct tcp_conn *) (xprt->xp_p1))->strm_stat =
 	    XPRT_DIED;
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 39ecbb0b50..4ea421a7b2 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -46,6 +46,10 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
 #include <sys/socket.h>
 #include <errno.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
 
 #define rpc_buffer(xprt) ((xprt)->xp_p1)
 #ifndef MAX
@@ -112,14 +116,14 @@ svcudp_bufcreate (sock, sendsz, recvsz)
 
   if (sock == RPC_ANYSOCK)
     {
-      if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+      if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
 	{
 	  perror (_("svcudp_create: socket creation problem"));
 	  return (SVCXPRT *) NULL;
 	}
       madesock = TRUE;
     }
-  bzero ((char *) &addr, sizeof (addr));
+  __bzero ((char *) &addr, sizeof (addr));
   addr.sin_family = AF_INET;
   if (bindresvport (sock, &addr))
     {
@@ -130,7 +134,7 @@ svcudp_bufcreate (sock, sendsz, recvsz)
     {
       perror (_("svcudp_create - cannot getsockname"));
       if (madesock)
-	(void) close (sock);
+	(void) __close (sock);
       return (SVCXPRT *) NULL;
     }
   xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
@@ -276,7 +280,7 @@ svcudp_destroy (xprt)
   struct svcudp_data *su = su_data (xprt);
 
   xprt_unregister (xprt);
-  (void) close (xprt->xp_sock);
+  (void) __close (xprt->xp_sock);
   XDR_DESTROY (&(su->su_xdrs));
   mem_free (rpc_buffer (xprt), su->su_iosz);
   mem_free ((caddr_t) su, sizeof (struct svcudp_data));
@@ -301,7 +305,7 @@ svcudp_destroy (xprt)
 	(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
 
 #define BZERO(addr, type, size)	 \
-	bzero((char *) addr, sizeof(type) * (int) (size))
+	__bzero((char *) addr, sizeof(type) * (int) (size))
 
 /*
  * An entry in the cache
@@ -479,7 +483,7 @@ cache_get (xprt, msg, replyp, replylenp)
   struct svcudp_data *su = su_data (xprt);
   struct udp_cache *uc = (struct udp_cache *) su->su_cache;
 
-#define EQADDR(a1, a2)	(bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
+#define EQADDR(a1, a2)	(memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
 
   loc = CACHE_LOC (xprt, su->su_xid);
   for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next)
diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c
index c74e06b5c1..f73c2d1461 100644
--- a/sunrpc/svcauth_des.c
+++ b/sunrpc/svcauth_des.c
@@ -282,7 +282,7 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
 	debug ("timestamp before last seen");
 	return (AUTH_REJECTEDVERF);	/* replay */
       }
-    gettimeofday (&current, (struct timezone *) NULL);
+    __gettimeofday (&current, (struct timezone *) NULL);
     current.tv_sec -= window;	/* allow for expiration */
     if (!BEFORE (&current, &timestamp))
       {
@@ -385,8 +385,8 @@ cache_init (void)
 
   authdes_cache = (struct cache_entry *)
     mem_alloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ);
-  bzero ((char *) authdes_cache,
-	 sizeof (struct cache_entry) * AUTHDES_CACHESZ);
+  __bzero ((char *) authdes_cache,
+	   sizeof (struct cache_entry) * AUTHDES_CACHESZ);
 
   authdes_lru = (short *) mem_alloc (sizeof (short) * AUTHDES_CACHESZ);
   /*
@@ -449,7 +449,7 @@ cache_spot (register des_block * key, char *name, struct timeval *timestamp)
       if (cp->key.key.high == hi &&
 	  cp->key.key.low == key->key.low &&
 	  cp->rname != NULL &&
-	  bcmp (cp->rname, name, strlen (name) + 1) == 0)
+	  memcmp (cp->rname, name, strlen (name) + 1) == 0)
 	{
 	  if (BEFORE (timestamp, &cp->laststamp))
 	    {
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index a58fade734..a049b2d27d 100644
--- a/sunrpc/xdr_array.c
+++ b/sunrpc/xdr_array.c
@@ -99,7 +99,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
 			    "xdr_array: out of memory\n");
 	    return FALSE;
 	  }
-	bzero (target, nodesize);
+	__bzero (target, nodesize);
 	break;
 
       case XDR_FREE:
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index b2ab2faabc..30be6393a2 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -53,6 +53,11 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
 #include <unistd.h>
 #include <rpc/rpc.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
+
 static bool_t xdrrec_getlong (XDR *, long *);
 static bool_t xdrrec_putlong (XDR *, const long *);
 static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int);
@@ -309,7 +314,7 @@ xdrrec_getpos (const XDR *xdrs)
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   long pos;
 
-  pos = lseek ((int) rstrm->tcp_handle, (long) 0, 1);
+  pos = __lseek ((int) rstrm->tcp_handle, (long) 0, 1);
   if (pos != -1)
     switch (xdrs->x_op)
       {
diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c
index 911892ef2d..090925d0d7 100644
--- a/sunrpc/xdr_ref.c
+++ b/sunrpc/xdr_ref.c
@@ -45,6 +45,11 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fputs(s, f) _IO_fputs (s, f)
+#endif
+
 #define LASTUNSIGNED	((u_int)0-1)
 
 /*
@@ -79,7 +84,7 @@ xdr_reference (xdrs, pp, size, proc)
 	    (void) fputs (_("xdr_reference: out of memory\n"), stderr);
 	    return FALSE;
 	  }
-	bzero (loc, (int) size);
+	__bzero (loc, (int) size);
 	break;
       default:
 	break;
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 8c3c5c7bb3..8588042eeb 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -45,6 +45,14 @@ static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
 #include <stdio.h>
 #include <rpc/xdr.h>
 
+#ifdef USE_IN_LIBIO
+# include <libio/iolibio.h>
+# define fflush(s) _IO_fflush (s)
+# define fread(p, m, n, s) _IO_fread (p, m, n, s)
+# define ftell(s) _IO_ftell (s)
+# define fwrite(p, m, n, s) _IO_fwrite (p, m, n, s)
+#endif
+
 static bool_t xdrstdio_getlong (XDR *, long *);
 static bool_t xdrstdio_putlong (XDR *, const long *);
 static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int);