about summary refs log tree commit diff
path: root/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/bindrsvprt.c16
-rw-r--r--sunrpc/clnt_tcp.c2
-rw-r--r--sunrpc/clnt_udp.c36
-rw-r--r--sunrpc/pm_getmaps.c2
-rw-r--r--sunrpc/pmap_rmt.c3
-rw-r--r--sunrpc/svc.c64
-rw-r--r--sunrpc/svc_run.c12
-rw-r--r--sunrpc/svc_tcp.c2
-rw-r--r--sunrpc/svc_udp.c3
9 files changed, 78 insertions, 62 deletions
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index 71803dd41c..44660dede6 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -6,23 +6,23 @@ static  char sccsid[] = "@(#)bindresvport.c	2.2 88/07/29 4.0 RPCSRC 1.8 88/02/08
  * 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
@@ -47,7 +47,9 @@ bindresvport(sd, sin)
 	int res;
 	static short port;
 	struct sockaddr_in myaddr;
+#ifndef errno
 	extern int errno;
+#endif
 	int i;
 
 #define STARTPORT 600
@@ -59,14 +61,14 @@ bindresvport(sd, sin)
 		bzero(sin, sizeof (*sin));
 		sin->sin_family = AF_INET;
 	} else if (sin->sin_family != AF_INET) {
-		errno = EPFNOSUPPORT;
+		__set_errno (EPFNOSUPPORT);
 		return (-1);
 	}
 	if (port == 0) {
 		port = (getpid() % NPORTS) + STARTPORT;
 	}
 	res = -1;
-	errno = EADDRINUSE;
+	__set_errno (EADDRINUSE);
 	for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) {
 		sin->sin_port = htons(port++);
 		if (port > ENDPORT) {
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 3b71e119f0..be365f1b2a 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -59,7 +59,9 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
 
 #define MCALL_MSG_SIZE 24
 
+#ifndef errno
 extern int errno;
+#endif
 
 static int	readtcp();
 static int	writetcp();
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 706457a606..2074095d99 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.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
@@ -45,7 +45,9 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
 #include <errno.h>
 #include <rpc/pmap_clnt.h>
 
+#ifndef errno
 extern int errno;
+#endif
 
 /*
  * UDP bases client side rpc operations
@@ -66,7 +68,7 @@ static struct clnt_ops udp_ops = {
 	clntudp_control
 };
 
-/* 
+/*
  * Private data kept per client handle
  */
 struct cu_data {
@@ -204,7 +206,7 @@ clntudp_create(raddr, program, version, wait, sockp)
 	    UDPMSGSIZE, UDPMSGSIZE));
 }
 
-static enum clnt_stat 
+static enum clnt_stat
 clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
 	register CLIENT	*cl;		/* client handle */
 	u_long		proc;		/* procedure number */
@@ -286,7 +288,7 @@ send_again:
 #endif /* def FD_SETSIZE */
 	for (;;) {
 		readfds = mask;
-		switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, 
+		switch (select(_rpc_dtablesize(), &readfds, (int *)NULL,
 			       (int *)NULL, &(cu->cu_wait))) {
 
 		case 0:
@@ -299,7 +301,7 @@ send_again:
 			if ((time_waited.tv_sec < timeout.tv_sec) ||
 				((time_waited.tv_sec == timeout.tv_sec) &&
 				(time_waited.tv_usec < timeout.tv_usec)))
-				goto send_again;	
+				goto send_again;
 			return (cu->cu_error.re_status = RPC_TIMEDOUT);
 
 		/*
@@ -308,27 +310,27 @@ send_again:
 		 */
 		case -1:
 			if (errno == EINTR)
-				continue;	
+				continue;
 			cu->cu_error.re_errno = errno;
 			return (cu->cu_error.re_status = RPC_CANTRECV);
 		}
 		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);
 		if (inlen < 0) {
 			if (errno == EWOULDBLOCK)
-				continue;	
+				continue;
 			cu->cu_error.re_errno = errno;
 			return (cu->cu_error.re_status = RPC_CANTRECV);
 		}
 		if (inlen < 4)
