diff options
Diffstat (limited to 'freebsd/lib/libc/rpc/clnt_dg.c')
-rw-r--r-- | freebsd/lib/libc/rpc/clnt_dg.c | 69 |
1 files changed, 31 insertions, 38 deletions
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); |