summaryrefslogtreecommitdiffstats
path: root/freebsd/lib/libc/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/lib/libc/rpc')
-rw-r--r--freebsd/lib/libc/rpc/auth_des.c8
-rw-r--r--freebsd/lib/libc/rpc/auth_none.c14
-rw-r--r--freebsd/lib/libc/rpc/auth_time.c45
-rw-r--r--freebsd/lib/libc/rpc/auth_unix.c34
-rw-r--r--freebsd/lib/libc/rpc/authdes_prot.c8
-rw-r--r--freebsd/lib/libc/rpc/authunix_prot.c4
-rw-r--r--freebsd/lib/libc/rpc/bindresvport.c8
-rw-r--r--freebsd/lib/libc/rpc/clnt_bcast.c77
-rw-r--r--freebsd/lib/libc/rpc/clnt_dg.c69
-rw-r--r--freebsd/lib/libc/rpc/clnt_generic.c2
-rw-r--r--freebsd/lib/libc/rpc/clnt_perror.c33
-rw-r--r--freebsd/lib/libc/rpc/clnt_raw.c36
-rw-r--r--freebsd/lib/libc/rpc/clnt_simple.c20
-rw-r--r--freebsd/lib/libc/rpc/clnt_vc.c117
-rw-r--r--freebsd/lib/libc/rpc/crypt_client.c6
-rw-r--r--freebsd/lib/libc/rpc/des_crypt.c23
-rw-r--r--freebsd/lib/libc/rpc/des_soft.c3
-rw-r--r--freebsd/lib/libc/rpc/getnetconfig.c48
-rw-r--r--freebsd/lib/libc/rpc/getnetpath.c21
-rw-r--r--freebsd/lib/libc/rpc/getpublickey.c14
-rw-r--r--freebsd/lib/libc/rpc/getrpcent.c9
-rw-r--r--freebsd/lib/libc/rpc/getrpcport.c4
-rw-r--r--freebsd/lib/libc/rpc/key_call.c48
-rw-r--r--freebsd/lib/libc/rpc/mt_misc.c7
-rw-r--r--freebsd/lib/libc/rpc/netname.c13
-rw-r--r--freebsd/lib/libc/rpc/netnamer.c46
-rw-r--r--freebsd/lib/libc/rpc/pmap_getmaps.c3
-rw-r--r--freebsd/lib/libc/rpc/pmap_getport.c7
-rw-r--r--freebsd/lib/libc/rpc/pmap_prot.c4
-rw-r--r--freebsd/lib/libc/rpc/pmap_prot2.c8
-rw-r--r--freebsd/lib/libc/rpc/pmap_rmt.c19
-rw-r--r--freebsd/lib/libc/rpc/rpc_callmsg.c12
-rw-r--r--freebsd/lib/libc/rpc/rpc_com.h4
-rw-r--r--freebsd/lib/libc/rpc/rpc_generic.c36
-rw-r--r--freebsd/lib/libc/rpc/rpc_prot.c48
-rw-r--r--freebsd/lib/libc/rpc/rpc_soc.c154
-rw-r--r--freebsd/lib/libc/rpc/rpcb_clnt.c133
-rw-r--r--freebsd/lib/libc/rpc/rpcb_prot.c46
-rw-r--r--freebsd/lib/libc/rpc/rpcb_st_xdr.c50
-rw-r--r--freebsd/lib/libc/rpc/rpcdname.c15
-rw-r--r--freebsd/lib/libc/rpc/rtime.c25
-rw-r--r--freebsd/lib/libc/rpc/svc.c111
-rw-r--r--freebsd/lib/libc/rpc/svc_auth.c19
-rw-r--r--freebsd/lib/libc/rpc/svc_auth_des.c37
-rw-r--r--freebsd/lib/libc/rpc/svc_auth_unix.c8
-rw-r--r--freebsd/lib/libc/rpc/svc_dg.c54
-rw-r--r--freebsd/lib/libc/rpc/svc_generic.c40
-rw-r--r--freebsd/lib/libc/rpc/svc_raw.c34
-rw-r--r--freebsd/lib/libc/rpc/svc_run.c4
-rw-r--r--freebsd/lib/libc/rpc/svc_simple.c34
-rw-r--r--freebsd/lib/libc/rpc/svc_vc.c106
51 files changed, 644 insertions, 1084 deletions
diff --git a/freebsd/lib/libc/rpc/auth_des.c b/freebsd/lib/libc/rpc/auth_des.c
index b3002301..02943484 100644
--- a/freebsd/lib/libc/rpc/auth_des.c
+++ b/freebsd/lib/libc/rpc/auth_des.c
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
extern bool_t xdr_authdes_cred( XDR *, struct authdes_cred *);
extern bool_t xdr_authdes_verf( XDR *, struct authdes_verf *);
-extern int key_encryptsession_pk();
+extern int key_encryptsession_pk(char *, netobj *, des_block *);
extern bool_t __rpc_get_time_offset(struct timeval *, nis_server *, char *,
char **, char **);
@@ -261,7 +261,7 @@ failed:
*/
/*ARGSUSED*/
static void
-authdes_nextverf(AUTH *auth)
+authdes_nextverf(AUTH *auth __unused)
{
/* what the heck am I supposed to do??? */
}
@@ -287,7 +287,7 @@ authdes_marshal(AUTH *auth, XDR *xdrs)
* Figure out the "time", accounting for any time difference
* with the server if necessary.
*/
- (void) gettimeofday(&ad->ad_timestamp, (struct timezone *)NULL);
+ (void)gettimeofday(&ad->ad_timestamp, NULL);
ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
while (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) {
@@ -422,7 +422,7 @@ authdes_validate(AUTH *auth, struct opaque_auth *rverf)
*/
/*ARGSUSED*/
static bool_t
-authdes_refresh(AUTH *auth, void *dummy)
+authdes_refresh(AUTH *auth, void *dummy __unused)
{
/* LINTED pointer alignment */
struct ad_private *ad = AUTH_PRIVATE(auth);
diff --git a/freebsd/lib/libc/rpc/auth_none.c b/freebsd/lib/libc/rpc/auth_none.c
index 821771de..9f91292a 100644
--- a/freebsd/lib/libc/rpc/auth_none.c
+++ b/freebsd/lib/libc/rpc/auth_none.c
@@ -67,9 +67,9 @@ static bool_t authnone_validate (AUTH *, struct opaque_auth *);
static bool_t authnone_refresh (AUTH *, void *);
static void authnone_destroy (AUTH *);
-extern bool_t xdr_opaque_auth();
+extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
-static struct auth_ops *authnone_ops();
+static struct auth_ops *authnone_ops(void);
static struct authnone_private {
AUTH no_client;
@@ -78,16 +78,16 @@ static struct authnone_private {
} *authnone_private;
AUTH *
-authnone_create()
+authnone_create(void)
{
struct authnone_private *ap = authnone_private;
XDR xdr_stream;
XDR *xdrs;
mutex_lock(&authnone_lock);
- if (ap == 0) {
- ap = (struct authnone_private *)calloc(1, sizeof (*ap));
- if (ap == 0) {
+ if (ap == NULL) {
+ ap = calloc(1, sizeof (*ap));
+ if (ap == NULL) {
mutex_unlock(&authnone_lock);
return (0);
}
@@ -158,7 +158,7 @@ authnone_destroy(AUTH *client)
}
static struct auth_ops *
-authnone_ops()
+authnone_ops(void)
{
static struct auth_ops ops;
diff --git a/freebsd/lib/libc/rpc/auth_time.c b/freebsd/lib/libc/rpc/auth_time.c
index 09e197a7..a685ebb5 100644
--- a/freebsd/lib/libc/rpc/auth_time.c
+++ b/freebsd/lib/libc/rpc/auth_time.c
@@ -63,8 +63,7 @@ extern int _rpc_dtablesize( void );
static int saw_alarm = 0;
static void
-alarm_hndler(s)
- int s;
+alarm_hndler(int s)
{
saw_alarm = 1;
return;
@@ -85,12 +84,7 @@ alarm_hndler(s)
* Turn a 'universal address' into a struct sockaddr_in.
* Bletch.
*/
-static int uaddr_to_sockaddr(uaddr, sin)
-#ifdef foo
- endpoint *endpt;
-#endif
- char *uaddr;
- struct sockaddr_in *sin;
+static int uaddr_to_sockaddr(char *uaddr, struct sockaddr_in *sin)
{
unsigned char p_bytes[2];
int i;
@@ -120,9 +114,7 @@ static int uaddr_to_sockaddr(uaddr, sin)
* Free the strings that were strduped into the eps structure.
*/
static void
-free_eps(eps, num)
- endpoint eps[];
- int num;
+free_eps(endpoint eps[], int num)
{
int i;
@@ -144,14 +136,15 @@ free_eps(eps, num)
* fact that gethostbyname() could do an NIS search. Ideally, the
* NIS+ server will call __rpc_get_time_offset() with the nis_server
* structure already populated.
+ *
+ * host - name of the time host
+ * srv - nis_server struct to use.
+ * eps[] - array of endpoints
+ * maxep - max array size
*/
static nis_server *
-get_server(sin, host, srv, eps, maxep)
- struct sockaddr_in *sin;
- char *host; /* name of the time host */
- nis_server *srv; /* nis_server struct to use. */
- endpoint eps[]; /* array of endpoints */
- int maxep; /* max array size */
+get_server(struct sockaddr_in *sin, char *host, nis_server *srv,
+ endpoint eps[], int maxep)
{
char hname[256];
int num_ep = 0, i;
@@ -238,14 +231,16 @@ get_server(sin, host, srv, eps, maxep)
* structure and to then contact the machine for the time.
*
* td = "server" - "client"
+ *
+ * td - Time difference
+ * srv - NIS Server description
+ * thost - if no server, this is the timehost
+ * uaddr - known universal address
+ * netid - known network identifier
*/
int
-__rpc_get_time_offset(td, srv, thost, uaddr, netid)
- struct timeval *td; /* Time difference */
- nis_server *srv; /* NIS Server description */
- char *thost; /* if no server, this is the timehost */
- char **uaddr; /* known universal address */
- struct sockaddr_in *netid; /* known network identifier */
+__rpc_get_time_offset(struct timeval *td, nis_server *srv, char *thost,
+ char **uaddr, struct sockaddr_in *netid)
{
CLIENT *clnt; /* Client handle */
endpoint *ep, /* useful endpoints */
@@ -262,7 +257,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
char ut[64], ipuaddr[64];
endpoint teps[32];
nis_server tsrv;
- void (*oldsig)() = NULL; /* old alarm handler */
+ void (*oldsig)(int) = NULL; /* old alarm handler */
struct sockaddr_in sin;
socklen_t len;
int s = RPC_ANYSOCK;
@@ -431,7 +426,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
} else {
int res;
- oldsig = (void (*)())signal(SIGALRM, alarm_hndler);
+ oldsig = (void (*)(int))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));
diff --git a/freebsd/lib/libc/rpc/auth_unix.c b/freebsd/lib/libc/rpc/auth_unix.c
index 1d9130df..b27236ad 100644
--- a/freebsd/lib/libc/rpc/auth_unix.c
+++ b/freebsd/lib/libc/rpc/auth_unix.c
@@ -93,12 +93,7 @@ struct audata {
* Returns an auth handle with the given stuff in it.
*/
AUTH *
-authunix_create(machname, uid, gid, len, aup_gids)
- char *machname;
- u_int uid;
- u_int gid;
- int len;
- u_int *aup_gids;
+authunix_create(char *machname, u_int uid, u_int gid, int len, u_int *aup_gids)
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
@@ -184,15 +179,15 @@ authunix_create(machname, uid, gid, len, aup_gids)
* syscalls.
*/
AUTH *
-authunix_create_default()
+authunix_create_default(void)
{
AUTH *auth;
int ngids;
long ngids_max;
char machname[MAXHOSTNAMELEN + 1];
- u_int uid;
- u_int gid;
- u_int *gids;
+ uid_t uid;
+ gid_t gid;
+ gid_t *gids;
ngids_max = sysconf(_SC_NGROUPS_MAX) + 1;
gids = malloc(sizeof(gid_t) * ngids_max);
@@ -220,16 +215,13 @@ authunix_create_default()
/* ARGSUSED */
static void
-authunix_nextverf(auth)
- AUTH *auth;
+authunix_nextverf(AUTH *auth)
{
/* no action necessary */
}
static bool_t
-authunix_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authunix_marshal(AUTH *auth, XDR *xdrs)
{
struct audata *au;
@@ -241,9 +233,7 @@ authunix_marshal(auth, xdrs)
}
static bool_t
-authunix_validate(auth, verf)
- AUTH *auth;
- struct opaque_auth *verf;
+authunix_validate(AUTH *auth, struct opaque_auth *verf)
{
struct audata *au;
XDR xdrs;
@@ -319,8 +309,7 @@ done:
}
static void
-authunix_destroy(auth)
- AUTH *auth;
+authunix_destroy(AUTH *auth)
{
struct audata *au;
@@ -345,8 +334,7 @@ authunix_destroy(auth)
* sets private data, au_marshed and au_mpos
*/
static void
-marshal_new_auth(auth)
- AUTH *auth;
+marshal_new_auth(AUTH *auth)
{
XDR xdr_stream;
XDR *xdrs = &xdr_stream;
@@ -365,7 +353,7 @@ marshal_new_auth(auth)
}
static struct auth_ops *
-authunix_ops()
+authunix_ops(void)
{
static struct auth_ops ops;
diff --git a/freebsd/lib/libc/rpc/authdes_prot.c b/freebsd/lib/libc/rpc/authdes_prot.c
index af77afdd..dd28c049 100644
--- a/freebsd/lib/libc/rpc/authdes_prot.c
+++ b/freebsd/lib/libc/rpc/authdes_prot.c
@@ -51,9 +51,7 @@ __FBSDID("$FreeBSD$");
#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
bool_t
-xdr_authdes_cred(xdrs, cred)
- XDR *xdrs;
- struct authdes_cred *cred;
+xdr_authdes_cred(XDR *xdrs, struct authdes_cred *cred)
{
enum authdes_namekind *padc_namekind = &cred->adc_namekind;
/*
@@ -80,9 +78,7 @@ xdr_authdes_cred(xdrs, cred)
bool_t
-xdr_authdes_verf(xdrs, verf)
- XDR *xdrs;
- struct authdes_verf *verf;
+xdr_authdes_verf(XDR *xdrs, struct authdes_verf *verf)
{
/*
* Unrolled xdr
diff --git a/freebsd/lib/libc/rpc/authunix_prot.c b/freebsd/lib/libc/rpc/authunix_prot.c
index e5413b2d..9eb5e8d3 100644
--- a/freebsd/lib/libc/rpc/authunix_prot.c
+++ b/freebsd/lib/libc/rpc/authunix_prot.c
@@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$");
* XDR for unix authentication parameters.
*/
bool_t
-xdr_authunix_parms(xdrs, p)
- XDR *xdrs;
- struct authunix_parms *p;
+xdr_authunix_parms(XDR *xdrs, struct authunix_parms *p)
{
u_int **paup_gids;
diff --git a/freebsd/lib/libc/rpc/bindresvport.c b/freebsd/lib/libc/rpc/bindresvport.c
index baf5cbd4..77e03568 100644
--- a/freebsd/lib/libc/rpc/bindresvport.c
+++ b/freebsd/lib/libc/rpc/bindresvport.c
@@ -63,9 +63,7 @@ __FBSDID("$FreeBSD$");
* Bind a socket to a privileged IP port
*/
int
-bindresvport(sd, sin)
- int sd;
- struct sockaddr_in *sin;
+bindresvport(int sd, struct sockaddr_in *sin)
{
return bindresvport_sa(sd, (struct sockaddr *)sin);
}
@@ -74,9 +72,7 @@ bindresvport(sd, sin)
* Bind a socket to a privileged IP port
*/
int
-bindresvport_sa(sd, sa)
- int sd;
- struct sockaddr *sa;
+bindresvport_sa(int sd, struct sockaddr *sa)
{
int old, error, af;
struct sockaddr_storage myaddr;
diff --git a/freebsd/lib/libc/rpc/clnt_bcast.c b/freebsd/lib/libc/rpc/clnt_bcast.c
index 3a12c1e9..d17e9166 100644
--- a/freebsd/lib/libc/rpc/clnt_bcast.c
+++ b/freebsd/lib/libc/rpc/clnt_bcast.c
@@ -227,21 +227,26 @@ __rpc_broadenable(int af, int s, struct broadif *bip)
return 0;
}
-
+/*
+ * rpc_broadcast_exp()
+ *
+ * prog - program number
+ * vers - version number
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * eachresult - call with each result obtained
+ * inittime - how long to wait initially
+ * waittime - maximum time to wait
+ * nettype - transport type
+ */
enum clnt_stat
-rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
- eachresult, inittime, waittime, nettype)
- rpcprog_t prog; /* program number */
- rpcvers_t vers; /* version number */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
- int inittime; /* how long to wait initially */
- int waittime; /* maximum time to wait */
- const char *nettype; /* transport type */
+rpc_broadcast_exp(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
+ xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults, caddr_t resultsp,
+ resultproc_t eachresult, int inittime, int waittime,
+ const char *nettype)
{
enum clnt_stat stat = RPC_SUCCESS; /* Return status */
XDR xdr_stream; /* XDR stream */
@@ -253,7 +258,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
int inlen;
u_int maxbufsize = 0;
AUTH *sys_auth = authunix_create_default();
- int i;
+ u_int i;
void *handle;
char uaddress[1024]; /* A self imposed limit */
char *uaddrp = uaddress;
@@ -343,7 +348,8 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
#ifdef PORTMAP
if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) {
udpbufsz = fdlist[fdlistno].dsize;
- if ((outbuf_pmap = malloc(udpbufsz)) == NULL) {
+ outbuf_pmap = reallocf(outbuf_pmap, udpbufsz);
+ if (outbuf_pmap == NULL) {
_close(fd);
stat = RPC_SYSTEMERROR;
goto done_broad;
@@ -466,7 +472,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
"broadcast packet");
stat = RPC_CANTSEND;
continue;
- };
+ }
#ifdef RPC_DEBUG
if (!__rpc_lowvers)
fprintf(stderr, "Broadcast packet sent "
@@ -633,13 +639,10 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
} /* The giant for loop */
done_broad:
- if (inbuf)
- (void) free(inbuf);
- if (outbuf)
- (void) free(outbuf);
+ free(inbuf);
+ free(outbuf);
#ifdef PORTMAP
- if (outbuf_pmap)
- (void) free(outbuf_pmap);
+ free(outbuf_pmap);
#endif /* PORTMAP */
for (i = 0; i < fdlistno; i++) {
(void)_close(fdlist[i].fd);
@@ -651,19 +654,23 @@ done_broad:
return (stat);
}
-
+/*
+ * rpc_broadcast()
+ *
+ * prog - program number
+ * vers - version number
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * eachresult - call with each result obtained
+ * nettype - transport type
+ */
enum clnt_stat
-rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
- eachresult, nettype)
- rpcprog_t prog; /* program number */
- rpcvers_t vers; /* version number */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
- const char *nettype; /* transport type */
+rpc_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc, xdrproc_t xargs,
+ caddr_t argsp, xdrproc_t xresults, caddr_t resultsp,
+ resultproc_t eachresult, const char *nettype)
{
enum clnt_stat dummy;
diff --git a/freebsd/lib/libc/rpc/clnt_dg.c b/freebsd/lib/libc/rpc/clnt_dg.c
index c3694337..0c6db42d 100644
--- a/freebsd/lib/libc/rpc/clnt_dg.c
+++ b/freebsd/lib/libc/rpc/clnt_dg.c
@@ -155,15 +155,17 @@ struct cu_data {
* If they are 0, use the transport default.
*
* If svcaddr is NULL, returns NULL.
+ *
+ * fd - open file descriptor
+ * svcaddr - servers address
+ * program - program number
+ * version - version number
+ * sendsz - buffer recv size
+ * recvsz - buffer send size
*/
CLIENT *
-clnt_dg_create(fd, svcaddr, program, version, sendsz, recvsz)
- int fd; /* open file descriptor */
- const struct netbuf *svcaddr; /* servers address */
- rpcprog_t program; /* program number */
- rpcvers_t version; /* version number */
- u_int sendsz; /* buffer recv size */
- u_int recvsz; /* buffer send size */
+clnt_dg_create(int fd, const struct netbuf *svcaddr, rpcprog_t program,
+ rpcvers_t version, u_int sendsz, u_int recvsz)
{
CLIENT *cl = NULL; /* client handle */
struct cu_data *cu = NULL; /* private data */
@@ -303,15 +305,18 @@ err2:
return (NULL);
}
+/*
+ * cl - client handle
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * utimeout - seconds to wait before giving up
+ */
static enum clnt_stat
-clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
- CLIENT *cl; /* client handle */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- void *argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- void *resultsp; /* pointer to results */
- struct timeval utimeout; /* seconds to wait before giving up */
+clnt_dg_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs, void *argsp,
+ xdrproc_t xresults, void *resultsp, struct timeval utimeout)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
XDR *xdrs;
@@ -329,7 +334,7 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
struct sockaddr *sa;
sigset_t mask;
sigset_t newmask;
- socklen_t inlen, salen;
+ socklen_t salen;
ssize_t recvlen = 0;
int kin_len, n, rpc_lock_value;
u_int32_t xid;
@@ -522,7 +527,6 @@ get_reply:
goto call_again_same_xid;
}
}
- inlen = (socklen_t)recvlen;
/*
* now decode and validate the response
@@ -580,7 +584,7 @@ get_reply:
}
} /* end successful completion */
/*
- * If unsuccesful AND error is an authentication error
+ * If unsuccessful AND error is an authentication error
* then refresh credentials and try again, else break
*/
else if (cu->cu_error.re_status == RPC_AUTHERROR)
@@ -605,9 +609,7 @@ out:
}
static void
-clnt_dg_geterr(cl, errp)
- CLIENT *cl;
- struct rpc_err *errp;
+clnt_dg_geterr(CLIENT *cl, struct rpc_err *errp)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
@@ -615,10 +617,7 @@ clnt_dg_geterr(cl, errp)
}
static bool_t
-clnt_dg_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
XDR *xdrs = &(cu->cu_outxdrs);
@@ -641,16 +640,12 @@ clnt_dg_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_dg_abort(h)
- CLIENT *h;
+clnt_dg_abort(CLIENT *h)
{
}
static bool_t
-clnt_dg_control(cl, request, info)
- CLIENT *cl;
- u_int request;
- void *info;
+clnt_dg_control(CLIENT *cl, u_int request, void *info)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
struct netbuf *addr;
@@ -749,7 +744,7 @@ clnt_dg_control(cl, request, info)
/*
* This RELIES on the information that, in the call body,
* the version number field is the fifth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
*(u_int32_t *)info =
@@ -766,7 +761,7 @@ clnt_dg_control(cl, request, info)
/*
* This RELIES on the information that, in the call body,
* the program number field is the fourth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
*(u_int32_t *)info =
@@ -793,8 +788,7 @@ clnt_dg_control(cl, request, info)
}
static void
-clnt_dg_destroy(cl)
- CLIENT *cl;
+clnt_dg_destroy(CLIENT *cl)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
int cu_fd = cu->cu_fd;
@@ -823,7 +817,7 @@ clnt_dg_destroy(cl)
}
static struct clnt_ops *
-clnt_dg_ops()
+clnt_dg_ops(void)
{
static struct clnt_ops ops;
sigset_t mask;
@@ -851,8 +845,7 @@ clnt_dg_ops()
* Make sure that the time is not garbage. -1 value is allowed.
*/
static bool_t
-time_not_ok(t)
- struct timeval *t;
+time_not_ok(struct timeval *t)
{
return (t->tv_sec < -1 || t->tv_sec > 100000000 ||
t->tv_usec < -1 || t->tv_usec > 1000000);
diff --git a/freebsd/lib/libc/rpc/clnt_generic.c b/freebsd/lib/libc/rpc/clnt_generic.c
index cca7f3e3..1f9960d2 100644
--- a/freebsd/lib/libc/rpc/clnt_generic.c
+++ b/freebsd/lib/libc/rpc/clnt_generic.c
@@ -404,7 +404,7 @@ clnt_tli_create(int fd, const struct netconfig *nconf,
if (madefd) {
(void) CLNT_CONTROL(cl, CLSET_FD_CLOSE, NULL);
/* (void) CLNT_CONTROL(cl, CLSET_POP_TIMOD, NULL); */
- };
+ }
return (cl);
diff --git a/freebsd/lib/libc/rpc/clnt_perror.c b/freebsd/lib/libc/rpc/clnt_perror.c
index 56155728..1dda69bc 100644
--- a/freebsd/lib/libc/rpc/clnt_perror.c
+++ b/freebsd/lib/libc/rpc/clnt_perror.c
@@ -63,11 +63,11 @@ static char *auth_errmsg(enum auth_stat);
#define CLNT_PERROR_BUFLEN 256
static char *
-_buf()
+_buf(void)
{
- if (buf == 0)
- buf = (char *)malloc(CLNT_PERROR_BUFLEN);
+ if (buf == NULL)
+ buf = malloc(CLNT_PERROR_BUFLEN);
return (buf);
}
@@ -75,9 +75,7 @@ _buf()
* Print reply error info
*/
char *
-clnt_sperror(rpch, s)
- CLIENT *rpch;
- const char *s;
+clnt_sperror(CLIENT *rpch, const char *s)
{
struct rpc_err e;
char *err;
@@ -89,7 +87,7 @@ clnt_sperror(rpch, s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return (0);
len = CLNT_PERROR_BUFLEN;
strstart = str;
@@ -182,9 +180,7 @@ clnt_sperror(rpch, s)
}
void
-clnt_perror(rpch, s)
- CLIENT *rpch;
- const char *s;
+clnt_perror(CLIENT *rpch, const char *s)
{
assert(rpch != NULL);
@@ -219,8 +215,7 @@ static const char *const rpc_errlist[] = {
* This interface for use by clntrpc
*/
char *
-clnt_sperrno(stat)
- enum clnt_stat stat;
+clnt_sperrno(enum clnt_stat stat)
{
unsigned int errnum = stat;
@@ -232,16 +227,14 @@ clnt_sperrno(stat)
}
void
-clnt_perrno(num)
- enum clnt_stat num;
+clnt_perrno(enum clnt_stat num)
{
(void) fprintf(stderr, "%s\n", clnt_sperrno(num));
}
char *
-clnt_spcreateerror(s)
- const char *s;
+clnt_spcreateerror(const char *s)
{
char *str;
size_t len, i;
@@ -249,7 +242,7 @@ clnt_spcreateerror(s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return(0);
len = CLNT_PERROR_BUFLEN;
i = snprintf(str, len, "%s: ", s);
@@ -293,8 +286,7 @@ clnt_spcreateerror(s)
}
void
-clnt_pcreateerror(s)
- const char *s;
+clnt_pcreateerror(const char *s)
{
assert(s != NULL);
@@ -321,8 +313,7 @@ static const char *const auth_errlist[] = {
};
static char *
-auth_errmsg(stat)
- enum auth_stat stat;
+auth_errmsg(enum auth_stat stat)
{
unsigned int errnum = stat;
diff --git a/freebsd/lib/libc/rpc/clnt_raw.c b/freebsd/lib/libc/rpc/clnt_raw.c
index ec130c14..f2f18b33 100644
--- a/freebsd/lib/libc/rpc/clnt_raw.c
+++ b/freebsd/lib/libc/rpc/clnt_raw.c
@@ -89,9 +89,7 @@ static struct clnt_ops *clnt_raw_ops(void);
* Create a client handle for memory based rpc.
*/
CLIENT *
-clnt_raw_create(prog, vers)
- rpcprog_t prog;
- rpcvers_t vers;
+clnt_raw_create(rpcprog_t prog, rpcvers_t vers)
{
struct clntraw_private *clp;
struct rpc_msg call_msg;
@@ -144,14 +142,8 @@ clnt_raw_create(prog, vers)
/* ARGSUSED */
static enum clnt_stat
-clnt_raw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
- CLIENT *h;
- rpcproc_t proc;
- xdrproc_t xargs;
- void *argsp;
- xdrproc_t xresults;
- void *resultsp;
- struct timeval timeout;
+clnt_raw_call(CLIENT *h, rpcproc_t proc, xdrproc_t xargs, void *argsp,
+ xdrproc_t xresults, void *resultsp, struct timeval timeout)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -242,19 +234,14 @@ call_again:
/*ARGSUSED*/
static void
-clnt_raw_geterr(cl, err)
- CLIENT *cl;
- struct rpc_err *err;
+clnt_raw_geterr(CLIENT *cl, struct rpc_err *err)
{
}
/* ARGSUSED */
static bool_t
-clnt_raw_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_raw_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -273,30 +260,25 @@ clnt_raw_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_raw_abort(cl)
- CLIENT *cl;
+clnt_raw_abort(CLIENT *cl)
{
}
/*ARGSUSED*/
static bool_t
-clnt_raw_control(cl, ui, str)
- CLIENT *cl;
- u_int ui;
- void *str;
+clnt_raw_control(CLIENT *cl, u_int ui, void *str)
{
return (FALSE);
}
/*ARGSUSED*/
static void
-clnt_raw_destroy(cl)
- CLIENT *cl;
+clnt_raw_destroy(CLIENT *cl)
{
}
static struct clnt_ops *
-clnt_raw_ops()
+clnt_raw_ops(void)
{
static struct clnt_ops ops;
diff --git a/freebsd/lib/libc/rpc/clnt_simple.c b/freebsd/lib/libc/rpc/clnt_simple.c
index 56d76b8a..491172cf 100644
--- a/freebsd/lib/libc/rpc/clnt_simple.c
+++ b/freebsd/lib/libc/rpc/clnt_simple.c
@@ -109,17 +109,19 @@ rpc_call_key_init(void)
* the future calls to same prog, vers, host and nettype combination.
*
* The total time available is 25 seconds.
+ *
+ * host - host name
+ * prognum - program number
+ * versnum - version number
+ * procnum - procedure number
+ * inproc, outproc - in/out XDR procedures
+ * in, out - recv/send data
+ * nettype - nettype
*/
enum clnt_stat
-rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
- const char *host; /* host name */
- rpcprog_t prognum; /* program number */
- rpcvers_t versnum; /* version number */
- rpcproc_t procnum; /* procedure number */
- xdrproc_t inproc, outproc; /* in/out XDR procedures */
- const char *in;
- char *out; /* recv/send data */
- const char *nettype; /* nettype */
+rpc_call(const char *host, const rpcprog_t prognum, const rpcvers_t versnum,
+ const rpcproc_t procnum, const xdrproc_t inproc, const char *in,
+ const xdrproc_t outproc, char *out, const char *nettype)
{
struct rpc_call_private *rcp = (struct rpc_call_private *) 0;
enum clnt_stat clnt_stat;
diff --git a/freebsd/lib/libc/rpc/clnt_vc.c b/freebsd/lib/libc/rpc/clnt_vc.c
index 6c34cccc..8dc3de48 100644
--- a/freebsd/lib/libc/rpc/clnt_vc.c
+++ b/freebsd/lib/libc/rpc/clnt_vc.c
@@ -143,7 +143,6 @@ static cond_t *vc_cv;
static const char clnt_vc_errstr[] = "%s : %s";
static const char clnt_vc_str[] = "clnt_vc_create";
-static const char clnt_read_vc_str[] = "read_vc";
static const char __no_mem_str[] = "out of memory";
/*
@@ -156,15 +155,17 @@ static const char __no_mem_str[] = "out of memory";
* set this something more useful.
*
* fd should be an open socket
+ *
+ * fd - open file descriptor
+ * raddr - servers address
+ * prog - program number
+ * vers - version number
+ * sendsz - buffer send size
+ * recvsz - buffer recv size
*/
CLIENT *
-clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
- int fd; /* open file descriptor */
- const struct netbuf *raddr; /* servers address */
- const rpcprog_t prog; /* program number */
- const rpcvers_t vers; /* version number */
- u_int sendsz; /* buffer recv size */
- u_int recvsz; /* buffer send size */
+clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
+ const rpcvers_t vers, u_int sendsz, u_int recvsz)
{
CLIENT *cl; /* client handle */
struct ct_data *ct = NULL; /* client handle */
@@ -261,7 +262,7 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
if (ct->ct_addr.buf == NULL)
goto err;
memcpy(ct->ct_addr.buf, raddr->buf, raddr->len);
- ct->ct_addr.len = raddr->maxlen;
+ ct->ct_addr.len = raddr->len;
ct->ct_addr.maxlen = raddr->maxlen;
/*
@@ -314,14 +315,8 @@ err:
}
static enum clnt_stat
-clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
- CLIENT *cl;
- rpcproc_t proc;
- xdrproc_t xdr_args;
- void *args_ptr;
- xdrproc_t xdr_results;
- void *results_ptr;
- struct timeval timeout;
+clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr,
+ xdrproc_t xdr_results, void *results_ptr, struct timeval timeout)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
XDR *xdrs = &(ct->ct_xdrs);
@@ -464,9 +459,7 @@ call_again:
}
static void
-clnt_vc_geterr(cl, errp)
- CLIENT *cl;
- struct rpc_err *errp;
+clnt_vc_geterr(CLIENT *cl, struct rpc_err *errp)
{
struct ct_data *ct;
@@ -478,10 +471,7 @@ clnt_vc_geterr(cl, errp)
}
static bool_t
-clnt_vc_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct ct_data *ct;
XDR *xdrs;
@@ -510,16 +500,26 @@ clnt_vc_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_vc_abort(cl)
- CLIENT *cl;
+clnt_vc_abort(CLIENT *cl)
+{
+}
+
+static __inline void
+htonlp(void *dst, const void *src, uint32_t incr)
+{
+ /* We are aligned, so we think */
+ *(uint32_t *)dst = htonl(*(const uint32_t *)src + incr);
+}
+
+static __inline void
+ntohlp(void *dst, const void *src)
{
+ /* We are aligned, so we think */
+ *(uint32_t *)dst = htonl(*(const uint32_t *)src);
}
static bool_t
-clnt_vc_control(cl, request, info)
- CLIENT *cl;
- u_int request;
- void *info;
+clnt_vc_control(CLIENT *cl, u_int request, void *info)
{
struct ct_data *ct;
void *infop = info;
@@ -592,49 +592,39 @@ clnt_vc_control(cl, request, info)
* first element in the call structure
* This will get the xid of the PREVIOUS call
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
+ ntohlp(info, &ct->ct_u.ct_mcalli);
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
- *(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
- htonl(*((u_int32_t *)info) + 1);
/* increment by 1 as clnt_vc_call() decrements once */
+ htonlp(&ct->ct_u.ct_mcalli, info, 1);
break;
case CLGET_VERS:
/*
* This RELIES on the information that, in the call body,
* the version number field is the fifth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 4 * BYTES_PER_XDR_UNIT));
+ ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
break;
case CLSET_VERS:
- *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 4 * BYTES_PER_XDR_UNIT) =
- htonl(*(u_int32_t *)info);
+ htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
break;
case CLGET_PROG:
/*
* This RELIES on the information that, in the call body,
* the program number field is the fourth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 3 * BYTES_PER_XDR_UNIT));
+ ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
break;
case CLSET_PROG:
- *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 3 * BYTES_PER_XDR_UNIT) =
- htonl(*(u_int32_t *)info);
+ htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
break;
default:
@@ -647,8 +637,7 @@ clnt_vc_control(cl, request, info)
static void
-clnt_vc_destroy(cl)
- CLIENT *cl;
+clnt_vc_destroy(CLIENT *cl)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
int ct_fd = ct->ct_fd;
@@ -668,8 +657,7 @@ clnt_vc_destroy(cl)
(void)_close(ct->ct_fd);
}
XDR_DESTROY(&(ct->ct_xdrs));
- if (ct->ct_addr.buf)
- free(ct->ct_addr.buf);
+ free(ct->ct_addr.buf);
mem_free(ct, sizeof(struct ct_data));
if (cl->cl_netid && cl->cl_netid[0])
mem_free(cl->cl_netid, strlen(cl->cl_netid) +1);
@@ -687,10 +675,7 @@ clnt_vc_destroy(cl)
* around for the rpc level.
*/
static int
-read_vc(ctp, buf, len)
- void *ctp;
- void *buf;
- int len;
+read_vc(void *ctp, void *buf, int len)
{
struct sockaddr sa;
socklen_t sal;
@@ -744,10 +729,7 @@ read_vc(ctp, buf, len)
}
static int
-write_vc(ctp, buf, len)
- void *ctp;
- void *buf;
- int len;
+write_vc(void *ctp, void *buf, int len)
{
struct sockaddr sa;
socklen_t sal;
@@ -778,7 +760,7 @@ write_vc(ctp, buf, len)
}
static struct clnt_ops *
-clnt_vc_ops()
+clnt_vc_ops(void)
{
static struct clnt_ops ops;
sigset_t mask, newmask;
@@ -806,18 +788,14 @@ clnt_vc_ops()
* Note this is different from time_not_ok in clnt_dg.c
*/
static bool_t
-time_not_ok(t)
- struct timeval *t;
+time_not_ok(struct timeval *t)
{
return (t->tv_sec <= -1 || t->tv_sec > 100000000 ||
t->tv_usec <= -1 || t->tv_usec > 1000000);
}
static int
-__msgread(sock, buf, cnt)
- int sock;
- void *buf;
- size_t cnt;
+__msgread(int sock, void *buf, size_t cnt)
{
struct iovec iov[1];
struct msghdr msg;
@@ -842,10 +820,7 @@ __msgread(sock, buf, cnt)
}
static int
-__msgwrite(sock, buf, cnt)
- int sock;
- void *buf;
- size_t cnt;
+__msgwrite(int sock, void *buf, size_t cnt)
{
struct iovec iov[1];
struct msghdr msg;
diff --git a/freebsd/lib/libc/rpc/crypt_client.c b/freebsd/lib/libc/rpc/crypt_client.c
index 9ce94157..15e915ad 100644
--- a/freebsd/lib/libc/rpc/crypt_client.c
+++ b/freebsd/lib/libc/rpc/crypt_client.c
@@ -45,10 +45,7 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
int
-_des_crypt_call(buf, len, dparms)
- char *buf;
- int len;
- struct desparams *dparms;
+_des_crypt_call(char *buf, int len, struct desparams *dparms)
{
CLIENT *clnt;
desresp *result_1;
@@ -66,6 +63,7 @@ _des_crypt_call(buf, len, dparms)
}
if (nconf == NULL) {
warnx("getnetconfig: %s", nc_sperror());
+ endnetconfig(localhandle);
return(DESERR_HWERROR);
}
clnt = clnt_tp_create(NULL, CRYPT_PROG, CRYPT_VERS, nconf);
diff --git a/freebsd/lib/libc/rpc/des_crypt.c b/freebsd/lib/libc/rpc/des_crypt.c
index b5f14f82..31763422 100644
--- a/freebsd/lib/libc/rpc/des_crypt.c
+++ b/freebsd/lib/libc/rpc/des_crypt.c
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02
__FBSDID("$FreeBSD$");
static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * );
-int (*__des_crypt_LOCAL)() = 0;
+int (*__des_crypt_LOCAL)(char *, unsigned, struct desparams *) = 0;
extern int _des_crypt_call(char *, int, struct desparams *);
/*
* Copy 8 bytes
@@ -72,12 +72,7 @@ extern int _des_crypt_call(char *, int, struct desparams *);
* CBC mode encryption
*/
int
-cbc_crypt(key, buf, len, mode, ivec)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- char *ivec;
+cbc_crypt(char *key, char *buf, unsigned len, unsigned mode, char *ivec)
{
int err;
struct desparams dp;
@@ -99,11 +94,7 @@ cbc_crypt(key, buf, len, mode, ivec)
* ECB mode encryption
*/
int
-ecb_crypt(key, buf, len, mode)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
+ecb_crypt(char *key, char *buf, unsigned len, unsigned mode)
{
struct desparams dp;
@@ -122,12 +113,8 @@ ecb_crypt(key, buf, len, mode)
* Common code to cbc_crypt() & ecb_crypt()
*/
static int
-common_crypt(key, buf, len, mode, desp)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- struct desparams *desp;
+common_crypt(char *key, char *buf, unsigned len, unsigned mode,
+ struct desparams *desp)
{
int desdev;
diff --git a/freebsd/lib/libc/rpc/des_soft.c b/freebsd/lib/libc/rpc/des_soft.c
index e67f90d8..2b6b8606 100644
--- a/freebsd/lib/libc/rpc/des_soft.c
+++ b/freebsd/lib/libc/rpc/des_soft.c
@@ -60,8 +60,7 @@ static char partab[128] = {
* Add odd parity to low bit of 8 byte key
*/
void
-des_setparity(p)
- char *p;
+des_setparity(char *p)
{
int i;
diff --git a/freebsd/lib/libc/rpc/getnetconfig.c b/freebsd/lib/libc/rpc/getnetconfig.c
index f6279e04..bc3bc7ef 100644
--- a/freebsd/lib/libc/rpc/getnetconfig.c
+++ b/freebsd/lib/libc/rpc/getnetconfig.c
@@ -149,7 +149,7 @@ nc_key_init(void)
#define MAXNETCONFIGLINE 1000
static int *
-__nc_error()
+__nc_error(void)
{
static int nc_error = 0;
int *nc_addr;
@@ -166,8 +166,7 @@ __nc_error()
if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) {
nc_addr = (int *)malloc(sizeof (int));
if (thr_setspecific(nc_key, (void *) nc_addr) != 0) {
- if (nc_addr)
- free(nc_addr);
+ free(nc_addr);
return (&nc_error);
}
*nc_addr = 0;
@@ -196,7 +195,7 @@ __nc_error()
* the netconfig database is not present).
*/
void *
-setnetconfig()
+setnetconfig(void)
{
struct netconfig_vars *nc_vars;
@@ -242,8 +241,7 @@ setnetconfig()
*/
struct netconfig *
-getnetconfig(handlep)
-void *handlep;
+getnetconfig(void *handlep)
{
struct netconfig_vars *ncp = (struct netconfig_vars *)handlep;
char *stringp; /* tmp string pointer */
@@ -380,8 +378,7 @@ void *handlep;
* previously).
*/
int
-endnetconfig(handlep)
-void *handlep;
+endnetconfig(void *handlep)
{
struct netconfig_vars *nc_handlep = (struct netconfig_vars *)handlep;
@@ -410,7 +407,7 @@ void *handlep;
}
/*
- * Noone needs these entries anymore, then frees them.
+ * No one needs these entries anymore, then frees them.
* Make sure all info in netconfig_info structure has been reinitialized.
*/
q = ni.head;
@@ -421,7 +418,7 @@ void *handlep;
while (q != NULL) {
p = q->next;
- if (q->ncp->nc_lookups != NULL) free(q->ncp->nc_lookups);
+ free(q->ncp->nc_lookups);
free(q->ncp);
free(q->linep);
free(q);
@@ -446,8 +443,7 @@ void *handlep;
*/
struct netconfig *
-getnetconfigent(netid)
- const char *netid;
+getnetconfigent(const char *netid)
{
FILE *file; /* NETCONFIG db's file pointer */
char *linep; /* holds current netconfig line */
@@ -538,13 +534,11 @@ getnetconfigent(netid)
*/
void
-freenetconfigent(netconfigp)
- struct netconfig *netconfigp;
+freenetconfigent(struct netconfig *netconfigp)
{
if (netconfigp != NULL) {
free(netconfigp->nc_netid); /* holds all netconfigp's strings */
- if (netconfigp->nc_lookups != NULL)
- free(netconfigp->nc_lookups);
+ free(netconfigp->nc_lookups);
free(netconfigp);
}
return;
@@ -560,12 +554,13 @@ freenetconfigent(netconfigp)
* Note that we modify stringp (putting NULLs after tokens) and
* we set the ncp's string field pointers to point to these tokens within
* stringp.
+ *
+ * stringp - string to parse
+ * ncp - where to put results
*/
static int
-parse_ncp(stringp, ncp)
-char *stringp; /* string to parse */
-struct netconfig *ncp; /* where to put results */
+parse_ncp(char *stringp, struct netconfig *ncp)
{
char *tokenp; /* for processing tokens */
char *lasts;
@@ -633,8 +628,7 @@ struct netconfig *ncp; /* where to put results */
} else {
char *cp; /* tmp string */
- if (ncp->nc_lookups != NULL) /* from last visit */
- free(ncp->nc_lookups);
+ free(ncp->nc_lookups); /* from last visit */
ncp->nc_lookups = NULL;
ncp->nc_nlookups = 0;
while ((cp = tokenp) != NULL) {
@@ -657,7 +651,7 @@ struct netconfig *ncp; /* where to put results */
* Returns a string describing the reason for failure.
*/
char *
-nc_sperror()
+nc_sperror(void)
{
const char *message;
@@ -688,8 +682,7 @@ nc_sperror()
* Prints a message onto standard error describing the reason for failure.
*/
void
-nc_perror(s)
- const char *s;
+nc_perror(const char *s)
{
fprintf(stderr, "%s: %s\n", s, nc_sperror());
}
@@ -698,11 +691,10 @@ nc_perror(s)
* Duplicates the matched netconfig buffer.
*/
static struct netconfig *
-dup_ncp(ncp)
-struct netconfig *ncp;
+dup_ncp(struct netconfig *ncp)
{
struct netconfig *p;
- char *tmp;
+ char *tmp, *tmp2;
u_int i;
if ((tmp=malloc(MAXNETCONFIGLINE)) == NULL)
@@ -711,6 +703,7 @@ struct netconfig *ncp;
free(tmp);
return(NULL);
}
+ tmp2 = tmp;
/*
* First we dup all the data from matched netconfig buffer. Then we
* adjust some of the member pointer to a pre-allocated buffer where
@@ -732,6 +725,7 @@ struct netconfig *ncp;
if (p->nc_lookups == NULL) {
free(p->nc_netid);
free(p);
+ free(tmp2);
return(NULL);
}
for (i=0; i < p->nc_nlookups; i++) {
diff --git a/freebsd/lib/libc/rpc/getnetpath.c b/freebsd/lib/libc/rpc/getnetpath.c
index 56493557..12def71b 100644
--- a/freebsd/lib/libc/rpc/getnetpath.c
+++ b/freebsd/lib/libc/rpc/getnetpath.c
@@ -84,7 +84,7 @@ char *_get_next_token(char *, int);
*/
void *
-setnetpath()
+setnetpath(void)
{
struct netpath_vars *np_sessionp; /* this session's variables */
@@ -99,9 +99,8 @@ setnetpath()
return (NULL);
}
if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) {
- free(np_sessionp);
syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
- return (NULL);
+ goto failed;
}
np_sessionp->valid = NP_VALID;
np_sessionp->ncp_list = NULL;
@@ -144,8 +143,7 @@ failed:
*/
struct netconfig *
-getnetpath(handlep)
- void *handlep;
+getnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netconfig *ncp = NULL; /* temp. holds a netconfig session */
@@ -200,8 +198,7 @@ getnetpath(handlep)
* (e.g. if setnetpath() was not called previously.
*/
int
-endnetpath(handlep)
- void *handlep;
+endnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netpath_chain *chainp, *lastp;
@@ -234,12 +231,12 @@ endnetpath(handlep)
* Returns pointer to the rest-of-the-string after the current token.
* The token itself starts at arg, and we null terminate it. We return NULL
* if either the arg is empty, or if this is the last token.
+ *
+ * npp - string
+ * token - char to parse string for
*/
-
char *
-_get_next_token(npp, token)
-char *npp; /* string */
-int token; /* char to parse string for */
+_get_next_token(char *npp, int token)
{
char *cp; /* char pointer */
char *np; /* netpath pointer */
@@ -267,7 +264,7 @@ int token; /* char to parse string for */
*cp++ = '\0'; /* null-terminate token */
/* get rid of any backslash escapes */
ep = npp;
- while ((np = strchr(ep, '\\')) != 0) {
+ while ((np = strchr(ep, '\\')) != NULL) {
if (np[1] == '\\')
np++;
strcpy(np, (ep = &np[1])); /* XXX: overlapping string copy */
diff --git a/freebsd/lib/libc/rpc/getpublickey.c b/freebsd/lib/libc/rpc/getpublickey.c
index d7bac7c2..0fef3d38 100644
--- a/freebsd/lib/libc/rpc/getpublickey.c
+++ b/freebsd/lib/libc/rpc/getpublickey.c
@@ -58,15 +58,13 @@ __FBSDID("$FreeBSD$");
/*
* Hack to let ypserv/rpc.nisd use AUTH_DES.
*/
-int (*__getpublickey_LOCAL)() = 0;
+int (*__getpublickey_LOCAL)(const char *, char *) = 0;
/*
* Get somebody's public key
*/
static int
-__getpublickey_real(netname, publickey)
- const char *netname;
- char *publickey;
+__getpublickey_real(const char *netname, char *publickey)
{
char lookup[3 * HEXKEYBYTES];
char *p;
@@ -91,9 +89,7 @@ __getpublickey_real(netname, publickey)
*/
int
-getpublicandprivatekey(key, ret)
- const char *key;
- char *ret;
+getpublicandprivatekey(const char *key, char *ret)
{
char buf[1024]; /* big enough */
char *res;
@@ -168,9 +164,7 @@ getpublicandprivatekey(key, ret)
}
}
-int getpublickey(netname, publickey)
- const char *netname;
- char *publickey;
+int getpublickey(const char *netname, char *publickey)
{
if (__getpublickey_LOCAL != NULL)
return(__getpublickey_LOCAL(netname, publickey));
diff --git a/freebsd/lib/libc/rpc/getrpcent.c b/freebsd/lib/libc/rpc/getrpcent.c
index b4d51e0d..bed8074c 100644
--- a/freebsd/lib/libc/rpc/getrpcent.c
+++ b/freebsd/lib/libc/rpc/getrpcent.c
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
*/
#include <rtems/bsd/sys/param.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <assert.h>
@@ -514,6 +513,7 @@ nis_rpcent(void *retval, void *mdata, va_list ap)
sizeof(char *)) {
*errnop = ERANGE;
rv = NS_RETURN;
+ free(resultbuf);
break;
}
@@ -523,6 +523,7 @@ nis_rpcent(void *retval, void *mdata, va_list ap)
if (aliases_size < 1) {
*errnop = ERANGE;
rv = NS_RETURN;
+ free(resultbuf);
break;
}
@@ -971,7 +972,7 @@ getrpc(int (*fn)(union key, struct rpcent *, char *, size_t, struct rpcent **),
}
struct rpcent *
-getrpcbyname(char *name)
+getrpcbyname(const char *name)
{
union key key;
@@ -991,7 +992,7 @@ getrpcbynumber(int number)
}
struct rpcent *
-getrpcent()
+getrpcent(void)
{
union key key;
@@ -1025,7 +1026,7 @@ setrpcent(int stayopen)
}
void
-endrpcent()
+endrpcent(void)
{
#ifdef NS_CACHING
static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
diff --git a/freebsd/lib/libc/rpc/getrpcport.c b/freebsd/lib/libc/rpc/getrpcport.c
index 161486dc..26e08b93 100644
--- a/freebsd/lib/libc/rpc/getrpcport.c
+++ b/freebsd/lib/libc/rpc/getrpcport.c
@@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
int
-getrpcport(host, prognum, versnum, proto)
- char *host;
- int prognum, versnum, proto;
+getrpcport(char *host, int prognum, int versnum, int proto)
{
struct sockaddr_in addr;
struct hostent *hp;
diff --git a/freebsd/lib/libc/rpc/key_call.c b/freebsd/lib/libc/rpc/key_call.c
index ba2a3835..c28aa507 100644
--- a/freebsd/lib/libc/rpc/key_call.c
+++ b/freebsd/lib/libc/rpc/key_call.c
@@ -83,15 +83,14 @@ __FBSDID("$FreeBSD$");
* implementations of these functions, and to call those in key_call().
*/
-cryptkeyres *(*__key_encryptsession_pk_LOCAL)() = 0;
-cryptkeyres *(*__key_decryptsession_pk_LOCAL)() = 0;
-des_block *(*__key_gendes_LOCAL)() = 0;
+cryptkeyres *(*__key_encryptsession_pk_LOCAL)(uid_t, void *arg) = 0;
+cryptkeyres *(*__key_decryptsession_pk_LOCAL)(uid_t, void *arg) = 0;
+des_block *(*__key_gendes_LOCAL)(uid_t, void *) = 0;
static int key_call( u_long, xdrproc_t, void *, xdrproc_t, void *);
int
-key_setsecret(secretkey)
- const char *secretkey;
+key_setsecret(const char *secretkey)
{
keystatus status;
@@ -133,10 +132,7 @@ key_secretkey_is_set(void)
}
int
-key_encryptsession_pk(remotename, remotekey, deskey)
- char *remotename;
- netobj *remotekey;
- des_block *deskey;
+key_encryptsession_pk(char *remotename, netobj *remotekey, des_block *deskey)
{
cryptkeyarg2 arg;
cryptkeyres res;
@@ -157,10 +153,7 @@ key_encryptsession_pk(remotename, remotekey, deskey)
}
int
-key_decryptsession_pk(remotename, remotekey, deskey)
- char *remotename;
- netobj *remotekey;
- des_block *deskey;
+key_decryptsession_pk(char *remotename, netobj *remotekey, des_block *deskey)
{
cryptkeyarg2 arg;
cryptkeyres res;
@@ -181,9 +174,7 @@ key_decryptsession_pk(remotename, remotekey, deskey)
}
int
-key_encryptsession(remotename, deskey)
- const char *remotename;
- des_block *deskey;
+key_encryptsession(const char *remotename, des_block *deskey)
{
cryptkeyarg arg;
cryptkeyres res;
@@ -203,9 +194,7 @@ key_encryptsession(remotename, deskey)
}
int
-key_decryptsession(remotename, deskey)
- const char *remotename;
- des_block *deskey;
+key_decryptsession(const char *remotename, des_block *deskey)
{
cryptkeyarg arg;
cryptkeyres res;
@@ -225,8 +214,7 @@ key_decryptsession(remotename, deskey)
}
int
-key_gendes(key)
- des_block *key;
+key_gendes(des_block *key)
{
if (!key_call((u_long)KEY_GEN, (xdrproc_t)xdr_void, NULL,
(xdrproc_t)xdr_des_block, key)) {
@@ -236,8 +224,7 @@ key_gendes(key)
}
int
-key_setnet(arg)
-struct key_netstarg *arg;
+key_setnet(struct key_netstarg *arg)
{
keystatus status;
@@ -256,9 +243,7 @@ struct key_netstarg *arg;
int
-key_get_conv(pkey, deskey)
- char *pkey;
- des_block *deskey;
+key_get_conv(char *pkey, des_block *deskey)
{
cryptkeyres res;
@@ -307,8 +292,7 @@ key_call_init(void)
* Keep the handle cached. This call may be made quite often.
*/
static CLIENT *
-getkeyserv_handle(vers)
-int vers;
+getkeyserv_handle(int vers)
{
void *localhandle;
struct netconfig *nconf;
@@ -431,12 +415,8 @@ int vers;
/* returns 0 on failure, 1 on success */
static int
-key_call(proc, xdr_arg, arg, xdr_rslt, rslt)
- u_long proc;
- xdrproc_t xdr_arg;
- void *arg;
- xdrproc_t xdr_rslt;
- void *rslt;
+key_call(u_long proc, xdrproc_t xdr_arg, void *arg, xdrproc_t xdr_rslt,
+ void *rslt)
{
CLIENT *clnt;
struct timeval wait_time;
diff --git a/freebsd/lib/libc/rpc/mt_misc.c b/freebsd/lib/libc/rpc/mt_misc.c
index b494bef7..75649fd2 100644
--- a/freebsd/lib/libc/rpc/mt_misc.c
+++ b/freebsd/lib/libc/rpc/mt_misc.c
@@ -95,9 +95,9 @@ rce_key_init(void)
}
struct rpc_createerr *
-__rpc_createerr()
+__rpc_createerr(void)
{
- struct rpc_createerr *rce_addr = 0;
+ struct rpc_createerr *rce_addr = NULL;
if (thr_main())
return (&rpc_createerr);
@@ -108,8 +108,7 @@ __rpc_createerr()
rce_addr = (struct rpc_createerr *)
malloc(sizeof (struct rpc_createerr));
if (thr_setspecific(rce_key, (void *) rce_addr) != 0) {
- if (rce_addr)
- free(rce_addr);
+ free(rce_addr);
return (&rpc_createerr);
}
memset(rce_addr, 0, sizeof (struct rpc_createerr));
diff --git a/freebsd/lib/libc/rpc/netname.c b/freebsd/lib/libc/rpc/netname.c
index d992c05d..25439fda 100644
--- a/freebsd/lib/libc/rpc/netname.c
+++ b/freebsd/lib/libc/rpc/netname.c
@@ -81,8 +81,7 @@ static char *OPSYS = "unix";
* Figure out my fully qualified network name
*/
int
-getnetname(name)
- char name[MAXNETNAMELEN+1];
+getnetname(char name[MAXNETNAMELEN+1])
{
uid_t uid;
@@ -99,10 +98,7 @@ getnetname(name)
* Convert unix cred to network-name
*/
int
-user2netname(netname, uid, domain)
- char netname[MAXNETNAMELEN + 1];
- const uid_t uid;
- const char *domain;
+user2netname(char netname[MAXNETNAMELEN + 1], const uid_t uid, const char *domain)
{
char *dfltdom;
@@ -124,10 +120,7 @@ user2netname(netname, uid, domain)
* Convert host to network-name
*/
int
-host2netname(netname, host, domain)
- char netname[MAXNETNAMELEN + 1];
- const char *host;
- const char *domain;
+host2netname(char netname[MAXNETNAMELEN + 1], const char *host, const char *domain)
{
char *dfltdom;
char hostname[MAXHOSTNAMELEN+1];
diff --git a/freebsd/lib/libc/rpc/netnamer.c b/freebsd/lib/libc/rpc/netnamer.c
index dd09c257..be154eb0 100644
--- a/freebsd/lib/libc/rpc/netnamer.c
+++ b/freebsd/lib/libc/rpc/netnamer.c
@@ -70,12 +70,8 @@ static int _getgroups( char *, gid_t * );
* Convert network-name into unix credential
*/
int
-netname2user(netname, uidp, gidp, gidlenp, gidlist)
- char netname[MAXNETNAMELEN + 1];
- uid_t *uidp;
- gid_t *gidp;
- int *gidlenp;
- gid_t *gidlist;
+netname2user(char netname[MAXNETNAMELEN + 1], uid_t *uidp, gid_t *gidp,
+ int *gidlenp, gid_t *gidlist)
{
char *p;
int gidlen;
@@ -151,9 +147,7 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist)
*/
static int
-_getgroups(uname, groups)
- char *uname;
- gid_t groups[NGRPS];
+_getgroups(char *uname, gid_t groups[NGRPS])
{
gid_t ngroups = 0;
struct group *grp;
@@ -192,10 +186,7 @@ toomany:
* Convert network-name to hostname
*/
int
-netname2host(netname, hostname, hostlen)
- char netname[MAXNETNAMELEN + 1];
- char *hostname;
- int hostlen;
+netname2host(char netname[MAXNETNAMELEN + 1], char *hostname, int hostlen)
{
int err;
char valbuf[1024];
@@ -241,8 +232,7 @@ netname2host(netname, hostname, hostlen)
* network information service.
*/
int
-getnetid(key, ret)
- char *key, *ret;
+getnetid(char *key, char *ret)
{
char buf[1024]; /* big enough */
char *res;
@@ -255,6 +245,9 @@ getnetid(key, ret)
char *lookup;
int len;
#endif
+ int rv;
+
+ rv = 0;
fd = fopen(NETIDFILE, "r");
if (fd == NULL) {
@@ -265,13 +258,11 @@ getnetid(key, ret)
return (0);
#endif
}
- for (;;) {
- if (fd == NULL)
- return (0); /* getnetidyp brings us here */
+ while (fd != NULL) {
res = fgets(buf, sizeof(buf), fd);
if (res == NULL) {
- fclose(fd);
- return (0);
+ rv = 0;
+ goto done;
}
if (res[0] == '#')
continue;
@@ -294,9 +285,8 @@ getnetid(key, ret)
lookup[len] = 0;
strcpy(ret, lookup);
free(lookup);
- if (fd != NULL)
- fclose(fd);
- return (2);
+ rv = 2;
+ goto done;
#else /* YP */
#ifdef DEBUG
fprintf(stderr,
@@ -322,10 +312,14 @@ getnetid(key, ret)
}
if (strcmp(mkey, key) == 0) {
strcpy(ret, mval);
- fclose(fd);
- return (1);
-
+ rv = 1;
+ goto done;
}
}
}
+
+done:
+ if (fd != NULL)
+ fclose(fd);
+ return (rv);
}
diff --git a/freebsd/lib/libc/rpc/pmap_getmaps.c b/freebsd/lib/libc/rpc/pmap_getmaps.c
index 7c35ff26..fd6c4a85 100644
--- a/freebsd/lib/libc/rpc/pmap_getmaps.c
+++ b/freebsd/lib/libc/rpc/pmap_getmaps.c
@@ -72,8 +72,7 @@ __FBSDID("$FreeBSD$");
* Calls the pmap service remotely to do get the maps.
*/
struct pmaplist *
-pmap_getmaps(address)
- struct sockaddr_in *address;
+pmap_getmaps(struct sockaddr_in *address)
{
struct pmaplist *head = NULL;
int sock = -1;
diff --git a/freebsd/lib/libc/rpc/pmap_getport.c b/freebsd/lib/libc/rpc/pmap_getport.c
index 7b6c4818..0ddfb68c 100644
--- a/freebsd/lib/libc/rpc/pmap_getport.c
+++ b/freebsd/lib/libc/rpc/pmap_getport.c
@@ -68,11 +68,8 @@ static const struct timeval tottimeout = { 60, 0 };
* Returns 0 if no map exists.
*/
u_short
-pmap_getport(address, program, version, protocol)
- struct sockaddr_in *address;
- u_long program;
- u_long version;
- u_int protocol;
+pmap_getport(struct sockaddr_in *address, u_long program, u_long version,
+ u_int protocol)
{
u_short port = 0;
int sock = -1;
diff --git a/freebsd/lib/libc/rpc/pmap_prot.c b/freebsd/lib/libc/rpc/pmap_prot.c
index 121af17a..03c303eb 100644
--- a/freebsd/lib/libc/rpc/pmap_prot.c
+++ b/freebsd/lib/libc/rpc/pmap_prot.c
@@ -54,9 +54,7 @@ __FBSDID("$FreeBSD$");
bool_t
-xdr_pmap(xdrs, regs)
- XDR *xdrs;
- struct pmap *regs;
+xdr_pmap(XDR *xdrs, struct pmap *regs)
{
assert(xdrs != NULL);
diff --git a/freebsd/lib/libc/rpc/pmap_prot2.c b/freebsd/lib/libc/rpc/pmap_prot2.c
index 9a50dfa7..0b5134a3 100644
--- a/freebsd/lib/libc/rpc/pmap_prot2.c
+++ b/freebsd/lib/libc/rpc/pmap_prot2.c
@@ -92,9 +92,7 @@ __FBSDID("$FreeBSD$");
* this sounds like a job for xdr_reference!
*/
bool_t
-xdr_pmaplist(xdrs, rp)
- XDR *xdrs;
- struct pmaplist **rp;
+xdr_pmaplist(XDR *xdrs, struct pmaplist **rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -136,9 +134,7 @@ xdr_pmaplist(xdrs, rp)
* functionality to xdr_pmaplist().
*/
bool_t
-xdr_pmaplist_ptr(xdrs, rp)
- XDR *xdrs;
- struct pmaplist *rp;
+xdr_pmaplist_ptr(XDR *xdrs, struct pmaplist *rp)
{
return xdr_pmaplist(xdrs, (struct pmaplist **)(void *)rp);
}
diff --git a/freebsd/lib/libc/rpc/pmap_rmt.c b/freebsd/lib/libc/rpc/pmap_rmt.c
index e2d45608..17f9d5b4 100644
--- a/freebsd/lib/libc/rpc/pmap_rmt.c
+++ b/freebsd/lib/libc/rpc/pmap_rmt.c
@@ -78,14 +78,9 @@ static const struct timeval timeout = { 3, 0 };
* 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;
+pmap_rmtcall(struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc,
+ xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
+ struct timeval tout, u_long *port_ptr)
{
int sock = -1;
CLIENT *client;
@@ -124,9 +119,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
* written for XDR_ENCODE direction only
*/
bool_t
-xdr_rmtcall_args(xdrs, cap)
- XDR *xdrs;
- struct rmtcallargs *cap;
+xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
{
u_int lenposition, argposition, position;
@@ -158,9 +151,7 @@ xdr_rmtcall_args(xdrs, cap)
* written for XDR_DECODE direction only
*/
bool_t
-xdr_rmtcallres(xdrs, crp)
- XDR *xdrs;
- struct rmtcallres *crp;
+xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp)
{
caddr_t port_ptr;
diff --git a/freebsd/lib/libc/rpc/rpc_callmsg.c b/freebsd/lib/libc/rpc/rpc_callmsg.c
index 7d236d5e..f635205c 100644
--- a/freebsd/lib/libc/rpc/rpc_callmsg.c
+++ b/freebsd/lib/libc/rpc/rpc_callmsg.c
@@ -56,9 +56,7 @@ __FBSDID("$FreeBSD$");
* XDR a call message
*/
bool_t
-xdr_callmsg(xdrs, cmsg)
- XDR *xdrs;
- struct rpc_msg *cmsg;
+xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
{
enum msg_type *prm_direction;
int32_t *buf;
@@ -197,11 +195,11 @@ xdr_callmsg(xdrs, cmsg)
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *) prm_direction) &&
(cmsg->rm_direction == CALL) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
(cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
+ xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) &&
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_vers)) &&
+ xdr_rpcproc(xdrs, &(cmsg->rm_call.cb_proc)) &&
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
return (FALSE);
diff --git a/freebsd/lib/libc/rpc/rpc_com.h b/freebsd/lib/libc/rpc/rpc_com.h
index 770faf91..bfa6a0bc 100644
--- a/freebsd/lib/libc/rpc/rpc_com.h
+++ b/freebsd/lib/libc/rpc/rpc_com.h
@@ -86,8 +86,8 @@ bool_t __xdrrec_setnonblock(XDR *, int);
bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
void __xprt_unregister_unlocked(SVCXPRT *);
-SVCXPRT **__svc_xports;
-int __svc_maxrec;
+extern SVCXPRT **__svc_xports;
+extern int __svc_maxrec;
__END_DECLS
diff --git a/freebsd/lib/libc/rpc/rpc_generic.c b/freebsd/lib/libc/rpc/rpc_generic.c
index d58bbfc0..8471fd7c 100644
--- a/freebsd/lib/libc/rpc/rpc_generic.c
+++ b/freebsd/lib/libc/rpc/rpc_generic.c
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include "reentrant.h"
-#include <sys/types.h>
#include <rtems/bsd/sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -113,7 +112,7 @@ static int getnettype(const char *);
* expensive call every time.
*/
int
-__rpc_dtbsize()
+__rpc_dtbsize(void)
{
static int tbsize;
struct rlimit rl;
@@ -134,12 +133,12 @@ __rpc_dtbsize()
/*
* Find the appropriate buffer size
+ *
+ * size - Size requested
*/
u_int
/*ARGSUSED*/
-__rpc_get_t_size(af, proto, size)
- int af, proto;
- int size; /* Size requested */
+__rpc_get_t_size(int af, int proto, int size)
{
int maxsize, defsize;
@@ -166,8 +165,7 @@ __rpc_get_t_size(af, proto, size)
* Find the appropriate address buffer size
*/
u_int
-__rpc_get_a_size(af)
- int af;
+__rpc_get_a_size(int af)
{
switch (af) {
case AF_INET:
@@ -186,8 +184,7 @@ __rpc_get_a_size(af)
#if 0
static char *
-strlocase(p)
- char *p;
+strlocase(char *p)
{
char *t = p;
@@ -203,8 +200,7 @@ strlocase(p)
* If nettype is NULL, it defaults to NETPATH.
*/
static int
-getnettype(nettype)
- const char *nettype;
+getnettype(const char *nettype)
{
int i;
@@ -239,8 +235,7 @@ keys_init(void)
* This should be freed by calling freenetconfigent()
*/
struct netconfig *
-__rpc_getconfip(nettype)
- const char *nettype;
+__rpc_getconfip(const char *nettype)
{
char *netid;
char *netid_tcp = (char *) NULL;
@@ -311,8 +306,7 @@ __rpc_getconfip(nettype)
* __rpc_getconf().
*/
void *
-__rpc_setconf(nettype)
- const char *nettype;
+__rpc_setconf(const char *nettype)
{
struct handle *handle;
@@ -355,8 +349,7 @@ failed:
* __rpc_setconf() should have been called previously.
*/
struct netconfig *
-__rpc_getconf(vhandle)
- void *vhandle;
+__rpc_getconf(void *vhandle)
{
struct handle *handle;
struct netconfig *nconf;
@@ -432,8 +425,7 @@ __rpc_getconf(vhandle)
}
void
-__rpc_endconf(vhandle)
- void * vhandle;
+__rpc_endconf(void *vhandle)
{
struct handle *handle;
@@ -454,8 +446,7 @@ __rpc_endconf(vhandle)
* Returns NULL if fails, else a non-NULL pointer.
*/
void *
-rpc_nullproc(clnt)
- CLIENT *clnt;
+rpc_nullproc(CLIENT *clnt)
{
struct timeval TIMEOUT = {25, 0};
@@ -471,8 +462,7 @@ rpc_nullproc(clnt)
* one succeeds in finding the netconf for the given fd.
*/
struct netconfig *
-__rpcgettp(fd)
- int fd;
+__rpcgettp(int fd)
{
const char *netid;
struct __rpc_sockinfo si;
diff --git a/freebsd/lib/libc/rpc/rpc_prot.c b/freebsd/lib/libc/rpc/rpc_prot.c
index 754f7cb9..d943ceaf 100644
--- a/freebsd/lib/libc/rpc/rpc_prot.c
+++ b/freebsd/lib/libc/rpc/rpc_prot.c
@@ -70,9 +70,7 @@ extern struct opaque_auth _null_auth;
* (see auth.h)
*/
bool_t
-xdr_opaque_auth(xdrs, ap)
- XDR *xdrs;
- struct opaque_auth *ap;
+xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
{
assert(xdrs != NULL);
@@ -88,9 +86,7 @@ xdr_opaque_auth(xdrs, ap)
* XDR a DES block
*/
bool_t
-xdr_des_block(xdrs, blkp)
- XDR *xdrs;
- des_block *blkp;
+xdr_des_block(XDR *xdrs, des_block *blkp)
{
assert(xdrs != NULL);
@@ -105,9 +101,7 @@ xdr_des_block(xdrs, blkp)
* XDR the MSG_ACCEPTED part of a reply message union
*/
bool_t
-xdr_accepted_reply(xdrs, ar)
- XDR *xdrs;
- struct accepted_reply *ar;
+xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar)
{
enum accept_stat *par_stat;
@@ -127,9 +121,9 @@ xdr_accepted_reply(xdrs, ar)
return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
case PROG_MISMATCH:
- if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
+ if (!xdr_rpcvers(xdrs, &(ar->ar_vers.low)))
return (FALSE);
- return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
+ return (xdr_rpcvers(xdrs, &(ar->ar_vers.high)));
case GARBAGE_ARGS:
case SYSTEM_ERR:
@@ -144,9 +138,7 @@ xdr_accepted_reply(xdrs, ar)
* XDR the MSG_DENIED part of a reply message union
*/
bool_t
-xdr_rejected_reply(xdrs, rr)
- XDR *xdrs;
- struct rejected_reply *rr;
+xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr)
{
enum reject_stat *prj_stat;
enum auth_stat *prj_why;
@@ -162,9 +154,9 @@ xdr_rejected_reply(xdrs, rr)
switch (rr->rj_stat) {
case RPC_MISMATCH:
- if (! xdr_u_int32_t(xdrs, &(rr->rj_vers.low)))
+ if (! xdr_rpcvers(xdrs, &(rr->rj_vers.low)))
return (FALSE);
- return (xdr_u_int32_t(xdrs, &(rr->rj_vers.high)));
+ return (xdr_rpcvers(xdrs, &(rr->rj_vers.high)));
case AUTH_ERROR:
prj_why = &rr->rj_why;
@@ -184,9 +176,7 @@ static const struct xdr_discrim reply_dscrm[3] = {
* XDR a reply message
*/
bool_t
-xdr_replymsg(xdrs, rmsg)
- XDR *xdrs;
- struct rpc_msg *rmsg;
+xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
{
enum msg_type *prm_direction;
enum reply_stat *prp_stat;
@@ -214,9 +204,7 @@ xdr_replymsg(xdrs, rmsg)
* The rm_xid is not really static, but the user can easily munge on the fly.
*/
bool_t
-xdr_callhdr(xdrs, cmsg)
- XDR *xdrs;
- struct rpc_msg *cmsg;
+xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
{
enum msg_type *prm_direction;
@@ -231,8 +219,8 @@ xdr_callhdr(xdrs, cmsg)
(xdrs->x_op == XDR_ENCODE) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *) prm_direction) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) )
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+ xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) )
return (xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)));
return (FALSE);
}
@@ -240,9 +228,7 @@ xdr_callhdr(xdrs, cmsg)
/* ************************** Client utility routine ************* */
static void
-accepted(acpt_stat, error)
- enum accept_stat acpt_stat;
- struct rpc_err *error;
+accepted(enum accept_stat acpt_stat, struct rpc_err *error)
{
assert(error != NULL);
@@ -281,9 +267,7 @@ accepted(acpt_stat, error)
}
static void
-rejected(rjct_stat, error)
- enum reject_stat rjct_stat;
- struct rpc_err *error;
+rejected(enum reject_stat rjct_stat, struct rpc_err *error)
{
assert(error != NULL);
@@ -308,9 +292,7 @@ rejected(rjct_stat, error)
* given a reply message, fills in the error
*/
void
-_seterr_reply(msg, error)
- struct rpc_msg *msg;
- struct rpc_err *error;
+_seterr_reply(struct rpc_msg *msg, struct rpc_err *error)
{
assert(msg != NULL);
diff --git a/freebsd/lib/libc/rpc/rpc_soc.c b/freebsd/lib/libc/rpc/rpc_soc.c
index 6b4260c4..d5b5be3a 100644
--- a/freebsd/lib/libc/rpc/rpc_soc.c
+++ b/freebsd/lib/libc/rpc/rpc_soc.c
@@ -90,14 +90,8 @@ static bool_t rpc_wrap_bcast(char *, struct netbuf *, struct netconfig *);
* A common clnt create routine
*/
static CLIENT *
-clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp)
- struct sockaddr_in *raddr;
- rpcprog_t prog;
- rpcvers_t vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
- char *tp;
+clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, int *sockp,
+ u_int sendsz, u_int recvsz, char *tp)
{
CLIENT *cl;
int madefd = FALSE;
@@ -166,14 +160,8 @@ err: if (madefd == TRUE)
}
CLIENT *
-clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long prog;
- u_long vers;
- struct timeval wait;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clntudp_bufcreate(struct sockaddr_in *raddr, u_long prog, u_long vers,
+ struct timeval wait, int *sockp, u_int sendsz, u_int recvsz)
{
CLIENT *cl;
@@ -187,12 +175,8 @@ clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
}
CLIENT *
-clntudp_create(raddr, program, version, wait, sockp)
- struct sockaddr_in *raddr;
- u_long program;
- u_long version;
- struct timeval wait;
- int *sockp;
+clntudp_create(struct sockaddr_in *raddr, u_long program, u_long version,
+ struct timeval wait, int *sockp)
{
return clntudp_bufcreate(raddr, program, version, wait, sockp,
@@ -200,13 +184,8 @@ clntudp_create(raddr, program, version, wait, sockp)
}
CLIENT *
-clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long prog;
- u_long vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp,
+ u_int sendsz, u_int recvsz)
{
return clnt_com_create(raddr, (rpcprog_t)prog, (rpcvers_t)vers, sockp,
@@ -214,9 +193,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
}
CLIENT *
-clntraw_create(prog, vers)
- u_long prog;
- u_long vers;
+clntraw_create(u_long prog, u_long vers)
{
return clnt_raw_create((rpcprog_t)prog, (rpcvers_t)vers);
@@ -226,11 +203,7 @@ clntraw_create(prog, vers)
* A common server create routine
*/
static SVCXPRT *
-svc_com_create(fd, sendsize, recvsize, netid)
- int fd;
- u_int sendsize;
- u_int recvsize;
- char *netid;
+svc_com_create(int fd, u_int sendsize, u_int recvsize, char *netid)
{
struct netconfig *nconf;
SVCXPRT *svc;
@@ -270,29 +243,21 @@ svc_com_create(fd, sendsize, recvsize, netid)
}
SVCXPRT *
-svctcp_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svctcp_create(int fd, u_int sendsize, u_int recvsize)
{
return svc_com_create(fd, sendsize, recvsize, "tcp");
}
SVCXPRT *
-svcudp_bufcreate(fd, sendsz, recvsz)
- int fd;
- u_int sendsz, recvsz;
+svcudp_bufcreate(int fd, u_int sendsz, u_int recvsz)
{
return svc_com_create(fd, sendsz, recvsz, "udp");
}
SVCXPRT *
-svcfd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svcfd_create(int fd, u_int sendsize, u_int recvsize)
{
return svc_fd_create(fd, sendsize, recvsize);
@@ -300,23 +265,21 @@ svcfd_create(fd, sendsize, recvsize)
SVCXPRT *
-svcudp_create(fd)
- int fd;
+svcudp_create(int fd)
{
return svc_com_create(fd, UDPMSGSIZE, UDPMSGSIZE, "udp");
}
SVCXPRT *
-svcraw_create()
+svcraw_create(void)
{
return svc_raw_create();
}
int
-get_myaddress(addr)
- struct sockaddr_in *addr;
+get_myaddress(struct sockaddr_in *addr)
{
memset((void *) addr, 0, sizeof(*addr));
@@ -330,11 +293,8 @@ get_myaddress(addr)
* For connectionless "udp" transport. Obsoleted by rpc_call().
*/
int
-callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
- const char *host;
- int prognum, versnum, procnum;
- xdrproc_t inproc, outproc;
- void *in, *out;
+callrpc(const char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, void *in, xdrproc_t outproc, void *out)
{
return (int)rpc_call(host, (rpcprog_t)prognum, (rpcvers_t)versnum,
@@ -345,10 +305,9 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
* For connectionless kind of transport. Obsoleted by rpc_reg()
*/
int
-registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
- int prognum, versnum, procnum;
- char *(*progname)(char [UDPMSGSIZE]);
- xdrproc_t inproc, outproc;
+registerrpc(int prognum, int versnum, int procnum,
+ char *(*progname)(char [UDPMSGSIZE]),
+ xdrproc_t inproc, xdrproc_t outproc)
{
return rpc_reg((rpcprog_t)prognum, (rpcvers_t)versnum,
@@ -376,10 +335,12 @@ clnt_broadcast_key_init(void)
*/
/* ARGSUSED */
static bool_t
-rpc_wrap_bcast(resultp, addr, nconf)
- char *resultp; /* results of the call */
- struct netbuf *addr; /* address of the guy who responded */
- struct netconfig *nconf; /* Netconf of the transport */
+rpc_wrap_bcast(char *resultp, struct netbuf *addr, struct netconfig *nconf)
+/*
+ * char *resultp; // results of the call
+ * struct netbuf *addr; // address of the guy who responded
+ * struct netconfig *nconf; // Netconf of the transport
+ */
{
resultproc_t clnt_broadcast_result;
@@ -397,15 +358,18 @@ rpc_wrap_bcast(resultp, addr, nconf)
* Broadcasts on UDP transport. Obsoleted by rpc_broadcast().
*/
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 */
- xdrproc_t xargs; /* xdr routine for args */
- void *argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- void *resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
+clnt_broadcast(u_long prog, u_long vers, u_long proc, xdrproc_t xargs,
+ void *argsp, xdrproc_t xresults, void *resultsp, resultproc_t eachresult)
+/*
+ * u_long prog; // program number
+ * u_long vers; // version number
+ * u_long proc; // procedure number
+ * xdrproc_t xargs; // xdr routine for args
+ * void *argsp; // pointer to args
+ * xdrproc_t xresults; // xdr routine for results
+ * void *resultsp; // pointer to results
+ * resultproc_t eachresult; // call with each result obtained
+ */
{
if (thr_main())
@@ -424,11 +388,14 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
* authdes_seccreate().
*/
AUTH *
-authdes_create(servername, window, syncaddr, ckey)
- char *servername; /* network name of server */
- u_int window; /* time to live */
- struct sockaddr *syncaddr; /* optional hostaddr to sync with */
- des_block *ckey; /* optional conversation key to use */
+authdes_create(char *servername, u_int window, struct sockaddr *syncaddr,
+ des_block *ckey)
+/*
+ * char *servername; // network name of server
+ * u_int window; // time to live
+ * struct sockaddr *syncaddr; // optional hostaddr to sync with
+ * des_block *ckey; // optional conversation key to use
+ */
{
AUTH *dummy;
AUTH *nauth;
@@ -455,27 +422,19 @@ fallback:
* Create a client handle for a unix connection. Obsoleted by clnt_vc_create()
*/
CLIENT *
-clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
- struct sockaddr_un *raddr;
- u_long prog;
- u_long vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clntunix_create(struct sockaddr_un *raddr, u_long prog, u_long vers, int *sockp,
+ u_int sendsz, u_int recvsz)
{
struct netbuf *svcaddr;
- struct netconfig *nconf;
CLIENT *cl;
int len;
cl = NULL;
- nconf = NULL;
svcaddr = NULL;
if ((raddr->sun_len == 0) ||
((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) ||
((svcaddr->buf = malloc(sizeof(struct sockaddr_un))) == NULL)) {
- if (svcaddr != NULL)
- free(svcaddr);
+ free(svcaddr);
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
return(cl);
@@ -508,11 +467,7 @@ done:
* Obsoleted by svc_vc_create().
*/
SVCXPRT *
-svcunix_create(sock, sendsize, recvsize, path)
- int sock;
- u_int sendsize;
- u_int recvsize;
- char *path;
+svcunix_create(int sock, u_int sendsize, u_int recvsize, char *path)
{
struct netconfig *nconf;
void *localhandle;
@@ -530,7 +485,7 @@ svcunix_create(sock, sendsize, recvsize, path)
break;
}
if (nconf == NULL)
- return(xprt);
+ goto done;
if ((sock = __rpc_nconf2fd(nconf)) < 0)
goto done;
@@ -572,10 +527,7 @@ done:
* descriptor as its first input. Obsoleted by svc_fd_create();
*/
SVCXPRT *
-svcunixfd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svcunixfd_create(int fd, u_int sendsize, u_int recvsize)
{
return (svc_fd_create(fd, sendsize, recvsize));
}
diff --git a/freebsd/lib/libc/rpc/rpcb_clnt.c b/freebsd/lib/libc/rpc/rpcb_clnt.c
index ffee9659..b8f1dd0c 100644
--- a/freebsd/lib/libc/rpc/rpcb_clnt.c
+++ b/freebsd/lib/libc/rpc/rpcb_clnt.c
@@ -111,9 +111,7 @@ static struct netbuf *got_entry(rpcb_entry_list_ptr, const struct netconfig *);
* These are private routines that may not be provided in future releases.
*/
bool_t
-__rpc_control(request, info)
- int request;
- void *info;
+__rpc_control(int request, void *info)
{
switch (request) {
case CLCR_GET_RPCB_TIMEOUT:
@@ -152,8 +150,7 @@ __rpc_control(request, info)
*/
static struct address_cache *
-check_cache(host, netid)
- const char *host, *netid;
+check_cache(const char *host, const char *netid)
{
struct address_cache *cptr;
@@ -173,8 +170,7 @@ check_cache(host, netid)
}
static void
-delete_cache(addr)
- struct netbuf *addr;
+delete_cache(struct netbuf *addr)
{
struct address_cache *cptr, *prevptr = NULL;
@@ -185,8 +181,7 @@ delete_cache(addr)
free(cptr->ac_netid);
free(cptr->ac_taddr->buf);
free(cptr->ac_taddr);
- if (cptr->ac_uaddr)
- free(cptr->ac_uaddr);
+ free(cptr->ac_uaddr);
if (prevptr)
prevptr->ac_next = cptr->ac_next;
else
@@ -200,10 +195,8 @@ delete_cache(addr)
}
static void
-add_cache(host, netid, taddr, uaddr)
- const char *host, *netid;
- char *uaddr;
- struct netbuf *taddr;
+add_cache(const char *host, const char *netid, struct netbuf *taddr,
+ char *uaddr)
{
struct address_cache *ad_cache, *cptr, *prevptr;
@@ -224,14 +217,10 @@ add_cache(host, netid, taddr, uaddr)
ad_cache->ac_taddr->buf = (char *) malloc(taddr->len);
if (ad_cache->ac_taddr->buf == NULL) {
out:
- if (ad_cache->ac_host)
- free(ad_cache->ac_host);
- if (ad_cache->ac_netid)
- free(ad_cache->ac_netid);
- if (ad_cache->ac_uaddr)
- free(ad_cache->ac_uaddr);
- if (ad_cache->ac_taddr)
- free(ad_cache->ac_taddr);
+ free(ad_cache->ac_host);
+ free(ad_cache->ac_netid);
+ free(ad_cache->ac_uaddr);
+ free(ad_cache->ac_taddr);
free(ad_cache);
return;
}
@@ -264,8 +253,7 @@ out:
free(cptr->ac_netid);
free(cptr->ac_taddr->buf);
free(cptr->ac_taddr);
- if (cptr->ac_uaddr)
- free(cptr->ac_uaddr);
+ free(cptr->ac_uaddr);
if (prevptr) {
prevptr->ac_next = NULL;
@@ -288,10 +276,7 @@ out:
* On error, returns NULL and free's everything.
*/
static CLIENT *
-getclnthandle(host, nconf, targaddr)
- const char *host;
- const struct netconfig *nconf;
- char **targaddr;
+getclnthandle(const char *host, const struct netconfig *nconf, char **targaddr)
{
CLIENT *client;
struct netbuf *addr, taddr;
@@ -437,7 +422,7 @@ getclnthandle(host, nconf, targaddr)
* rpcbind. Returns NULL on error and free's everything.
*/
static CLIENT *
-local_rpcb()
+local_rpcb(void)
{
CLIENT *client;
static struct netconfig *loopnconf;
@@ -516,6 +501,7 @@ try_nconf:
hostname = IN6_LOCALHOST_STRING;
}
}
+ endnetconfig(nc_handle);
if (tmpnconf == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
mutex_unlock(&loopnconf_lock);
@@ -523,7 +509,6 @@ try_nconf:
}
loopnconf = getnetconfigent(tmpnconf->nc_netid);
/* loopnconf is never freed */
- endnetconfig(nc_handle);
}
mutex_unlock(&loopnconf_lock);
client = getclnthandle(hostname, loopnconf, NULL);
@@ -533,13 +518,13 @@ try_nconf:
/*
* Set a mapping between program, version and address.
* Calls the rpcbind service to do the mapping.
+ *
+ * nconf - Network structure of transport
+ * address - Services netconfig address
*/
bool_t
-rpcb_set(program, version, nconf, address)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf; /* Network structure of transport */
- const struct netbuf *address; /* Services netconfig address */
+rpcb_set(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
+ const struct netbuf *address)
{
CLIENT *client;
bool_t rslt = FALSE;
@@ -596,10 +581,7 @@ rpcb_set(program, version, nconf, address)
* only for the given transport.
*/
bool_t
-rpcb_unset(program, version, nconf)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
+rpcb_unset(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf)
{
CLIENT *client;
bool_t rslt = FALSE;
@@ -636,9 +618,7 @@ rpcb_unset(program, version, nconf)
* From the merged list, find the appropriate entry
*/
static struct netbuf *
-got_entry(relp, nconf)
- rpcb_entry_list_ptr relp;
- const struct netconfig *nconf;
+got_entry(rpcb_entry_list_ptr relp, const struct netconfig *nconf)
{
struct netbuf *na = NULL;
rpcb_entry_list_ptr sp;
@@ -669,7 +649,7 @@ got_entry(relp, nconf)
* local transport.
*/
static bool_t
-__rpcbind_is_up()
+__rpcbind_is_up(void)
{
struct netconfig *nconf;
struct sockaddr_un sun;
@@ -683,11 +663,11 @@ __rpcbind_is_up()
strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
break;
}
+ endnetconfig(localhandle);
+
if (nconf == NULL)
return (FALSE);
- endnetconfig(localhandle);
-
memset(&sun, 0, sizeof sun);
sock = _socket(AF_LOCAL, SOCK_STREAM, 0);
if (sock < 0)
@@ -724,13 +704,9 @@ __rpcbind_is_up()
* starts working properly. Also look under clnt_vc.c.
*/
struct netbuf *
-__rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
- const char *host;
- CLIENT **clpp;
- struct timeval *tp;
+__rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
+ const struct netconfig *nconf, const char *host,
+ CLIENT **clpp, struct timeval *tp)
{
static bool_t check_rpcbind = TRUE;
CLIENT *client = NULL;
@@ -818,10 +794,8 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
malloc(remote.len)) == NULL)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
clnt_geterr(client, &rpc_createerr.cf_error);
- if (address) {
- free(address);
- address = NULL;
- }
+ free(address);
+ address = NULL;
goto error;
}
memcpy(address->buf, remote.buf, remote.len);
@@ -1039,12 +1013,8 @@ done:
* Assuming that the address is all properly allocated
*/
bool_t
-rpcb_getaddr(program, version, nconf, address, host)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
- struct netbuf *address;
- const char *host;
+rpcb_getaddr(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
+ struct netbuf *address, const char *host)
{
struct netbuf *na;
@@ -1075,9 +1045,7 @@ rpcb_getaddr(program, version, nconf, address, host)
* It returns NULL on failure.
*/
rpcblist *
-rpcb_getmaps(nconf, host)
- const struct netconfig *nconf;
- const char *host;
+rpcb_getmaps(const struct netconfig *nconf, const char *host)
{
rpcblist_ptr head = NULL;
CLIENT *client;
@@ -1125,19 +1093,20 @@ done:
* which will look up a service program in the address maps, and then
* remotely call that routine with the given parameters. This allows
* programs to do a lookup and call in one step.
-*/
+ *
+ * nconf -Netconfig structure
+ * host - Remote host name
+ * proc - Remote proc identifiers
+ * xdrargs, xdrres; XDR routines
+ * argsp, resp - Argument and Result
+ * tout - Timeout value for this call
+ * addr_ptr - Preallocated netbuf address
+ */
enum clnt_stat
-rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
- xdrres, resp, tout, addr_ptr)
- const struct netconfig *nconf; /* Netconfig structure */
- const char *host; /* Remote host name */
- rpcprog_t prog;
- rpcvers_t vers;
- rpcproc_t proc; /* Remote proc identifiers */
- xdrproc_t xdrargs, xdrres; /* XDR routines */
- caddr_t argsp, resp; /* Argument and Result */
- struct timeval tout; /* Timeout value for this call */
- const struct netbuf *addr_ptr; /* Preallocated netbuf address */
+rpcb_rmtcall(const struct netconfig *nconf, const char *host, rpcprog_t prog,
+ rpcvers_t vers, rpcproc_t proc, xdrproc_t xdrargs, caddr_t argsp,
+ xdrproc_t xdrres, caddr_t resp, struct timeval tout,
+ const struct netbuf *addr_ptr)
{
CLIENT *client;
enum clnt_stat stat;
@@ -1208,9 +1177,7 @@ error:
* Returns 1 if succeeds else 0.
*/
bool_t
-rpcb_gettime(host, timep)
- const char *host;
- time_t *timep;
+rpcb_gettime(const char *host, time_t *timep)
{
CLIENT *client = NULL;
void *handle;
@@ -1269,9 +1236,7 @@ rpcb_gettime(host, timep)
* really be called because local n2a libraries are always provided.
*/
char *
-rpcb_taddr2uaddr(nconf, taddr)
- struct netconfig *nconf;
- struct netbuf *taddr;
+rpcb_taddr2uaddr(struct netconfig *nconf, struct netbuf *taddr)
{
CLIENT *client;
char *uaddr = NULL;
@@ -1303,9 +1268,7 @@ rpcb_taddr2uaddr(nconf, taddr)
* really be called because local n2a libraries are always provided.
*/
struct netbuf *
-rpcb_uaddr2taddr(nconf, uaddr)
- struct netconfig *nconf;
- char *uaddr;
+rpcb_uaddr2taddr(struct netconfig *nconf, char *uaddr)
{
CLIENT *client;
struct netbuf *taddr;
diff --git a/freebsd/lib/libc/rpc/rpcb_prot.c b/freebsd/lib/libc/rpc/rpcb_prot.c
index c3a7ea8e..95072371 100644
--- a/freebsd/lib/libc/rpc/rpcb_prot.c
+++ b/freebsd/lib/libc/rpc/rpcb_prot.c
@@ -56,14 +56,12 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
bool_t
-xdr_rpcb(xdrs, objp)
- XDR *xdrs;
- RPCB *objp;
+xdr_rpcb(XDR *xdrs, RPCB *objp)
{
- if (!xdr_u_int32_t(xdrs, &objp->r_prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->r_prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->r_vers)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
@@ -102,9 +100,7 @@ xdr_rpcb(xdrs, objp)
*/
bool_t
-xdr_rpcblist_ptr(xdrs, rp)
- XDR *xdrs;
- rpcblist_ptr *rp;
+xdr_rpcblist_ptr(XDR *xdrs, rpcblist_ptr *rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -156,9 +152,7 @@ xdr_rpcblist_ptr(xdrs, rp)
* functionality to xdr_rpcblist_ptr().
*/
bool_t
-xdr_rpcblist(xdrs, rp)
- XDR *xdrs;
- RPCBLIST **rp;
+xdr_rpcblist(XDR *xdrs, RPCBLIST **rp)
{
bool_t dummy;
@@ -168,9 +162,7 @@ xdr_rpcblist(xdrs, rp)
bool_t
-xdr_rpcb_entry(xdrs, objp)
- XDR *xdrs;
- rpcb_entry *objp;
+xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp)
{
if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
return (FALSE);
@@ -191,9 +183,7 @@ xdr_rpcb_entry(xdrs, objp)
}
bool_t
-xdr_rpcb_entry_list_ptr(xdrs, rp)
- XDR *xdrs;
- rpcb_entry_list_ptr *rp;
+xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -219,14 +209,14 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
* the case of freeing we must remember the next object
* before we free the current object ...
*/
- if (freeing)
+ if (freeing && *rp)
next = (*rp)->rpcb_entry_next;
if (! xdr_reference(xdrs, (caddr_t *)rp,
(u_int)sizeof (rpcb_entry_list),
(xdrproc_t)xdr_rpcb_entry)) {
return (FALSE);
}
- if (freeing && *rp) {
+ if (freeing) {
next_copy = next;
rp = &next_copy;
/*
@@ -246,9 +236,7 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
* written for XDR_ENCODE direction only
*/
bool_t
-xdr_rpcb_rmtcallargs(xdrs, p)
- XDR *xdrs;
- struct rpcb_rmtcallargs *p;
+xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *p)
{
struct r_rpcb_rmtcallargs *objp =
(struct r_rpcb_rmtcallargs *)(void *)p;
@@ -257,13 +245,13 @@ xdr_rpcb_rmtcallargs(xdrs, p)
buf = XDR_INLINE(xdrs, 3 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
} else {
@@ -298,9 +286,7 @@ xdr_rpcb_rmtcallargs(xdrs, p)
* written for XDR_DECODE direction only
*/
bool_t
-xdr_rpcb_rmtcallres(xdrs, p)
- XDR *xdrs;
- struct rpcb_rmtcallres *p;
+xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *p)
{
bool_t dummy;
struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
@@ -316,9 +302,7 @@ xdr_rpcb_rmtcallres(xdrs, p)
}
bool_t
-xdr_netbuf(xdrs, objp)
- XDR *xdrs;
- struct netbuf *objp;
+xdr_netbuf(XDR *xdrs, struct netbuf *objp)
{
bool_t dummy;
void **pp;
diff --git a/freebsd/lib/libc/rpc/rpcb_st_xdr.c b/freebsd/lib/libc/rpc/rpcb_st_xdr.c
index 375f06cd..6b8711ea 100644
--- a/freebsd/lib/libc/rpc/rpcb_st_xdr.c
+++ b/freebsd/lib/libc/rpc/rpcb_st_xdr.c
@@ -49,16 +49,14 @@ __FBSDID("$FreeBSD$");
/* Link list of all the stats about getport and getaddr */
bool_t
-xdr_rpcbs_addrlist(xdrs, objp)
- XDR *xdrs;
- rpcbs_addrlist *objp;
+xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
{
struct rpcbs_addrlist **pnext;
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -85,9 +83,7 @@ xdr_rpcbs_addrlist(xdrs, objp)
/* Link list of all the stats about rmtcall */
bool_t
-xdr_rpcbs_rmtcalllist(xdrs, objp)
- XDR *xdrs;
- rpcbs_rmtcalllist *objp;
+xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
{
int32_t *buf;
struct rpcbs_rmtcalllist **pnext;
@@ -95,13 +91,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
if (xdrs->x_op == XDR_ENCODE) {
buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -134,13 +130,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
} else if (xdrs->x_op == XDR_DECODE) {
buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -170,13 +166,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
}
return (TRUE);
}
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -200,9 +196,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
}
bool_t
-xdr_rpcbs_proc(xdrs, objp)
- XDR *xdrs;
- rpcbs_proc objp;
+xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
{
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
sizeof (int), (xdrproc_t)xdr_int)) {
@@ -212,9 +206,7 @@ xdr_rpcbs_proc(xdrs, objp)
}
bool_t
-xdr_rpcbs_addrlist_ptr(xdrs, objp)
- XDR *xdrs;
- rpcbs_addrlist_ptr *objp;
+xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
(xdrproc_t)xdr_rpcbs_addrlist)) {
@@ -224,9 +216,7 @@ xdr_rpcbs_addrlist_ptr(xdrs, objp)
}
bool_t
-xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
- XDR *xdrs;
- rpcbs_rmtcalllist_ptr *objp;
+xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
@@ -236,9 +226,7 @@ xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
}
bool_t
-xdr_rpcb_stat(xdrs, objp)
- XDR *xdrs;
- rpcb_stat *objp;
+xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
{
if (!xdr_rpcbs_proc(xdrs, objp->info)) {
@@ -264,9 +252,7 @@ xdr_rpcb_stat(xdrs, objp)
* being monitored.
*/
bool_t
-xdr_rpcb_stat_byvers(xdrs, objp)
- XDR *xdrs;
- rpcb_stat_byvers objp;
+xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
{
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
diff --git a/freebsd/lib/libc/rpc/rpcdname.c b/freebsd/lib/libc/rpc/rpcdname.c
index 1805da80..63ea11e1 100644
--- a/freebsd/lib/libc/rpc/rpcdname.c
+++ b/freebsd/lib/libc/rpc/rpcdname.c
@@ -45,20 +45,20 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "un-namespace.h"
-static char *default_domain = 0;
+static char *default_domain;
static char *
-get_default_domain()
+get_default_domain(void)
{
char temp[256];
- if (default_domain)
+ if (default_domain != NULL)
return (default_domain);
if (getdomainname(temp, sizeof(temp)) < 0)
return (0);
if ((int) strlen(temp) > 0) {
- default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
- if (default_domain == 0)
+ default_domain = malloc((strlen(temp) + (unsigned)1));
+ if (default_domain == NULL)
return (0);
(void) strcpy(default_domain, temp);
return (default_domain);
@@ -73,10 +73,9 @@ get_default_domain()
* get rejected elsewhere in the NIS client package.
*/
int
-__rpc_get_default_domain(domain)
- char **domain;
+__rpc_get_default_domain(char **domain)
{
- if ((*domain = get_default_domain()) != 0)
+ if ((*domain = get_default_domain()) != NULL)
return (0);
return (-1);
}
diff --git a/freebsd/lib/libc/rpc/rtime.c b/freebsd/lib/libc/rpc/rtime.c
index b8f783e9..a6223863 100644
--- a/freebsd/lib/libc/rpc/rtime.c
+++ b/freebsd/lib/libc/rpc/rtime.c
@@ -63,16 +63,14 @@ __FBSDID("$FreeBSD$");
extern int _rpc_dtablesize( void );
-#define NYEARS (unsigned long)(1970 - 1900)
-#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
+#define NYEARS (unsigned long)(1970 - 1900)
+#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
static void do_close( int );
int
-rtime(addrp, timep, timeout)
- struct sockaddr_in *addrp;
- struct timeval *timep;
- struct timeval *timeout;
+rtime(struct sockaddr_in *addrp, struct timeval *timep,
+ struct timeval *timeout)
{
int s;
fd_set readfds;
@@ -102,11 +100,11 @@ 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);
- return(-1);
+ return(-1);
}
do {
FD_ZERO(&readfds);
@@ -119,14 +117,14 @@ rtime(addrp, timep, timeout)
errno = ETIMEDOUT;
}
do_close(s);
- return(-1);
+ 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);
+ return(-1);
}
} else {
if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
@@ -141,7 +139,7 @@ rtime(addrp, timep, timeout)
}
if (res != sizeof(thetime)) {
errno = EIO;
- return(-1);
+ return(-1);
}
thetime = ntohl(thetime);
timep->tv_sec = thetime - TOFFSET;
@@ -150,8 +148,7 @@ rtime(addrp, timep, timeout)
}
static void
-do_close(s)
- int s;
+do_close(int s)
{
int save;
diff --git a/freebsd/lib/libc/rpc/svc.c b/freebsd/lib/libc/rpc/svc.c
index 709bfffa..64b79036 100644
--- a/freebsd/lib/libc/rpc/svc.c
+++ b/freebsd/lib/libc/rpc/svc.c
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
* The services list
* Each entry represents a set of procedures (an rpc program).
* The dispatch routine takes request structs and runs the
- * apropriate procedure.
+ * appropriate procedure.
*/
static struct svc_callout {
struct svc_callout *sc_next;
@@ -86,6 +86,9 @@ static struct svc_callout {
void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
} *svc_head;
+SVCXPRT **__svc_xports;
+int __svc_maxrec;
+
static struct svc_callout *svc_find(rpcprog_t, rpcvers_t,
struct svc_callout **, char *);
static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
@@ -96,8 +99,7 @@ static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
* Activate a transport handle.
*/
void
-xprt_register(xprt)
- SVCXPRT *xprt;
+xprt_register(SVCXPRT *xprt)
{
int sock;
@@ -139,9 +141,7 @@ __xprt_unregister_unlocked(SVCXPRT *xprt)
* De-activate a transport handle.
*/
static void
-__xprt_do_unregister(xprt, dolock)
- SVCXPRT *xprt;
- bool_t dolock;
+__xprt_do_unregister(SVCXPRT *xprt, bool_t dolock)
{
int sock;
@@ -170,12 +170,9 @@ __xprt_do_unregister(xprt, dolock)
* program number comes in.
*/
bool_t
-svc_reg(xprt, prog, vers, dispatch, nconf)
- SVCXPRT *xprt;
- const rpcprog_t prog;
- const rpcvers_t vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- const struct netconfig *nconf;
+svc_reg(SVCXPRT *xprt, const rpcprog_t prog, const rpcvers_t vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ const struct netconfig *nconf)
{
bool_t dummy;
struct svc_callout *prev;
@@ -203,8 +200,7 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
rwlock_wrlock(&svc_lock);
if ((s = svc_find(prog, vers, &prev, netid)) != NULL) {
- if (netid)
- free(netid);
+ free(netid);
if (s->sc_dispatch == dispatch)
goto rpcb_it; /* he is registering another xptr */
rwlock_unlock(&svc_lock);
@@ -212,8 +208,7 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
}
s = mem_alloc(sizeof (struct svc_callout));
if (s == NULL) {
- if (netid)
- free(netid);
+ free(netid);
rwlock_unlock(&svc_lock);
return (FALSE);
}
@@ -244,9 +239,7 @@ rpcb_it:
* Remove a service program from the callout list.
*/
void
-svc_unreg(prog, vers)
- const rpcprog_t prog;
- const rpcvers_t vers;
+svc_unreg(const rpcprog_t prog, const rpcvers_t vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -277,12 +270,9 @@ svc_unreg(prog, vers)
* program number comes in.
*/
bool_t
-svc_register(xprt, prog, vers, dispatch, protocol)
- SVCXPRT *xprt;
- u_long prog;
- u_long vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- int protocol;
+svc_register(SVCXPRT *xprt, u_long prog, u_long vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ int protocol)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -317,9 +307,7 @@ pmap_it:
* Remove a service program from the callout list.
*/
void
-svc_unregister(prog, vers)
- u_long prog;
- u_long vers;
+svc_unregister(u_long prog, u_long vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -344,11 +332,8 @@ svc_unregister(prog, vers)
* struct.
*/
static struct svc_callout *
-svc_find(prog, vers, prev, netid)
- rpcprog_t prog;
- rpcvers_t vers;
- struct svc_callout **prev;
- char *netid;
+svc_find(rpcprog_t prog, rpcvers_t vers, struct svc_callout **prev,
+ char *netid)
{
struct svc_callout *s, *p;
@@ -372,10 +357,8 @@ svc_find(prog, vers, prev, netid)
* Send a reply to an rpc request
*/
bool_t
-svc_sendreply(xprt, xdr_results, xdr_location)
- SVCXPRT *xprt;
- xdrproc_t xdr_results;
- void * xdr_location;
+svc_sendreply(SVCXPRT *xprt, xdrproc_t xdr_results,
+ void * xdr_location)
{
struct rpc_msg rply;
@@ -394,8 +377,7 @@ svc_sendreply(xprt, xdr_results, xdr_location)
* No procedure error reply
*/
void
-svcerr_noproc(xprt)
- SVCXPRT *xprt;
+svcerr_noproc(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -412,8 +394,7 @@ svcerr_noproc(xprt)
* Can't decode args error reply
*/
void
-svcerr_decode(xprt)
- SVCXPRT *xprt;
+svcerr_decode(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -430,8 +411,7 @@ svcerr_decode(xprt)
* Some system error
*/
void
-svcerr_systemerr(xprt)
- SVCXPRT *xprt;
+svcerr_systemerr(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -452,31 +432,27 @@ svcerr_systemerr(xprt)
* protocol: the portmapper (or rpc binder).
*/
void
-__svc_versquiet_on(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_on(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags |= SVC_VERSQUIET;
}
void
-__svc_versquiet_off(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_off(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags &= ~SVC_VERSQUIET;
}
void
-svc_versquiet(xprt)
- SVCXPRT *xprt;
+svc_versquiet(SVCXPRT *xprt)
{
__svc_versquiet_on(xprt);
}
int
-__svc_versquiet_get(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_get(SVCXPRT *xprt)
{
return (SVC_EXT(xprt)->xp_flags & SVC_VERSQUIET);
@@ -487,9 +463,7 @@ __svc_versquiet_get(xprt)
* Authentication error reply
*/
void
-svcerr_auth(xprt, why)
- SVCXPRT *xprt;
- enum auth_stat why;
+svcerr_auth(SVCXPRT *xprt, enum auth_stat why)
{
struct rpc_msg rply;
@@ -506,8 +480,7 @@ svcerr_auth(xprt, why)
* Auth too weak error reply
*/
void
-svcerr_weakauth(xprt)
- SVCXPRT *xprt;
+svcerr_weakauth(SVCXPRT *xprt)
{
assert(xprt != NULL);
@@ -519,8 +492,7 @@ svcerr_weakauth(xprt)
* Program unavailable error reply
*/
void
-svcerr_noprog(xprt)
- SVCXPRT *xprt;
+svcerr_noprog(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -537,10 +509,7 @@ svcerr_noprog(xprt)
* Program version mismatch error reply
*/
void
-svcerr_progvers(xprt, low_vers, high_vers)
- SVCXPRT *xprt;
- rpcvers_t low_vers;
- rpcvers_t high_vers;
+svcerr_progvers(SVCXPRT *xprt, rpcvers_t low_vers, rpcvers_t high_vers)
{
struct rpc_msg rply;
@@ -562,7 +531,7 @@ svcerr_progvers(xprt, low_vers, high_vers)
* parameters.
*/
SVCXPRT *
-svc_xprt_alloc()
+svc_xprt_alloc(void)
{
SVCXPRT *xprt;
SVCXPRT_EXT *ext;
@@ -587,8 +556,7 @@ svc_xprt_alloc()
* Free a server transport structure.
*/
void
-svc_xprt_free(xprt)
- SVCXPRT *xprt;
+svc_xprt_free(SVCXPRT *xprt)
{
mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT));
@@ -614,8 +582,7 @@ svc_xprt_free(xprt)
*/
void
-svc_getreq(rdfds)
- int rdfds;
+svc_getreq(int rdfds)
{
fd_set readfds;
@@ -625,8 +592,7 @@ svc_getreq(rdfds)
}
void
-svc_getreqset(readfds)
- fd_set *readfds;
+svc_getreqset(fd_set *readfds)
{
int bit, fd;
fd_mask mask, *maskp;
@@ -646,8 +612,7 @@ svc_getreqset(readfds)
}
void
-svc_getreq_common(fd)
- int fd;
+svc_getreq_common(int fd)
{
SVCXPRT *xprt;
struct svc_req r;
@@ -742,9 +707,7 @@ call_done:
void
-svc_getreq_poll(pfdp, pollretval)
- struct pollfd *pfdp;
- int pollretval;
+svc_getreq_poll(struct pollfd *pfdp, int pollretval)
{
int i;
int fds_found;
diff --git a/freebsd/lib/libc/rpc/svc_auth.c b/freebsd/lib/libc/rpc/svc_auth.c
index 917e5e81..ea56b340 100644
--- a/freebsd/lib/libc/rpc/svc_auth.c
+++ b/freebsd/lib/libc/rpc/svc_auth.c
@@ -97,9 +97,7 @@ struct svc_auth_ops svc_auth_null_ops;
* invalid.
*/
enum auth_stat
-_authenticate(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_authenticate(struct svc_req *rqst, struct rpc_msg *msg)
{
int cred_flavor;
struct authsvc *asp;
@@ -153,11 +151,7 @@ _authenticate(rqst, msg)
* that don't need to inspect or modify the message body.
*/
static bool_t
-svcauth_null_wrap(auth, xdrs, xdr_func, xdr_ptr)
- SVCAUTH *auth;
- XDR *xdrs;
- xdrproc_t xdr_func;
- caddr_t xdr_ptr;
+svcauth_null_wrap(SVCAUTH *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr)
{
return (xdr_func(xdrs, xdr_ptr));
@@ -170,9 +164,7 @@ struct svc_auth_ops svc_auth_null_ops = {
/*ARGSUSED*/
enum auth_stat
-_svcauth_null(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_null(struct svc_req *rqst, struct rpc_msg *msg)
{
return (AUTH_OK);
}
@@ -192,9 +184,8 @@ _svcauth_null(rqst, msg)
*/
int
-svc_auth_reg(cred_flavor, handler)
- int cred_flavor;
- enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *);
+svc_auth_reg(int cred_flavor,
+ enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *))
{
struct authsvc *asp;
diff --git a/freebsd/lib/libc/rpc/svc_auth_des.c b/freebsd/lib/libc/rpc/svc_auth_des.c
index a9408019..55f3d3ee 100644
--- a/freebsd/lib/libc/rpc/svc_auth_des.c
+++ b/freebsd/lib/libc/rpc/svc_auth_des.c
@@ -92,11 +92,11 @@ struct cache_entry {
static struct cache_entry *authdes_cache/* [AUTHDES_CACHESZ] */;
static short *authdes_lru/* [AUTHDES_CACHESZ] */;
-static void cache_init(); /* initialize the cache */
-static short cache_spot(); /* find an entry in the cache */
-static void cache_ref(/*short sid*/); /* note that sid was ref'd */
+static void cache_init(void); /* initialize the cache */
+static short cache_spot(des_block *, char *, struct timeval *); /* find an entry in the cache */
+static void cache_ref(short sid); /* note that sid was ref'd */
-static void invalidate(); /* invalidate entry in cache */
+static void invalidate(char *); /* invalidate entry in cache */
/*
* cache statistics
@@ -111,9 +111,7 @@ static struct {
* Service side authenticator for AUTH_DES
*/
enum auth_stat
-_svcauth_des(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_des(struct svc_req *rqst, struct rpc_msg *msg)
{
long *ixdr;
@@ -272,7 +270,7 @@ _svcauth_des(rqst, msg)
debug("timestamp before last seen");
return (AUTH_REJECTEDVERF); /* replay */
}
- (void) gettimeofday(&current, (struct timezone *)NULL);
+ (void)gettimeofday(&current, NULL);
current.tv_sec -= window; /* allow for expiration */
if (!BEFORE(&current, &timestamp)) {
debug("timestamp expired");
@@ -357,7 +355,7 @@ _svcauth_des(rqst, msg)
* Initialize the cache
*/
static void
-cache_init()
+cache_init(void)
{
int i;
@@ -380,7 +378,7 @@ cache_init()
* Find the lru victim
*/
static short
-cache_victim()
+cache_victim(void)
{
return (authdes_lru[AUTHDES_CACHESZ-1]);
}
@@ -389,8 +387,7 @@ cache_victim()
* Note that sid was referenced
*/
static void
-cache_ref(sid)
- short sid;
+cache_ref(short sid)
{
int i;
short curr;
@@ -412,10 +409,7 @@ cache_ref(sid)
* return the spot in the cache.
*/
static short
-cache_spot(key, name, timestamp)
- des_block *key;
- char *name;
- struct timeval *timestamp;
+cache_spot(des_block *key, char *name, struct timeval *timestamp)
{
struct cache_entry *cp;
int i;
@@ -463,12 +457,8 @@ struct bsdcred {
* the credential.
*/
int
-authdes_getucred(adc, uid, gid, grouplen, groups)
- struct authdes_cred *adc;
- uid_t *uid;
- gid_t *gid;
- int *grouplen;
- gid_t *groups;
+authdes_getucred(struct authdes_cred *adc, uid_t *uid, gid_t *gid,
+ int *grouplen, gid_t *groups)
{
unsigned sid;
int i;
@@ -527,8 +517,7 @@ authdes_getucred(adc, uid, gid, grouplen, groups)
}
static void
-invalidate(cred)
- char *cred;
+invalidate(char *cred)
{
if (cred == NULL) {
return;
diff --git a/freebsd/lib/libc/rpc/svc_auth_unix.c b/freebsd/lib/libc/rpc/svc_auth_unix.c
index bd052b77..53459786 100644
--- a/freebsd/lib/libc/rpc/svc_auth_unix.c
+++ b/freebsd/lib/libc/rpc/svc_auth_unix.c
@@ -58,9 +58,7 @@ __FBSDID("$FreeBSD$");
* Unix longhand authenticator
*/
enum auth_stat
-_svcauth_unix(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
{
enum auth_stat stat;
XDR xdrs;
@@ -149,9 +147,7 @@ done:
*/
/*ARGSUSED*/
enum auth_stat
-_svcauth_short(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_short(struct svc_req *rqst, struct rpc_msg *msg)
{
return (AUTH_REJECTEDCRED);
}
diff --git a/freebsd/lib/libc/rpc/svc_dg.c b/freebsd/lib/libc/rpc/svc_dg.c
index 0d75191c..377ce5f2 100644
--- a/freebsd/lib/libc/rpc/svc_dg.c
+++ b/freebsd/lib/libc/rpc/svc_dg.c
@@ -104,10 +104,7 @@ static const char svc_dg_err4[] = "cannot set IP_RECVDSTADDR";
static const char __no_mem_str[] = "out of memory";
SVCXPRT *
-svc_dg_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_dg_create(int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt;
struct svc_dg_data *su = NULL;
@@ -190,8 +187,7 @@ freedata_nowarn:
/*ARGSUSED*/
static enum xprt_stat
-svc_dg_stat(xprt)
- SVCXPRT *xprt;
+svc_dg_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
@@ -252,9 +248,7 @@ svc_dg_recvfrom(int fd, char *buf, int buflen,
}
static bool_t
-svc_dg_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_dg_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_dg_data *su = su_data(xprt);
XDR *xdrs = &(su->su_xdrs);
@@ -337,9 +331,7 @@ svc_dg_sendto(int fd, char *buf, int buflen,
}
static bool_t
-svc_dg_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_dg_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_dg_data *su = su_data(xprt);
XDR *xdrs = &(su->su_xdrs);
@@ -380,10 +372,7 @@ svc_dg_reply(xprt, msg)
}
static bool_t
-svc_dg_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_dg_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_dg_data *su;
@@ -394,10 +383,7 @@ svc_dg_getargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_dg_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_dg_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
XDR *xdrs = &(su_data(xprt)->su_xdrs);
@@ -406,8 +392,7 @@ svc_dg_freeargs(xprt, xdr_args, args_ptr)
}
static void
-svc_dg_destroy(xprt)
- SVCXPRT *xprt;
+svc_dg_destroy(SVCXPRT *xprt)
{
struct svc_dg_data *su = su_data(xprt);
@@ -423,24 +408,19 @@ svc_dg_destroy(xprt)
(void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen);
if (xprt->xp_ltaddr.buf)
(void) mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen);
- if (xprt->xp_tp)
- (void) free(xprt->xp_tp);
+ free(xprt->xp_tp);
svc_xprt_free(xprt);
}
static bool_t
/*ARGSUSED*/
-svc_dg_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_dg_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static void
-svc_dg_ops(xprt)
- SVCXPRT *xprt;
+svc_dg_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -538,9 +518,7 @@ static const char alloc_err[] = "could not allocate cache ";
static const char enable_err[] = "cache already enabled";
int
-svc_dg_enablecache(transp, size)
- SVCXPRT *transp;
- u_int size;
+svc_dg_enablecache(SVCXPRT *transp, u_int size)
{
struct svc_dg_data *su = su_data(transp);
struct cl_cache *uc;
@@ -595,9 +573,7 @@ static const char cache_set_err2[] = "victim alloc failed";
static const char cache_set_err3[] = "could not allocate new rpc buffer";
static void
-cache_set(xprt, replylen)
- SVCXPRT *xprt;
- size_t replylen;
+cache_set(SVCXPRT *xprt, size_t replylen)
{
cache_ptr victim;
cache_ptr *vicp;
@@ -685,11 +661,7 @@ cache_set(xprt, replylen)
* return 1 if found, 0 if not found and set the stage for cache_set()
*/
static int
-cache_get(xprt, msg, replyp, replylenp)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
- char **replyp;
- size_t *replylenp;
+cache_get(SVCXPRT *xprt, struct rpc_msg *msg, char **replyp, size_t *replylenp)
{
u_int loc;
cache_ptr ent;
diff --git a/freebsd/lib/libc/rpc/svc_generic.c b/freebsd/lib/libc/rpc/svc_generic.c
index 4d7a23a4..0643ae22 100644
--- a/freebsd/lib/libc/rpc/svc_generic.c
+++ b/freebsd/lib/libc/rpc/svc_generic.c
@@ -74,13 +74,14 @@ extern int __svc_vc_setflag(SVCXPRT *, int);
* It creates a link list of all the handles it could create.
* If svc_create() is called multiple times, it uses the handle
* created earlier instead of creating a new handle every time.
+ *
+ * prognum - Program number
+ * versnum - Version number
+ * nettype - Networktype token
*/
int
-svc_create(dispatch, prognum, versnum, nettype)
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- rpcprog_t prognum; /* Program number */
- rpcvers_t versnum; /* Version number */
- const char *nettype; /* Networktype token */
+svc_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
+ rpcprog_t prognum, rpcvers_t versnum, const char *nettype)
{
struct xlist {
SVCXPRT *xprt; /* Server handle */
@@ -123,7 +124,8 @@ svc_create(dispatch, prognum, versnum, nettype)
if (l == NULL) {
warnx("svc_create: no memory");
mutex_unlock(&xprtlist_lock);
- return (0);
+ num = 0;
+ goto done;
}
l->xprt = xprt;
l->next = xprtlist;
@@ -133,6 +135,7 @@ svc_create(dispatch, prognum, versnum, nettype)
}
mutex_unlock(&xprtlist_lock);
}
+done:
__rpc_endconf(handle);
/*
* In case of num == 0; the error messages are generated by the
@@ -145,13 +148,14 @@ svc_create(dispatch, prognum, versnum, nettype)
* The high level interface to svc_tli_create().
* It tries to create a server for "nconf" and registers the service
* with the rpcbind. It calls svc_tli_create();
+ *
+ * prognum - Program number
+ * versnum - Version number
+ * ncofn - Netconfig structure for the network
*/
SVCXPRT *
-svc_tp_create(dispatch, prognum, versnum, nconf)
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- rpcprog_t prognum; /* Program number */
- rpcvers_t versnum; /* Version number */
- const struct netconfig *nconf; /* Netconfig structure for the network */
+svc_tp_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
+ rpcprog_t prognum, rpcvers_t versnum, const struct netconfig *nconf)
{
SVCXPRT *xprt;
@@ -186,14 +190,16 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
* is set to 8.
*
* If sendsz or recvsz are zero, their default values are chosen.
+ *
+ * fd - Connection end point
+ * nconf - Netconfig struct for nettoken
+ * bindaddr - Local bind address
+ * sendsz - Max sendsize
+ * recvxz - Max recvsize
*/
SVCXPRT *
-svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- int fd; /* Connection end point */
- const struct netconfig *nconf; /* Netconfig struct for nettoken */
- const struct t_bind *bindaddr; /* Local bind address */
- u_int sendsz; /* Max sendsize */
- u_int recvsz; /* Max recvsize */
+svc_tli_create(int fd, const struct netconfig *nconf,
+ const struct t_bind *bindaddr, u_int sendsz, u_int recvsz)
{
SVCXPRT *xprt = NULL; /* service handle */
bool_t madefd = FALSE; /* whether fd opened here */
diff --git a/freebsd/lib/libc/rpc/svc_raw.c b/freebsd/lib/libc/rpc/svc_raw.c
index 7f9c4eb4..772e523f 100644
--- a/freebsd/lib/libc/rpc/svc_raw.c
+++ b/freebsd/lib/libc/rpc/svc_raw.c
@@ -84,7 +84,7 @@ static bool_t svc_raw_control(SVCXPRT *, const u_int, void *);
char *__rpc_rawcombuf = NULL;
SVCXPRT *
-svc_raw_create()
+svc_raw_create(void)
{
struct svc_raw_private *srp;
/* VARIABLES PROTECTED BY svcraw_lock: svc_raw_private, srp */
@@ -127,17 +127,14 @@ svc_raw_create()
/*ARGSUSED*/
static enum xprt_stat
-svc_raw_stat(xprt)
-SVCXPRT *xprt; /* args needed to satisfy ANSI-C typechecking */
+svc_raw_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
/*ARGSUSED*/
static bool_t
-svc_raw_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_raw_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -161,9 +158,7 @@ svc_raw_recv(xprt, msg)
/*ARGSUSED*/
static bool_t
-svc_raw_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_raw_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -203,10 +198,7 @@ svc_raw_reply(xprt, msg)
/*ARGSUSED*/
static bool_t
-svc_raw_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_raw_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_raw_private *srp;
@@ -224,10 +216,7 @@ svc_raw_getargs(xprt, xdr_args, args_ptr)
/*ARGSUSED*/
static bool_t
-svc_raw_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_raw_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -247,24 +236,19 @@ svc_raw_freeargs(xprt, xdr_args, args_ptr)
/*ARGSUSED*/
static void
-svc_raw_destroy(xprt)
-SVCXPRT *xprt;
+svc_raw_destroy(SVCXPRT *xprt)
{
}
/*ARGSUSED*/
static bool_t
-svc_raw_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_raw_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static void
-svc_raw_ops(xprt)
- SVCXPRT *xprt;
+svc_raw_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
diff --git a/freebsd/lib/libc/rpc/svc_run.c b/freebsd/lib/libc/rpc/svc_run.c
index 85506c5c..4e6ed628 100644
--- a/freebsd/lib/libc/rpc/svc_run.c
+++ b/freebsd/lib/libc/rpc/svc_run.c
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
#include "mt_misc.h"
void
-svc_run()
+svc_run(void)
{
fd_set readfds, cleanfds;
struct timeval timeout;
@@ -91,7 +91,7 @@ svc_run()
* more work to do.
*/
void
-svc_exit()
+svc_exit(void)
{
rwlock_wrlock(&svc_fd_lock);
FD_ZERO(&svc_fdset);
diff --git a/freebsd/lib/libc/rpc/svc_simple.c b/freebsd/lib/libc/rpc/svc_simple.c
index da3f1ebf..28da2898 100644
--- a/freebsd/lib/libc/rpc/svc_simple.c
+++ b/freebsd/lib/libc/rpc/svc_simple.c
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
/*
* This interface creates a virtual listener for all the services
- * started thru rpc_reg(). It listens on the same endpoint for
+ * started through rpc_reg(). It listens on the same endpoint for
* all the services and then executes the corresponding service
* for the given prognum and procnum.
*/
@@ -94,16 +94,18 @@ static const char __no_mem_str[] = "out of memory";
* is also limited by the recvsize for that transport, even if it is
* a COTS transport. This may be wrong, but for cases like these, they
* should not use the simplified interfaces like this.
+ *
+ * prognum - program number
+ * versnum - version number
+ * procnum - procedure number
+ * progname - Server routine
+ * inproc, outproc - in/out XDR procedures
+ * nettype - nettype
*/
-
int
-rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- rpcprog_t prognum; /* program number */
- rpcvers_t versnum; /* version number */
- rpcproc_t procnum; /* procedure number */
- char *(*progname)(char *); /* Server routine */
- xdrproc_t inproc, outproc; /* in/out XDR procedures */
- char *nettype; /* nettype */
+rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
+ char *(*progname)(char *), xdrproc_t inproc, xdrproc_t outproc,
+ char *nettype)
{
struct netconfig *nconf;
int done = FALSE;
@@ -166,10 +168,8 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
if (((xdrbuf = malloc((unsigned)recvsz)) == NULL) ||
((netid = strdup(nconf->nc_netid)) == NULL)) {
warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
- if (xdrbuf != NULL)
- free(xdrbuf);
- if (netid != NULL)
- free(netid);
+ free(xdrbuf);
+ free(netid);
SVC_DESTROY(svcxprt);
break;
}
@@ -231,7 +231,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
mutex_unlock(&proglst_lock);
if (done == FALSE) {
- warnx("%s cant find suitable transport for %s",
+ warnx("%s can't find suitable transport for %s",
rpc_reg_msg, nettype);
return (-1);
}
@@ -244,9 +244,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
*/
static void
-universal(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
+universal(struct svc_req *rqstp, SVCXPRT *transp)
{
rpcprog_t prog;
rpcvers_t vers;
@@ -276,7 +274,7 @@ universal(rqstp, transp)
/* decode arguments into a CLEAN buffer */
xdrbuf = pl->p_xdrbuf;
/* Zero the arguments: reqd ! */
- (void) memset(xdrbuf, 0, sizeof (pl->p_recvsz));
+ (void) memset(xdrbuf, 0, (size_t)pl->p_recvsz);
/*
* Assuming that sizeof (xdrbuf) would be enough
* for the arguments; if not then the program
diff --git a/freebsd/lib/libc/rpc/svc_vc.c b/freebsd/lib/libc/rpc/svc_vc.c
index 5b17ca4b..5b4c7bd3 100644
--- a/freebsd/lib/libc/rpc/svc_vc.c
+++ b/freebsd/lib/libc/rpc/svc_vc.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include "reentrant.h"
-#include <sys/types.h>
#include <rtems/bsd/sys/param.h>
#include <sys/poll.h>
#include <sys/socket.h>
@@ -125,12 +124,9 @@ struct cf_conn { /* kept in xprt->xp_p1 for actual connection */
* 0 => use the system default.
*/
SVCXPRT *
-svc_vc_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_vc_create(int fd, u_int sendsize, u_int recvsize)
{
- SVCXPRT *xprt;
+ SVCXPRT *xprt = NULL;
struct cf_rendezvous *r = NULL;
struct __rpc_sockinfo si;
struct sockaddr_storage sslocal;
@@ -188,10 +184,7 @@ cleanup_svc_vc_create:
* descriptor as its first input.
*/
SVCXPRT *
-svc_fd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_fd_create(int fd, u_int sendsize, u_int recvsize)
{
struct sockaddr_storage ss;
socklen_t slen;
@@ -245,10 +238,7 @@ freedata:
}
static SVCXPRT *
-makefd_xprt(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+makefd_xprt(int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt;
struct cf_conn *cd;
@@ -274,7 +264,7 @@ makefd_xprt(fd, sendsize, recvsize)
xprt, read_vc, write_vc);
xprt->xp_p1 = cd;
xprt->xp_verf.oa_base = cd->verf_body;
- svc_vc_ops(xprt); /* truely deals with calls */
+ svc_vc_ops(xprt); /* truly deals with calls */
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
xprt->xp_fd = fd;
if (__rpc_fd2sockinfo(fd, &si) && __rpc_sockinfo2netid(&si, &netid))
@@ -287,15 +277,13 @@ done:
/*ARGSUSED*/
static bool_t
-rendezvous_request(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+rendezvous_request(SVCXPRT *xprt, struct rpc_msg *msg)
{
int sock, flags;
struct cf_rendezvous *r;
struct cf_conn *cd;
- struct sockaddr_storage addr;
- socklen_t len;
+ struct sockaddr_storage addr, sslocal;
+ socklen_t len, slen;
struct __rpc_sockinfo si;
SVCXPRT *newxprt;
fd_set cleanfds;
@@ -360,6 +348,20 @@ again:
__xdrrec_setnonblock(&cd->xdrs, cd->maxrec);
} else
cd->nonblock = FALSE;
+ slen = sizeof(struct sockaddr_storage);
+ if(_getsockname(sock, (struct sockaddr *)(void *)&sslocal, &slen) < 0) {
+ warnx("svc_vc_create: could not retrieve local addr");
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0;
+ } else {
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = sslocal.ss_len;
+ newxprt->xp_ltaddr.buf = mem_alloc((size_t)sslocal.ss_len);
+ if (newxprt->xp_ltaddr.buf == NULL) {
+ warnx("svc_vc_create: no mem for local addr");
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0;
+ } else {
+ memcpy(newxprt->xp_ltaddr.buf, &sslocal, (size_t)sslocal.ss_len);
+ }
+ }
gettimeofday(&cd->last_recv_time, NULL);
@@ -368,16 +370,14 @@ again:
/*ARGSUSED*/
static enum xprt_stat
-rendezvous_stat(xprt)
- SVCXPRT *xprt;
+rendezvous_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
static void
-svc_vc_destroy(xprt)
- SVCXPRT *xprt;
+svc_vc_destroy(SVCXPRT *xprt)
{
assert(xprt != NULL);
@@ -386,8 +386,7 @@ svc_vc_destroy(xprt)
}
static void
-__svc_vc_dodestroy(xprt)
- SVCXPRT *xprt;
+__svc_vc_dodestroy(SVCXPRT *xprt)
{
struct cf_conn *cd;
struct cf_rendezvous *r;
@@ -410,28 +409,20 @@ __svc_vc_dodestroy(xprt)
mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen);
if (xprt->xp_ltaddr.buf)
mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen);
- if (xprt->xp_tp)
- free(xprt->xp_tp);
- if (xprt->xp_netid)
- free(xprt->xp_netid);
+ free(xprt->xp_tp);
+ free(xprt->xp_netid);
svc_xprt_free(xprt);
}
/*ARGSUSED*/
static bool_t
-svc_vc_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static bool_t
-svc_vc_rendezvous_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_vc_rendezvous_control(SVCXPRT *xprt, const u_int rq, void *in)
{
struct cf_rendezvous *cfp;
@@ -459,10 +450,7 @@ svc_vc_rendezvous_control(xprt, rq, in)
* fatal for the connection.
*/
static int
-read_vc(xprtp, buf, len)
- void *xprtp;
- void *buf;
- int len;
+read_vc(void *xprtp, void *buf, int len)
{
SVCXPRT *xprt;
int sock;
@@ -522,10 +510,7 @@ fatal_err:
* Any error is fatal and the connection is closed.
*/
static int
-write_vc(xprtp, buf, len)
- void *xprtp;
- void *buf;
- int len;
+write_vc(void *xprtp, void *buf, int len)
{
SVCXPRT *xprt;
int i, cnt;
@@ -569,8 +554,7 @@ write_vc(xprtp, buf, len)
}
static enum xprt_stat
-svc_vc_stat(xprt)
- SVCXPRT *xprt;
+svc_vc_stat(SVCXPRT *xprt)
{
struct cf_conn *cd;
@@ -586,9 +570,7 @@ svc_vc_stat(xprt)
}
static bool_t
-svc_vc_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct cf_conn *cd;
XDR *xdrs;
@@ -616,10 +598,7 @@ svc_vc_recv(xprt, msg)
}
static bool_t
-svc_vc_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_vc_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct cf_conn *cd;
@@ -630,10 +609,7 @@ svc_vc_getargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_vc_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_vc_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
XDR *xdrs;
@@ -647,9 +623,7 @@ svc_vc_freeargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_vc_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct cf_conn *cd;
XDR *xdrs;
@@ -691,8 +665,7 @@ svc_vc_reply(xprt, msg)
}
static void
-svc_vc_ops(xprt)
- SVCXPRT *xprt;
+svc_vc_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -715,8 +688,7 @@ svc_vc_ops(xprt)
}
static void
-svc_vc_rendezvous_ops(xprt)
- SVCXPRT *xprt;
+svc_vc_rendezvous_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -730,7 +702,7 @@ svc_vc_rendezvous_ops(xprt)
ops.xp_reply =
(bool_t (*)(SVCXPRT *, struct rpc_msg *))abort;
ops.xp_freeargs =
- (bool_t (*)(SVCXPRT *, xdrproc_t, void *))abort,
+ (bool_t (*)(SVCXPRT *, xdrproc_t, void *))abort;
ops.xp_destroy = svc_vc_destroy;
ops2.xp_control = svc_vc_rendezvous_control;
}