-			continue;	
+			continue;
 		/* see if reply transaction id matches sent id */
 		if (*((u_int32_t *)(cu->cu_inbuf)) != *((u_int32_t *)(cu->cu_outbuf)))
-			continue;	
+			continue;
 		/* we now assume we have the proper reply */
 		break;
 	}
@@ -351,7 +353,7 @@ send_again:
 				xdrs->x_op = XDR_FREE;
 				(void)xdr_opaque_auth(xdrs,
 				    &(reply_msg.acpted_rply.ar_verf));
-			} 
+			}
 		}  /* end successful completion */
 		else {
 			/* maybe our credentials need to be refreshed ... */
@@ -391,7 +393,7 @@ clntudp_freeres(cl, xdr_res, res_ptr)
 	return ((*xdr_res)(xdrs, res_ptr));
 }
 
-static void 
+static void
 clntudp_abort(/*h*/)
 	/*CLIENT *h;*/
 {
@@ -426,7 +428,7 @@ clntudp_control(cl, request, info)
 	}
 	return (TRUE);
 }
-	
+
 static void
 clntudp_destroy(cl)
 	CLIENT *cl;
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index 7a9cbb6f18..d84e0c5dc0 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -54,7 +54,9 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
 #define MAX_BROADCAST_SIZE 1400
 #endif
 
+#ifndef errno
 extern int errno;
+#endif
 
 /*
  * Get a copy of the current port maps.
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index a944f6ccb6..3fbc47224d 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -53,7 +53,9 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
 #include <arpa/inet.h>
 #define MAX_BROADCAST_SIZE 1400
 
+#ifndef errno
 extern int errno;
+#endif
 static struct timeval timeout = { 3, 0 };
 
 
@@ -388,4 +390,3 @@ done_broad:
 	AUTH_DESTROY(unix_auth);
 	return (stat);
 }
-
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index e0af7107be..5995c25bfd 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.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
@@ -45,7 +45,9 @@ static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
 
+#ifndef errno
 extern int errno;
+#endif
 
 #ifdef FD_SETSIZE
 static SVCXPRT **xports;
@@ -103,12 +105,12 @@ xprt_register(xprt)
 }
 
 /*
- * De-activate a transport handle. 
+ * De-activate a transport handle.
  */
 void
-xprt_unregister(xprt) 
+xprt_unregister(xprt)
 	SVCXPRT *xprt;
