From 7f2ac73888b8ef372ea597049981b27e7d810ac2 Mon Sep 17 00:00:00 2001 From: Mystery Man Date: Wed, 20 Aug 2003 07:37:27 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'MDKC_1_0'. --- mdk-stage1/dietlibc/librpc/auth_none.c | 12 ++- mdk-stage1/dietlibc/librpc/auth_unix.c | 17 ++-- mdk-stage1/dietlibc/librpc/authunix_prot.c | 2 +- mdk-stage1/dietlibc/librpc/bindresvport.c | 4 +- mdk-stage1/dietlibc/librpc/clnt_generic.c | 10 +-- mdk-stage1/dietlibc/librpc/clnt_raw.c | 17 ++-- mdk-stage1/dietlibc/librpc/clnt_simple.c | 10 +-- mdk-stage1/dietlibc/librpc/clnt_tcp.c | 48 +++++----- mdk-stage1/dietlibc/librpc/clnt_udp.c | 51 +++++------ mdk-stage1/dietlibc/librpc/get_myaddress.c | 2 +- mdk-stage1/dietlibc/librpc/getrpcent.c | 9 +- mdk-stage1/dietlibc/librpc/getrpcport.c | 6 +- mdk-stage1/dietlibc/librpc/pmap_clnt.c | 17 ++-- mdk-stage1/dietlibc/librpc/pmap_getmaps.c | 5 +- mdk-stage1/dietlibc/librpc/pmap_getport.c | 16 ++-- mdk-stage1/dietlibc/librpc/pmap_prot2.c | 4 +- mdk-stage1/dietlibc/librpc/pmap_rmt.c | 111 ++++++++++++----------- mdk-stage1/dietlibc/librpc/rpc_callmsg.c | 12 +-- mdk-stage1/dietlibc/librpc/rpc_prot.c | 4 +- mdk-stage1/dietlibc/librpc/svc.c | 39 ++++---- mdk-stage1/dietlibc/librpc/svc_auth_unix.c | 6 +- mdk-stage1/dietlibc/librpc/svc_raw.c | 6 +- mdk-stage1/dietlibc/librpc/svc_run.c | 2 +- mdk-stage1/dietlibc/librpc/svc_simple.c | 6 +- mdk-stage1/dietlibc/librpc/svc_tcp.c | 58 ++++++------ mdk-stage1/dietlibc/librpc/svc_udp.c | 86 +++++++++--------- mdk-stage1/dietlibc/librpc/xdr.c | 36 ++++---- mdk-stage1/dietlibc/librpc/xdr_array.c | 38 +++++--- mdk-stage1/dietlibc/librpc/xdr_mem.c | 36 ++++---- mdk-stage1/dietlibc/librpc/xdr_rec.c | 138 ++++++++++++++--------------- mdk-stage1/dietlibc/librpc/xdr_reference.c | 14 +-- mdk-stage1/dietlibc/librpc/xdr_stdio.c | 26 +++--- 32 files changed, 430 insertions(+), 418 deletions(-) (limited to 'mdk-stage1/dietlibc/librpc') diff --git a/mdk-stage1/dietlibc/librpc/auth_none.c b/mdk-stage1/dietlibc/librpc/auth_none.c index 7a4dffe87..59124bae4 100644 --- a/mdk-stage1/dietlibc/librpc/auth_none.c +++ b/mdk-stage1/dietlibc/librpc/auth_none.c @@ -46,14 +46,11 @@ static char sccsid[] = #include #define MAX_MARSHEL_SIZE 20 -/* - * Authenticator operations routines - */ static void authnone_verf(); -static void authnone_destroy(); -static bool_t authnone_marshal(); static bool_t authnone_validate(); static bool_t authnone_refresh(); +static void authnone_destroy(); +static bool_t authnone_marshal(AUTH *client, XDR *xdrs); static struct auth_ops ops = { authnone_verf, @@ -66,7 +63,7 @@ static struct auth_ops ops = { static struct authnone_private { AUTH no_client; char marshalled_client[MAX_MARSHEL_SIZE]; - u_int mcnt; + unsigned int mcnt; } *authnone_private; AUTH *authnone_create() @@ -86,7 +83,7 @@ AUTH *authnone_create() ap->no_client.ah_ops = &ops; xdrs = &xdr_stream; xdrmem_create(xdrs, ap->marshalled_client, - (u_int) MAX_MARSHEL_SIZE, XDR_ENCODE); + (unsigned int) MAX_MARSHEL_SIZE, XDR_ENCODE); (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); ap->mcnt = XDR_GETPOS(xdrs); @@ -126,3 +123,4 @@ static bool_t authnone_refresh() static void authnone_destroy() { } + diff --git a/mdk-stage1/dietlibc/librpc/auth_unix.c b/mdk-stage1/dietlibc/librpc/auth_unix.c index 5daeb5f4a..59eb6ff18 100644 --- a/mdk-stage1/dietlibc/librpc/auth_unix.c +++ b/mdk-stage1/dietlibc/librpc/auth_unix.c @@ -78,9 +78,9 @@ static struct auth_ops auth_unix_ops = { struct audata { struct opaque_auth au_origcred; /* original credentials */ struct opaque_auth au_shcred; /* short hand cred */ - u_long au_shfaults; /* short hand cache faults */ + unsigned long au_shfaults; /* short hand cache faults */ char au_marshed[MAX_AUTH_BYTES]; - u_int au_mpos; /* xdr pos at end of marshed */ + unsigned int au_mpos; /* xdr pos at end of marshed */ }; #define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private) @@ -121,7 +121,7 @@ AUTH *authunix_create __P ((char *machname, uid_t uid, } #endif auth->ah_ops = &auth_unix_ops; - auth->ah_private = (caddr_t) au; + auth->ah_private = (char*) au; auth->ah_verf = au->au_shcred = _null_auth; au->au_shfaults = 0; @@ -133,7 +133,7 @@ AUTH *authunix_create __P ((char *machname, uid_t uid, aup.aup_machname = machname; aup.aup_uid = uid; aup.aup_gid = gid; - aup.aup_len = (u_int) len; + aup.aup_len = (unsigned int) len; aup.aup_gids = aup_gids; /* @@ -145,14 +145,14 @@ AUTH *authunix_create __P ((char *machname, uid_t uid, au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs); au->au_origcred.oa_flavor = AUTH_UNIX; #ifdef KERNEL - au->au_origcred.oa_base = mem_alloc((u_int) len); + au->au_origcred.oa_base = mem_alloc((unsigned int) len); #else - if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) { + if ((au->au_origcred.oa_base = mem_alloc((unsigned int) len)) == NULL) { (void) fprintf(stderr, "authunix_create: out of memory\n"); return (NULL); } #endif - bcopy(mymem, au->au_origcred.oa_base, (u_int) len); + memmove(au->au_origcred.oa_base, mymem, (unsigned int) len); /* * set auth handle to reflect new cred. @@ -288,7 +288,7 @@ register AUTH *auth; if (auth->ah_verf.oa_base != NULL) mem_free(auth->ah_verf.oa_base, auth->ah_verf.oa_length); - mem_free((caddr_t) auth, sizeof(*auth)); + mem_free((char*) auth, sizeof(*auth)); } /* @@ -311,3 +311,4 @@ register AUTH *auth; } XDR_DESTROY(xdrs); } + diff --git a/mdk-stage1/dietlibc/librpc/authunix_prot.c b/mdk-stage1/dietlibc/librpc/authunix_prot.c index ddcadb808..53897a364 100644 --- a/mdk-stage1/dietlibc/librpc/authunix_prot.c +++ b/mdk-stage1/dietlibc/librpc/authunix_prot.c @@ -59,7 +59,7 @@ register struct authunix_parms *p; && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) && xdr_int(xdrs, &a) && xdr_int(xdrs, &b) - && xdr_array(xdrs, (caddr_t *) & (p->aup_gids), + && xdr_array(xdrs, (char* *) & (p->aup_gids), &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int)) { p->aup_uid=(uid_t)a; p->aup_gid=(gid_t)b; diff --git a/mdk-stage1/dietlibc/librpc/bindresvport.c b/mdk-stage1/dietlibc/librpc/bindresvport.c index 8b65261dd..1131cc263 100644 --- a/mdk-stage1/dietlibc/librpc/bindresvport.c +++ b/mdk-stage1/dietlibc/librpc/bindresvport.c @@ -37,6 +37,7 @@ #include #include #include +#include "dietfeatures.h" /* * Bind a socket to a privileged IP port @@ -48,7 +49,6 @@ struct sockaddr_in *sin; int res; static short port; struct sockaddr_in myaddr; - extern int errno; int i; #define STARTPORT 600 @@ -57,7 +57,7 @@ struct sockaddr_in *sin; if (sin == (struct sockaddr_in *) 0) { sin = &myaddr; - bzero(sin, sizeof(*sin)); + memset(sin,0,sizeof(*sin)); sin->sin_family = AF_INET; } else if (sin->sin_family != AF_INET) { errno = EPFNOSUPPORT; diff --git a/mdk-stage1/dietlibc/librpc/clnt_generic.c b/mdk-stage1/dietlibc/librpc/clnt_generic.c index 9bb81cc80..5c0b96af9 100644 --- a/mdk-stage1/dietlibc/librpc/clnt_generic.c +++ b/mdk-stage1/dietlibc/librpc/clnt_generic.c @@ -44,8 +44,8 @@ static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI"; * returns client handle. Default options are set, which the user can * change using the rpc equivalent of ioctl()'s. */ -CLIENT *clnt_create __P ((const char *hostname, const u_long prog, - const u_long vers, const char *proto)) +CLIENT *clnt_create __P ((const char *hostname, const unsigned long prog, + const unsigned long vers, const char *proto)) { struct hostent *h; struct protoent *p; @@ -68,14 +68,14 @@ CLIENT *clnt_create __P ((const char *hostname, const u_long prog, return (NULL); } #ifdef __linux__ - bzero((char *) &sin, sizeof(sin)); + memset((char*)&sin,0,sizeof(sin)); #endif sin.sin_family = h->h_addrtype; sin.sin_port = 0; #ifndef __linux__ - bzero(sin.sin_zero, sizeof(sin.sin_zero)); + memset(sin.sin_zero,0,sizeof(sin.sin_zero)); #endif - bcopy(h->h_addr, (char *) &sin.sin_addr, h->h_length); + memmove((char *) &sin.sin_addr, h->h_addr, h->h_length); p = getprotobyname(proto); if (p == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; diff --git a/mdk-stage1/dietlibc/librpc/clnt_raw.c b/mdk-stage1/dietlibc/librpc/clnt_raw.c index 7479b55d6..52ab64421 100644 --- a/mdk-stage1/dietlibc/librpc/clnt_raw.c +++ b/mdk-stage1/dietlibc/librpc/clnt_raw.c @@ -54,7 +54,7 @@ static struct clntraw_private { XDR xdr_stream; char _raw_buf[UDPMSGSIZE]; char mashl_callmsg[MCALL_MSG_SIZE]; - u_int mcnt; + unsigned int mcnt; } *clntraw_private; static enum clnt_stat clntraw_call(); @@ -73,14 +73,12 @@ static struct clnt_ops client_ops = { clntraw_control }; -void svc_getreq(); - /* * Create a client handle for memory based rpc. */ CLIENT *clntraw_create(prog, vers) -u_long prog; -u_long vers; +unsigned long prog; +unsigned long vers; { register struct clntraw_private *clp = clntraw_private; struct rpc_msg call_msg; @@ -123,11 +121,11 @@ u_long vers; static enum clnt_stat clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout) CLIENT *h; -u_long proc; +unsigned long proc; xdrproc_t xargs; -caddr_t argsp; +char* argsp; xdrproc_t xresults; -caddr_t resultsp; +char* resultsp; struct timeval timeout; { register struct clntraw_private *clp = clntraw_private; @@ -202,7 +200,7 @@ static void clntraw_geterr() static bool_t clntraw_freeres(cl, xdr_res, res_ptr) CLIENT *cl; xdrproc_t xdr_res; -caddr_t res_ptr; +char* res_ptr; { register struct clntraw_private *clp = clntraw_private; register XDR *xdrs = &clp->xdr_stream; @@ -228,3 +226,4 @@ static bool_t clntraw_control() static void clntraw_destroy() { } + diff --git a/mdk-stage1/dietlibc/librpc/clnt_simple.c b/mdk-stage1/dietlibc/librpc/clnt_simple.c index f309f86ff..e1f4c5f6c 100644 --- a/mdk-stage1/dietlibc/librpc/clnt_simple.c +++ b/mdk-stage1/dietlibc/librpc/clnt_simple.c @@ -54,8 +54,8 @@ static struct callrpc_private { char *oldhost; } *callrpc_private; -int callrpc (const char *host, const u_long prognum, - const u_long versnum, const u_long procnum, +int callrpc (const char *host, const unsigned long prognum, + const unsigned long versnum, const unsigned long procnum, const xdrproc_t inproc, const char *in, const xdrproc_t outproc, char *out) { @@ -91,11 +91,11 @@ int callrpc (const char *host, const u_long prognum, return ((int) RPC_UNKNOWNHOST); timeout.tv_usec = 0; timeout.tv_sec = 5; - bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); + memmove((char *) &server_addr.sin_addr, hp->h_addr, hp->h_length); server_addr.sin_family = AF_INET; server_addr.sin_port = 0; - if ((crp->client = clntudp_create(&server_addr, (u_long) prognum, - (u_long) versnum, timeout, + if ((crp->client = clntudp_create(&server_addr, (unsigned long) prognum, + (unsigned long) versnum, timeout, &crp->socket)) == NULL) return ((int) rpc_createerr.cf_stat); crp->valid = 1; diff --git a/mdk-stage1/dietlibc/librpc/clnt_tcp.c b/mdk-stage1/dietlibc/librpc/clnt_tcp.c index 8c39e8933..56bf3315a 100644 --- a/mdk-stage1/dietlibc/librpc/clnt_tcp.c +++ b/mdk-stage1/dietlibc/librpc/clnt_tcp.c @@ -57,11 +57,10 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #include #include #include +#include "dietfeatures.h" #define MCALL_MSG_SIZE 24 -extern int errno; - static int readtcp(); static int writetcp(); @@ -89,7 +88,7 @@ struct ct_data { struct sockaddr_in ct_addr; struct rpc_err ct_error; char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */ - u_int ct_mpos; /* pos after marshal */ + unsigned int ct_mpos; /* pos after marshal */ XDR ct_xdrs; }; @@ -109,11 +108,11 @@ struct ct_data { */ CLIENT *clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) struct sockaddr_in *raddr; -u_long prog; -u_long vers; +unsigned long prog; +unsigned long vers; register int *sockp; -u_int sendsz; -u_int recvsz; +unsigned int sendsz; +unsigned int recvsz; { CLIENT *h; register struct ct_data *ct; @@ -139,12 +138,12 @@ u_int recvsz; * If no port number given ask the pmap for one */ if (raddr->sin_port == 0) { - u_short port; + unsigned short port; if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) { - mem_free((caddr_t) ct, sizeof(struct ct_data)); + mem_free((char*) ct, sizeof(struct ct_data)); - mem_free((caddr_t) h, sizeof(CLIENT)); + mem_free((char*) h, sizeof(CLIENT)); return ((CLIENT *) NULL); } raddr->sin_port = htons(port); @@ -206,9 +205,9 @@ u_int recvsz; * and authnone for authentication. */ xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz, - (caddr_t) ct, readtcp, writetcp); + (char*) ct, readtcp, writetcp); h->cl_ops = &tcp_ops; - h->cl_private = (caddr_t) ct; + h->cl_private = (char*) ct; h->cl_auth = authnone_create(); return (h); @@ -216,9 +215,9 @@ u_int recvsz; /* * Something goofed, free stuff and barf */ - mem_free((caddr_t) ct, sizeof(struct ct_data)); + mem_free((char*) ct, sizeof(struct ct_data)); - mem_free((caddr_t) h, sizeof(CLIENT)); + mem_free((char*) h, sizeof(CLIENT)); return ((CLIENT *) NULL); } @@ -226,18 +225,18 @@ static enum clnt_stat clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) register CLIENT *h; -u_long proc; +unsigned long proc; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; xdrproc_t xdr_results; -caddr_t results_ptr; +char* results_ptr; struct timeval timeout; { register struct ct_data *ct = (struct ct_data *) h->cl_private; register XDR *xdrs = &(ct->ct_xdrs); struct rpc_msg reply_msg; - u_long x_id; - u_long *msg_x_id = (u_long *) (ct->ct_mcall); /* yuk */ + unsigned long x_id; + unsigned long *msg_x_id = (unsigned long *) (ct->ct_mcall); /* yuk */ register bool_t shipnow; int refreshes = 2; @@ -332,7 +331,7 @@ struct rpc_err *errp; static bool_t clnttcp_freeres(cl, xdr_res, res_ptr) CLIENT *cl; xdrproc_t xdr_res; -caddr_t res_ptr; +char* res_ptr; { register struct ct_data *ct = (struct ct_data *) cl->cl_private; register XDR *xdrs = &(ct->ct_xdrs); @@ -379,9 +378,9 @@ CLIENT *h; (void) close(ct->ct_sock); } XDR_DESTROY(&(ct->ct_xdrs)); - mem_free((caddr_t) ct, sizeof(struct ct_data)); + mem_free((char*) ct, sizeof(struct ct_data)); - mem_free((caddr_t) h, sizeof(CLIENT)); + mem_free((char*) h, sizeof(CLIENT)); } /* @@ -391,7 +390,7 @@ CLIENT *h; */ static int readtcp(ct, buf, len) register struct ct_data *ct; -caddr_t buf; +char* buf; register int len; { #ifdef FD_SETSIZE @@ -447,7 +446,7 @@ register int len; static int writetcp(ct, buf, len) struct ct_data *ct; -caddr_t buf; +char* buf; int len; { register int i, cnt; @@ -461,3 +460,4 @@ int len; } return (len); } + diff --git a/mdk-stage1/dietlibc/librpc/clnt_udp.c b/mdk-stage1/dietlibc/librpc/clnt_udp.c index 7305d3ff1..874ef62db 100644 --- a/mdk-stage1/dietlibc/librpc/clnt_udp.c +++ b/mdk-stage1/dietlibc/librpc/clnt_udp.c @@ -45,8 +45,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include #include #include - -extern int errno; +#include "dietfeatures.h" /* * UDP bases client side rpc operations @@ -67,6 +66,7 @@ static struct clnt_ops udp_ops = { clntudp_control }; + /* * Private data kept per client handle */ @@ -79,10 +79,10 @@ struct cu_data { struct timeval cu_total; struct rpc_err cu_error; XDR cu_outxdrs; - u_int cu_xdrpos; - u_int cu_sendsz; + unsigned int cu_xdrpos; + unsigned int cu_sendsz; char *cu_outbuf; - u_int cu_recvsz; + unsigned int cu_recvsz; char cu_inbuf[1]; }; @@ -105,12 +105,12 @@ struct cu_data { CLIENT *clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) struct sockaddr_in *raddr; -u_long program; -u_long version; +unsigned long program; +unsigned long version; struct timeval wait; register int *sockp; -u_int sendsz; -u_int recvsz; +unsigned int sendsz; +unsigned int recvsz; { CLIENT *cl; register struct cu_data *cu; @@ -137,7 +137,7 @@ u_int recvsz; (void) gettimeofday(&now, (struct timezone *) 0); if (raddr->sin_port == 0) { - u_short port; + unsigned short port; if ((port = pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) { @@ -146,7 +146,7 @@ u_int recvsz; raddr->sin_port = htons(port); } cl->cl_ops = &udp_ops; - cl->cl_private = (caddr_t) cu; + cl->cl_private = (char*) cu; cu->cu_raddr = *raddr; cu->cu_rlen = sizeof(cu->cu_raddr); cu->cu_wait = wait; @@ -186,16 +186,16 @@ u_int recvsz; return (cl); fooy: if (cu) - mem_free((caddr_t) cu, sizeof(*cu) + sendsz + recvsz); + mem_free((char*) cu, sizeof(*cu) + sendsz + recvsz); if (cl) - mem_free((caddr_t) cl, sizeof(CLIENT)); + mem_free((char*) cl, sizeof(CLIENT)); return ((CLIENT *) NULL); } CLIENT *clntudp_create(raddr, program, version, wait, sockp) struct sockaddr_in *raddr; -u_long program; -u_long version; +unsigned long program; +unsigned long version; struct timeval wait; register int *sockp; { @@ -207,11 +207,11 @@ register int *sockp; static enum clnt_stat clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) register CLIENT *cl; /* client handle */ -u_long proc; /* procedure number */ +unsigned long proc; /* procedure number */ xdrproc_t xargs; /* xdr routine for args */ -caddr_t argsp; /* pointer to args */ +char* argsp; /* pointer to args */ xdrproc_t xresults; /* xdr routine for results */ -caddr_t resultsp; /* pointer to results */ +char* resultsp; /* pointer to results */ struct timeval utimeout; /* seconds to wait before giving up */ { register struct cu_data *cu = (struct cu_data *) cl->cl_private; @@ -250,7 +250,7 @@ struct timeval utimeout; /* seconds to wait before giving up */ /* * the transaction is the first thing in the out buffer */ - (*(u_short *) (cu->cu_outbuf))++; + (*(unsigned short *) (cu->cu_outbuf))++; if ((!XDR_PUTLONG(xdrs, (long *) &proc)) || (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) return (cu->cu_error.re_status = RPC_CANTENCODEARGS); @@ -324,10 +324,10 @@ struct timeval utimeout; /* seconds to wait before giving up */ cu->cu_error.re_errno = errno; return (cu->cu_error.re_status = RPC_CANTRECV); } - if (inlen < sizeof(u_long)) + if (inlen < sizeof(unsigned long)) continue; /* see if reply transaction id matches sent id */ - if (*((u_long *) (cu->cu_inbuf)) != *((u_long *) (cu->cu_outbuf))) + if (*((unsigned long *) (cu->cu_inbuf)) != *((unsigned long *) (cu->cu_outbuf))) continue; /* we now assume we have the proper reply */ break; @@ -336,7 +336,7 @@ struct timeval utimeout; /* seconds to wait before giving up */ /* * now decode and validate the response */ - xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE); + xdrmem_create(&reply_xdrs, cu->cu_inbuf, (unsigned int) inlen, XDR_DECODE); ok = xdr_replymsg(&reply_xdrs, &reply_msg); /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */ if (ok) { @@ -380,7 +380,7 @@ struct rpc_err *errp; static bool_t clntudp_freeres(cl, xdr_res, res_ptr) CLIENT *cl; xdrproc_t xdr_res; -caddr_t res_ptr; +char* res_ptr; { register struct cu_data *cu = (struct cu_data *) cl->cl_private; register XDR *xdrs = &(cu->cu_outxdrs); @@ -432,6 +432,7 @@ CLIENT *cl; (void) close(cu->cu_sock); } XDR_DESTROY(&(cu->cu_outxdrs)); - mem_free((caddr_t) cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz)); - mem_free((caddr_t) cl, sizeof(CLIENT)); + mem_free((char*) cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz)); + mem_free((char*) cl, sizeof(CLIENT)); } + diff --git a/mdk-stage1/dietlibc/librpc/get_myaddress.c b/mdk-stage1/dietlibc/librpc/get_myaddress.c index cd63383d0..1ce2c2b32 100644 --- a/mdk-stage1/dietlibc/librpc/get_myaddress.c +++ b/mdk-stage1/dietlibc/librpc/get_myaddress.c @@ -64,6 +64,6 @@ void get_myaddress(struct sockaddr_in* addr) exit(1); } addr->sin_family = AF_INET; - bcopy((char *) hp->h_addr, (char *) &addr->sin_addr, hp->h_length); + memmove((char *) &addr->sin_addr, (char *) hp->h_addr, hp->h_length); addr->sin_port = htons(PMAPPORT); } diff --git a/mdk-stage1/dietlibc/librpc/getrpcent.c b/mdk-stage1/dietlibc/librpc/getrpcent.c index 5e7f694d2..71774a2eb 100644 --- a/mdk-stage1/dietlibc/librpc/getrpcent.c +++ b/mdk-stage1/dietlibc/librpc/getrpcent.c @@ -44,6 +44,7 @@ static char sccsid[] = #include #include #include +#include /* * Internet version. @@ -60,9 +61,7 @@ struct rpcdata { char *domain; } *rpcdata; -static struct rpcent *interpret(); -struct hostent *gethostent(); -char *inet_ntoa(); +static struct rpcent *interpret(const char* val, size_t len); #ifndef __linux__ static char *index(); @@ -195,7 +194,7 @@ char *s; } #endif -static struct rpcent *interpret(const char* val, int len) +static struct rpcent *interpret(const char* val, size_t len) { register struct rpcdata *d = _rpcdata(); char *p; @@ -203,7 +202,7 @@ static struct rpcent *interpret(const char* val, int len) if (d == 0) return 0; - strncpy(d->line, val, len); + strncpy(d->line, val, (size_t)len); p = d->line; d->line[len] = '\n'; if (*p == '#') diff --git a/mdk-stage1/dietlibc/librpc/getrpcport.c b/mdk-stage1/dietlibc/librpc/getrpcport.c index a7085cbe7..7b6e50a7d 100644 --- a/mdk-stage1/dietlibc/librpc/getrpcport.c +++ b/mdk-stage1/dietlibc/librpc/getrpcport.c @@ -42,15 +42,15 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; #include #include -extern int getrpcport (const char * host, u_long prognum, - u_long versnum, u_int proto) +extern int getrpcport (const char * host, unsigned long prognum, + unsigned long versnum, unsigned int proto) { struct sockaddr_in addr; struct hostent *hp; if ((hp = gethostbyname(host)) == NULL) return (0); - bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length); + memmove((char *) &addr.sin_addr, hp->h_addr, hp->h_length); addr.sin_family = AF_INET; addr.sin_port = 0; return (pmap_getport(&addr, prognum, versnum, proto)); diff --git a/mdk-stage1/dietlibc/librpc/pmap_clnt.c b/mdk-stage1/dietlibc/librpc/pmap_clnt.c index 428675656..9dbf3f624 100644 --- a/mdk-stage1/dietlibc/librpc/pmap_clnt.c +++ b/mdk-stage1/dietlibc/librpc/pmap_clnt.c @@ -48,18 +48,15 @@ static char sccsid[] = static struct timeval timeout = { 5, 0 }; static struct timeval tottimeout = { 60, 0 }; -void clnt_perror(); - - /* * Set a mapping between program,version and port. * Calls the pmap service remotely to do the mapping. */ bool_t pmap_set(program, version, protocol, port) -u_long program; -u_long version; +unsigned long program; +unsigned long version; int protocol; -u_short port; +unsigned short port; { struct sockaddr_in myaddress; int socket = -1; @@ -77,7 +74,7 @@ u_short port; parms.pm_vers = version; parms.pm_prot = protocol; parms.pm_port = port; - if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, + if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, (char*)&parms, (xdrproc_t)xdr_bool, (void*)&rslt, tottimeout) != RPC_SUCCESS) { clnt_perror(client, "Cannot register service"); return (FALSE); @@ -92,8 +89,8 @@ u_short port; * Calls the pmap service remotely to do the un-mapping. */ bool_t pmap_unset(program, version) -u_long program; -u_long version; +unsigned long program; +unsigned long version; { struct sockaddr_in myaddress; int socket = -1; @@ -110,7 +107,7 @@ u_long version; parms.pm_prog = program; parms.pm_vers = version; parms.pm_port = parms.pm_prot = 0; - CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, + CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (char*)&parms, (xdrproc_t)xdr_bool, (void*)&rslt, tottimeout); CLNT_DESTROY(client); (void) close(socket); diff --git a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c index 6940783fb..de51a733a 100644 --- a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c +++ b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c @@ -48,14 +48,13 @@ static char sccsid[] = #include #include #include +#include //#include #include #define NAMELEN 255 #define MAX_BROADCAST_SIZE 1400 #include -extern int errno; - /* * Get a copy of the current port maps. * Calls the pmap service remotely to do get the maps. @@ -74,7 +73,7 @@ struct sockaddr_in *address; client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket, 50, 500); if (client != (CLIENT *) NULL) { if (CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_pmaplist, - (caddr_t)&head, minutetimeout) != RPC_SUCCESS) { + (char*)&head, minutetimeout) != RPC_SUCCESS) { clnt_perror(client, "pmap_getmaps rpc problem"); } CLNT_DESTROY(client); diff --git a/mdk-stage1/dietlibc/librpc/pmap_getport.c b/mdk-stage1/dietlibc/librpc/pmap_getport.c index 174dca41a..edf199e69 100644 --- a/mdk-stage1/dietlibc/librpc/pmap_getport.c +++ b/mdk-stage1/dietlibc/librpc/pmap_getport.c @@ -55,18 +55,18 @@ static struct timeval tottimeout = { 60, 0 }; * Calls the pmap service remotely to do the lookup. * Returns 0 if no map exists. */ -u_short pmap_getport(address, program, version, protocol) +unsigned short pmap_getport(address, program, version, protocol) struct sockaddr_in *address; -u_long program; -u_long version; -u_int protocol; +unsigned long program; +unsigned long version; +unsigned int protocol; { - u_short port = 0; + unsigned short port = 0; int socket = -1; register CLIENT *client; struct pmap parms; - address->sin_port = htons(PMAPPORT); + address->sin_port = htons((unsigned short)PMAPPORT); client = clntudp_bufcreate(address, PMAPPROG, PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); @@ -75,8 +75,8 @@ u_int protocol; parms.pm_vers = version; parms.pm_prot = protocol; parms.pm_port = 0; /* not needed or used */ - if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (caddr_t)&parms, - (xdrproc_t)xdr_u_short, (caddr_t)&port, tottimeout) != RPC_SUCCESS) { + if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (char*)&parms, + (xdrproc_t)xdr_u_short, (char*)&port, tottimeout) != RPC_SUCCESS) { rpc_createerr.cf_stat = RPC_PMAPFAILURE; clnt_geterr(client, &rpc_createerr.cf_error); } else if (port == 0) { diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot2.c b/mdk-stage1/dietlibc/librpc/pmap_prot2.c index 870c844ed..cd2deb036 100644 --- a/mdk-stage1/dietlibc/librpc/pmap_prot2.c +++ b/mdk-stage1/dietlibc/librpc/pmap_prot2.c @@ -107,8 +107,8 @@ bool_t xdr_pmaplist(XDR* xdrs, struct pmaplist** rp) */ if (freeing) next = &((*rp)->pml_next); - if (!xdr_reference(xdrs, (caddr_t *) rp, - (u_int) sizeof(struct pmaplist), (xdrproc_t)xdr_pmap)) + if (!xdr_reference(xdrs, (char* *) rp, + (unsigned int) sizeof(struct pmaplist), (xdrproc_t)xdr_pmap)) return (FALSE); rp = (freeing) ? next : &((*rp)->pml_next); diff --git a/mdk-stage1/dietlibc/librpc/pmap_rmt.c b/mdk-stage1/dietlibc/librpc/pmap_rmt.c index 02efcf91c..390bd736e 100644 --- a/mdk-stage1/dietlibc/librpc/pmap_rmt.c +++ b/mdk-stage1/dietlibc/librpc/pmap_rmt.c @@ -49,11 +49,12 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; //#include #include #include +#include #define MAX_BROADCAST_SIZE 1400 #include #include +#include "dietfeatures.h" -extern int errno; static struct timeval timeout = { 3, 0 }; @@ -64,42 +65,40 @@ static struct timeval timeout = { 3, 0 }; * remotely call that routine with the given parameters. This allows * programs to do a lookup and call in one step. */ -enum clnt_stat -pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, - port_ptr) -struct sockaddr_in *addr; -u_long prog, vers, proc; -xdrproc_t xdrargs, xdrres; -caddr_t argsp, resp; -struct timeval tout; -u_long *port_ptr; -{ - int socket = -1; - register CLIENT *client; - struct rmtcallargs a; - struct rmtcallres r; - enum clnt_stat stat; +enum clnt_stat pmap_rmtcall (struct sockaddr_in *addr, + const unsigned long prog, + const unsigned long vers, + const unsigned long proc, + xdrproc_t xdrargs, + char* argsp, xdrproc_t xdrres, + char* resp, struct timeval tout, + unsigned long *port_ptr) { + int socket = -1; + register CLIENT *client; + struct rmtcallargs a; + struct rmtcallres r; + enum clnt_stat stat; - addr->sin_port = htons(PMAPPORT); - client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket); - if (client != (CLIENT *) NULL) { - a.prog = prog; - a.vers = vers; - a.proc = proc; - a.args_ptr = argsp; - a.xdr_args = xdrargs; - r.port_ptr = port_ptr; - r.results_ptr = resp; - r.xdr_results = xdrres; - stat = CLNT_CALL(client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a, - (xdrproc_t)xdr_rmtcallres, (caddr_t)&r, tout); - CLNT_DESTROY(client); - } else { - stat = RPC_FAILED; - } - (void) close(socket); - addr->sin_port = 0; - return (stat); + addr->sin_port = htons((short)PMAPPORT); + client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket); + if (client != (CLIENT *) NULL) { + a.prog = prog; + a.vers = vers; + a.proc = proc; + a.args_ptr = argsp; + a.xdr_args = xdrargs; + r.port_ptr = port_ptr; + r.results_ptr = resp; + r.xdr_results = xdrres; + stat = CLNT_CALL(client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, (char*)&a, + (xdrproc_t)xdr_rmtcallres, (char*)&r, tout); + CLNT_DESTROY(client); + } else { + stat = RPC_FAILED; + } + (void) close(socket); + addr->sin_port = 0; + return (stat); } @@ -109,7 +108,7 @@ u_long *port_ptr; */ bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap) { - u_int lenposition, argposition, position; + unsigned int lenposition, argposition, position; if (xdr_u_long(xdrs, &(cap->prog)) && xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) { @@ -120,7 +119,7 @@ bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap) if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) return (FALSE); position = XDR_GETPOS(xdrs); - cap->arglen = (u_long) position - (u_long) argposition; + cap->arglen = (unsigned long) position - (unsigned long) argposition; XDR_SETPOS(xdrs, lenposition); if (!xdr_u_long(xdrs, &(cap->arglen))) return (FALSE); @@ -136,12 +135,12 @@ bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap) */ bool_t xdr_rmtcallres(XDR* xdrs, struct rmtcallres* crp) { - caddr_t port_ptr; + char* port_ptr; - port_ptr = (caddr_t) crp->port_ptr; - if (xdr_reference(xdrs, &port_ptr, sizeof(u_long), + port_ptr = (char*) crp->port_ptr; + if (xdr_reference(xdrs, &port_ptr, sizeof(unsigned long), (xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) { - crp->port_ptr = (u_long *) port_ptr; + crp->port_ptr = (unsigned long *) port_ptr; return ((*(crp->xdr_results)) (xdrs, crp->results_ptr)); } return (FALSE); @@ -222,13 +221,13 @@ char *buf; /* why allocxate more when we can use existing... */ enum clnt_stat clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) -u_long prog; /* program number */ -u_long vers; /* version number */ -u_long proc; /* procedure number */ +unsigned long prog; /* program number */ +unsigned long vers; /* version number */ +unsigned long proc; /* procedure number */ xdrproc_t xargs; /* xdr routine for args */ -caddr_t argsp; /* pointer to args */ +char* argsp; /* pointer to args */ xdrproc_t xresults; /* xdr routine for results */ -caddr_t resultsp; /* pointer to results */ +char* resultsp; /* pointer to results */ resultproc_t eachresult; /* call with each result obtained */ { enum clnt_stat stat; @@ -248,8 +247,8 @@ resultproc_t eachresult; /* call with each result obtained */ #endif /* def FD_SETSIZE */ register int i; bool_t done = FALSE; - register u_long xid; - u_long port; + register unsigned long xid; + unsigned long port; struct in_addr addrs[20]; struct sockaddr_in baddr, raddr; /* broadcast and response addresses */ struct rmtcallargs a; @@ -281,9 +280,9 @@ resultproc_t eachresult; /* call with each result obtained */ mask = (1 << sock); #endif /* def FD_SETSIZE */ nets = getbroadcastnets(addrs, sock, inbuf); - bzero((char *) &baddr, sizeof(baddr)); + memset((char*)&baddr,0,sizeof(baddr)); baddr.sin_family = AF_INET; - baddr.sin_port = htons(PMAPPORT); + baddr.sin_port = htons((short)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); @@ -318,7 +317,7 @@ resultproc_t eachresult; /* call with each result obtained */ 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, (size_t)outlen, 0, (struct sockaddr *) &baddr, sizeof(struct sockaddr)) != outlen) { perror("Cannot send broadcast packet"); @@ -332,7 +331,7 @@ resultproc_t eachresult; /* call with each result obtained */ } recv_again: msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = (caddr_t) & r; + msg.acpted_rply.ar_results.where = (char*) & r; msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres; readfds = mask; switch (select(_rpc_dtablesize(), &readfds, 0, 0, &t)) { @@ -361,18 +360,18 @@ resultproc_t eachresult; /* call with each result obtained */ stat = RPC_CANTRECV; goto done_broad; } - if (inlen < sizeof(u_long)) + if ((size_t)inlen < sizeof(unsigned long)) goto recv_again; /* * see if reply transaction id matches sent id. * If so, decode the results. */ - xdrmem_create(xdrs, inbuf, (u_int) inlen, XDR_DECODE); + xdrmem_create(xdrs, inbuf, (unsigned int) inlen, XDR_DECODE); if (xdr_replymsg(xdrs, &msg)) { if ((msg.rm_xid == xid) && (msg.rm_reply.rp_stat == MSG_ACCEPTED) && (msg.acpted_rply.ar_stat == SUCCESS)) { - raddr.sin_port = htons((u_short) port); + raddr.sin_port = htons((unsigned short) port); done = (*eachresult) (resultsp, &raddr); } /* otherwise, we just ignore the errors ... */ diff --git a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c index 4b3a9880e..a3514f41c 100644 --- a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c +++ b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c @@ -83,14 +83,14 @@ register struct rpc_msg *cmsg; IXDR_PUT_ENUM(buf, oa->oa_flavor); IXDR_PUT_LONG(buf, oa->oa_length); if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); + memmove((char*) buf, oa->oa_base, oa->oa_length); buf += RNDUP(oa->oa_length) / sizeof(long); } oa = &cmsg->rm_call.cb_verf; IXDR_PUT_ENUM(buf, oa->oa_flavor); IXDR_PUT_LONG(buf, oa->oa_length); if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); + memmove((char*) buf, oa->oa_base, oa->oa_length); /* no real need.... buf += RNDUP(oa->oa_length) / sizeof (long); */ @@ -122,7 +122,7 @@ register struct rpc_msg *cmsg; return (FALSE); } if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) + oa->oa_base = (char*) mem_alloc(oa->oa_length); } buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); @@ -132,7 +132,7 @@ register struct rpc_msg *cmsg; return (FALSE); } } else { - bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); + memmove(oa->oa_base, (char*) buf, oa->oa_length); /* no real need.... buf += RNDUP(oa->oa_length) / sizeof (long); @@ -155,7 +155,7 @@ register struct rpc_msg *cmsg; return (FALSE); } if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) + oa->oa_base = (char*) mem_alloc(oa->oa_length); } buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); @@ -165,7 +165,7 @@ register struct rpc_msg *cmsg; return (FALSE); } } else { - bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); + memmove(oa->oa_base, (char*) buf, oa->oa_length); /* no real need... buf += RNDUP(oa->oa_length) / sizeof (long); diff --git a/mdk-stage1/dietlibc/librpc/rpc_prot.c b/mdk-stage1/dietlibc/librpc/rpc_prot.c index 19a4db27f..d5ca5ab77 100644 --- a/mdk-stage1/dietlibc/librpc/rpc_prot.c +++ b/mdk-stage1/dietlibc/librpc/rpc_prot.c @@ -74,7 +74,7 @@ bool_t xdr_des_block(xdrs, blkp) register XDR *xdrs; register des_block *blkp; { - return (xdr_opaque(xdrs, (caddr_t) blkp, sizeof(des_block))); + return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block))); } /* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */ @@ -146,7 +146,7 @@ register struct rpc_msg *rmsg; xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) && (rmsg->rm_direction == REPLY)) return (xdr_union(xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat), - (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm, + (char*) & (rmsg->rm_reply.ru), reply_dscrm, NULL_xdrproc_t)); return (FALSE); } diff --git a/mdk-stage1/dietlibc/librpc/svc.c b/mdk-stage1/dietlibc/librpc/svc.c index 4fcdb5216..b430deb4a 100644 --- a/mdk-stage1/dietlibc/librpc/svc.c +++ b/mdk-stage1/dietlibc/librpc/svc.c @@ -44,12 +44,11 @@ static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro"; #include #include #include +#include #ifdef __linux__ #include #endif -extern int errno; - #ifdef FD_SETSIZE static SVCXPRT **xports; #else @@ -69,8 +68,8 @@ static SVCXPRT *xports[NOFILE]; */ static struct svc_callout { struct svc_callout *sc_next; - u_long sc_prog; - u_long sc_vers; + unsigned long sc_prog; + unsigned long sc_vers; void (*sc_dispatch) (); } *svc_head; @@ -135,8 +134,8 @@ SVCXPRT *xprt; */ bool_t svc_register(xprt, prog, vers, dispatch, protocol) SVCXPRT *xprt; -u_long prog; -u_long vers; +unsigned long prog; +unsigned long vers; void (*dispatch) (); rpcprot_t protocol; { @@ -170,8 +169,8 @@ rpcprot_t protocol; * Remove a service program from the callout list. */ void svc_unregister(prog, vers) -u_long prog; -u_long vers; +unsigned long prog; +unsigned long vers; { struct svc_callout *prev; register struct svc_callout *s; @@ -184,7 +183,7 @@ u_long vers; prev->sc_next = s->sc_next; } s->sc_next = NULL_SVC; - mem_free((char *) s, (u_int) sizeof(struct svc_callout)); + mem_free((char *) s, (unsigned int) sizeof(struct svc_callout)); /* now unregister the information with the local binder service */ (void) pmap_unset(prog, vers); @@ -195,8 +194,8 @@ u_long vers; * struct. */ static struct svc_callout *svc_find(prog, vers, prev) -u_long prog; -u_long vers; +unsigned long prog; +unsigned long vers; struct svc_callout **prev; { register struct svc_callout *s, *p; @@ -220,7 +219,7 @@ struct svc_callout **prev; bool_t svc_sendreply(xprt, xdr_results, xdr_location) register SVCXPRT *xprt; xdrproc_t xdr_results; -caddr_t xdr_location; +char* xdr_location; { struct rpc_msg rply; @@ -324,8 +323,8 @@ register SVCXPRT *xprt; */ void svcerr_progvers(xprt, low_vers, high_vers) register SVCXPRT *xprt; -u_long low_vers; -u_long high_vers; +unsigned long low_vers; +unsigned long high_vers; { struct rpc_msg rply; @@ -389,13 +388,13 @@ int *readfds; enum xprt_stat stat; struct rpc_msg msg; int prog_found; - u_long low_vers; - u_long high_vers; + unsigned long low_vers; + unsigned long high_vers; struct svc_req r; register SVCXPRT *xprt; - register u_long mask; + register unsigned long mask; register int bit; - register u_long *maskp; + register unsigned long *maskp; register int setsize; register int sock; char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE]; @@ -409,9 +408,9 @@ int *readfds; setsize = _rpc_dtablesize(); #ifdef __linux__ /*#define NFDBITS 32*/ - maskp = (u_long *) readfds; + maskp = (unsigned long *) readfds; #else - maskp = (u_long *) readfds->fds_bits; + maskp = (unsigned long *) readfds->fds_bits; #endif for (sock = 0; sock < setsize; sock += NFDBITS) { for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) { diff --git a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c index 7e0305f0a..e81eba7d9 100644 --- a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c +++ b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c @@ -64,7 +64,7 @@ register struct rpc_msg *msg; char area_machname[MAX_MACHINE_NAME + 1]; gid_t area_gids[NGRPS]; } *area; - u_int auth_len; + unsigned int auth_len; int str_len, gid_len; register int i; @@ -72,7 +72,7 @@ register struct rpc_msg *msg; aup = &area->area_aup; aup->aup_machname = area->area_machname; aup->aup_gids = area->area_gids; - auth_len = (u_int) msg->rm_call.cb_cred.oa_length; + auth_len = (unsigned int) msg->rm_call.cb_cred.oa_length; xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len, XDR_DECODE); buf = XDR_INLINE(&xdrs, auth_len); @@ -83,7 +83,7 @@ register struct rpc_msg *msg; stat = AUTH_BADCRED; goto done; } - bcopy((caddr_t) buf, aup->aup_machname, (u_int) str_len); + memmove(aup->aup_machname, (char*) buf, (unsigned int) str_len); aup->aup_machname[str_len] = 0; str_len = RNDUP(str_len); buf += str_len / sizeof(long); diff --git a/mdk-stage1/dietlibc/librpc/svc_raw.c b/mdk-stage1/dietlibc/librpc/svc_raw.c index c13ea5e06..eebb433ee 100644 --- a/mdk-stage1/dietlibc/librpc/svc_raw.c +++ b/mdk-stage1/dietlibc/librpc/svc_raw.c @@ -69,6 +69,7 @@ static struct xp_ops server_ops = { svcraw_destroy }; + SVCXPRT *svcraw_create() { register struct svcraw_private *srp = svcraw_private; @@ -130,7 +131,7 @@ struct rpc_msg *msg; static bool_t svcraw_getargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { register struct svcraw_private *srp = svcraw_private; @@ -142,7 +143,7 @@ caddr_t args_ptr; static bool_t svcraw_freeargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { register struct svcraw_private *srp = svcraw_private; register XDR *xdrs; @@ -157,3 +158,4 @@ caddr_t args_ptr; static void svcraw_destroy() { } + diff --git a/mdk-stage1/dietlibc/librpc/svc_run.c b/mdk-stage1/dietlibc/librpc/svc_run.c index c7150e357..506b37942 100644 --- a/mdk-stage1/dietlibc/librpc/svc_run.c +++ b/mdk-stage1/dietlibc/librpc/svc_run.c @@ -39,6 +39,7 @@ static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro"; #include #include #include +#include "dietfeatures.h" void svc_run() { @@ -47,7 +48,6 @@ void svc_run() #else int readfds; #endif /* def FD_SETSIZE */ - extern int errno; for (;;) { #ifdef FD_SETSIZE diff --git a/mdk-stage1/dietlibc/librpc/svc_simple.c b/mdk-stage1/dietlibc/librpc/svc_simple.c index 0bb9a19eb..d2310de1e 100644 --- a/mdk-stage1/dietlibc/librpc/svc_simple.c +++ b/mdk-stage1/dietlibc/librpc/svc_simple.c @@ -73,8 +73,8 @@ int registerrpc(int prognum, int versnum, int procnum, char *(*progname)(), xdrp return (-1); } } - (void) pmap_unset((u_long) prognum, (u_long) versnum); - if (!svc_register(transp, (u_long) prognum, (u_long) versnum, + (void) pmap_unset((unsigned long) prognum, (unsigned long) versnum); + if (!svc_register(transp, (unsigned long) prognum, (unsigned long) versnum, universal, IPPROTO_UDP)) { (void) fprintf(stderr, "couldn't register prog %d vers %d\n", prognum, versnum); @@ -120,7 +120,7 @@ SVCXPRT *transp; for (pl = proglst; pl != NULL; pl = pl->p_nxt) if (pl->p_prognum == prog && pl->p_procnum == proc) { /* decode arguments into a CLEAN buffer */ - bzero(xdrbuf, sizeof(xdrbuf)); /* required ! */ + memset(xdrbuf, 0, sizeof(xdrbuf)); /* required ! */ if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) { svcerr_decode(transp); return; diff --git a/mdk-stage1/dietlibc/librpc/svc_tcp.c b/mdk-stage1/dietlibc/librpc/svc_tcp.c index 6edafa1b1..0444bc0d0 100644 --- a/mdk-stage1/dietlibc/librpc/svc_tcp.c +++ b/mdk-stage1/dietlibc/librpc/svc_tcp.c @@ -48,6 +48,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; #include #include #include +#include "dietfeatures.h" /* * Ops vector for TCP/IP based rpc service handle @@ -59,14 +60,7 @@ static bool_t svctcp_reply(); static bool_t svctcp_freeargs(); static void svctcp_destroy(); -static struct xp_ops svctcp_op = { - svctcp_recv, - svctcp_stat, - svctcp_getargs, - svctcp_reply, - svctcp_freeargs, - svctcp_destroy -}; +static struct xp_ops svctcp_op; /* * Ops vector for TCP/IP rendezvous handler @@ -87,13 +81,13 @@ static int readtcp(), writetcp(); static SVCXPRT *makefd_xprt(); struct tcp_rendezvous { /* kept in xprt->xp_p1 */ - u_int sendsize; - u_int recvsize; + unsigned int sendsize; + unsigned int recvsize; }; struct tcp_conn { /* kept in xprt->xp_p1 */ enum xprt_stat strm_stat; - u_long x_id; + unsigned long x_id; XDR xdrs; char verf_body[MAX_AUTH_BYTES]; }; @@ -120,8 +114,8 @@ struct tcp_conn { /* kept in xprt->xp_p1 */ */ SVCXPRT *svctcp_create(sock, sendsize, recvsize) register int sock; -u_int sendsize; -u_int recvsize; +unsigned int sendsize; +unsigned int recvsize; { bool_t madesock = FALSE; register SVCXPRT *xprt; @@ -136,7 +130,7 @@ u_int recvsize; } madesock = TRUE; } - bzero((char *) &addr, sizeof(addr)); + memset((char *) &addr, 0, sizeof(addr)); addr.sin_family = AF_INET; if (bindresvport(sock, &addr)) { addr.sin_port = 0; @@ -162,7 +156,7 @@ u_int recvsize; return (NULL); } xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) r; + xprt->xp_p1 = (char*) r; xprt->xp_verf = _null_auth; xprt->xp_ops = &svctcp_rendezvous_op; xprt->xp_port = ntohs(addr.sin_port); @@ -177,8 +171,8 @@ u_int recvsize; */ SVCXPRT *svcfd_create(fd, sendsize, recvsize) int fd; -u_int sendsize; -u_int recvsize; +unsigned int sendsize; +unsigned int recvsize; { return (makefd_xprt(fd, sendsize, recvsize)); @@ -186,8 +180,8 @@ u_int recvsize; static SVCXPRT *makefd_xprt(fd, sendsize, recvsize) int fd; -u_int sendsize; -u_int recvsize; +unsigned int sendsize; +unsigned int recvsize; { register SVCXPRT *xprt; register struct tcp_conn *cd; @@ -207,9 +201,9 @@ u_int recvsize; } cd->strm_stat = XPRT_IDLE; xdrrec_create(&(cd->xdrs), sendsize, recvsize, - (caddr_t) xprt, readtcp, writetcp); + (char*) xprt, readtcp, writetcp); xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) cd; + xprt->xp_p1 = (char*) cd; xprt->xp_verf.oa_base = cd->verf_body; xprt->xp_addrlen = 0; xprt->xp_ops = &svctcp_op; /* truely deals with calls */ @@ -267,9 +261,9 @@ register SVCXPRT *xprt; /* an actual connection socket */ XDR_DESTROY(&(cd->xdrs)); } - mem_free((caddr_t) cd, sizeof(struct tcp_conn)); + mem_free((char*) cd, sizeof(struct tcp_conn)); - mem_free((caddr_t) xprt, sizeof(SVCXPRT)); + mem_free((char*) xprt, sizeof(SVCXPRT)); } /* @@ -285,7 +279,7 @@ static struct timeval wait_per_try = { 35, 0 }; */ static int readtcp(xprt, buf, len) register SVCXPRT *xprt; -caddr_t buf; +char* buf; register int len; { register int sock = xprt->xp_sock; @@ -327,7 +321,7 @@ register int len; */ static int writetcp(xprt, buf, len) register SVCXPRT *xprt; -caddr_t buf; +char* buf; int len; { register int i, cnt; @@ -372,7 +366,7 @@ register struct rpc_msg *msg; static bool_t svctcp_getargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { return ((*xdr_args) @@ -382,7 +376,7 @@ caddr_t args_ptr; static bool_t svctcp_freeargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { register XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs); @@ -404,3 +398,13 @@ register struct rpc_msg *msg; (void) xdrrec_endofrecord(xdrs, TRUE); return (stat); } + +static struct xp_ops svctcp_op = { + svctcp_recv, + svctcp_stat, + svctcp_getargs, + svctcp_reply, + svctcp_freeargs, + svctcp_destroy +}; + diff --git a/mdk-stage1/dietlibc/librpc/svc_udp.c b/mdk-stage1/dietlibc/librpc/svc_udp.c index 1cdb5ce91..af22f289f 100644 --- a/mdk-stage1/dietlibc/librpc/svc_udp.c +++ b/mdk-stage1/dietlibc/librpc/svc_udp.c @@ -45,10 +45,9 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; #include #include #include - +#include "dietfeatures.h" #define rpc_buffer(xprt) ((xprt)->xp_p1) -#define MAX(a, b) ((a > b) ? a : b) static bool_t svcudp_recv(); static bool_t svcudp_reply(); @@ -57,23 +56,14 @@ static bool_t svcudp_getargs(); static bool_t svcudp_freeargs(); static void svcudp_destroy(); -static struct xp_ops svcudp_op = { - svcudp_recv, - svcudp_stat, - svcudp_getargs, - svcudp_reply, - svcudp_freeargs, - svcudp_destroy -}; - -extern int errno; +static struct xp_ops svcudp_op; /* * kept in xprt->xp_p2 */ struct svcudp_data { - u_int su_iosz; /* byte size of send.recv buffer */ - u_long su_xid; /* transaction id */ + unsigned int su_iosz; /* byte size of send.recv buffer */ + unsigned long su_xid; /* transaction id */ XDR su_xdrs; /* XDR handle */ char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ char *su_cache; /* cached data, NULL if no cache */ @@ -81,8 +71,8 @@ struct svcudp_data { #define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2)) -static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp); -static void cache_set(SVCXPRT* xprt, u_long replylen); +static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, unsigned long* replylenp); +static void cache_set(SVCXPRT* xprt, unsigned long replylen); /* * Usage: @@ -99,7 +89,7 @@ static void cache_set(SVCXPRT* xprt, u_long replylen); */ SVCXPRT *svcudp_bufcreate(sock, sendsz, recvsz) register int sock; -u_int sendsz, recvsz; +unsigned int sendsz, recvsz; { bool_t madesock = FALSE; register SVCXPRT *xprt; @@ -114,7 +104,7 @@ u_int sendsz, recvsz; } madesock = TRUE; } - bzero((char *) &addr, sizeof(addr)); + memset((char *) &addr, 0, sizeof(addr)); addr.sin_family = AF_INET; if (bindresvport(sock, &addr)) { addr.sin_port = 0; @@ -144,7 +134,7 @@ u_int sendsz, recvsz; xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, XDR_DECODE); su->su_cache = NULL; - xprt->xp_p2 = (caddr_t) su; + xprt->xp_p2 = (char*) su; xprt->xp_verf.oa_base = su->su_verfbody; xprt->xp_ops = &svcudp_op; xprt->xp_port = ntohs(addr.sin_port); @@ -175,7 +165,7 @@ struct rpc_msg *msg; register XDR *xdrs = &(su->su_xdrs); register int rlen; char *reply; - u_long replylen; + unsigned long replylen; again: xprt->xp_addrlen = sizeof(struct sockaddr_in); @@ -185,7 +175,7 @@ struct rpc_msg *msg; &(xprt->xp_addrlen)); if (rlen == -1 && errno == EINTR) goto again; - if (rlen < 4 * sizeof(u_long)) + if (rlen < 4 * sizeof(unsigned long)) return (FALSE); xdrs->x_op = XDR_DECODE; XDR_SETPOS(xdrs, 0); @@ -222,7 +212,7 @@ struct rpc_msg *msg; == slen) { stat = TRUE; if (su->su_cache && slen >= 0) { - cache_set(xprt, (u_long) slen); + cache_set(xprt, (unsigned long) slen); } } } @@ -232,7 +222,7 @@ struct rpc_msg *msg; static bool_t svcudp_getargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { return ((*xdr_args) (&(su_data(xprt)->su_xdrs), args_ptr)); @@ -241,7 +231,7 @@ caddr_t args_ptr; static bool_t svcudp_freeargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; -caddr_t args_ptr; +char* args_ptr; { register XDR *xdrs = &(su_data(xprt)->su_xdrs); @@ -258,9 +248,9 @@ register SVCXPRT *xprt; (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)); + mem_free((char*) su, sizeof(struct svcudp_data)); - mem_free((caddr_t) xprt, sizeof(SVCXPRT)); + mem_free((char*) xprt, sizeof(SVCXPRT)); } @@ -281,7 +271,7 @@ register SVCXPRT *xprt; (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - bzero((char *) addr, sizeof(type) * (int) (size)) + memset((char *) addr, 0, sizeof(type) * (int) (size)) /* * An entry in the cache @@ -291,16 +281,16 @@ struct cache_node { /* * Index into cache is xid, proc, vers, prog and address */ - u_long cache_xid; - u_long cache_proc; - u_long cache_vers; - u_long cache_prog; + unsigned long cache_xid; + unsigned long cache_proc; + unsigned long cache_vers; + unsigned long cache_prog; struct sockaddr_in cache_addr; /* * The cached reply and length */ char *cache_reply; - u_long cache_replylen; + unsigned long cache_replylen; /* * Next node on the list, if there is a collision */ @@ -313,13 +303,13 @@ struct cache_node { * The entire cache */ struct udp_cache { - u_long uc_size; /* size of cache */ + unsigned long uc_size; /* size of cache */ cache_ptr *uc_entries; /* hash table of entries in cache */ cache_ptr *uc_fifo; /* fifo list of entries in cache */ - u_long uc_nextvictim; /* points to next victim in fifo list */ - u_long uc_prog; /* saved program number */ - u_long uc_vers; /* saved version number */ - u_long uc_proc; /* saved procedure number */ + unsigned long uc_nextvictim; /* points to next victim in fifo list */ + unsigned long uc_prog; /* saved program number */ + unsigned long uc_vers; /* saved version number */ + unsigned long uc_proc; /* saved procedure number */ struct sockaddr_in uc_addr; /* saved caller's address */ }; @@ -335,7 +325,7 @@ struct udp_cache { * Enable use of the cache. * Note: there is no disable. */ -int svcudp_enablecache(SVCXPRT* transp, u_long size) +int svcudp_enablecache(SVCXPRT* transp, unsigned long size) { struct svcudp_data *su = su_data(transp); struct udp_cache *uc; @@ -371,13 +361,13 @@ int svcudp_enablecache(SVCXPRT* transp, u_long size) /* * Set an entry in the cache */ -static void cache_set(SVCXPRT* xprt, u_long replylen) +static void cache_set(SVCXPRT* xprt, unsigned long replylen) { register cache_ptr victim; register cache_ptr *vicp; register struct svcudp_data *su = su_data(xprt); struct udp_cache *uc = (struct udp_cache *) su->su_cache; - u_int loc; + unsigned int loc; char *newbuf; /* @@ -434,14 +424,14 @@ static void cache_set(SVCXPRT* xprt, u_long replylen) * Try to get an entry from the cache * return 1 if found, 0 if not found */ -static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp) +static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, unsigned long* replylenp) { - u_int loc; + unsigned int loc; register cache_ptr ent; register struct svcudp_data *su = su_data(xprt); register 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) { @@ -465,3 +455,13 @@ static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* uc->uc_addr = xprt->xp_raddr; return (0); } + +static struct xp_ops svcudp_op = { + svcudp_recv, + svcudp_stat, + svcudp_getargs, + svcudp_reply, + svcudp_freeargs, + svcudp_destroy +}; + diff --git a/mdk-stage1/dietlibc/librpc/xdr.c b/mdk-stage1/dietlibc/librpc/xdr.c index 864b47dea..836a5697a 100644 --- a/mdk-stage1/dietlibc/librpc/xdr.c +++ b/mdk-stage1/dietlibc/librpc/xdr.c @@ -52,7 +52,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; */ #define XDR_FALSE ((long) 0) #define XDR_TRUE ((long) 1) -#define LASTUNSIGNED ((u_int) 0-1) +#define LASTUNSIGNED ((unsigned int) 0-1) /* * for unit alignment @@ -76,7 +76,7 @@ void xdr_free(xdrproc_t proc, char* objp) */ bool_t xdr_void( /* xdrs, addr */ ) /* XDR *xdrs; */ - /* caddr_t addr; */ + /* char* addr; */ { return (TRUE); @@ -108,10 +108,10 @@ bool_t xdr_u_int(XDR* xdrs, unsigned int* up) #ifdef lint (void) (xdr_short(xdrs, (short *) up)); - return (xdr_u_long(xdrs, (u_long *) up)); + return (xdr_u_long(xdrs, (unsigned long *) up)); #else - if (sizeof(u_int) == sizeof(u_long)) { - return (xdr_u_long(xdrs, (u_long *) up)); + if (sizeof(unsigned int) == sizeof(unsigned long)) { + return (xdr_u_long(xdrs, (unsigned long *) up)); } else { return (xdr_short(xdrs, (short *) up)); } @@ -184,19 +184,19 @@ bool_t xdr_short(XDR* xdrs, short* sp) */ bool_t xdr_u_short(XDR* xdrs, unsigned short* usp) { - u_long l; + unsigned long l; switch (xdrs->x_op) { case XDR_ENCODE: - l = (u_long) * usp; + l = (unsigned long) * usp; return (XDR_PUTLONG(xdrs, &l)); case XDR_DECODE: if (!XDR_GETLONG(xdrs, &l)) { return (FALSE); } - *usp = (u_short) l; + *usp = (unsigned short) l; return (TRUE); case XDR_FREE: @@ -226,7 +226,7 @@ bool_t xdr_char(XDR* xdrs, char* cp) */ bool_t xdr_u_char(XDR* xdrs, unsigned char* cp) { - u_int u; + unsigned int u; u = (*cp); if (!xdr_u_int(xdrs, &u)) { @@ -297,10 +297,10 @@ enum_t *ep; */ bool_t xdr_opaque(xdrs, cp, cnt) register XDR *xdrs; -caddr_t cp; -register u_int cnt; +char* cp; +register unsigned int cnt; { - register u_int rndup; + register unsigned int rndup; static char crud[BYTES_PER_XDR_UNIT]; /* @@ -349,11 +349,11 @@ register u_int cnt; bool_t xdr_bytes(xdrs, cpp, sizep, maxsize) register XDR *xdrs; char **cpp; -register u_int *sizep; -u_int maxsize; +register unsigned int *sizep; +unsigned int maxsize; { register char *sp = *cpp; /* sp is the actual string pointer */ - register u_int nodesize; + register unsigned int nodesize; /* * first deal with the length since xdr bytes are counted @@ -465,11 +465,11 @@ bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim* bool_t xdr_string(xdrs, cpp, maxsize) register XDR *xdrs; char **cpp; -u_int maxsize; +unsigned int maxsize; { register char *sp = *cpp; /* sp is the actual string pointer */ - u_int size; - u_int nodesize; + unsigned int size; + unsigned int nodesize; /* * first deal with the length since xdr strings are counted-strings diff --git a/mdk-stage1/dietlibc/librpc/xdr_array.c b/mdk-stage1/dietlibc/librpc/xdr_array.c index f8ae12b19..f0c9bbbb3 100644 --- a/mdk-stage1/dietlibc/librpc/xdr_array.c +++ b/mdk-stage1/dietlibc/librpc/xdr_array.c @@ -48,7 +48,7 @@ static char sccsid[] = #include #include -#define LASTUNSIGNED ((u_int)0-1) +#define LASTUNSIGNED ((unsigned int)0-1) /* @@ -60,17 +60,17 @@ static char sccsid[] = */ bool_t xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) register XDR *xdrs; -caddr_t *addrp; /* array pointer */ -u_int *sizep; /* number of elements */ -u_int maxsize; /* max numberof elements */ -u_int elsize; /* size in bytes of each element */ +char* *addrp; /* array pointer */ +unsigned int *sizep; /* number of elements */ +unsigned int maxsize; /* max numberof elements */ +unsigned int elsize; /* size in bytes of each element */ xdrproc_t elproc; /* xdr routine to handle each element */ { - register u_int i; - register caddr_t target = *addrp; - register u_int c; /* the actual element count */ + register unsigned int i; + register char* target = *addrp; + register unsigned int c; /* the actual element count */ register bool_t stat = TRUE; - register u_int nodesize; + register unsigned int nodesize; /* like strings, arrays are really counted arrays */ if (!xdr_u_int(xdrs, sizep)) { @@ -80,7 +80,17 @@ xdrproc_t elproc; /* xdr routine to handle each element */ if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) { return (FALSE); } - nodesize = c * elsize; + /* duh, look for integer overflow (fefe) */ + { + unsigned int i; + nodesize = 0; + for (i=c; i; --i) { + unsigned int tmp=nodesize+elsize; + if (tmpx_op = op; xdrs->x_ops = &xdrmem_ops; - xdrs->x_private = xdrs->x_base = addr; + xdrs->x_private = xdrs->x_base = (char*)addr; xdrs->x_handy = size; } @@ -98,7 +99,7 @@ long *lp; if ((xdrs->x_handy -= sizeof(long)) < 0) return (FALSE); - *lp = (long) ntohl((u_long) (*((long *) (xdrs->x_private)))); + *lp = (long) ntohl((unsigned long) (*((long *) (xdrs->x_private)))); xdrs->x_private += sizeof(long); return (TRUE); @@ -112,7 +113,7 @@ long *lp; if ((xdrs->x_handy -= sizeof(long)) < 0) return (FALSE); - *(long *) xdrs->x_private = (long) htonl((u_long) (*lp)); + *(long *) xdrs->x_private = (long) htonl((unsigned long) (*lp)); xdrs->x_private += sizeof(long); return (TRUE); @@ -120,43 +121,43 @@ long *lp; static bool_t xdrmem_getbytes(xdrs, addr, len) register XDR *xdrs; -caddr_t addr; -register u_int len; +char* addr; +register unsigned int len; { if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(xdrs->x_private, addr, len); + memmove(addr, xdrs->x_private, len); xdrs->x_private += len; return (TRUE); } static bool_t xdrmem_putbytes(xdrs, addr, len) register XDR *xdrs; -caddr_t addr; -register u_int len; +char* addr; +register unsigned int len; { if ((xdrs->x_handy -= len) < 0) return (FALSE); - bcopy(addr, xdrs->x_private, len); + memmove(xdrs->x_private, addr, len); xdrs->x_private += len; return (TRUE); } -static u_int xdrmem_getpos(xdrs) +static unsigned int xdrmem_getpos(xdrs) register XDR *xdrs; { - return ((u_int) xdrs->x_private - (u_int) xdrs->x_base); + return ((unsigned int) xdrs->x_private - (unsigned int) xdrs->x_base); } static bool_t xdrmem_setpos(xdrs, pos) register XDR *xdrs; -u_int pos; +unsigned int pos; { - register caddr_t newaddr = xdrs->x_base + pos; - register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; + register char* newaddr = xdrs->x_base + pos; + register char* lastaddr = xdrs->x_private + xdrs->x_handy; if ((long) newaddr > (long) lastaddr) return (FALSE); @@ -178,3 +179,4 @@ int len; } return (buf); } + diff --git a/mdk-stage1/dietlibc/librpc/xdr_rec.c b/mdk-stage1/dietlibc/librpc/xdr_rec.c index 83e800f5e..759a76108 100644 --- a/mdk-stage1/dietlibc/librpc/xdr_rec.c +++ b/mdk-stage1/dietlibc/librpc/xdr_rec.c @@ -42,7 +42,7 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro"; * and the tcp transport level. A record is composed on one or more * record fragments. A record fragment is a thirty-two bit header followed * by n bytes of data, where n is contained in the header. The header - * is represented as a htonl(u_long). Thegh order bit encodes + * is represented as a htonl(unsigned long). Thegh order bit encodes * whether or not the fragment is the last fragment of the record * (1 => fragment is last, 0 => more fragments to follow. * The other 31 bits encode the byte length of the fragment. @@ -56,13 +56,13 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro"; extern long lseek(); -static u_int fix_buf_size(); +static unsigned int fix_buf_size(); static bool_t xdrrec_getlong(); static bool_t xdrrec_putlong(); static bool_t xdrrec_getbytes(); static bool_t xdrrec_putbytes(); -static u_int xdrrec_getpos(); +static unsigned int xdrrec_getpos(); static bool_t xdrrec_setpos(); static int32_t *xdrrec_inline(); static void xdrrec_destroy(); @@ -78,6 +78,7 @@ static struct xdr_ops xdrrec_ops = { xdrrec_destroy }; + /* * A record is composed of one or more record fragments. * A record fragment is a two-byte header followed by zero to @@ -91,32 +92,32 @@ static struct xdr_ops xdrrec_ops = { * meet the needs of xdr and rpc based on tcp. */ -#define LAST_FRAG ((u_long)(1 << 31)) +#define LAST_FRAG ((unsigned long)(1 << 31)) typedef struct rec_strm { - caddr_t tcp_handle; - caddr_t the_buffer; + char* tcp_handle; + char* the_buffer; /* * out-goung bits */ int (*writeit) (); - caddr_t out_base; /* output buffer (points to frag header) */ - caddr_t out_finger; /* next output position */ - caddr_t out_boundry; /* data cannot up to this address */ - u_long *frag_header; /* beginning of curren fragment */ + char* out_base; /* output buffer (points to frag header) */ + char* out_finger; /* next output position */ + char* out_boundry; /* data cannot up to this address */ + unsigned long *frag_header; /* beginning of curren fragment */ bool_t frag_sent; /* true if buffer sent in middle of record */ /* * in-coming bits */ int (*readit) (); - u_long in_size; /* fixed size of the input buffer */ - caddr_t in_base; - caddr_t in_finger; /* location of next byte to be had */ - caddr_t in_boundry; /* can read up to this location */ + unsigned long in_size; /* fixed size of the input buffer */ + char* in_base; + char* in_finger; /* location of next byte to be had */ + char* in_boundry; /* can read up to this location */ long fbtbc; /* fragment bytes to be consumed */ bool_t last_frag; - u_int sendsize; - u_int recvsize; + unsigned int sendsize; + unsigned int recvsize; } RECSTREAM; @@ -131,9 +132,9 @@ typedef struct rec_strm { */ void xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) register XDR *xdrs; -register u_int sendsize; -register u_int recvsize; -caddr_t tcp_handle; +register unsigned int sendsize; +register unsigned int recvsize; +char* tcp_handle; int (*readit) (); /* like read, but pass it a tcp_handle, not sock */ int (*writeit) (); /* like write, but pass it a tcp_handle, not sock */ { @@ -159,20 +160,20 @@ int (*writeit) (); /* like write, but pass it a tcp_handle, not sock */ return; } for (rstrm->out_base = rstrm->the_buffer; - (u_int) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; + (unsigned long) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; rstrm->out_base++); rstrm->in_base = rstrm->out_base + sendsize; /* * now the rest ... */ xdrs->x_ops = &xdrrec_ops; - xdrs->x_private = (caddr_t) rstrm; + xdrs->x_private = (char*) rstrm; rstrm->tcp_handle = tcp_handle; rstrm->readit = readit; rstrm->writeit = writeit; rstrm->out_finger = rstrm->out_boundry = rstrm->out_base; - rstrm->frag_header = (u_long *) rstrm->out_base; - rstrm->out_finger += sizeof(u_long); + rstrm->frag_header = (unsigned long *) rstrm->out_base; + rstrm->out_finger += sizeof(unsigned long); rstrm->out_boundry += sendsize; rstrm->frag_sent = FALSE; rstrm->in_size = recvsize; @@ -198,15 +199,15 @@ long *lp; /* first try the inline, fast case */ if ((rstrm->fbtbc >= sizeof(long)) && - (((int) rstrm->in_boundry - (int) buflp) >= sizeof(long))) { - *lp = (long) ntohl((u_long) (*buflp)); + (((long) rstrm->in_boundry - (long) buflp) >= sizeof(long))) { + *lp = (long) ntohl((unsigned long) (*buflp)); rstrm->fbtbc -= sizeof(long); rstrm->in_finger += sizeof(long); } else { - if (!xdrrec_getbytes(xdrs, (caddr_t) & mylong, sizeof(long))) + if (!xdrrec_getbytes(xdrs, (char*) & mylong, sizeof(long))) return (FALSE); - *lp = (long) ntohl((u_long) mylong); + *lp = (long) ntohl((unsigned long) mylong); } return (TRUE); } @@ -216,17 +217,17 @@ long *lp; */ static bool_t flush_out(RECSTREAM* rstrm, bool_t eor) { - register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; - register u_long len = (u_long) (rstrm->out_finger) - - (u_long) (rstrm->frag_header) - sizeof(u_long); + register unsigned long eormask = (eor == TRUE) ? LAST_FRAG : 0; + register unsigned long len = (unsigned long) (rstrm->out_finger) - + (unsigned long) (rstrm->frag_header) - sizeof(unsigned long); *(rstrm->frag_header) = htonl(len | eormask); - len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->out_base); + len = (unsigned long) (rstrm->out_finger) - (unsigned long) (rstrm->out_base); if ((*(rstrm->writeit)) (rstrm->tcp_handle, rstrm->out_base, (int) len) != (int) len) return (FALSE); - rstrm->frag_header = (u_long *) rstrm->out_base; - rstrm->out_finger = (caddr_t) rstrm->out_base + sizeof(u_long); + rstrm->frag_header = (unsigned long *) rstrm->out_base; + rstrm->out_finger = (char*) rstrm->out_base + sizeof(unsigned long); return (TRUE); } @@ -235,12 +236,12 @@ static bool_t fill_input_buf(rstrm) register RECSTREAM *rstrm; { - register caddr_t where; - u_int i; + register char* where; + unsigned int i; register int len; where = rstrm->in_base; - i = (u_int) rstrm->in_boundry % BYTES_PER_XDR_UNIT; + i = (unsigned long) rstrm->in_boundry % BYTES_PER_XDR_UNIT; where += i; len = rstrm->in_size - i; if ((len = (*(rstrm->readit)) (rstrm->tcp_handle, where, len)) == -1) @@ -255,20 +256,20 @@ static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes(rstrm, addr, len) register RECSTREAM *rstrm; -register caddr_t addr; +register char* addr; register int len; { register int current; while (len > 0) { - current = (int) rstrm->in_boundry - (int) rstrm->in_finger; + current = (long) rstrm->in_boundry - (long) rstrm->in_finger; if (current == 0) { if (!fill_input_buf(rstrm)) return (FALSE); continue; } current = (len < current) ? len : current; - bcopy(rstrm->in_finger, addr, current); + memmove(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; @@ -281,9 +282,9 @@ static bool_t set_input_fragment(rstrm) register RECSTREAM *rstrm; { - u_long header; + unsigned long header; - if (!get_input_bytes(rstrm, (caddr_t) & header, sizeof(header))) + if (!get_input_bytes(rstrm, (char*) & header, sizeof(header))) return (FALSE); header = (long) ntohl(header); rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; @@ -300,7 +301,7 @@ long cnt; register int current; while (cnt > 0) { - current = (int) rstrm->in_boundry - (int) rstrm->in_finger; + current = (long) rstrm->in_boundry - (long) rstrm->in_finger; if (current == 0) { if (!fill_input_buf(rstrm)) return (FALSE); @@ -313,8 +314,8 @@ long cnt; return (TRUE); } -static u_int fix_buf_size(s) -register u_int s; +static unsigned int fix_buf_size(s) +register unsigned int s; { if (s < 100) @@ -341,7 +342,7 @@ long *lp; dest_lp = ((long *) (rstrm->out_finger)); rstrm->out_finger += sizeof(long); } - *dest_lp = (long) htonl((u_long) (*lp)); + *dest_lp = (long) htonl((unsigned long) (*lp)); return (TRUE); } @@ -349,8 +350,8 @@ static bool_t /* must manage buffers, fragments, and records */ xdrrec_getbytes(xdrs, addr, len) XDR *xdrs; -register caddr_t addr; -register u_int len; +register char* addr; +register unsigned int len; { register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); register int current; @@ -376,16 +377,16 @@ register u_int len; static bool_t xdrrec_putbytes(xdrs, addr, len) XDR *xdrs; -register caddr_t addr; -register u_int len; +register char* addr; +register unsigned int len; { register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); register int current; while (len > 0) { - current = (u_int) rstrm->out_boundry - (u_int) rstrm->out_finger; + current = (unsigned long) rstrm->out_boundry - (unsigned long) rstrm->out_finger; current = (len < current) ? len : current; - bcopy(addr, rstrm->out_finger, current); + memmove(rstrm->out_finger, addr, current); rstrm->out_finger += current; addr += current; len -= current; @@ -398,13 +399,13 @@ register u_int len; return (TRUE); } -static u_int xdrrec_getpos(xdrs) +static unsigned int xdrrec_getpos(xdrs) register XDR *xdrs; { register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; register long pos; - pos = lseek((int) rstrm->tcp_handle, (long) 0, 1); + pos = lseek((int)((long) rstrm->tcp_handle), (long) 0, 1); if (pos != -1) switch (xdrs->x_op) { @@ -417,27 +418,27 @@ register XDR *xdrs; break; default: - pos = (u_int) - 1; + pos = (unsigned int) - 1; break; } - return ((u_int) pos); + return ((unsigned int) pos); } static bool_t xdrrec_setpos(xdrs, pos) register XDR *xdrs; -u_int pos; +unsigned int pos; { register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; - u_int currpos = xdrrec_getpos(xdrs); + unsigned int currpos = xdrrec_getpos(xdrs); int delta = currpos - pos; - caddr_t newpos; + char* newpos; if ((int) currpos != -1) switch (xdrs->x_op) { case XDR_ENCODE: newpos = rstrm->out_finger - delta; - if ((newpos > (caddr_t) (rstrm->frag_header)) && + if ((newpos > (char*) (rstrm->frag_header)) && (newpos < rstrm->out_boundry)) { rstrm->out_finger = newpos; return (TRUE); @@ -493,7 +494,7 @@ register XDR *xdrs; mem_free(rstrm->the_buffer, rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT); - mem_free((caddr_t) rstrm, sizeof(RECSTREAM)); + mem_free((char*) rstrm, sizeof(RECSTREAM)); } @@ -554,20 +555,19 @@ XDR *xdrs; bool_t sendnow; { register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register u_long len; /* fragment length */ + register unsigned long len; /* fragment length */ if (sendnow || rstrm->frag_sent || - ((u_long) rstrm->out_finger + sizeof(u_long) >= - (u_long) rstrm->out_boundry)) { + ((unsigned long) rstrm->out_finger + sizeof(unsigned long) >= + (unsigned long) rstrm->out_boundry)) { rstrm->frag_sent = FALSE; return (flush_out(rstrm, TRUE)); } - len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->frag_header) - - sizeof(u_long); - *(rstrm->frag_header) = htonl((u_long) len | LAST_FRAG); - rstrm->frag_header = (u_long *) rstrm->out_finger; - rstrm->out_finger += sizeof(u_long); + len = (unsigned long) (rstrm->out_finger) - (unsigned long) (rstrm->frag_header) - + sizeof(unsigned long); + *(rstrm->frag_header) = htonl((unsigned long) len | LAST_FRAG); + rstrm->frag_header = (unsigned long *) rstrm->out_finger; + rstrm->out_finger += sizeof(unsigned long); return (TRUE); } - diff --git a/mdk-stage1/dietlibc/librpc/xdr_reference.c b/mdk-stage1/dietlibc/librpc/xdr_reference.c index 7715d821c..3e42d12f3 100644 --- a/mdk-stage1/dietlibc/librpc/xdr_reference.c +++ b/mdk-stage1/dietlibc/librpc/xdr_reference.c @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; #include #include -#define LASTUNSIGNED ((u_int)0-1) +#define LASTUNSIGNED ((unsigned int)0-1) /* * XDR an indirect pointer @@ -58,11 +58,11 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; */ bool_t xdr_reference(xdrs, pp, size, proc) register XDR *xdrs; -caddr_t *pp; /* the pointer to work on */ -u_int size; /* size of the object pointed to */ +char* *pp; /* the pointer to work on */ +unsigned int size; /* size of the object pointed to */ xdrproc_t proc; /* xdr routine to handle the object */ { - register caddr_t loc = *pp; + register char* loc = *pp; register bool_t stat; if (loc == NULL) @@ -71,12 +71,12 @@ xdrproc_t proc; /* xdr routine to handle the object */ return (TRUE); case XDR_DECODE: - *pp = loc = (caddr_t) mem_alloc(size); + *pp = loc = (char*) mem_alloc(size); if (loc == NULL) { (void) fprintf(stderr, "xdr_reference: out of memory\n"); return (FALSE); } - bzero(loc, (int) size); + memset(loc, 0, (int) size); break; } @@ -112,7 +112,7 @@ xdrproc_t proc; /* xdr routine to handle the object */ bool_t xdr_pointer(xdrs, objpp, obj_size, xdr_obj) register XDR *xdrs; char **objpp; -u_int obj_size; +unsigned int obj_size; xdrproc_t xdr_obj; { diff --git a/mdk-stage1/dietlibc/librpc/xdr_stdio.c b/mdk-stage1/dietlibc/librpc/xdr_stdio.c index e3190e0a9..1bc9ada16 100644 --- a/mdk-stage1/dietlibc/librpc/xdr_stdio.c +++ b/mdk-stage1/dietlibc/librpc/xdr_stdio.c @@ -51,7 +51,7 @@ static bool_t xdrstdio_getlong(); static bool_t xdrstdio_putlong(); static bool_t xdrstdio_getbytes(); static bool_t xdrstdio_putbytes(); -static u_int xdrstdio_getpos(); +static unsigned int xdrstdio_getpos(); static bool_t xdrstdio_setpos(); static int32_t *xdrstdio_inline(); static void xdrstdio_destroy(); @@ -70,6 +70,7 @@ static struct xdr_ops xdrstdio_ops = { xdrstdio_destroy /* destroy stream */ }; + /* * Initialize a stdio xdr stream. * Sets the xdr stream handle xdrs for use on the stream file. @@ -83,7 +84,7 @@ enum xdr_op op; xdrs->x_op = op; xdrs->x_ops = &xdrstdio_ops; - xdrs->x_private = (caddr_t) file; + xdrs->x_private = (char*) file; xdrs->x_handy = 0; xdrs->x_base = 0; } @@ -104,7 +105,7 @@ XDR *xdrs; register long *lp; { - if (fread((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != + if (fread((char*) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != 1) return (FALSE); #ifndef mc68000 @@ -123,7 +124,7 @@ long *lp; lp = &mycopy; #endif - if (fwrite((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != + if (fwrite((char*) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != 1) return (FALSE); return (TRUE); @@ -131,8 +132,8 @@ long *lp; static bool_t xdrstdio_getbytes(xdrs, addr, len) XDR *xdrs; -caddr_t addr; -u_int len; +char* addr; +unsigned int len; { if ((len != 0) @@ -143,8 +144,8 @@ u_int len; static bool_t xdrstdio_putbytes(xdrs, addr, len) XDR *xdrs; -caddr_t addr; -u_int len; +char* addr; +unsigned int len; { if ((len != 0) @@ -153,16 +154,16 @@ u_int len; return (TRUE); } -static u_int xdrstdio_getpos(xdrs) +static unsigned int xdrstdio_getpos(xdrs) XDR *xdrs; { - return ((u_int) ftell((FILE *) xdrs->x_private)); + return ((unsigned int) ftell((FILE *) xdrs->x_private)); } static bool_t xdrstdio_setpos(xdrs, pos) XDR *xdrs; -u_int pos; +unsigned int pos; { return ((fseek((FILE *) xdrs->x_private, (long) pos, 0) < 0) ? @@ -171,7 +172,7 @@ u_int pos; static int32_t *xdrstdio_inline(xdrs, len) XDR *xdrs; -u_int len; +unsigned int len; { /* @@ -185,3 +186,4 @@ u_int len; */ return (NULL); } + -- cgit v1.2.1