diff options
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r-- | lib/libc/rpc/auth_time.c | 12 | ||||
-rw-r--r-- | lib/libc/rpc/bindresvport.c | 14 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_generic.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_simple.c | 2 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_tcp.c | 10 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_udp.c | 14 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_unix.c | 16 | ||||
-rw-r--r-- | lib/libc/rpc/get_myaddress.c | 8 | ||||
-rw-r--r-- | lib/libc/rpc/key_call.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_clnt.c | 2 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getmaps.c | 3 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getport.c | 2 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_rmt.c | 21 | ||||
-rw-r--r-- | lib/libc/rpc/rpc_dtablesize.c | 2 | ||||
-rw-r--r-- | lib/libc/rpc/rtime.c | 12 | ||||
-rw-r--r-- | lib/libc/rpc/svc.c | 1 | ||||
-rw-r--r-- | lib/libc/rpc/svc_auth_des.c | 1 | ||||
-rw-r--r-- | lib/libc/rpc/svc_run.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/svc_tcp.c | 22 | ||||
-rw-r--r-- | lib/libc/rpc/svc_udp.c | 14 | ||||
-rw-r--r-- | lib/libc/rpc/svc_unix.c | 22 |
21 files changed, 114 insertions, 78 deletions
diff --git a/lib/libc/rpc/auth_time.c b/lib/libc/rpc/auth_time.c index 836a69f..114d59d 100644 --- a/lib/libc/rpc/auth_time.c +++ b/lib/libc/rpc/auth_time.c @@ -31,6 +31,7 @@ * * $FreeBSD$ */ +#include "namespace.h" #include <stdio.h> #include <syslog.h> #include <string.h> @@ -46,6 +47,7 @@ #include <rpc/rpc_com.h> #undef NIS #include <rpcsvc/nis.h> +#include "un-namespace.h" /* * FreeBSD currently uses RPC 4.0, which uses portmap rather than @@ -385,7 +387,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) goto error; } - s = socket(AF_INET, type, 0); + s = _socket(AF_INET, type, 0); if (s == -1) { msg("unable to open fd to network."); goto error; @@ -401,7 +403,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) fd_set readfds; int res; - if (sendto(s, &thetime, sizeof(thetime), 0, + if (_sendto(s, &thetime, sizeof(thetime), 0, (struct sockaddr *)&sin, sizeof(sin)) == -1) { msg("udp : sendto failed."); goto error; @@ -409,13 +411,13 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) do { FD_ZERO(&readfds); FD_SET(s, &readfds); - res = select(_rpc_dtablesize(), &readfds, + res = _select(_rpc_dtablesize(), &readfds, (fd_set *)NULL, (fd_set *)NULL, &timeout); } while (res < 0 && errno == EINTR); if (res <= 0) goto error; len = sizeof(from); - res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0, + res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0, (struct sockaddr *)&from, &len); if (res == -1) { msg("recvfrom failed on udp transport."); @@ -428,7 +430,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid) oldsig = (void (*)())signal(SIGALRM, alarm_hndler); saw_alarm = 0; /* global tracking the alarm */ alarm(20); /* only wait 20 seconds */ - res = connect(s, (struct sockaddr *)&sin, sizeof(sin)); + res = _connect(s, (struct sockaddr *)&sin, sizeof(sin)); if (res == -1) { msg("failed to connect to tcp endpoint."); goto error; diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c index fb43eed..2aed9dd 100644 --- a/lib/libc/rpc/bindresvport.c +++ b/lib/libc/rpc/bindresvport.c @@ -40,12 +40,14 @@ static char *rcsid = "$FreeBSD$"; * Portions Copyright(C) 1996, Jason Downs. All rights reserved. */ +#include "namespace.h" #include <sys/types.h> #include <sys/errno.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <string.h> +#include "un-namespace.h" /* * Bind a socket to a privileged IP port @@ -78,7 +80,7 @@ bindresvport_sa(sd, sa) salen = sizeof(myaddr); sa = (struct sockaddr *)&myaddr; - if (getsockname(sd, sa, &salen) == -1) + if (_getsockname(sd, sa, &salen) == -1) return -1; /* errno is correctly set */ af = sa->sa_family; @@ -110,23 +112,23 @@ bindresvport_sa(sd, sa) if (port == 0) { int oldlen = sizeof(old); - error = getsockopt(sd, proto, portrange, &old, &oldlen); + error = _getsockopt(sd, proto, portrange, &old, &oldlen); if (error < 0) return (error); - error = setsockopt(sd, proto, portrange, &portlow, + error = _setsockopt(sd, proto, portrange, &portlow, sizeof(portlow)); if (error < 0) return (error); } - error = bind(sd, sa, salen); + error = _bind(sd, sa, salen); if (port == 0) { int saved_errno = errno; if (error) { - if (setsockopt(sd, proto, portrange, &old, + if (_setsockopt(sd, proto, portrange, &old, sizeof(old)) < 0) errno = saved_errno; return (error); @@ -134,7 +136,7 @@ bindresvport_sa(sd, sa) if (sa != (struct sockaddr *)&myaddr) { /* Hmm, what did the kernel assign... */ - if (getsockname(sd, sa, &salen) < 0) + if (_getsockname(sd, sa, &salen) < 0) errno = saved_errno; return (error); } diff --git a/lib/libc/rpc/clnt_generic.c b/lib/libc/rpc/clnt_generic.c index 5e3cb7b..d885f18 100644 --- a/lib/libc/rpc/clnt_generic.c +++ b/lib/libc/rpc/clnt_generic.c @@ -38,14 +38,14 @@ static char *rcsid = "$FreeBSD$"; */ #include <rpc/rpc.h> #include <sys/socket.h> -#include <sys/errno.h> +#include <errno.h> #include <netdb.h> #include <string.h> /* * Generic client creation: takes (hostname, program-number, protocol) and * returns client handle. Default options are set, which the user can - * change using the rpc equivalent of ioctl()'s. + * change using the rpc equivalent of _ioctl()'s. */ CLIENT * clnt_create(hostname, prog, vers, proto) diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index 897eab5..46d959b 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -40,6 +40,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <sys/param.h> #include <stdio.h> #include <stdlib.h> @@ -48,6 +49,7 @@ static char *rcsid = "$FreeBSD$"; #include <rpc/rpc.h> #include <sys/socket.h> #include <netdb.h> +#include "un-namespace.h" static struct callrpc_private { CLIENT *client; diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c index 1889694..9e8e394 100644 --- a/lib/libc/rpc/clnt_tcp.c +++ b/lib/libc/rpc/clnt_tcp.c @@ -52,6 +52,7 @@ static char *rcsid = "$FreeBSD$"; * Now go hang yourself. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -61,6 +62,7 @@ static char *rcsid = "$FreeBSD$"; #include <netdb.h> #include <errno.h> #include <rpc/pmap_clnt.h> +#include "un-namespace.h" #define MCALL_MSG_SIZE 24 @@ -159,10 +161,10 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) * If no socket given, open one */ 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, + || (_connect(*sockp, (struct sockaddr *)raddr, sizeof(*raddr)) < 0)) { rpc_createerr.cf_stat = RPC_SYSTEMERROR; rpc_createerr.cf_error.re_errno = errno; @@ -450,7 +452,7 @@ clnttcp_control(cl, request, info) break; case CLGET_LOCAL_ADDR: len = sizeof(struct sockaddr); - if (getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0) + if (_getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0) return(FALSE); break; case CLGET_RETRY_TIMEOUT: @@ -516,7 +518,7 @@ readtcp(ct, buf, len) /* XXX we know the other bits are still clear */ FD_SET(ct->ct_sock, fds); tv = delta; /* in case select writes back */ - r = select(ct->ct_sock+1, fds, NULL, NULL, &tv); + r = _select(ct->ct_sock+1, fds, NULL, NULL, &tv); save_errno = errno; gettimeofday(&after, NULL); diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c index 3dc7710..bc103ed 100644 --- a/lib/libc/rpc/clnt_udp.c +++ b/lib/libc/rpc/clnt_udp.c @@ -39,6 +39,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -49,6 +50,7 @@ static char *rcsid = "$FreeBSD$"; #include <netdb.h> #include <errno.h> #include <rpc/pmap_clnt.h> +#include "un-namespace.h" /* * UDP bases client side rpc operations @@ -173,7 +175,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) if (*sockp < 0) { 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; rpc_createerr.cf_error.re_errno = errno; @@ -182,7 +184,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) /* attempt to bind to priv 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 { cu->cu_closeit = FALSE; @@ -271,7 +273,7 @@ call_again: outlen = (int)XDR_GETPOS(xdrs); send_again: - if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0, + if (_sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0, (struct sockaddr *)&(cu->cu_raddr), cu->cu_rlen) != outlen) { cu->cu_error.re_errno = errno; if (fds != &readfds) @@ -301,7 +303,7 @@ send_again: /* XXX we know the other bits are still clear */ FD_SET(cu->cu_sock, fds); tv = cu->cu_wait; - switch (select(cu->cu_sock+1, fds, NULL, NULL, &tv)) { + switch (_select(cu->cu_sock+1, fds, NULL, NULL, &tv)) { case 0: timeradd(&time_waited, &cu->cu_wait, &tmp1); @@ -332,7 +334,7 @@ send_again: do { fromlen = sizeof(struct sockaddr); - inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, + inlen = _recvfrom(cu->cu_sock, cu->cu_inbuf, (int) cu->cu_recvsz, 0, (struct sockaddr *)&from, &fromlen); } while (inlen < 0 && errno == EINTR); @@ -539,7 +541,7 @@ clntudp_control(cl, request, info) break; case CLGET_LOCAL_ADDR: len = sizeof(struct sockaddr); - if (getsockname(cu->cu_sock, (struct sockaddr *)info, &len) <0) + if (_getsockname(cu->cu_sock, (struct sockaddr *)info, &len) <0) return(FALSE); break; case CLGET_SVC_ADDR: diff --git a/lib/libc/rpc/clnt_unix.c b/lib/libc/rpc/clnt_unix.c index 3b28bf8..d55859c 100644 --- a/lib/libc/rpc/clnt_unix.c +++ b/lib/libc/rpc/clnt_unix.c @@ -52,6 +52,7 @@ static char *rcsid = "$FreeBSD$"; * Now go hang yourself. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -63,6 +64,7 @@ static char *rcsid = "$FreeBSD$"; #include <netdb.h> #include <errno.h> #include <rpc/pmap_clnt.h> +#include "un-namespace.h" #define MCALL_MSG_SIZE 24 @@ -149,12 +151,12 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) * If no socket given, open one */ if (*sockp < 0) { - *sockp = socket(AF_UNIX, SOCK_STREAM, 0); + *sockp = _socket(AF_UNIX, SOCK_STREAM, 0); len = strlen(raddr->sun_path) + sizeof(raddr->sun_family) + sizeof(raddr->sun_len) + 1; raddr->sun_len = len; if ((*sockp < 0) - || (connect(*sockp, (struct sockaddr *)raddr, len) < 0)) { + || (_connect(*sockp, (struct sockaddr *)raddr, len) < 0)) { rpc_createerr.cf_stat = RPC_SYSTEMERROR; rpc_createerr.cf_error.re_errno = errno; if (*sockp != -1) @@ -441,7 +443,7 @@ clntunix_control(cl, request, info) break; case CLGET_LOCAL_ADDR: len = sizeof(struct sockaddr); - if (getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0) + if (_getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0) return(FALSE); break; case CLGET_RETRY_TIMEOUT: @@ -473,7 +475,7 @@ clntunix_destroy(h) } /* - * read() and write() are replaced with recvmsg()/sendmsg() so that + * _read() and _write() are replaced with _recvmsg()/_sendmsg() so that * we can pass ancillary control data. In this case, the data constists * of credential information which the kernel will fill in for us. * XXX: This code is specific to FreeBSD and will not work on other @@ -505,7 +507,7 @@ static int __msgread(sock, buf, cnt) msg.msg_controllen = sizeof(struct cmessage); msg.msg_flags = 0; - return(recvmsg(sock, &msg, 0)); + return(_recvmsg(sock, &msg, 0)); } static int __msgwrite(sock, buf, cnt) @@ -533,7 +535,7 @@ static int __msgwrite(sock, buf, cnt) msg.msg_controllen = sizeof(struct cmessage); msg.msg_flags = 0; - return(sendmsg(sock, &msg, 0)); + return(_sendmsg(sock, &msg, 0)); } /* @@ -571,7 +573,7 @@ readunix(ct, buf, len) /* XXX we know the other bits are still clear */ FD_SET(ct->ct_sock, fds); tv = delta; /* in case select writes back */ - r = select(ct->ct_sock+1, fds, NULL, NULL, &tv); + r = _select(ct->ct_sock+1, fds, NULL, NULL, &tv); save_errno = errno; gettimeofday(&after, NULL); diff --git a/lib/libc/rpc/get_myaddress.c b/lib/libc/rpc/get_myaddress.c index eb2917e..70c3ac0 100644 --- a/lib/libc/rpc/get_myaddress.c +++ b/lib/libc/rpc/get_myaddress.c @@ -40,6 +40,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <rpc/types.h> #include <rpc/xdr.h> #include <rpc/pmap_prot.h> @@ -50,6 +51,7 @@ static char *rcsid = "$FreeBSD$"; #include <sys/ioctl.h> #include <netinet/in.h> #include <arpa/inet.h> +#include "un-namespace.h" /* * don't use gethostbyname, which would invoke yellow pages @@ -67,12 +69,12 @@ get_myaddress(addr) struct ifreq ifreq, *ifr, *end; int loopback = 0, gotit = 0; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + if ((s = _socket(AF_INET, SOCK_DGRAM, 0)) < 0) { return(-1); } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) { + if (_ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) { _close(s); return(-1); } @@ -82,7 +84,7 @@ again: while (ifr < end) { memcpy(&ifreq, ifr, sizeof(ifreq)); - if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) { + if (_ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) { _close(s); return(-1); } diff --git a/lib/libc/rpc/key_call.c b/lib/libc/rpc/key_call.c index 703e038..c6c3e78 100644 --- a/lib/libc/rpc/key_call.c +++ b/lib/libc/rpc/key_call.c @@ -43,6 +43,7 @@ * gendeskey(deskey) - generate a secure des key */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -57,6 +58,7 @@ #include <signal.h> #include <sys/wait.h> #include <sys/fcntl.h> +#include "un-namespace.h" #define KEY_TIMEOUT 5 /* per-try timeout in seconds */ @@ -322,7 +324,7 @@ int vers; if (kcp->client != NULL) { /* if other side closed socket, build handle again */ clnt_control(kcp->client, CLGET_FD, (char *)&fd); - if (getpeername(fd,(struct sockaddr *)&name,&namelen) == -1) { + if (_getpeername(fd,(struct sockaddr *)&name,&namelen) == -1) { auth_destroy(kcp->client->cl_auth); clnt_destroy(kcp->client); kcp->client = NULL; diff --git a/lib/libc/rpc/pmap_clnt.c b/lib/libc/rpc/pmap_clnt.c index 540187b..41bb78d 100644 --- a/lib/libc/rpc/pmap_clnt.c +++ b/lib/libc/rpc/pmap_clnt.c @@ -40,6 +40,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -47,6 +48,7 @@ static char *rcsid = "$FreeBSD$"; #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> #include <netinet/in.h> +#include "un-namespace.h" static struct timeval timeout = { 5, 0 }; static struct timeval tottimeout = { 60, 0 }; diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c index 777877b..b51ac69 100644 --- a/lib/libc/rpc/pmap_getmaps.c +++ b/lib/libc/rpc/pmap_getmaps.c @@ -41,6 +41,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> @@ -51,6 +52,8 @@ static char *rcsid = "$FreeBSD$"; #include <errno.h> #include <net/if.h> #include <sys/ioctl.h> +#include "un-namespace.h" + #define NAMELEN 255 #define MAX_BROADCAST_SIZE 1400 diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c index 2d6f5ac..bef94fdf 100644 --- a/lib/libc/rpc/pmap_getport.c +++ b/lib/libc/rpc/pmap_getport.c @@ -40,12 +40,14 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> #include <sys/socket.h> #include <net/if.h> #include <unistd.h> +#include "un-namespace.h" static struct timeval timeout = { 5, 0 }; static struct timeval tottimeout = { 60, 0 }; diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c index f36acf1..298c956 100644 --- a/lib/libc/rpc/pmap_rmt.c +++ b/lib/libc/rpc/pmap_rmt.c @@ -41,6 +41,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> @@ -54,6 +55,8 @@ static char *rcsid = "$FreeBSD$"; #include <net/if.h> #include <sys/ioctl.h> #include <arpa/inet.h> +#include "un-namespace.h" + #define MAX_BROADCAST_SIZE 1400 static struct timeval timeout = { 3, 0 }; @@ -177,7 +180,7 @@ getbroadcastnets(addrs, sock, 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); } @@ -190,7 +193,7 @@ getbroadcastnets(addrs, sock, buf) if (ifr->ifr_addr.sa_family != AF_INET) continue; memcpy(&ifreq, ifr, sizeof(ifreq)); - if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifreq) < 0) { + if (_ioctl(sock, SIOCGIFFLAGS, (char *)&ifreq) < 0) { perror("broadcast: ioctl (get interface flags)"); continue; } @@ -198,7 +201,7 @@ getbroadcastnets(addrs, sock, buf) (ifreq.ifr_flags & IFF_UP)) { 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) { addr = inet_makeaddr(inet_netof(sin->sin_addr), INADDR_ANY); @@ -263,13 +266,13 @@ 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; goto done_broad; } #ifdef SO_BROADCAST - if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) { + if (_setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) { perror("Cannot set socket option SO_BROADCAST"); stat = RPC_CANTSEND; goto done_broad; @@ -332,7 +335,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) for (t.tv_sec = 4; t.tv_sec <= 14; t.tv_sec += 2) { for (i = 0; i < nets; i++) { baddr.sin_addr = addrs[i]; - if (sendto(sock, outbuf, outlen, 0, + if (_sendto(sock, outbuf, outlen, 0, (struct sockaddr *)&baddr, sizeof (struct sockaddr)) != outlen) { perror("Cannot send broadcast packet"); @@ -350,8 +353,8 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) msg.acpted_rply.ar_results.proc = xdr_rmtcallres; /* XXX we know the other bits are still clear */ FD_SET(sock, fds); - tv = t; /* for select() that copies back */ - switch (select(sock + 1, fds, NULL, NULL, &tv)) { + tv = t; /* for _select() that copies back */ + switch (_select(sock + 1, fds, NULL, NULL, &tv)) { case 0: /* timed out */ stat = RPC_TIMEDOUT; @@ -367,7 +370,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) } /* end of select results switch */ try_again: fromlen = sizeof(struct sockaddr); - inlen = recvfrom(sock, inbuf, UDPMSGSIZE, 0, + inlen = _recvfrom(sock, inbuf, UDPMSGSIZE, 0, (struct sockaddr *)&raddr, &fromlen); if (inlen < 0) { if (errno == EINTR) diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c index 1ce5617..44b32796 100644 --- a/lib/libc/rpc/rpc_dtablesize.c +++ b/lib/libc/rpc/rpc_dtablesize.c @@ -45,7 +45,7 @@ static char *rcsid = "$FreeBSD$"; * descriptors be greater than FD_SETSIZE (which us 256 by default). * * Since old programs tend to use this call to determine the first arg - * for select(), having this return > FD_SETSIZE is a Bad Idea(TM)! + * for _select(), having this return > FD_SETSIZE is a Bad Idea(TM)! */ int _rpc_dtablesize(void) diff --git a/lib/libc/rpc/rtime.c b/lib/libc/rpc/rtime.c index 0aaf7c0..61d0e86 100644 --- a/lib/libc/rpc/rtime.c +++ b/lib/libc/rpc/rtime.c @@ -41,6 +41,7 @@ * subtract seconds before Jan 1, 1970 to get * what unix uses. */ +#include "namespace.h" #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -51,6 +52,7 @@ #include <netinet/in.h> #include <stdio.h> #include <netdb.h> +#include "un-namespace.h" #if defined(LIBC_SCCS) && !defined(lint) /* from: static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 SMI"; */ @@ -84,7 +86,7 @@ rtime(addrp, timep, timeout) } else { type = SOCK_DGRAM; } - s = socket(AF_INET, type, 0); + s = _socket(AF_INET, type, 0); if (s < 0) { return(-1); } @@ -98,7 +100,7 @@ rtime(addrp, timep, timeout) addrp->sin_port = serv->s_port; if (type == SOCK_DGRAM) { - res = sendto(s, (char *)&thetime, sizeof(thetime), 0, + res = _sendto(s, (char *)&thetime, sizeof(thetime), 0, (struct sockaddr *)addrp, sizeof(*addrp)); if (res < 0) { do_close(s); @@ -107,7 +109,7 @@ rtime(addrp, timep, timeout) do { FD_ZERO(&readfds); FD_SET(s, &readfds); - res = select(_rpc_dtablesize(), &readfds, + res = _select(_rpc_dtablesize(), &readfds, (fd_set *)NULL, (fd_set *)NULL, timeout); } while (res < 0 && errno == EINTR); if (res <= 0) { @@ -118,14 +120,14 @@ rtime(addrp, timep, timeout) return(-1); } fromlen = sizeof(from); - res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0, + res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0, (struct sockaddr *)&from, &fromlen); do_close(s); if (res < 0) { return(-1); } } else { - if (connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) { + if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) { do_close(s); return(-1); } diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c index 1f9803b..94d6057 100644 --- a/lib/libc/rpc/svc.c +++ b/lib/libc/rpc/svc.c @@ -45,7 +45,6 @@ static char *rcsid = "$FreeBSD$"; #include <string.h> #include <stdlib.h> -#include <sys/errno.h> #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> diff --git a/lib/libc/rpc/svc_auth_des.c b/lib/libc/rpc/svc_auth_des.c index 6a937f5..f3af780 100644 --- a/lib/libc/rpc/svc_auth_des.c +++ b/lib/libc/rpc/svc_auth_des.c @@ -48,6 +48,7 @@ #include <string.h> #include <stdlib.h> +#include <stdio.h> #include <unistd.h> #include <rpc/des_crypt.h> #include <sys/param.h> diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c index f39886a..bc5b48a 100644 --- a/lib/libc/rpc/svc_run.c +++ b/lib/libc/rpc/svc_run.c @@ -37,6 +37,7 @@ static char *rcsid = "$FreeBSD$"; * This is the rpc server side idle loop * Wait for input, call server program. */ +#include "namespace.h" #include <rpc/rpc.h> #include <stdio.h> #include <sys/errno.h> @@ -45,6 +46,7 @@ static char *rcsid = "$FreeBSD$"; #include <unistd.h> #include <stdlib.h> #include <string.h> +#include "un-namespace.h" extern int __svc_fdsetsize; extern fd_set *__svc_fdset; @@ -62,7 +64,7 @@ svc_run() memcpy(fds, __svc_fdset, bytes); } else fds = NULL; - switch (select(svc_maxfd + 1, fds, NULL, NULL, + switch (_select(svc_maxfd + 1, fds, NULL, NULL, (struct timeval *)0)) { case -1: if (errno == EINTR) { @@ -79,7 +81,7 @@ svc_run() free(fds); continue; default: - /* if fds == NULL, select() can't return a result */ + /* if fds == NULL, _select() can't return a result */ svc_getreqset2(fds, svc_maxfd + 1); free(fds); } diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index 3e14010..b060997 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -43,6 +43,7 @@ static char *rcsid = "$FreeBSD$"; * and a record/tcp stream. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -51,6 +52,7 @@ static char *rcsid = "$FreeBSD$"; #include <sys/socket.h> #include <sys/ioctl.h> #include <errno.h> +#include "un-namespace.h" /* * Ops vector for TCP/IP based rpc service handle @@ -135,14 +137,14 @@ svctcp_create(sock, sendsize, recvsize) int on; 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; } on = 1; - if (ioctl(sock, FIONBIO, &on) < 0) { + if (_ioctl(sock, FIONBIO, &on) < 0) { perror("svc_tcp.c - cannot turn on non-blocking mode"); if (madesock) (void)_close(sock); @@ -153,10 +155,10 @@ svctcp_create(sock, sendsize, recvsize) addr.sin_family = AF_INET; if (bindresvport(sock, &addr)) { addr.sin_port = 0; - (void)bind(sock, (struct sockaddr *)&addr, len); + (void)_bind(sock, (struct sockaddr *)&addr, len); } - if ((getsockname(sock, (struct sockaddr *)&addr, &len) != 0) || - (listen(sock, 2) != 0)) { + if ((_getsockname(sock, (struct sockaddr *)&addr, &len) != 0) || + (_listen(sock, 2) != 0)) { perror("svctcp_.c - cannot getsockname or listen"); if (madesock) (void)_close(sock); @@ -247,7 +249,7 @@ rendezvous_request(xprt) r = (struct tcp_rendezvous *)xprt->xp_p1; again: len = sizeof(struct sockaddr_in); - if ((sock = accept(xprt->xp_sock, (struct sockaddr *)&addr, + if ((sock = _accept(xprt->xp_sock, (struct sockaddr *)&addr, &len)) < 0) { if (errno == EINTR) goto again; @@ -264,7 +266,7 @@ rendezvous_request(xprt) * The listening socket is in FIONBIO mode and we inherit it. */ off = 0; - if (ioctl(sock, FIONBIO, &off) < 0) { + if (_ioctl(sock, FIONBIO, &off) < 0) { _close(sock); return (FALSE); } @@ -317,7 +319,7 @@ static struct timeval wait_per_try = { 35, 0 }; * Note: we have to be careful here not to allow ourselves to become * blocked too long in this routine. While we're waiting for data from one * client, another client may be trying to connect. To avoid this situation, - * some code from svc_run() is transplanted here: the select() loop checks + * some code from svc_run() is transplanted here: the _select() loop checks * all RPC descriptors including the one we want and calls svc_getreqset2() * to handle new requests if any are detected. */ @@ -349,8 +351,8 @@ readtcp(xprt, buf, len) /* XXX we know the other bits are still clear */ FD_SET(sock, fds); - tv = delta; /* in case select() implements writeback */ - switch (select(svc_maxfd + 1, fds, NULL, NULL, &tv)) { + tv = delta; /* in case _select() implements writeback */ + switch (_select(svc_maxfd + 1, fds, NULL, NULL, &tv)) { case -1: if (errno != EINTR) goto fatal_err; diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c index 9849d53..0abd486 100644 --- a/lib/libc/rpc/svc_udp.c +++ b/lib/libc/rpc/svc_udp.c @@ -41,6 +41,7 @@ static char *rcsid = "$FreeBSD$"; * Copyright (C) 1984, Sun Microsystems, Inc. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -48,6 +49,7 @@ static char *rcsid = "$FreeBSD$"; #include <rpc/rpc.h> #include <sys/socket.h> #include <errno.h> +#include "un-namespace.h" #define rpc_buffer(xprt) ((xprt)->xp_p1) #define MAX(a, b) ((a > b) ? a : b) @@ -107,7 +109,7 @@ svcudp_bufcreate(sock, sendsz, recvsz) int len = sizeof(struct sockaddr_in); 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); } @@ -118,9 +120,9 @@ svcudp_bufcreate(sock, sendsz, recvsz) addr.sin_family = AF_INET; if (bindresvport(sock, &addr)) { addr.sin_port = 0; - (void)bind(sock, (struct sockaddr *)&addr, len); + (void)_bind(sock, (struct sockaddr *)&addr, len); } - if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) { + if (_getsockname(sock, (struct sockaddr *)&addr, &len) != 0) { perror("svcudp_create - cannot getsockname"); if (madesock) (void)_close(sock); @@ -182,7 +184,7 @@ svcudp_recv(xprt, msg) again: xprt->xp_addrlen = sizeof(struct sockaddr_in); - rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz, + rlen = _recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz, 0, (struct sockaddr *)&(xprt->xp_raddr), &(xprt->xp_addrlen)); if (rlen == -1 && errno == EINTR) goto again; @@ -195,7 +197,7 @@ svcudp_recv(xprt, msg) su->su_xid = msg->rm_xid; if (su->su_cache != NULL) { if (cache_get(xprt, msg, &reply, &replylen)) { - (void) sendto(xprt->xp_sock, reply, (int) replylen, 0, + (void) _sendto(xprt->xp_sock, reply, (int) replylen, 0, (struct sockaddr *) &xprt->xp_raddr, xprt->xp_addrlen); return (TRUE); } @@ -218,7 +220,7 @@ svcudp_reply(xprt, msg) msg->rm_xid = su->su_xid; if (xdr_replymsg(xdrs, msg)) { slen = (int)XDR_GETPOS(xdrs); - if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0, + if (_sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0, (struct sockaddr *)&(xprt->xp_raddr), xprt->xp_addrlen) == slen) { stat = TRUE; diff --git a/lib/libc/rpc/svc_unix.c b/lib/libc/rpc/svc_unix.c index dc680d0..ac92bc5 100644 --- a/lib/libc/rpc/svc_unix.c +++ b/lib/libc/rpc/svc_unix.c @@ -43,6 +43,7 @@ static char *rcsid = "$FreeBSD$"; * and a record/unix stream. */ +#include "namespace.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -52,6 +53,7 @@ static char *rcsid = "$FreeBSD$"; #include <sys/un.h> #include <sys/uio.h> #include <errno.h> +#include "un-namespace.h" /* * Ops vector for AF_UNIX based rpc service handle @@ -130,7 +132,7 @@ static int __msgread(sock, buf, cnt) msg.msg_controllen = sizeof(struct cmessage); msg.msg_flags = 0; - return(recvmsg(sock, &msg, 0)); + return(_recvmsg(sock, &msg, 0)); } static int __msgwrite(sock, buf, cnt) @@ -157,7 +159,7 @@ static int __msgwrite(sock, buf, cnt) msg.msg_controllen = sizeof(struct cmessage); msg.msg_flags = 0; - return(sendmsg(sock, &msg, 0)); + return(_sendmsg(sock, &msg, 0)); } /* @@ -194,7 +196,7 @@ svcunix_create(sock, sendsize, recvsize, path) int len = sizeof(struct sockaddr_un); if (sock == RPC_ANYSOCK) { - if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + if ((sock = _socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("svc_unix.c - AF_UNIX socket creation problem"); return ((SVCXPRT *)NULL); } @@ -207,10 +209,10 @@ svcunix_create(sock, sendsize, recvsize, path) sizeof(addr.sun_len) + 1; addr.sun_len = len; - bind(sock, (struct sockaddr *)&addr, len); + _bind(sock, (struct sockaddr *)&addr, len); - if ((getsockname(sock, (struct sockaddr *)&addr, &len) != 0) || - (listen(sock, 2) != 0)) { + if ((_getsockname(sock, (struct sockaddr *)&addr, &len) != 0) || + (_listen(sock, 2) != 0)) { perror("svc_unix.c - cannot getsockname or listen"); if (madesock) (void)_close(sock); @@ -301,7 +303,7 @@ rendezvous_request(xprt) r = (struct unix_rendezvous *)xprt->xp_p1; again: len = sizeof(struct sockaddr_in); - if ((sock = accept(xprt->xp_sock, (struct sockaddr *)&addr, + if ((sock = _accept(xprt->xp_sock, (struct sockaddr *)&addr, &len)) < 0) { if (errno == EINTR) goto again; @@ -359,7 +361,7 @@ static struct timeval wait_per_try = { 35, 0 }; * Note: we have to be careful here not to allow ourselves to become * blocked too long in this routine. While we're waiting for data from one * client, another client may be trying to connect. To avoid this situation, - * some code from svc_run() is transplanted here: the select() loop checks + * some code from svc_run() is transplanted here: the _select() loop checks * all RPC descriptors including the one we want and calls svc_getreqset2() * to handle new requests if any are detected. */ @@ -391,8 +393,8 @@ readunix(xprt, buf, len) /* XXX we know the other bits are still clear */ FD_SET(sock, fds); - tv = delta; /* in case select() implements writeback */ - switch (select(svc_maxfd + 1, fds, NULL, NULL, &tv)) { + tv = delta; /* in case _select() implements writeback */ + switch (_select(svc_maxfd + 1, fds, NULL, NULL, &tv)) { case -1: if (errno != EINTR) goto fatal_err; |