-{ 
+{
 	register int sock = xprt->xp_sock;
 
 #ifdef FD_SETSIZE
@@ -223,15 +225,15 @@ svc_sendreply(xprt, xdr_results, xdr_location)
 	xdrproc_t xdr_results;
 	caddr_t xdr_location;
 {
-	struct rpc_msg rply; 
+	struct rpc_msg rply;
 
-	rply.rm_direction = REPLY;  
-	rply.rm_reply.rp_stat = MSG_ACCEPTED; 
-	rply.acpted_rply.ar_verf = xprt->xp_verf; 
+	rply.rm_direction = REPLY;
+	rply.rm_reply.rp_stat = MSG_ACCEPTED;
+	rply.acpted_rply.ar_verf = xprt->xp_verf;
 	rply.acpted_rply.ar_stat = SUCCESS;
 	rply.acpted_rply.ar_results.where = xdr_location;
 	rply.acpted_rply.ar_results.proc = xdr_results;
-	return (SVC_REPLY(xprt, &rply)); 
+	return (SVC_REPLY(xprt, &rply));
 }
 
 /*
@@ -257,13 +259,13 @@ void
 svcerr_decode(xprt)
 	register SVCXPRT *xprt;
 {
-	struct rpc_msg rply; 
+	struct rpc_msg rply;
 
-	rply.rm_direction = REPLY; 
-	rply.rm_reply.rp_stat = MSG_ACCEPTED; 
+	rply.rm_direction = REPLY;
+	rply.rm_reply.rp_stat = MSG_ACCEPTED;
 	rply.acpted_rply.ar_verf = xprt->xp_verf;
 	rply.acpted_rply.ar_stat = GARBAGE_ARGS;
-	SVC_REPLY(xprt, &rply); 
+	SVC_REPLY(xprt, &rply);
 }
 
 /*
@@ -273,13 +275,13 @@ void
 svcerr_systemerr(xprt)
 	register SVCXPRT *xprt;
 {
-	struct rpc_msg rply; 
+	struct rpc_msg rply;
 
-	rply.rm_direction = REPLY; 
-	rply.rm_reply.rp_stat = MSG_ACCEPTED; 
+	rply.rm_direction = REPLY;
+	rply.rm_reply.rp_stat = MSG_ACCEPTED;
 	rply.acpted_rply.ar_verf = xprt->xp_verf;
 	rply.acpted_rply.ar_stat = SYSTEM_ERR;
-	SVC_REPLY(xprt, &rply); 
+	SVC_REPLY(xprt, &rply);
 }
 
 /*
@@ -313,15 +315,15 @@ svcerr_weakauth(xprt)
 /*
  * Program unavailable error reply
  */
-void 
+void
 svcerr_noprog(xprt)
 	register SVCXPRT *xprt;
 {
-	struct rpc_msg rply;  
+	struct rpc_msg rply;
 
-	rply.rm_direction = REPLY;   
-	rply.rm_reply.rp_stat = MSG_ACCEPTED;  
-	rply.acpted_rply.ar_verf = xprt->xp_verf;  
+	rply.rm_direction = REPLY;
+	rply.rm_reply.rp_stat = MSG_ACCEPTED;
+	rply.acpted_rply.ar_verf = xprt->xp_verf;
 	rply.acpted_rply.ar_stat = PROG_UNAVAIL;
 	SVC_REPLY(xprt, &rply);
 }
@@ -329,9 +331,9 @@ svcerr_noprog(xprt)
 /*
  * Program version mismatch error reply
  */
-void  
+void
 svcerr_progvers(xprt, low_vers, high_vers)
-	register SVCXPRT *xprt; 
+	register SVCXPRT *xprt;
 	u_long low_vers;
 	u_long high_vers;
 {
@@ -356,9 +358,9 @@ svcerr_progvers(xprt, low_vers, high_vers)
  * the "raw" parameters (msg.rm_call.cb_cred and msg.rm_call.cb_verf) and
  * the "cooked" credentials (rqst->rq_clntcred).
  * However, this function does not know the structure of the cooked
- * credentials, so it make the following assumptions: 
+ * credentials, so it make the following assumptions:
  *   a) the structure is contiguous (no pointers), and
- *   b) the cred structure size does not exceed RQCRED_SIZE bytes. 
+ *   b) the cred structure size does not exceed RQCRED_SIZE bytes.
  * In all events, all three parameters are freed upon exit from this routine.
  * The storage is trivially management on the call stack in user land, but
  * is mallocated in kernel land.
@@ -410,7 +412,7 @@ svc_getreqset(readfds)
 
 
 #ifdef FD_SETSIZE
-	setsize = _rpc_dtablesize();	
+	setsize = _rpc_dtablesize();
 	maskp = (u_int32_t *)readfds->fds_bits;
 	for (sock = 0; sock < setsize; sock += 32) {
 	    for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c
index c1c3e04781..45ea4008bc 100644
--- a/sunrpc/svc_run.c
+++ b/sunrpc/svc_run.c
@@ -10,23 +10,23 @@ static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
  * 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
@@ -47,7 +47,9 @@ svc_run()
 #else
       int readfds;
 #endif /* def FD_SETSIZE */
+#ifndef errno
 	extern int errno;
+#endif
 
 	for (;;) {
 #ifdef FD_SETSIZE
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index 8886a9f1fd..6846f38409 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -46,7 +46,9 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
 #include <sys/socket.h>
 #include <errno.h>
 #define abort ((bool_t (*) ()) abort)
+#ifndef errno
 extern errno;
+#endif
 
 /*
  * Ops vector for TCP/IP based rpc service handle
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index a910452094..7c3a31b79e 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -64,7 +64,9 @@ static struct xp_ops svcudp_op = {
 	svcudp_destroy
 };
 
+#ifndef errno
 extern int errno;
+#endif
 
 /*
  * kept in xprt->xp_p2
@@ -472,4 +474,3 @@ cache_get(xprt, msg, replyp, replylenp)
 	uc->uc_addr = xprt->xp_raddr;
 	return(0);
 }
-