Libraries updates and cleanup

* Updating common/lib
 * Updating lib/csu
 * Updating lib/libc
 * Updating libexec/ld.elf_so
 * Corrected test on __minix in featuretest to actually follow the
   meaning of the comment.
 * Cleaned up _REENTRANT-related defintions.
 * Disabled -D_REENTRANT for libfetch
 * Removing some unneeded __NBSD_LIBC defines and tests

Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
2012-11-15 12:06:41 +01:00
parent f6aac1c3b5
commit f14fb60209
1285 changed files with 44244 additions and 14308 deletions

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.17 2008/10/25 19:07:26 mrg Exp $
# $NetBSD: Makefile.inc,v 1.21 2012/08/10 12:20:10 joerg Exp $
# librpc sources
.PATH: ${.CURDIR}/rpc
@@ -14,7 +14,7 @@ SRCS+= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \
svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_generic.c svc_raw.c \
svc_run.c svc_simple.c svc_vc.c \
xdr.c xdr_array.c xdr_float.c xdr_mem.c xdr_rec.c xdr_reference.c \
xdr_stdio.c __rpc_getxid.c
xdr_stdio.c xdr_sizeof.c __rpc_getxid.c
CPPFLAGS+= -DPORTMAP
@@ -157,6 +157,7 @@ MLINKS+= bindresvport.3 bindresvport_sa.3 \
xdr.3 xdr_reference.3 \
xdr.3 xdr_setpos.3 \
xdr.3 xdr_short.3 \
xdr.3 xdr_sizeof.3 \
xdr.3 xdrstdio_create.3 \
xdr.3 xdr_string.3 \
xdr.3 xdr_u_char.3 \
@@ -166,3 +167,8 @@ MLINKS+= bindresvport.3 bindresvport_sa.3 \
xdr.3 xdr_vector.3 \
xdr.3 xdr_void.3 \
xdr.3 xdr_wrapstring.3
# XXX
.if ${HAVE_GCC:U} == 45 || ${MACHINE} == "vax"
COPTS.xdr_float.c+= -fno-strict-aliasing
.endif

View File

@@ -1,4 +1,4 @@
/* $NetBSD: auth_none.c,v 1.14 2001/01/16 15:46:52 lukem Exp $ */
/* $NetBSD: auth_none.c,v 1.15 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: auth_none.c,v 1.14 2001/01/16 15:46:52 lukem Exp $");
__RCSID("$NetBSD: auth_none.c,v 1.15 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -66,11 +66,11 @@ __weak_alias(authnone_create,_authnone_create)
* Authenticator operations routines
*/
static bool_t authnone_marshal __P((AUTH *, XDR *));
static void authnone_verf __P((AUTH *));
static bool_t authnone_validate __P((AUTH *, struct opaque_auth *));
static bool_t authnone_refresh __P((AUTH *));
static void authnone_destroy __P((AUTH *));
static bool_t authnone_marshal(AUTH *, XDR *);
static void authnone_verf(AUTH *);
static bool_t authnone_validate(AUTH *, struct opaque_auth *);
static bool_t authnone_refresh(AUTH *);
static void authnone_destroy(AUTH *);
static const struct auth_ops ops = {
authnone_verf,
@@ -87,7 +87,7 @@ static struct authnone_private {
} *authnone_private;
AUTH *
authnone_create()
authnone_create(void)
{
struct authnone_private *ap = authnone_private;
XDR xdr_stream;
@@ -115,9 +115,7 @@ authnone_create()
/*ARGSUSED*/
static bool_t
authnone_marshal(client, xdrs)
AUTH *client;
XDR *xdrs;
authnone_marshal(AUTH *client, XDR *xdrs)
{
struct authnone_private *ap = authnone_private;
@@ -131,16 +129,13 @@ authnone_marshal(client, xdrs)
/*ARGSUSED*/
static void
authnone_verf(client)
AUTH *client;
authnone_verf(AUTH *client)
{
}
/*ARGSUSED*/
static bool_t
authnone_validate(client, auth)
AUTH *client;
struct opaque_auth *auth;
authnone_validate(AUTH *client, struct opaque_auth *auth)
{
return (TRUE);
@@ -148,8 +143,7 @@ authnone_validate(client, auth)
/*ARGSUSED*/
static bool_t
authnone_refresh(client)
AUTH *client;
authnone_refresh(AUTH *client)
{
return (FALSE);
@@ -157,7 +151,6 @@ authnone_refresh(client)
/*ARGSUSED*/
static void
authnone_destroy(client)
AUTH *client;
authnone_destroy(AUTH *client)
{
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: auth_unix.c,v 1.22 2009/01/11 02:46:29 christos Exp $ */
/* $NetBSD: auth_unix.c,v 1.23 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: auth_unix.c,v 1.22 2009/01/11 02:46:29 christos Exp $");
__RCSID("$NetBSD: auth_unix.c,v 1.23 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -74,13 +74,13 @@ __weak_alias(authunix_create_default,_authunix_create_default)
/* auth_unix.c */
static void authunix_nextverf __P((AUTH *));
static bool_t authunix_marshal __P((AUTH *, XDR *));
static bool_t authunix_validate __P((AUTH *, struct opaque_auth *));
static bool_t authunix_refresh __P((AUTH *));
static void authunix_destroy __P((AUTH *));
static void marshal_new_auth __P((AUTH *));
static const struct auth_ops *authunix_ops __P((void));
static void authunix_nextverf(AUTH *);
static bool_t authunix_marshal(AUTH *, XDR *);
static bool_t authunix_validate(AUTH *, struct opaque_auth *);
static bool_t authunix_refresh(AUTH *);
static void authunix_destroy(AUTH *);
static void marshal_new_auth(AUTH *);
static const struct auth_ops *authunix_ops(void);
/*
* This struct is pointed to by the ah_private field of an auth_handle.
@@ -99,12 +99,7 @@ struct audata {
* Returns an auth handle with the given stuff in it.
*/
AUTH *
authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
int uid;
int gid;
int len;
int *aup_gids;
authunix_create(char *machname, int uid, int gid, int len, int *aup_gids)
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
@@ -190,7 +185,7 @@ authunix_create(machname, uid, gid, len, aup_gids)
* syscalls.
*/
AUTH *
authunix_create_default()
authunix_create_default(void)
{
int len;
char machname[MAXHOSTNAMELEN + 1];
@@ -216,16 +211,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;
@@ -237,9 +229,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;
@@ -271,8 +261,7 @@ authunix_validate(auth, verf)
}
static bool_t
authunix_refresh(auth)
AUTH *auth;
authunix_refresh(AUTH *auth)
{
struct audata *au = AUTH_PRIVATE(auth);
struct authunix_parms aup;
@@ -316,8 +305,7 @@ done:
}
static void
authunix_destroy(auth)
AUTH *auth;
authunix_destroy(AUTH *auth)
{
struct audata *au;
@@ -342,8 +330,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;
@@ -362,7 +349,7 @@ marshal_new_auth(auth)
}
static const struct auth_ops *
authunix_ops()
authunix_ops(void)
{
static struct auth_ops ops;
#ifdef _REENTRANT

View File

@@ -1,4 +1,4 @@
/* $NetBSD: authunix_prot.c,v 1.13 2006/05/11 17:11:57 mrg Exp $ */
/* $NetBSD: authunix_prot.c,v 1.15 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: authunix_prot.c,v 1.13 2006/05/11 17:11:57 mrg Exp $");
__RCSID("$NetBSD: authunix_prot.c,v 1.15 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -63,9 +63,7 @@ __weak_alias(xdr_authunix_parms,_xdr_authunix_parms)
* 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)
{
_DIAGASSERT(xdrs != NULL);
@@ -76,7 +74,8 @@ xdr_authunix_parms(xdrs, p)
&& xdr_int(xdrs, &(p->aup_uid))
&& xdr_int(xdrs, &(p->aup_gid))
&& xdr_array(xdrs, (char **)(void *)&(p->aup_gids),
&(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
&(p->aup_len), NGRPS, (unsigned int)sizeof(int),
(xdrproc_t)xdr_int) ) {
return (TRUE);
}
return (FALSE);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: bindresvport.c,v 1.21 2003/01/18 11:29:03 thorpej Exp $ */
/* $NetBSD: bindresvport.c,v 1.23 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)bindresvport.c 1.8 88/02/08 SMI";
static char *sccsid = "@(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: bindresvport.c,v 1.21 2003/01/18 11:29:03 thorpej Exp $");
__RCSID("$NetBSD: bindresvport.c,v 1.23 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -65,9 +65,7 @@ __weak_alias(bindresvport_sa,_bindresvport_sa)
* Bind a socket to a privileged IP port
*/
int
bindresvport(sd, brsin)
int sd;
struct sockaddr_in *brsin;
bindresvport(int sd, struct sockaddr_in *brsin)
{
return bindresvport_sa(sd, (struct sockaddr *)(void *)brsin);
}
@@ -76,9 +74,7 @@ bindresvport(sd, brsin)
* 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 error, old;
struct sockaddr_storage myaddr;
@@ -136,7 +132,7 @@ bindresvport_sa(sd, sa)
if (error < 0)
return (error);
error = setsockopt(sd, proto, portrange, &portlow,
sizeof(portlow));
(socklen_t)sizeof(portlow));
if (error < 0)
return (error);
}
@@ -148,7 +144,7 @@ bindresvport_sa(sd, sa)
if (error < 0) {
if (setsockopt(sd, proto, portrange, &old,
sizeof(old)) < 0)
(socklen_t)sizeof(old)) < 0)
errno = saved_errno;
return (error);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_bcast.c,v 1.22 2010/03/07 23:49:14 dholland Exp $ */
/* $NetBSD: clnt_bcast.c,v 1.24 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_bcast.c,v 1.22 2010/03/07 23:49:14 dholland Exp $");
__RCSID("$NetBSD: clnt_bcast.c,v 1.24 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -122,9 +122,9 @@ struct broadif {
typedef TAILQ_HEAD(, broadif) broadlist_t;
int __rpc_getbroadifs __P((int, int, int, broadlist_t *));
void __rpc_freebroadifs __P((broadlist_t *));
int __rpc_broadenable __P((int, int, struct broadif *));
int __rpc_getbroadifs(int, int, int, broadlist_t *);
void __rpc_freebroadifs(broadlist_t *);
int __rpc_broadenable(int, int, struct broadif *);
int __rpc_lowvers = 0;
@@ -234,7 +234,8 @@ __rpc_broadenable(int af, int s, struct broadif *bip)
return -1;
} else
#endif
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &o, sizeof o) < 0)
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &o,
(socklen_t)sizeof(o)) == -1)
return -1;
return 0;
@@ -242,19 +243,18 @@ __rpc_broadenable(int af, int s, struct broadif *bip)
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 */
const char * 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, /* program number */
rpcvers_t vers, /* version number */
rpcproc_t proc, /* procedure number */
xdrproc_t xargs, /* xdr routine for args */
const char * 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 */
{
enum clnt_stat stat = RPC_SUCCESS; /* Return status */
XDR xdr_stream; /* XDR stream */
@@ -282,7 +282,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
broadlist_t nal;
} fdlist[MAXBCAST];
struct pollfd pfd[MAXBCAST];
size_t fdlistno = 0;
nfds_t fdlistno = 0;
struct r_rpcb_rmtcallargs barg; /* Remote arguments */
struct r_rpcb_rmtcallres bres; /* Remote results */
size_t outlen;
@@ -469,7 +469,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
if (!__rpc_lowvers)
if ((size_t)sendto(fdlist[i].fd, outbuf,
outlen, 0, (struct sockaddr*)addr,
(size_t)fdlist[i].asize) !=
(socklen_t)fdlist[i].asize) !=
outlen) {
warn("clnt_bcast: cannot send"
" broadcast packet");
@@ -491,7 +491,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
fdlist[i].proto == IPPROTO_UDP) {
if ((size_t)sendto(fdlist[i].fd,
outbuf_pmap, outlen_pmap, 0, addr,
(size_t)fdlist[i].asize) !=
(socklen_t)fdlist[i].asize) !=
outlen_pmap) {
warnx("clnt_bcast: "
"Cannot send "
@@ -665,17 +665,16 @@ done_broad:
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 */
const char * 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, /* program number */
rpcvers_t vers, /* version number */
rpcproc_t proc, /* procedure number */
xdrproc_t xargs, /* xdr routine for args */
const char * 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 */
{
enum clnt_stat dummy;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_dg.c,v 1.24 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: clnt_dg.c,v 1.26 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_dg.c,v 1.24 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: clnt_dg.c,v 1.26 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -71,15 +71,15 @@ __weak_alias(clnt_dg_create,_clnt_dg_create)
#define RPC_MAX_BACKOFF 30 /* seconds */
static struct clnt_ops *clnt_dg_ops __P((void));
static bool_t time_not_ok __P((struct timeval *));
static enum clnt_stat clnt_dg_call __P((CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval));
static void clnt_dg_geterr __P((CLIENT *, struct rpc_err *));
static bool_t clnt_dg_freeres __P((CLIENT *, xdrproc_t, caddr_t));
static void clnt_dg_abort __P((CLIENT *));
static bool_t clnt_dg_control __P((CLIENT *, u_int, char *));
static void clnt_dg_destroy __P((CLIENT *));
static struct clnt_ops *clnt_dg_ops(void);
static bool_t time_not_ok(struct timeval *);
static enum clnt_stat clnt_dg_call(CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval);
static void clnt_dg_geterr(CLIENT *, struct rpc_err *);
static bool_t clnt_dg_freeres(CLIENT *, xdrproc_t, caddr_t);
static void clnt_dg_abort(CLIENT *);
static bool_t clnt_dg_control(CLIENT *, u_int, char *);
static void clnt_dg_destroy(CLIENT *);
@@ -153,13 +153,13 @@ struct cu_data {
* If svcaddr is NULL, returns NULL.
*/
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, /* 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 */
{
CLIENT *cl = NULL; /* client handle */
struct cu_data *cu = NULL; /* private data */
@@ -299,14 +299,14 @@ err2:
}
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 */
const char * argsp; /* pointer to args */
xdrproc_t xresults; /* xdr routine for results */
caddr_t resultsp; /* pointer to results */
struct timeval utimeout; /* seconds to wait before giving up */
clnt_dg_call(
CLIENT * cl, /* client handle */
rpcproc_t proc, /* procedure number */
xdrproc_t xargs, /* xdr routine for args */
const char * argsp, /* pointer to args */
xdrproc_t xresults, /* xdr routine for results */
caddr_t resultsp, /* pointer to results */
struct timeval utimeout) /* seconds to wait before giving up */
{
struct cu_data *cu;
XDR *xdrs;
@@ -415,12 +415,12 @@ send_again:
cu->cu_error.re_status = RPC_CANTRECV;
goto out;
}
if (recvlen >= (ssize_t)sizeof(uint32_t) &&
(*((uint32_t *)(void *)(cu->cu_inbuf)) ==
*((uint32_t *)(void *)(cu->cu_outbuf)))) {
/* We now assume we have the proper reply. */
break;
}
if (recvlen >= (ssize_t)sizeof(uint32_t)) {
if (memcmp(cu->cu_inbuf, cu->cu_outbuf,
sizeof(uint32_t)) == 0)
/* Assume we have the proper reply. */
break;
}
}
if (n == -1) {
cu->cu_error.re_errno = errno;
@@ -497,9 +497,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;
@@ -511,10 +509,7 @@ clnt_dg_geterr(cl, errp)
}
static bool_t
clnt_dg_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
caddr_t res_ptr;
clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
{
struct cu_data *cu;
XDR *xdrs;
@@ -543,16 +538,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;
char *info;
clnt_dg_control(CLIENT *cl, u_int request, char *info)
{
struct cu_data *cu;
struct netbuf *addr;
@@ -692,8 +683,7 @@ clnt_dg_control(cl, request, info)
}
static void
clnt_dg_destroy(cl)
CLIENT *cl;
clnt_dg_destroy(CLIENT *cl)
{
struct cu_data *cu;
int cu_fd;
@@ -727,7 +717,7 @@ clnt_dg_destroy(cl)
}
static struct clnt_ops *
clnt_dg_ops()
clnt_dg_ops(void)
{
static struct clnt_ops ops;
#ifdef _REENTRANT
@@ -758,8 +748,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)
{
_DIAGASSERT(t != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_generic.c,v 1.27 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: clnt_generic.c,v 1.28 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_generic.c 1.32 89/03/16 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_generic.c,v 1.27 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: clnt_generic.c,v 1.28 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -72,13 +72,13 @@ __weak_alias(clnt_tli_create,_clnt_tli_create)
* if this can not be done.
*/
CLIENT *
clnt_create_vers(hostname, prog, vers_out, vers_low, vers_high, nettype)
const char *hostname;
rpcprog_t prog;
rpcvers_t *vers_out;
rpcvers_t vers_low;
rpcvers_t vers_high;
const char *nettype;
clnt_create_vers(
const char * hostname,
rpcprog_t prog,
rpcvers_t * vers_out,
rpcvers_t vers_low,
rpcvers_t vers_high,
const char * nettype)
{
CLIENT *clnt;
struct timeval to;
@@ -145,11 +145,11 @@ error:
* It calls clnt_tp_create();
*/
CLIENT *
clnt_create(hostname, prog, vers, nettype)
const char *hostname; /* server name */
rpcprog_t prog; /* program number */
rpcvers_t vers; /* version number */
const char *nettype; /* net type */
clnt_create(
const char * hostname, /* server name */
rpcprog_t prog, /* program number */
rpcvers_t vers, /* version number */
const char * nettype) /* net type */
{
struct netconfig *nconf;
CLIENT *clnt = NULL;
@@ -218,11 +218,11 @@ clnt_create(hostname, prog, vers, nettype)
* It finds out the server address from rpcbind and calls clnt_tli_create()
*/
CLIENT *
clnt_tp_create(hostname, prog, vers, nconf)
const char *hostname; /* server name */
rpcprog_t prog; /* program number */
rpcvers_t vers; /* version number */
const struct netconfig *nconf; /* net config struct */
clnt_tp_create(
const char * hostname, /* server name */
rpcprog_t prog, /* program number */
rpcvers_t vers, /* version number */
const struct netconfig *nconf) /* net config struct */
{
struct netbuf *svcaddr; /* servers address */
CLIENT *cl = NULL; /* client handle */
@@ -284,14 +284,14 @@ out:
* If sizes are 0; appropriate defaults will be chosen.
*/
CLIENT *
clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
int fd; /* fd */
const struct netconfig *nconf; /* netconfig structure */
const struct netbuf *svcaddr; /* servers address */
rpcprog_t prog; /* program number */
rpcvers_t vers; /* version number */
u_int sendsz; /* send size */
u_int recvsz; /* recv size */
clnt_tli_create(
int fd, /* fd */
const struct netconfig *nconf, /* netconfig structure */
const struct netbuf *svcaddr, /* servers address */
rpcprog_t prog, /* program number */
rpcvers_t vers, /* version number */
u_int sendsz, /* send size */
u_int recvsz) /* recv size */
{
CLIENT *cl; /* client handle */
bool_t madefd = FALSE; /* whether fd opened here */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_perror.c,v 1.28 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: clnt_perror.c,v 1.29 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: clnt_perror.c,v 1.28 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: clnt_perror.c,v 1.29 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -69,11 +69,11 @@ __weak_alias(clnt_sperror,_clnt_sperror)
static char *buf;
static size_t buflen;
static char *_buf __P((void));
static char *auth_errmsg __P((enum auth_stat));
static char *_buf(void);
static char *auth_errmsg(enum auth_stat);
static char *
_buf()
_buf(void)
{
buflen = 256;
@@ -86,9 +86,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;
@@ -179,9 +177,7 @@ clnt_sperror(rpch, s)
}
void
clnt_perror(rpch, s)
CLIENT *rpch;
const char *s;
clnt_perror(CLIENT *rpch, const char *s)
{
_DIAGASSERT(rpch != NULL);
@@ -222,8 +218,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;
const char *msg;
@@ -239,16 +234,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;
@@ -298,8 +291,7 @@ clnt_spcreateerror(s)
}
void
clnt_pcreateerror(s)
const char *s;
clnt_pcreateerror(const char *s)
{
_DIAGASSERT(s != NULL);
@@ -319,12 +311,11 @@ 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;
if (errnum < (sizeof(auth_errlist)/sizeof(auth_errlist[0])))
if (errnum < __arraycount(auth_errlist))
return __UNCONST(auth_errlist[errnum]);
return(NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_raw.c,v 1.29 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: clnt_raw.c,v 1.30 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: clnt_raw.c,v 1.29 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: clnt_raw.c,v 1.30 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -85,22 +85,20 @@ static struct clntraw_private {
u_int mcnt;
} *clntraw_private;
static enum clnt_stat clnt_raw_call __P((CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval));
static void clnt_raw_geterr __P((CLIENT *, struct rpc_err *));
static bool_t clnt_raw_freeres __P((CLIENT *, xdrproc_t, caddr_t));
static void clnt_raw_abort __P((CLIENT *));
static bool_t clnt_raw_control __P((CLIENT *, u_int, char *));
static void clnt_raw_destroy __P((CLIENT *));
static struct clnt_ops *clnt_raw_ops __P((void));
static enum clnt_stat clnt_raw_call(CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval);
static void clnt_raw_geterr(CLIENT *, struct rpc_err *);
static bool_t clnt_raw_freeres(CLIENT *, xdrproc_t, caddr_t);
static void clnt_raw_abort(CLIENT *);
static bool_t clnt_raw_control(CLIENT *, u_int, char *);
static void clnt_raw_destroy(CLIENT *);
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 = clntraw_private;
struct rpc_msg call_msg;
@@ -156,14 +154,8 @@ out:
/* ARGSUSED */
static enum clnt_stat
clnt_raw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
CLIENT *h;
rpcproc_t proc;
xdrproc_t xargs;
const char *argsp;
xdrproc_t xresults;
caddr_t resultsp;
struct timeval timeout;
clnt_raw_call(CLIENT *h, rpcproc_t proc, xdrproc_t xargs, const char *argsp,
xdrproc_t xresults, caddr_t resultsp, struct timeval timeout)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -254,19 +246,14 @@ call_again:
/*ARGSUSED*/
static void
clnt_raw_geterr(cl, error)
CLIENT *cl;
struct rpc_err *error;
clnt_raw_geterr(CLIENT *cl, struct rpc_err *error)
{
}
/* ARGSUSED */
static bool_t
clnt_raw_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
caddr_t res_ptr;
clnt_raw_freeres(CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -285,30 +272,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;
char *str;
clnt_raw_control(CLIENT *cl, u_int ui, char *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;
#ifdef _REENTRANT

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_simple.c,v 1.30 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: clnt_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_simple.c 1.49 89/01/31 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: clnt_simple.c,v 1.30 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: clnt_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -85,7 +85,7 @@ struct rpc_call_private {
static struct rpc_call_private *rpc_call_private_main;
#ifdef _REENTRANT
static void rpc_call_destroy __P((void *));
static void rpc_call_destroy(void *);
static void
rpc_call_destroy(void *vp)
@@ -118,15 +118,16 @@ rpc_call_setup(void)
* The total time available is 25 seconds.
*/
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, /* host name */
rpcprog_t prognum, /* program number */
rpcvers_t versnum, /* version number */
rpcproc_t procnum, /* procedure number */
xdrproc_t inproc, /* in XDR procedures */
const char * in, /* recv data */
xdrproc_t outproc, /* out XDR procedures */
char * out, /* send data */
const char * nettype) /* nettype */
{
struct rpc_call_private *rcp = (struct rpc_call_private *) 0;
enum clnt_stat clnt_stat;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: clnt_vc.c,v 1.17 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: clnt_vc.c,v 1.18 2012/03/13 21:13:44 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -36,7 +36,7 @@ static char *sccsid = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";
static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_vc.c,v 1.17 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: clnt_vc.c,v 1.18 2012/03/13 21:13:44 christos Exp $");
#endif
#endif
@@ -85,17 +85,17 @@ __weak_alias(clnt_vc_create,_clnt_vc_create)
#define MCALL_MSG_SIZE 24
static enum clnt_stat clnt_vc_call __P((CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval));
static void clnt_vc_geterr __P((CLIENT *, struct rpc_err *));
static bool_t clnt_vc_freeres __P((CLIENT *, xdrproc_t, caddr_t));
static void clnt_vc_abort __P((CLIENT *));
static bool_t clnt_vc_control __P((CLIENT *, u_int, char *));
static void clnt_vc_destroy __P((CLIENT *));
static struct clnt_ops *clnt_vc_ops __P((void));
static bool_t time_not_ok __P((struct timeval *));
static int read_vc __P((caddr_t, caddr_t, int));
static int write_vc __P((caddr_t, caddr_t, int));
static enum clnt_stat clnt_vc_call(CLIENT *, rpcproc_t, xdrproc_t,
const char *, xdrproc_t, caddr_t, struct timeval);
static void clnt_vc_geterr(CLIENT *, struct rpc_err *);
static bool_t clnt_vc_freeres(CLIENT *, xdrproc_t, caddr_t);
static void clnt_vc_abort(CLIENT *);
static bool_t clnt_vc_control(CLIENT *, u_int, char *);
static void clnt_vc_destroy(CLIENT *);
static struct clnt_ops *clnt_vc_ops(void);
static bool_t time_not_ok(struct timeval *);
static int read_vc(caddr_t, caddr_t, int);
static int write_vc(caddr_t, caddr_t, int);
struct ct_data {
int ct_fd;
@@ -154,13 +154,14 @@ static cond_t *vc_cv;
* fd should be an open socket
*/
CLIENT *
clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
int fd;
const struct netbuf *raddr;
rpcprog_t prog;
rpcvers_t vers;
u_int sendsz;
u_int recvsz;
clnt_vc_create(
int fd,
const struct netbuf *raddr,
rpcprog_t prog,
rpcvers_t vers,
u_int sendsz,
u_int recvsz
)
{
CLIENT *h;
struct ct_data *ct = NULL;
@@ -314,14 +315,15 @@ fooy:
}
static enum clnt_stat
clnt_vc_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
CLIENT *h;
rpcproc_t proc;
xdrproc_t xdr_args;
const char *args_ptr;
xdrproc_t xdr_results;
caddr_t results_ptr;
struct timeval timeout;
clnt_vc_call(
CLIENT *h,
rpcproc_t proc,
xdrproc_t xdr_args,
const char *args_ptr,
xdrproc_t xdr_results,
caddr_t results_ptr,
struct timeval timeout
)
{
struct ct_data *ct;
XDR *xdrs;
@@ -444,9 +446,10 @@ call_again:
}
static void
clnt_vc_geterr(h, errp)
CLIENT *h;
struct rpc_err *errp;
clnt_vc_geterr(
CLIENT *h,
struct rpc_err *errp
)
{
struct ct_data *ct;
@@ -458,10 +461,11 @@ clnt_vc_geterr(h, errp)
}
static bool_t
clnt_vc_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
caddr_t res_ptr;
clnt_vc_freeres(
CLIENT *cl,
xdrproc_t xdr_res,
caddr_t res_ptr
)
{
struct ct_data *ct;
XDR *xdrs;
@@ -495,16 +499,16 @@ clnt_vc_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
clnt_vc_abort(cl)
CLIENT *cl;
clnt_vc_abort(CLIENT *cl)
{
}
static bool_t
clnt_vc_control(cl, request, info)
CLIENT *cl;
u_int request;
char *info;
clnt_vc_control(
CLIENT *cl,
u_int request,
char *info
)
{
struct ct_data *ct;
void *infop = info;
@@ -631,8 +635,7 @@ clnt_vc_control(cl, request, info)
static void
clnt_vc_destroy(cl)
CLIENT *cl;
clnt_vc_destroy(CLIENT *cl)
{
struct ct_data *ct;
#ifdef _REENTRANT
@@ -673,14 +676,12 @@ clnt_vc_destroy(cl)
* around for the rpc level.
*/
static int
read_vc(ctp, buf, len)
caddr_t ctp;
caddr_t buf;
int len;
read_vc(char *ctp, char *buf, int len)
{
struct ct_data *ct = (struct ct_data *)(void *)ctp;
struct pollfd fd;
struct timespec ts;
ssize_t nread;
if (len == 0)
return (0);
@@ -703,7 +704,7 @@ read_vc(ctp, buf, len)
}
break;
}
switch (len = read(ct->ct_fd, buf, (size_t)len)) {
switch (nread = read(ct->ct_fd, buf, (size_t)len)) {
case 0:
/* premature eof */
@@ -717,30 +718,28 @@ read_vc(ctp, buf, len)
ct->ct_error.re_status = RPC_CANTRECV;
break;
}
return (len);
return (int)nread;
}
static int
write_vc(ctp, buf, len)
caddr_t ctp;
caddr_t buf;
int len;
write_vc(char *ctp, char *buf, int len)
{
struct ct_data *ct = (struct ct_data *)(void *)ctp;
int i, cnt;
ssize_t i;
size_t cnt;
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
if ((i = write(ct->ct_fd, buf, (size_t)cnt)) == -1) {
if ((i = write(ct->ct_fd, buf, cnt)) == -1) {
ct->ct_error.re_errno = errno;
ct->ct_error.re_status = RPC_CANTSEND;
return (-1);
}
}
return (len);
return len;
}
static struct clnt_ops *
clnt_vc_ops()
clnt_vc_ops(void)
{
static struct clnt_ops ops;
#ifdef _REENTRANT
@@ -772,8 +771,7 @@ 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)
{
_DIAGASSERT(t != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: getnetconfig.c,v 1.18 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: getnetconfig.c,v 1.20 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)getnetconfig.c 1.12 91/12/19 SMI";
#else
__RCSID("$NetBSD: getnetconfig.c,v 1.18 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: getnetconfig.c,v 1.20 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -135,9 +135,9 @@ struct netconfig_vars {
#define NC_INVALID 0
static int *__nc_error __P((void));
static int parse_ncp __P((char *, struct netconfig *));
static struct netconfig *dup_ncp __P((struct netconfig *));
static int *__nc_error(void);
static int parse_ncp(char *, struct netconfig *);
static struct netconfig *dup_ncp(struct netconfig *);
static FILE *nc_file; /* for netconfig db */
@@ -157,7 +157,7 @@ __nc_error_setup(void)
#endif
static int *
__nc_error()
__nc_error(void)
{
#ifdef _REENTRANT
int *nc_addr = NULL;
@@ -207,7 +207,7 @@ __nc_error()
* the netconfig database is not present).
*/
void *
setnetconfig()
setnetconfig(void)
{
struct netconfig_vars *nc_vars;
@@ -220,7 +220,7 @@ setnetconfig()
* handle without reopening the netconfig db.
*/
ni.ref++;
if ((nc_file != NULL) || (nc_file = fopen(NETCONFIG, "r")) != NULL) {
if ((nc_file != NULL) || (nc_file = fopen(NETCONFIG, "re")) != NULL) {
nc_vars->valid = NC_VALID;
nc_vars->flag = 0;
nc_vars->nc_configs = ni.head;
@@ -242,8 +242,7 @@ setnetconfig()
*/
struct netconfig *
getnetconfig(handlep)
void *handlep;
getnetconfig(void *handlep)
{
struct netconfig_vars *ncp = (struct netconfig_vars *)handlep;
char *stringp; /* tmp string pointer */
@@ -361,8 +360,7 @@ getnetconfig(handlep)
* previously).
*/
int
endnetconfig(handlep)
void *handlep;
endnetconfig(void *handlep)
{
struct netconfig_vars *nc_handlep = (struct netconfig_vars *)handlep;
@@ -421,8 +419,7 @@ endnetconfig(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 */
@@ -498,8 +495,7 @@ getnetconfigent(netid)
*/
void
freenetconfigent(netconfigp)
struct netconfig *netconfigp;
freenetconfigent(struct netconfig *netconfigp)
{
if (netconfigp != NULL) {
/* holds all netconfigp's strings */
@@ -523,9 +519,9 @@ freenetconfigent(netconfigp)
*/
static int
parse_ncp(stringp, ncp)
char *stringp; /* string to parse */
struct netconfig *ncp; /* where to put results */
parse_ncp(
char *stringp, /* string to parse */
struct netconfig *ncp) /* where to put results */
{
char *tokenp; /* for processing tokens */
char *lasts;
@@ -609,7 +605,7 @@ parse_ncp(stringp, ncp)
* Returns a string describing the reason for failure.
*/
char *
nc_sperror()
nc_sperror(void)
{
const char *message;
@@ -636,8 +632,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)
{
_DIAGASSERT(s != NULL);
@@ -649,8 +644,7 @@ 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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: getnetpath.c,v 1.14 2008/05/24 16:04:15 christos Exp $ */
/* $NetBSD: getnetpath.c,v 1.16 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)getnetpath.c 1.11 91/12/19 SMI";
#else
__RCSID("$NetBSD: getnetpath.c,v 1.14 2008/05/24 16:04:15 christos Exp $");
__RCSID("$NetBSD: getnetpath.c,v 1.16 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -78,7 +78,7 @@ struct netpath_vars {
#define NP_VALID 0xf00d
#define NP_INVALID 0
char *_get_next_token __P((char *, int));
char *_get_next_token(char *, int);
/*
@@ -93,7 +93,7 @@ char *_get_next_token __P((char *, int));
*/
void *
setnetpath()
setnetpath(void)
{
struct netpath_vars *np_sessionp; /* this session's variables */
char *npp; /* NETPATH env variable */
@@ -147,8 +147,7 @@ setnetpath()
*/
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 */
@@ -207,8 +206,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: getrpcent.c,v 1.21 2004/08/16 02:47:54 ginsbach Exp $ */
/* $NetBSD: getrpcent.c,v 1.22 2011/10/15 23:00:02 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
#if 0
static char *sccsid = "@(#)getrpcent.c 1.14 91/03/11 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: getrpcent.c,v 1.21 2004/08/16 02:47:54 ginsbach Exp $");
__RCSID("$NetBSD: getrpcent.c,v 1.22 2011/10/15 23:00:02 christos Exp $");
#endif
#endif
@@ -140,7 +140,7 @@ setrpcent(int f)
if (d == 0)
return;
if (d->rpcf == NULL)
d->rpcf = fopen(RPCDB, "r");
d->rpcf = fopen(RPCDB, "re");
else
rewind(d->rpcf);
d->stayopen |= f;
@@ -166,7 +166,7 @@ getrpcent(void)
if (d == 0)
return(NULL);
if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "r")) == NULL)
if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "re")) == NULL)
return (NULL);
if (fgets(d->line, BUFSIZ, d->rpcf) == NULL)
return (NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: getrpcport.c,v 1.16 2000/01/22 22:19:18 mycroft Exp $ */
/* $NetBSD: getrpcport.c,v 1.17 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)getrpcport.c 1.3 87/08/11 SMI";
static char *sccsid = "@(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: getrpcport.c,v 1.16 2000/01/22 22:19:18 mycroft Exp $");
__RCSID("$NetBSD: getrpcport.c,v 1.17 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -61,9 +61,7 @@ __weak_alias(getrpcport,_getrpcport)
#endif
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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: mt_misc.c,v 1.8 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: mt_misc.c,v 1.9 2012/03/20 17:14:50 matt Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: mt_misc.c,v 1.8 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: mt_misc.c,v 1.9 2012/03/20 17:14:50 matt Exp $");
#endif
#include "namespace.h"
@@ -112,7 +112,7 @@ __rpc_createerr_setup(void)
#endif /* _REENTRANT */
struct rpc_createerr*
__rpc_createerr()
__rpc_createerr(void)
{
#ifdef _REENTRANT
struct rpc_createerr *rce_addr = 0;
@@ -134,4 +134,3 @@ __rpc_createerr()
return &rpc_createerr;
#endif
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pmap_getmaps.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */
/* $NetBSD: pmap_getmaps.c,v 1.17 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: pmap_getmaps.c,v 1.16 2000/07/06 03:10:34 christos Exp $");
__RCSID("$NetBSD: pmap_getmaps.c,v 1.17 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -77,8 +77,7 @@ __weak_alias(pmap_getmaps,_pmap_getmaps)
* 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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pmap_prot.c,v 1.10 2000/01/22 22:19:18 mycroft Exp $ */
/* $NetBSD: pmap_prot.c,v 1.11 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: pmap_prot.c,v 1.10 2000/01/22 22:19:18 mycroft Exp $");
__RCSID("$NetBSD: pmap_prot.c,v 1.11 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -60,9 +60,7 @@ __weak_alias(xdr_pmap,_xdr_pmap)
bool_t
xdr_pmap(xdrs, regs)
XDR *xdrs;
struct pmap *regs;
xdr_pmap(XDR *xdrs, struct pmap *regs)
{
_DIAGASSERT(xdrs != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pmap_prot2.c,v 1.15 2001/01/04 14:42:20 lukem Exp $ */
/* $NetBSD: pmap_prot2.c,v 1.16 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: pmap_prot2.c,v 1.15 2001/01/04 14:42:20 lukem Exp $");
__RCSID("$NetBSD: pmap_prot2.c,v 1.16 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -97,9 +97,7 @@ __weak_alias(xdr_pmaplist,_xdr_pmaplist)
* 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
@@ -141,9 +139,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)
{
_DIAGASSERT(xdrs != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pmap_rmt.c,v 1.30 2010/03/23 20:28:59 drochner Exp $ */
/* $NetBSD: pmap_rmt.c,v 1.33 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: pmap_rmt.c,v 1.30 2010/03/23 20:28:59 drochner Exp $");
__RCSID("$NetBSD: pmap_rmt.c,v 1.33 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -85,14 +85,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;
@@ -131,9 +126,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;
@@ -165,9 +158,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;
@@ -175,7 +166,7 @@ xdr_rmtcallres(xdrs, crp)
_DIAGASSERT(crp != NULL);
port_ptr = (caddr_t)(void *)crp->port_ptr;
if (xdr_reference(xdrs, &port_ptr, sizeof (u_long),
if (xdr_reference(xdrs, &port_ptr, (u_int)sizeof(u_long),
(xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
crp->port_ptr = (u_long *)(void *)port_ptr;
return ((*(crp->xdr_results))(xdrs, crp->results_ptr));

View File

@@ -1,6 +1,6 @@
.\" @(#)rpc.3n 1.31 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
.\" $NetBSD: rpc.3,v 1.22 2010/03/22 19:30:54 joerg Exp $
.\" $NetBSD: rpc.3,v 1.24 2012/05/13 15:47:38 wiz Exp $
.Dd May 7, 1993
.Dt RPC 3
.Os
@@ -254,9 +254,8 @@ enum xdr_op {
* structure of the data type to be decoded. If this points to 0,
* then the type routines should allocate dynamic storage of the
* appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
typedef bool_t (*xdrproc_t)();
typedef bool_t (*xdrproc_t)(XDR *, const void *);
/*
* The XDR handle.
@@ -312,92 +311,92 @@ pages on which they are described:
.Bl -column "authunix_create_default()" "rpc_clnt_create(3)"
.It Em "RPC Routine" Ta Em "Manual Reference Page"
.Pp
.It Fn auth_destroy Ta Xr rpc_clnt_auth 3 ,
.It Fn authdes_create Ta Xr rpc_soc 3 ,
.It Fn authnone_create Ta Xr rpc_clnt_auth 3 ,
.It Fn authsys_create Ta Xr rpc_clnt_auth 3 ,
.It Fn authsys_create_default Ta Xr rpc_clnt_auth 3 ,
.It Fn authunix_create Ta Xr rpc_soc 3 ,
.It Fn authunix_create_default Ta Xr rpc_soc 3 ,
.It Fn callrpc Ta Xr rpc_soc 3 ,
.It Fn clnt_broadcast Ta Xr rpc_soc 3 ,
.It Fn clnt_call Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_control Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_create Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_destroy Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_dg_create Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_freeres Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_geterr Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_pcreateerror Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_perrno Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_perror Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_raw_create Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_spcreateerror Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_sperrno Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_sperror Ta Xr rpc_clnt_calls 3 ,
.It Fn clnt_tli_create Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_tp_create Ta Xr rpc_clnt_create 3 ,
.It Fn clnt_udpcreate Ta Xr rpc_soc 3 ,
.It Fn clnt_vc_create Ta Xr rpc_clnt_create 3 ,
.It Fn clntraw_create Ta Xr rpc_soc 3 ,
.It Fn clnttcp_create Ta Xr rpc_soc 3 ,
.It Fn clntudp_bufcreate Ta Xr rpc_soc 3 ,
.It Fn get_myaddress Ta Xr rpc_soc 3 ,
.It Fn pmap_getmaps Ta Xr rpc_soc 3 ,
.It Fn pmap_getport Ta Xr rpc_soc 3 ,
.It Fn pmap_rmtcall Ta Xr rpc_soc 3 ,
.It Fn pmap_set Ta Xr rpc_soc 3 ,
.It Fn pmap_unset Ta Xr rpc_soc 3 ,
.It Fn registerrpc Ta Xr rpc_soc 3 ,
.It Fn rpc_broadcast Ta Xr rpc_clnt_calls 3 ,
.It Fn rpc_broadcast_exp Ta Xr rpc_clnt_calls 3 ,
.It Fn rpc_call Ta Xr rpc_clnt_calls 3 ,
.It Fn rpc_reg Ta Xr rpc_svc_calls 3 ,
.It Fn svc_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_destroy Ta Xr rpc_svc_create 3 ,
.It Fn svc_dg_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_dg_enablecache Ta Xr rpc_svc_calls 3 ,
.It Fn svc_fd_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_fds Ta Xr rpc_soc 3 ,
.It Fn svc_freeargs Ta Xr rpc_svc_reg 3 ,
.It Fn svc_getargs Ta Xr rpc_svc_reg 3 ,
.It Fn svc_getcaller Ta Xr rpc_soc 3 ,
.It Fn svc_getreq Ta Xr rpc_soc 3 ,
.It Fn svc_getreqset Ta Xr rpc_svc_calls 3 ,
.It Fn svc_getrpccaller Ta Xr rpc_svc_calls 3 ,
.It Fn svc_kerb_reg Ta Xr kerberos_rpc 3 ,
.It Fn svc_raw_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_reg Ta Xr rpc_svc_calls 3 ,
.It Fn svc_register Ta Xr rpc_soc 3 ,
.It Fn svc_run Ta Xr rpc_svc_reg 3 ,
.It Fn svc_sendreply Ta Xr rpc_svc_reg 3 ,
.It Fn svc_tli_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_tp_create Ta Xr rpc_svc_create 3 ,
.It Fn svc_unreg Ta Xr rpc_svc_calls 3 ,
.It Fn svc_unregister Ta Xr rpc_soc 3 ,
.It Fn svc_vc_create Ta Xr rpc_svc_create 3 ,
.It Fn svcerr_auth Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_decode Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_noproc Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_noprog Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_progvers Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_systemerr Ta Xr rpc_svc_err 3 ,
.It Fn svcerr_weakauth Ta Xr rpc_svc_err 3 ,
.It Fn svcfd_create Ta Xr rpc_soc 3 ,
.It Fn svcraw_create Ta Xr rpc_soc 3 ,
.It Fn svctcp_create Ta Xr rpc_soc 3 ,
.It Fn svcudp_bufcreate Ta Xr rpc_soc 3 ,
.It Fn svcudp_create Ta Xr rpc_soc 3 ,
.It Fn xdr_accepted_reply Ta Xr rpc_xdr 3 ,
.It Fn xdr_authsys_parms Ta Xr rpc_xdr 3 ,
.It Fn xdr_authunix_parms Ta Xr rpc_soc 3 ,
.It Fn xdr_callhdr Ta Xr rpc_xdr 3 ,
.It Fn xdr_callmsg Ta Xr rpc_xdr 3 ,
.It Fn xdr_opaque_auth Ta Xr rpc_xdr 3 ,
.It Fn xdr_rejected_reply Ta Xr rpc_xdr 3 ,
.It Fn xdr_replymsg Ta Xr rpc_xdr 3 ,
.It Fn xprt_register Ta Xr rpc_svc_calls 3 ,
.It Fn xprt_unregister Ta Xr rpc_svc_calls 3 ,
.It Fn auth_destroy Ta Xr rpc_clnt_auth 3
.It Fn authdes_create Ta Xr rpc_soc 3
.It Fn authnone_create Ta Xr rpc_clnt_auth 3
.It Fn authsys_create Ta Xr rpc_clnt_auth 3
.It Fn authsys_create_default Ta Xr rpc_clnt_auth 3
.It Fn authunix_create Ta Xr rpc_soc 3
.It Fn authunix_create_default Ta Xr rpc_soc 3
.It Fn callrpc Ta Xr rpc_soc 3
.It Fn clnt_broadcast Ta Xr rpc_soc 3
.It Fn clnt_call Ta Xr rpc_clnt_calls 3
.It Fn clnt_control Ta Xr rpc_clnt_create 3
.It Fn clnt_create Ta Xr rpc_clnt_create 3
.It Fn clnt_destroy Ta Xr rpc_clnt_create 3
.It Fn clnt_dg_create Ta Xr rpc_clnt_create 3
.It Fn clnt_freeres Ta Xr rpc_clnt_calls 3
.It Fn clnt_geterr Ta Xr rpc_clnt_calls 3
.It Fn clnt_pcreateerror Ta Xr rpc_clnt_create 3
.It Fn clnt_perrno Ta Xr rpc_clnt_calls 3
.It Fn clnt_perror Ta Xr rpc_clnt_calls 3
.It Fn clnt_raw_create Ta Xr rpc_clnt_create 3
.It Fn clnt_spcreateerror Ta Xr rpc_clnt_create 3
.It Fn clnt_sperrno Ta Xr rpc_clnt_calls 3
.It Fn clnt_sperror Ta Xr rpc_clnt_calls 3
.It Fn clnt_tli_create Ta Xr rpc_clnt_create 3
.It Fn clnt_tp_create Ta Xr rpc_clnt_create 3
.It Fn clnt_udpcreate Ta Xr rpc_soc 3
.It Fn clnt_vc_create Ta Xr rpc_clnt_create 3
.It Fn clntraw_create Ta Xr rpc_soc 3
.It Fn clnttcp_create Ta Xr rpc_soc 3
.It Fn clntudp_bufcreate Ta Xr rpc_soc 3
.It Fn get_myaddress Ta Xr rpc_soc 3
.It Fn pmap_getmaps Ta Xr rpc_soc 3
.It Fn pmap_getport Ta Xr rpc_soc 3
.It Fn pmap_rmtcall Ta Xr rpc_soc 3
.It Fn pmap_set Ta Xr rpc_soc 3
.It Fn pmap_unset Ta Xr rpc_soc 3
.It Fn registerrpc Ta Xr rpc_soc 3
.It Fn rpc_broadcast Ta Xr rpc_clnt_calls 3
.It Fn rpc_broadcast_exp Ta Xr rpc_clnt_calls 3
.It Fn rpc_call Ta Xr rpc_clnt_calls 3
.It Fn rpc_reg Ta Xr rpc_svc_calls 3
.It Fn svc_create Ta Xr rpc_svc_create 3
.It Fn svc_destroy Ta Xr rpc_svc_create 3
.It Fn svc_dg_create Ta Xr rpc_svc_create 3
.It Fn svc_dg_enablecache Ta Xr rpc_svc_calls 3
.It Fn svc_fd_create Ta Xr rpc_svc_create 3
.It Fn svc_fds Ta Xr rpc_soc 3
.It Fn svc_freeargs Ta Xr rpc_svc_reg 3
.It Fn svc_getargs Ta Xr rpc_svc_reg 3
.It Fn svc_getcaller Ta Xr rpc_soc 3
.It Fn svc_getreq Ta Xr rpc_soc 3
.It Fn svc_getreqset Ta Xr rpc_svc_calls 3
.It Fn svc_getrpccaller Ta Xr rpc_svc_calls 3
.It Fn svc_kerb_reg Ta Xr kerberos_rpc 3
.It Fn svc_raw_create Ta Xr rpc_svc_create 3
.It Fn svc_reg Ta Xr rpc_svc_calls 3
.It Fn svc_register Ta Xr rpc_soc 3
.It Fn svc_run Ta Xr rpc_svc_reg 3
.It Fn svc_sendreply Ta Xr rpc_svc_reg 3
.It Fn svc_tli_create Ta Xr rpc_svc_create 3
.It Fn svc_tp_create Ta Xr rpc_svc_create 3
.It Fn svc_unreg Ta Xr rpc_svc_calls 3
.It Fn svc_unregister Ta Xr rpc_soc 3
.It Fn svc_vc_create Ta Xr rpc_svc_create 3
.It Fn svcerr_auth Ta Xr rpc_svc_err 3
.It Fn svcerr_decode Ta Xr rpc_svc_err 3
.It Fn svcerr_noproc Ta Xr rpc_svc_err 3
.It Fn svcerr_noprog Ta Xr rpc_svc_err 3
.It Fn svcerr_progvers Ta Xr rpc_svc_err 3
.It Fn svcerr_systemerr Ta Xr rpc_svc_err 3
.It Fn svcerr_weakauth Ta Xr rpc_svc_err 3
.It Fn svcfd_create Ta Xr rpc_soc 3
.It Fn svcraw_create Ta Xr rpc_soc 3
.It Fn svctcp_create Ta Xr rpc_soc 3
.It Fn svcudp_bufcreate Ta Xr rpc_soc 3
.It Fn svcudp_create Ta Xr rpc_soc 3
.It Fn xdr_accepted_reply Ta Xr rpc_xdr 3
.It Fn xdr_authsys_parms Ta Xr rpc_xdr 3
.It Fn xdr_authunix_parms Ta Xr rpc_soc 3
.It Fn xdr_callhdr Ta Xr rpc_xdr 3
.It Fn xdr_callmsg Ta Xr rpc_xdr 3
.It Fn xdr_opaque_auth Ta Xr rpc_xdr 3
.It Fn xdr_rejected_reply Ta Xr rpc_xdr 3
.It Fn xdr_replymsg Ta Xr rpc_xdr 3
.It Fn xprt_register Ta Xr rpc_svc_calls 3
.It Fn xprt_unregister Ta Xr rpc_svc_calls 3
.El
.Sh FILES
.Pa /etc/netconfig

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpc_callmsg.c,v 1.18 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: rpc_callmsg.c,v 1.19 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: rpc_callmsg.c,v 1.18 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: rpc_callmsg.c,v 1.19 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -64,9 +64,7 @@ __weak_alias(xdr_callmsg,_xdr_callmsg)
* XDR a call message
*/
bool_t
xdr_callmsg(xdrs, cmsg)
XDR *xdrs;
struct rpc_msg *cmsg;
xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
{
int32_t *buf;
struct opaque_auth *oa;

View File

@@ -2,7 +2,7 @@
.\" Copyright 1989 AT&T
.\" @(#)rpc_clnt_create 1.5 89/07/24 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_clnt_create.3,v 1.11 2009/05/23 18:57:25 christos Exp $
.\" $NetBSD: rpc_clnt_create.3,v 1.12 2011/05/17 03:35:39 enami Exp $
.Dd May 23, 2009
.Dt RPC_CLNT_CREATE 3
.Os
@@ -84,8 +84,8 @@ is ignored in all subsequent calls.
Note:
If you set the timeout value to 0
.Fn clnt_control
immediately returns an error (
.Dv RPC_TIMEDOUT ) .
immediately returns an error
.Pq Dv RPC_TIMEDOUT .
Set the timeout parameter to 0 for batching calls.
.Bl -column CLSET_FD_NCLOSE "struct timeval *" "do not close fd on destroy"
.It Dv CLGET_SVC_ADDR Ta "struct netbuf *" Ta "get servers address"

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpc_dtablesize.c,v 1.14 1998/11/15 17:32:43 christos Exp $ */
/* $NetBSD: rpc_dtablesize.c,v 1.15 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";
static char *sccsid = "@(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: rpc_dtablesize.c,v 1.14 1998/11/15 17:32:43 christos Exp $");
__RCSID("$NetBSD: rpc_dtablesize.c,v 1.15 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -43,14 +43,14 @@ __RCSID("$NetBSD: rpc_dtablesize.c,v 1.14 1998/11/15 17:32:43 christos Exp $");
#include <unistd.h>
int _rpc_dtablesize __P((void)); /* XXX */
int _rpc_dtablesize(void); /* XXX */
/*
* Cache the result of sysconf(_SC_OPEN_MAX), so we don't have to do an
* expensive system call every time.
*/
int
_rpc_dtablesize()
_rpc_dtablesize(void)
{
static int size;
if (size == 0)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpc_generic.c,v 1.24 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: rpc_generic.c,v 1.26 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: rpc_generic.c,v 1.24 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: rpc_generic.c,v 1.26 2012/03/20 17:14:50 matt Exp $");
#endif
#include "namespace.h"
@@ -109,16 +109,16 @@ static const struct netid_af na_cvt[] = {
};
#if 0
static char *strlocase __P((char *));
static char *strlocase(char *);
#endif
static int getnettype __P((const char *));
static int getnettype(const char *);
/*
* Cache the result of getrlimit(), so we don't have to do an
* expensive call every time.
*/
int
__rpc_dtbsize()
__rpc_dtbsize(void)
{
static int tbsize;
struct rlimit rl;
@@ -142,9 +142,10 @@ __rpc_dtbsize()
*/
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) /* Size requested */
{
int maxsize, defsize;
@@ -171,8 +172,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:
@@ -191,8 +191,7 @@ __rpc_get_a_size(af)
#if 0
static char *
strlocase(p)
char *p;
strlocase(char *p)
{
char *t = p;
@@ -210,8 +209,7 @@ strlocase(p)
* If nettype is NULL, it defaults to NETPATH.
*/
static int
getnettype(nettype)
const char *nettype;
getnettype(const char *nettype)
{
int i;
@@ -248,8 +246,7 @@ __rpc_getconfigp_setup(void)
#endif
struct netconfig *
__rpc_getconfip(nettype)
const char *nettype;
__rpc_getconfip(const char *nettype)
{
char *netid;
char *netid_tcp = NULL;
@@ -334,8 +331,7 @@ __rpc_getconfip(nettype)
* __rpc_getconf().
*/
void *
__rpc_setconf(nettype)
const char *nettype;
__rpc_setconf(const char *nettype)
{
struct handle *handle;
@@ -380,8 +376,7 @@ __rpc_setconf(nettype)
* __rpc_setconf() should have been called previously.
*/
struct netconfig *
__rpc_getconf(vhandle)
void *vhandle;
__rpc_getconf(void *vhandle)
{
struct handle *handle;
struct netconfig *nconf;
@@ -457,8 +452,7 @@ __rpc_getconf(vhandle)
}
void
__rpc_endconf(vhandle)
void * vhandle;
__rpc_endconf(void *vhandle)
{
struct handle *handle;
@@ -479,8 +473,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};
@@ -496,8 +489,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;
@@ -649,8 +641,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
switch (af) {
case AF_INET:
sinp = nbuf->buf;
if (inet_ntop(af, &sinp->sin_addr, namebuf, sizeof namebuf)
== NULL)
if (inet_ntop(af, &sinp->sin_addr, namebuf,
(socklen_t)sizeof namebuf) == NULL)
return NULL;
port = ntohs(sinp->sin_port);
if (asprintf(&ret, "%s.%u.%u", namebuf, ((u_int32_t)port) >> 8,
@@ -660,8 +652,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
#ifdef INET6
case AF_INET6:
sin6 = nbuf->buf;
if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6)
== NULL)
if (inet_ntop(af, &sin6->sin6_addr, namebuf6,
(socklen_t)sizeof namebuf6) == NULL)
return NULL;
port = ntohs(sin6->sin6_port);
if (asprintf(&ret, "%s.%u.%u", namebuf6, ((u_int32_t)port) >> 8,
@@ -687,6 +679,7 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
struct netbuf *ret = NULL;
char *addrstr, *p;
unsigned port, portlo, porthi;
size_t len;
struct sockaddr_in *sinp;
#ifdef INET6
struct sockaddr_in6 *sin6;
@@ -765,7 +758,9 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
memset(sun, 0, sizeof *sun);
sun->sun_family = AF_LOCAL;
strncpy(sun->sun_path, addrstr, sizeof(sun->sun_path) - 1);
ret->len = ret->maxlen = sun->sun_len = SUN_LEN(sun);
len = SUN_LEN(sun);
_DIAGASSERT(__type_fit(uint8_t, len));
ret->len = ret->maxlen = sun->sun_len = (uint8_t)len;
ret->buf = sun;
break;
default:
@@ -893,5 +888,6 @@ __rpc_setnodelay(int fd, const struct __rpc_sockinfo *si)
int one = 1;
if (si->si_proto != IPPROTO_TCP)
return 0;
return setsockopt(fd, si->si_proto, TCP_NODELAY, &one, sizeof(one));
return setsockopt(fd, si->si_proto, TCP_NODELAY, &one,
(socklen_t)sizeof(one));
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpc_prot.c,v 1.18 2003/05/29 18:15:25 christos Exp $ */
/* $NetBSD: rpc_prot.c,v 1.20 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";
#else
__RCSID("$NetBSD: rpc_prot.c,v 1.18 2003/05/29 18:15:25 christos Exp $");
__RCSID("$NetBSD: rpc_prot.c,v 1.20 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -69,8 +69,8 @@ __weak_alias(xdr_rejected_reply,_xdr_rejected_reply)
__weak_alias(xdr_replymsg,_xdr_replymsg)
#endif
static void accepted __P((enum accept_stat, struct rpc_err *));
static void rejected __P((enum reject_stat, struct rpc_err *));
static void accepted(enum accept_stat, struct rpc_err *);
static void rejected(enum reject_stat, struct rpc_err *);
/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
@@ -79,9 +79,7 @@ static void rejected __P((enum reject_stat, struct rpc_err *));
* (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)
{
_DIAGASSERT(xdrs != NULL);
@@ -97,15 +95,14 @@ 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)
{
_DIAGASSERT(xdrs != NULL);
_DIAGASSERT(blkp != NULL);
return (xdr_opaque(xdrs, (caddr_t)(void *)blkp, sizeof(des_block)));
return (xdr_opaque(xdrs, (caddr_t)(void *)blkp,
(u_int)sizeof(des_block)));
}
/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
@@ -114,9 +111,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)
{
_DIAGASSERT(xdrs != NULL);
@@ -150,9 +145,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)
{
_DIAGASSERT(xdrs != NULL);
@@ -184,9 +177,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)
{
_DIAGASSERT(xdrs != NULL);
_DIAGASSERT(rmsg != NULL);
@@ -208,9 +199,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)
{
_DIAGASSERT(xdrs != NULL);
@@ -231,9 +220,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)
{
_DIAGASSERT(error != NULL);
@@ -272,9 +259,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)
{
_DIAGASSERT(error != NULL);
@@ -299,9 +284,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)
{
_DIAGASSERT(msg != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpc_soc.c,v 1.13 2010/12/08 02:06:38 joerg Exp $ */
/* $NetBSD: rpc_soc.c,v 1.16 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)rpc_soc.c 1.41 89/05/02 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: rpc_soc.c,v 1.13 2010/12/08 02:06:38 joerg Exp $");
__RCSID("$NetBSD: rpc_soc.c,v 1.16 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -97,23 +97,17 @@ __weak_alias(clnt_broadcast,_clnt_broadcast)
extern mutex_t rpcsoc_lock;
#endif
static CLIENT *clnt_com_create __P((struct sockaddr_in *, rpcprog_t, rpcvers_t,
int *, u_int, u_int, const char *));
static SVCXPRT *svc_com_create __P((int, u_int, u_int, const char *));
static bool_t rpc_wrap_bcast __P((char *, struct netbuf *, struct netconfig *));
static CLIENT *clnt_com_create(struct sockaddr_in *, rpcprog_t, rpcvers_t,
int *, u_int, u_int, const char *);
static SVCXPRT *svc_com_create(int, u_int, u_int, const char *);
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;
const char *tp;
clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers,
int *sockp, u_int sendsz, u_int recvsz, const char *tp)
{
CLIENT *cl;
int madefd = FALSE;
@@ -188,14 +182,7 @@ 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;
@@ -212,34 +199,23 @@ 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,
UDPMSGSIZE, UDPMSGSIZE);
}
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,
sendsz, recvsz, "tcp");
}
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);
}
@@ -248,11 +224,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;
const char *netid;
svc_com_create(int fd, u_int sendsize, u_int recvsize, const char *netid)
{
struct netconfig *nconf;
SVCXPRT *svc;
@@ -294,48 +266,38 @@ 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);
}
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)
{
_DIAGASSERT(addr != NULL);
@@ -351,11 +313,8 @@ get_myaddress(addr)
* For connectionless "udp" transport. Obsoleted by rpc_call().
*/
int
callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
char *host;
int prognum, versnum, procnum;
xdrproc_t inproc, outproc;
char *in, *out;
callrpc(char *host, int prognum, int versnum, int procnum,
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out)
{
return (int)rpc_call(host, (rpcprog_t)prognum, (rpcvers_t)versnum,
(rpcproc_t)procnum, inproc, in, outproc, out, "udp");
@@ -365,10 +324,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) __P((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,
(rpcproc_t)procnum, progname, inproc, outproc, __UNCONST("udp"));
@@ -389,10 +347,10 @@ static resultproc_t clnt_broadcast_result_main;
*/
/* 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, /* 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;
@@ -429,15 +387,15 @@ clnt_broadcast_setup(void)
* 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 */
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 */
clnt_broadcast(
u_long prog, /* program number */
u_long vers, /* version number */
u_long 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 */
{
#ifdef _REENTRANT
if (__isthreaded == 0)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpcb_clnt.c,v 1.25 2010/03/23 20:28:58 drochner Exp $ */
/* $NetBSD: rpcb_clnt.c,v 1.27 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rpcb_clnt.c 1.30 89/06/21 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: rpcb_clnt.c,v 1.25 2010/03/23 20:28:58 drochner Exp $");
__RCSID("$NetBSD: rpcb_clnt.c,v 1.27 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -107,15 +107,12 @@ static int cachesize;
extern int __rpc_lowvers;
static struct address_cache *check_cache __P((const char *, const char *));
static void delete_cache __P((struct netbuf *));
static void add_cache __P((const char *, const char *, struct netbuf *,
char *));
static CLIENT *getclnthandle __P((const char *, const struct netconfig *,
char **));
static CLIENT *local_rpcb __P((void));
static struct netbuf *got_entry __P((rpcb_entry_list_ptr,
const struct netconfig *));
static struct address_cache *check_cache(const char *, const char *);
static void delete_cache(struct netbuf *);
static void add_cache(const char *, const char *, struct netbuf *, char *);
static CLIENT *getclnthandle(const char *, const struct netconfig *, char **);
static CLIENT *local_rpcb(void);
static struct netbuf *got_entry(rpcb_entry_list_ptr, const struct netconfig *);
/*
* This routine adjusts the timeout used for calls to the remote rpcbind.
@@ -124,9 +121,7 @@ static struct netbuf *got_entry __P((rpcb_entry_list_ptr,
* 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)
{
_DIAGASSERT(info != NULL);
@@ -171,8 +166,7 @@ extern rwlock_t rpcbaddr_cache_lock;
*/
static struct address_cache *
check_cache(host, netid)
const char *host, *netid;
check_cache(const char *host, const char *netid)
{
struct address_cache *cptr;
@@ -195,8 +189,7 @@ check_cache(host, netid)
}
static void
delete_cache(addr)
struct netbuf *addr;
delete_cache(struct netbuf *addr)
{
struct address_cache *cptr, *prevptr = NULL;
@@ -224,10 +217,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;
@@ -313,10 +304,7 @@ out:
* rpcbind. Returns NULL on error 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;
@@ -442,7 +430,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;
@@ -466,13 +454,16 @@ local_rpcb()
goto try_nconf;
sun.sun_family = AF_LOCAL;
strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
nbuf.len = sun.sun_len = SUN_LEN(&sun);
tsize = SUN_LEN(&sun);
_DIAGASSERT(__type_fit(uint8_t, tsize));
nbuf.len = sun.sun_len = (uint8_t)tsize;
nbuf.maxlen = sizeof (struct sockaddr_un);
nbuf.buf = &sun;
tsize = __rpc_get_t_size(AF_LOCAL, 0, 0);
_DIAGASSERT(__type_fit(u_int, tsize));
client = clnt_vc_create(sock, &nbuf, (rpcprog_t)RPCBPROG,
(rpcvers_t)RPCBVERS, tsize, tsize);
(rpcvers_t)RPCBVERS, (u_int)tsize, (u_int)tsize);
if (client != NULL) {
/* XXX - mark the socket to be closed in destructor */
@@ -543,11 +534,9 @@ try_nconf:
* Calls the rpcbind service to do the mapping.
*/
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, /* Network structure of transport */
const struct netbuf *address) /* Services netconfig address */
{
CLIENT *client;
bool_t rslt = FALSE;
@@ -602,10 +591,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;
@@ -640,9 +626,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;
@@ -689,12 +673,8 @@ got_entry(relp, nconf)
* starts working properly. Also look under clnt_vc.c.
*/
struct netbuf *
__rpcb_findaddr(program, version, nconf, host, clpp)
rpcprog_t program;
rpcvers_t version;
const struct netconfig *nconf;
const char *host;
CLIENT **clpp;
__rpcb_findaddr(rpcprog_t program, rpcvers_t version,
const struct netconfig *nconf, const char *host, CLIENT **clpp)
{
CLIENT *client = NULL;
RPCB parms;
@@ -995,12 +975,9 @@ done:
* Assuming that the address is all properly allocated
*/
int
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;
@@ -1032,9 +1009,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;
@@ -1084,18 +1059,18 @@ done:
* programs to do a lookup and call in one step.
*/
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 */
const char *argsp; /* Argument */
caddr_t resp; /* Result */
struct timeval tout; /* Timeout value for this call */
const struct netbuf *addr_ptr; /* Preallocated netbuf address */
rpcb_rmtcall(
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,
const char *argsp, /* Argument */
xdrproc_t xdrres, /* XDR routines */
caddr_t resp, /* Result */
struct timeval tout, /* Timeout value for this call */
const struct netbuf *addr_ptr) /* Preallocated netbuf address */
{
CLIENT *client;
enum clnt_stat stat;
@@ -1162,9 +1137,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;
@@ -1223,14 +1196,11 @@ 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;
/* parameter checking */
if (nconf == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
@@ -1257,9 +1227,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpcb_prot.c,v 1.9 2006/05/11 17:11:57 mrg Exp $ */
/* $NetBSD: rpcb_prot.c,v 1.10 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rpcb_prot.c 1.9 89/04/21 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: rpcb_prot.c,v 1.9 2006/05/11 17:11:57 mrg Exp $");
__RCSID("$NetBSD: rpcb_prot.c,v 1.10 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -72,9 +72,7 @@ __weak_alias(xdr_netbuf,_xdr_netbuf)
bool_t
xdr_rpcb(xdrs, objp)
XDR *xdrs;
RPCB *objp;
xdr_rpcb(XDR *xdrs, RPCB *objp)
{
_DIAGASSERT(objp != NULL);
@@ -121,9 +119,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
@@ -180,9 +176,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;
@@ -192,9 +186,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)
{
_DIAGASSERT(objp != NULL);
@@ -218,9 +210,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
@@ -278,9 +268,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;
@@ -332,9 +320,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;
@@ -352,9 +338,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: rpcb_st_xdr.c,v 1.7 2006/05/11 17:11:57 mrg Exp $ */
/* $NetBSD: rpcb_st_xdr.c,v 1.9 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: rpcb_st_xdr.c,v 1.7 2006/05/11 17:11:57 mrg Exp $");
__RCSID("$NetBSD: rpcb_st_xdr.c,v 1.9 2012/06/25 22:32:45 abs Exp $");
#endif
#include "namespace.h"
@@ -61,9 +61,7 @@ __weak_alias(xdr_rpcb_stat_byvers,_xdr_rpcb_stat_byvers)
#endif
bool_t
xdr_rpcbs_addrlist(xdrs, objp)
XDR *xdrs;
rpcbs_addrlist *objp;
xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
{
_DIAGASSERT(objp != NULL);
@@ -85,7 +83,7 @@ xdr_rpcbs_addrlist(xdrs, objp)
}
if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
sizeof (rpcbs_addrlist),
(u_int)sizeof (rpcbs_addrlist),
(xdrproc_t)xdr_rpcbs_addrlist)) {
return (FALSE);
}
@@ -96,9 +94,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;
@@ -138,7 +134,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
return (FALSE);
}
if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
sizeof (rpcbs_rmtcalllist),
(u_int)sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
@@ -176,7 +172,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
return (FALSE);
}
if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
sizeof (rpcbs_rmtcalllist),
(u_int)sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
@@ -204,7 +200,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
return (FALSE);
}
if (!xdr_pointer(xdrs, (char **)(void *)&objp->next,
sizeof (rpcbs_rmtcalllist),
(u_int)sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
@@ -212,23 +208,19 @@ 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)) {
(u_int)sizeof (int), (xdrproc_t)xdr_int)) {
return (FALSE);
}
return (TRUE);
}
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),
if (!xdr_pointer(xdrs, (char **)objp, (u_int)sizeof (rpcbs_addrlist),
(xdrproc_t)xdr_rpcbs_addrlist)) {
return (FALSE);
}
@@ -236,11 +228,9 @@ 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),
if (!xdr_pointer(xdrs, (char **)objp, (u_int)sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
@@ -248,9 +238,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)
{
_DIAGASSERT(objp != NULL);
@@ -275,12 +263,10 @@ 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)) {
(u_int)sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
return (FALSE);
}
return (TRUE);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc.c,v 1.30 2010/07/08 20:12:37 tron Exp $ */
/* $NetBSD: svc.c,v 1.31 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc.c 2.4 88/08/11 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc.c,v 1.30 2010/07/08 20:12:37 tron Exp $");
__RCSID("$NetBSD: svc.c,v 1.31 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -108,7 +108,7 @@ static struct svc_callout {
rpcprog_t sc_prog;
rpcvers_t sc_vers;
char *sc_netid;
void (*sc_dispatch) __P((struct svc_req *, SVCXPRT *));
void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
} *svc_head;
#ifdef _REENTRANT
@@ -116,9 +116,9 @@ extern rwlock_t svc_lock;
extern rwlock_t svc_fd_lock;
#endif
static struct svc_callout *svc_find __P((rpcprog_t, rpcvers_t,
struct svc_callout **, char *));
static void __xprt_do_unregister __P((SVCXPRT *xprt, bool_t dolock));
static struct svc_callout *svc_find(rpcprog_t, rpcvers_t,
struct svc_callout **, char *);
static void __xprt_do_unregister(SVCXPRT *xprt, bool_t dolock);
/* *************** SVCXPRT related stuff **************** */
@@ -126,8 +126,7 @@ static void __xprt_do_unregister __P((SVCXPRT *xprt, bool_t dolock));
* Activate a transport handle.
*/
void
xprt_register(xprt)
SVCXPRT *xprt;
xprt_register(SVCXPRT *xprt)
{
int sock;
@@ -169,9 +168,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;
@@ -200,12 +197,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) __P((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;
@@ -281,9 +275,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;
@@ -314,12 +306,8 @@ 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) __P((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;
@@ -354,9 +342,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;
@@ -381,11 +367,7 @@ 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;
@@ -410,10 +392,7 @@ 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;
const char *xdr_location;
svc_sendreply(SVCXPRT *xprt, xdrproc_t xdr_results, const char *xdr_location)
{
struct rpc_msg rply;
@@ -432,8 +411,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;
@@ -450,8 +428,7 @@ svcerr_noproc(xprt)
* Can't decode args error reply
*/
void
svcerr_decode(xprt)
SVCXPRT *xprt;
svcerr_decode(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -468,8 +445,7 @@ svcerr_decode(xprt)
* Some system error
*/
void
svcerr_systemerr(xprt)
SVCXPRT *xprt;
svcerr_systemerr(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -490,8 +466,7 @@ svcerr_systemerr(xprt)
* protocol: the portmapper (or rpc binder).
*/
void
__svc_versquiet_on(xprt)
SVCXPRT *xprt;
__svc_versquiet_on(SVCXPRT *xprt)
{
u_long tmp;
@@ -502,8 +477,7 @@ __svc_versquiet_on(xprt)
}
void
__svc_versquiet_off(xprt)
SVCXPRT *xprt;
__svc_versquiet_off(SVCXPRT *xprt)
{
u_long tmp;
@@ -514,15 +488,13 @@ __svc_versquiet_off(xprt)
}
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)
{
_DIAGASSERT(xprt != NULL);
@@ -535,9 +507,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;
@@ -554,8 +524,7 @@ svcerr_auth(xprt, why)
* Auth too weak error reply
*/
void
svcerr_weakauth(xprt)
SVCXPRT *xprt;
svcerr_weakauth(SVCXPRT *xprt)
{
_DIAGASSERT(xprt != NULL);
@@ -567,8 +536,7 @@ svcerr_weakauth(xprt)
* Program unavailable error reply
*/
void
svcerr_noprog(xprt)
SVCXPRT *xprt;
svcerr_noprog(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -585,10 +553,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;
@@ -622,8 +587,7 @@ svcerr_progvers(xprt, low_vers, high_vers)
*/
void
svc_getreq(rdfds)
int rdfds;
svc_getreq(int rdfds)
{
fd_set readfds;
@@ -633,8 +597,7 @@ svc_getreq(rdfds)
}
void
svc_getreqset(readfds)
fd_set *readfds;
svc_getreqset(fd_set *readfds)
{
uint32_t mask, *maskp;
int sock, bit, fd;
@@ -653,8 +616,7 @@ svc_getreqset(readfds)
}
void
svc_getreq_common(fd)
int fd;
svc_getreq_common(int fd)
{
SVCXPRT *xprt;
struct svc_req r;
@@ -741,9 +703,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_auth.c,v 1.15 2003/09/09 03:56:40 itojun Exp $ */
/* $NetBSD: svc_auth.c,v 1.16 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)svc_auth.c 1.26 89/02/07 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: svc_auth.c,v 1.15 2003/09/09 03:56:40 itojun Exp $");
__RCSID("$NetBSD: svc_auth.c,v 1.16 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -77,7 +77,7 @@ __weak_alias(svc_auth_reg,_svc_auth_reg)
/* declarations to allow servers to specify new authentication flavors */
struct authsvc {
int flavor;
enum auth_stat (*handler) __P((struct svc_req *, struct rpc_msg *));
enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *);
struct authsvc *next;
};
static struct authsvc *Auths = NULL;
@@ -101,9 +101,7 @@ static struct authsvc *Auths = NULL;
* 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;
@@ -158,9 +156,7 @@ _authenticate(rqst, msg)
/*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);
}
@@ -180,9 +176,9 @@ _svcauth_null(rqst, msg)
*/
int
svc_auth_reg(cred_flavor, handler)
int cred_flavor;
enum auth_stat (*handler) __P((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;
#ifdef _REENTRANT

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_auth_unix.c,v 1.18 2003/01/18 11:29:06 thorpej Exp $ */
/* $NetBSD: svc_auth_unix.c,v 1.20 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc_auth_unix.c,v 1.18 2003/01/18 11:29:06 thorpej Exp $");
__RCSID("$NetBSD: svc_auth_unix.c,v 1.20 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -62,9 +62,7 @@ __RCSID("$NetBSD: svc_auth_unix.c,v 1.18 2003/01/18 11:29:06 thorpej Exp $");
* 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;
@@ -106,7 +104,8 @@ _svcauth_unix(rqst, msg)
stat = AUTH_BADCRED;
goto done;
}
aup->aup_len = gid_len;
_DIAGASSERT(__type_fit(u_int, gid_len));
aup->aup_len = (u_int)gid_len;
for (i = 0; i < gid_len; i++) {
aup->aup_gids[i] = (int)IXDR_GET_INT32(buf);
}
@@ -141,9 +140,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);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_dg.c,v 1.12 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: svc_dg.c,v 1.14 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -44,7 +44,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: svc_dg.c,v 1.12 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: svc_dg.c,v 1.14 2012/03/20 17:14:50 matt Exp $");
#endif
#include "namespace.h"
@@ -78,16 +78,16 @@ __weak_alias(svc_dg_create,_svc_dg_create)
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
static void svc_dg_ops __P((SVCXPRT *));
static enum xprt_stat svc_dg_stat __P((SVCXPRT *));
static bool_t svc_dg_recv __P((SVCXPRT *, struct rpc_msg *));
static bool_t svc_dg_reply __P((SVCXPRT *, struct rpc_msg *));
static bool_t svc_dg_getargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static bool_t svc_dg_freeargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static void svc_dg_destroy __P((SVCXPRT *));
static bool_t svc_dg_control __P((SVCXPRT *, const u_int, void *));
static int cache_get __P((SVCXPRT *, struct rpc_msg *, char **, size_t *));
static void cache_set __P((SVCXPRT *, size_t));
static void svc_dg_ops(SVCXPRT *);
static enum xprt_stat svc_dg_stat(SVCXPRT *);
static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *);
static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *);
static bool_t svc_dg_getargs(SVCXPRT *, xdrproc_t, caddr_t);
static bool_t svc_dg_freeargs(SVCXPRT *, xdrproc_t, caddr_t);
static void svc_dg_destroy(SVCXPRT *);
static bool_t svc_dg_control(SVCXPRT *, const u_int, void *);
static int cache_get(SVCXPRT *, struct rpc_msg *, char **, size_t *);
static void cache_set(SVCXPRT *, size_t);
/*
* Usage:
@@ -104,10 +104,7 @@ static const char svc_dg_err2[] = " transport does not support data transfer";
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;
@@ -140,7 +137,8 @@ svc_dg_create(fd, sendsize, recvsize)
su->su_iosz = ((MAX(sendsize, recvsize) + 3) / 4) * 4;
if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL)
goto freedata;
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
_DIAGASSERT(__type_fit(u_int, su->su_iosz));
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), (u_int)su->su_iosz,
XDR_DECODE);
su->su_cache = NULL;
xprt->xp_fd = fd;
@@ -171,16 +169,13 @@ freedata:
/*ARGSUSED*/
static enum xprt_stat
svc_dg_stat(xprt)
SVCXPRT *xprt;
svc_dg_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
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;
XDR *xdrs;
@@ -234,9 +229,7 @@ again:
}
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;
XDR *xdrs;
@@ -266,19 +259,13 @@ svc_dg_reply(xprt, msg)
}
static bool_t
svc_dg_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
caddr_t args_ptr;
svc_dg_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
return (*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr);
}
static bool_t
svc_dg_freeargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
caddr_t args_ptr;
svc_dg_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
XDR *xdrs;
@@ -290,8 +277,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;
@@ -316,17 +302,13 @@ svc_dg_destroy(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;
@@ -433,9 +415,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;
struct cl_cache *uc;
@@ -494,9 +474,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;
@@ -566,8 +544,9 @@ cache_set(xprt, replylen)
victim->cache_replylen = replylen;
victim->cache_reply = rpc_buffer(xprt);
rpc_buffer(xprt) = newbuf;
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt),
su->su_iosz, XDR_ENCODE);
_DIAGASSERT(__type_fit(u_int, su->su_iosz));
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), (u_int)su->su_iosz,
XDR_ENCODE);
victim->cache_xid = su->su_xid;
victim->cache_proc = uc->uc_proc;
victim->cache_vers = uc->uc_vers;
@@ -589,11 +568,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_generic.c,v 1.10 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: svc_generic.c,v 1.12 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: svc_generic.c,v 1.10 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: svc_generic.c,v 1.12 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -58,7 +58,7 @@ __RCSID("$NetBSD: svc_generic.c,v 1.10 2008/04/25 17:44:44 christos Exp $");
#include <rpc/nettype.h>
#include <stdio.h>
#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
@@ -71,7 +71,7 @@ __weak_alias(svc_tp_create,_svc_tp_create)
__weak_alias(svc_tli_create,_svc_tli_create)
#endif
extern int __svc_vc_setflag __P((SVCXPRT *, int));
extern int __svc_vc_setflag(SVCXPRT *, int);
/*
* The highest level interface for server creation.
@@ -83,11 +83,11 @@ extern int __svc_vc_setflag __P((SVCXPRT *, int));
* created earlier instead of creating a new handle every time.
*/
int
svc_create(dispatch, prognum, versnum, nettype)
void (*dispatch) __P((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, /* Program number */
rpcvers_t versnum, /* Version number */
const char *nettype) /* Networktype token */
{
struct xlist {
SVCXPRT *xprt; /* Server handle */
@@ -157,11 +157,11 @@ svc_create(dispatch, prognum, versnum, nettype)
* with the rpcbind. It calls svc_tli_create();
*/
SVCXPRT *
svc_tp_create(dispatch, prognum, versnum, nconf)
void (*dispatch) __P((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, /* Program number */
rpcvers_t versnum, /* Version number */
const struct netconfig *nconf) /* Netconfig structure for the network */
{
SVCXPRT *xprt;
@@ -197,12 +197,12 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
* If sendsz or recvsz are zero, their default values are chosen.
*/
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, /* 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 */
{
SVCXPRT *xprt = NULL; /* service handle */
bool_t madefd = FALSE; /* whether fd opened here */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_raw.c,v 1.21 2008/05/24 15:59:59 christos Exp $ */
/* $NetBSD: svc_raw.c,v 1.22 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)svc_raw.c 1.25 89/01/31 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: svc_raw.c,v 1.21 2008/05/24 15:59:59 christos Exp $");
__RCSID("$NetBSD: svc_raw.c,v 1.22 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -81,19 +81,19 @@ static struct svc_raw_private {
extern mutex_t svcraw_lock;
#endif
static enum xprt_stat svc_raw_stat __P((SVCXPRT *));
static bool_t svc_raw_recv __P((SVCXPRT *, struct rpc_msg *));
static bool_t svc_raw_reply __P((SVCXPRT *, struct rpc_msg *));
static bool_t svc_raw_getargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static bool_t svc_raw_freeargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static void svc_raw_destroy __P((SVCXPRT *));
static void svc_raw_ops __P((SVCXPRT *));
static bool_t svc_raw_control __P((SVCXPRT *, const u_int, void *));
static enum xprt_stat svc_raw_stat(SVCXPRT *);
static bool_t svc_raw_recv(SVCXPRT *, struct rpc_msg *);
static bool_t svc_raw_reply(SVCXPRT *, struct rpc_msg *);
static bool_t svc_raw_getargs(SVCXPRT *, xdrproc_t, caddr_t);
static bool_t svc_raw_freeargs(SVCXPRT *, xdrproc_t, caddr_t);
static void svc_raw_destroy(SVCXPRT *);
static void svc_raw_ops(SVCXPRT *);
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 */
@@ -129,17 +129,14 @@ out:
/*ARGSUSED*/
static enum xprt_stat
svc_raw_stat(xprt)
SVCXPRT *xprt; /* args needed to satisfy ANSI-C typechecking */
svc_raw_stat(SVCXPRT *xprt) /* args needed to satisfy ANSI-C typechecking */
{
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;
@@ -163,9 +160,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;
@@ -190,10 +185,7 @@ svc_raw_reply(xprt, msg)
/*ARGSUSED*/
static bool_t
svc_raw_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
caddr_t args_ptr;
svc_raw_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
struct svc_raw_private *srp;
@@ -209,10 +201,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;
caddr_t args_ptr;
svc_raw_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -232,24 +221,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_run.c,v 1.19 2003/01/18 11:29:07 thorpej Exp $ */
/* $NetBSD: svc_run.c,v 1.20 2012/06/24 15:26:03 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc_run.c,v 1.19 2003/01/18 11:29:07 thorpej Exp $");
__RCSID("$NetBSD: svc_run.c,v 1.20 2012/06/24 15:26:03 christos Exp $");
#endif
#endif
@@ -61,7 +61,7 @@ __weak_alias(svc_exit,_svc_exit)
#endif
void
svc_run()
svc_run(void)
{
fd_set readfds, cleanfds;
struct timeval timeout;
@@ -98,7 +98,7 @@ svc_run()
* more work to do.
*/
void
svc_exit()
svc_exit(void)
{
#ifdef _REENTRANT
extern rwlock_t svc_fd_lock;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_simple.c,v 1.30 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: svc_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: svc_simple.c,v 1.30 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: svc_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $");
#endif
#include "namespace.h"
@@ -68,10 +68,10 @@ __RCSID("$NetBSD: svc_simple.c,v 1.30 2008/04/25 17:44:44 christos Exp $");
__weak_alias(rpc_reg,_rpc_reg)
#endif
static void universal __P((struct svc_req *, SVCXPRT *));
static void universal(struct svc_req *, SVCXPRT *);
static struct proglst {
char *(*p_progname) __P((char *));
char *(*p_progname)(char *);
rpcprog_t p_prognum;
rpcvers_t p_versnum;
rpcproc_t p_procnum;
@@ -102,13 +102,14 @@ static const char __no_mem_str[] = "out of memory";
*/
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) __P((char *)); /* Server routine */
xdrproc_t inproc, outproc; /* in/out XDR procedures */
char *nettype; /* nettype */
rpc_reg(
rpcprog_t prognum, /* program number */
rpcvers_t versnum, /* version number */
rpcproc_t procnum, /* procedure number */
char *(*progname)(char *), /* Server routine */
xdrproc_t inproc, /* in XDR procedure */
xdrproc_t outproc, /* out XDR procedure */
char *nettype) /* nettype */
{
struct netconfig *nconf;
int done = FALSE;
@@ -251,9 +252,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;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: svc_vc.c,v 1.22 2009/02/12 04:38:52 lukem Exp $ */
/* $NetBSD: svc_vc.c,v 1.26 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc_vc.c,v 1.22 2009/02/12 04:38:52 lukem Exp $");
__RCSID("$NetBSD: svc_vc.c,v 1.26 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -79,23 +79,22 @@ __weak_alias(svc_vc_create,_svc_vc_create)
extern rwlock_t svc_fd_lock;
#endif
static SVCXPRT *makefd_xprt __P((int, u_int, u_int));
static bool_t rendezvous_request __P((SVCXPRT *, struct rpc_msg *));
static enum xprt_stat rendezvous_stat __P((SVCXPRT *));
static void svc_vc_destroy __P((SVCXPRT *));
static void __svc_vc_dodestroy __P((SVCXPRT *));
static int read_vc __P((caddr_t, caddr_t, int));
static int write_vc __P((caddr_t, caddr_t, int));
static enum xprt_stat svc_vc_stat __P((SVCXPRT *));
static bool_t svc_vc_recv __P((SVCXPRT *, struct rpc_msg *));
static bool_t svc_vc_getargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static bool_t svc_vc_freeargs __P((SVCXPRT *, xdrproc_t, caddr_t));
static bool_t svc_vc_reply __P((SVCXPRT *, struct rpc_msg *));
static void svc_vc_rendezvous_ops __P((SVCXPRT *));
static void svc_vc_ops __P((SVCXPRT *));
static bool_t svc_vc_control __P((SVCXPRT *, const u_int, void *));
static bool_t svc_vc_rendezvous_control __P((SVCXPRT *, const u_int,
void *));
static SVCXPRT *makefd_xprt(int, u_int, u_int);
static bool_t rendezvous_request(SVCXPRT *, struct rpc_msg *);
static enum xprt_stat rendezvous_stat(SVCXPRT *);
static void svc_vc_destroy(SVCXPRT *);
static void __svc_vc_dodestroy(SVCXPRT *);
static int read_vc(caddr_t, caddr_t, int);
static int write_vc(caddr_t, caddr_t, int);
static enum xprt_stat svc_vc_stat(SVCXPRT *);
static bool_t svc_vc_recv(SVCXPRT *, struct rpc_msg *);
static bool_t svc_vc_getargs(SVCXPRT *, xdrproc_t, caddr_t);
static bool_t svc_vc_freeargs(SVCXPRT *, xdrproc_t, caddr_t);
static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *);
static void svc_vc_rendezvous_ops(SVCXPRT *);
static void svc_vc_ops(SVCXPRT *);
static bool_t svc_vc_control(SVCXPRT *, const u_int, void *);
static bool_t svc_vc_rendezvous_control(SVCXPRT *, const u_int, void *);
struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */
u_int sendsize;
@@ -132,10 +131,7 @@ 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;
struct cf_rendezvous *r = NULL;
@@ -179,7 +175,8 @@ svc_vc_create(fd, sendsize, recvsize)
* We want to be able to check credentials on local sockets.
*/
if (sslocal.ss_family == AF_LOCAL)
if (setsockopt(fd, 0, LOCAL_CREDS, &one, sizeof one) < 0)
if (setsockopt(fd, 0, LOCAL_CREDS, &one, (socklen_t)sizeof one)
== -1)
goto cleanup_svc_vc_create;
xprt->xp_ltaddr.maxlen = xprt->xp_ltaddr.len = sslocal.ss_len;
@@ -192,13 +189,13 @@ svc_vc_create(fd, sendsize, recvsize)
xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
xprt_register(xprt);
return (xprt);
return xprt;
cleanup_svc_vc_create:
if (xprt)
mem_free(xprt, sizeof(*xprt));
if (r != NULL)
mem_free(r, sizeof(*r));
return (NULL);
return NULL;
}
/*
@@ -206,10 +203,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;
@@ -263,10 +257,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;
@@ -295,7 +286,7 @@ makefd_xprt(fd, sendsize, recvsize)
goto out;
xprt_register(xprt);
return (xprt);
return xprt;
out:
warn("svc_tcp: makefd_xprt");
if (xprt)
@@ -305,9 +296,7 @@ out:
/*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;
@@ -337,7 +326,7 @@ again:
if (__svc_clean_idle(&cleanfds, 0, FALSE))
goto again;
}
return (FALSE);
return FALSE;
}
/*
* make a new transporter (re-uses xprt)
@@ -380,24 +369,22 @@ again:
(void)gettimeofday(&cd->last_recv_time, NULL);
return (FALSE); /* there is never an rpc msg to be processed */
return FALSE; /* there is never an rpc msg to be processed */
out:
(void)close(sock);
return (FALSE); /* there was an error */
return FALSE; /* there was an error */
}
/*ARGSUSED*/
static enum xprt_stat
rendezvous_stat(xprt)
SVCXPRT *xprt;
rendezvous_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
return XPRT_IDLE;
}
static void
svc_vc_destroy(xprt)
SVCXPRT *xprt;
svc_vc_destroy(SVCXPRT *xprt)
{
_DIAGASSERT(xprt != NULL);
@@ -406,8 +393,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;
@@ -439,26 +425,20 @@ __svc_vc_dodestroy(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);
return FALSE;
}
/*ARGSUSED*/
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;
cfp = (struct cf_rendezvous *)xprt->xp_p1;
if (cfp == NULL)
return (FALSE);
return FALSE;
switch (rq) {
case SVCGET_CONNMAXREC:
*(int *)in = cfp->maxrec;
@@ -467,9 +447,9 @@ svc_vc_rendezvous_control(xprt, rq, in)
cfp->maxrec = *(int *)in;
break;
default:
return (FALSE);
return FALSE;
}
return (TRUE);
return TRUE;
}
/*
@@ -480,10 +460,7 @@ svc_vc_rendezvous_control(xprt, rq, in)
* fatal for the connection.
*/
static int
read_vc(xprtp, buf, len)
caddr_t xprtp;
caddr_t buf;
int len;
read_vc(caddr_t xprtp, caddr_t buf, int len)
{
SVCXPRT *xprt;
int sock;
@@ -540,7 +517,7 @@ read_vc(xprtp, buf, len)
cfp = (struct cf_conn *)xprt->xp_p1;
if (cfp->nonblock) {
len = read(sock, buf, (size_t)len);
len = (int)read(sock, buf, (size_t)len);
if (len < 0) {
if (errno == EAGAIN)
len = 0;
@@ -569,16 +546,16 @@ read_vc(xprtp, buf, len)
}
} while ((pollfd.revents & POLLIN) == 0);
if ((len = read(sock, buf, (size_t)len)) > 0) {
if ((len = (int)read(sock, buf, (size_t)len)) > 0) {
gettimeofday(&cfp->last_recv_time, NULL);
return (len);
return len;
}
fatal_err:
if (crmsg != NULL)
free(crmsg);
((struct cf_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED;
return (-1);
return -1;
}
/*
@@ -586,10 +563,7 @@ fatal_err:
* Any error is fatal and the connection is closed.
*/
static int
write_vc(xprtp, buf, len)
caddr_t xprtp;
caddr_t buf;
int len;
write_vc(caddr_t xprtp, caddr_t buf, int len)
{
SVCXPRT *xprt;
int i, cnt;
@@ -605,12 +579,12 @@ write_vc(xprtp, buf, len)
gettimeofday(&tv0, NULL);
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
if ((i = write(xprt->xp_fd, buf, (size_t)cnt)) < 0) {
if ((i = (int)write(xprt->xp_fd, buf, (size_t)cnt)) < 0) {
if (errno != EAGAIN || !cd->nonblock) {
cd->strm_stat = XPRT_DIED;
return (-1);
return -1;
}
if (cd->nonblock && i != cnt) {
if (cd->nonblock) {
/*
* For non-blocking connections, do not
* take more than 2 seconds writing the
@@ -621,17 +595,17 @@ write_vc(xprtp, buf, len)
gettimeofday(&tv1, NULL);
if (tv1.tv_sec - tv0.tv_sec >= 2) {
cd->strm_stat = XPRT_DIED;
return (-1);
return -1;
}
}
i = 0;
}
}
return (len);
return len;
}
static enum xprt_stat
svc_vc_stat(xprt)
SVCXPRT *xprt;
svc_vc_stat(SVCXPRT *xprt)
{
struct cf_conn *cd;
@@ -640,16 +614,14 @@ svc_vc_stat(xprt)
cd = (struct cf_conn *)(xprt->xp_p1);
if (cd->strm_stat == XPRT_DIED)
return (XPRT_DIED);
return XPRT_DIED;
if (! xdrrec_eof(&(cd->xdrs)))
return (XPRT_MOREREQS);
return (XPRT_IDLE);
return XPRT_MOREREQS;
return XPRT_IDLE;
}
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;
@@ -670,31 +642,25 @@ svc_vc_recv(xprt, msg)
if (xdr_callmsg(xdrs, msg)) {
cd->x_id = msg->rm_xid;
return (TRUE);
return TRUE;
}
cd->strm_stat = XPRT_DIED;
return (FALSE);
return FALSE;
}
static bool_t
svc_vc_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
caddr_t args_ptr;
svc_vc_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
_DIAGASSERT(xprt != NULL);
/* args_ptr may be NULL */
return ((*xdr_args)(&(((struct cf_conn *)(xprt->xp_p1))->xdrs),
args_ptr));
return (*xdr_args)(&(((struct cf_conn *)(xprt->xp_p1))->xdrs),
args_ptr);
}
static bool_t
svc_vc_freeargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
caddr_t args_ptr;
svc_vc_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
XDR *xdrs;
@@ -704,13 +670,11 @@ svc_vc_freeargs(xprt, xdr_args, args_ptr)
xdrs = &(((struct cf_conn *)(xprt->xp_p1))->xdrs);
xdrs->x_op = XDR_FREE;
return ((*xdr_args)(xdrs, args_ptr));
return (*xdr_args)(xdrs, 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;
@@ -726,12 +690,11 @@ svc_vc_reply(xprt, msg)
msg->rm_xid = cd->x_id;
rstat = xdr_replymsg(xdrs, msg);
(void)xdrrec_endofrecord(xdrs, TRUE);
return (rstat);
return rstat;
}
static void
svc_vc_ops(xprt)
SVCXPRT *xprt;
svc_vc_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -757,29 +720,23 @@ 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;
#ifdef _REENTRANT
extern mutex_t ops_lock;
#endif
/* XXXGCC vax compiler unhappy otherwise */
#ifdef __vax__
extern void abort(void);
#endif
mutex_lock(&ops_lock);
if (ops.xp_recv == NULL) {
ops.xp_recv = rendezvous_request;
ops.xp_stat = rendezvous_stat;
ops.xp_getargs =
(bool_t (*) __P((SVCXPRT *, xdrproc_t, caddr_t)))abort;
(bool_t (*)(SVCXPRT *, xdrproc_t, caddr_t))abort;
ops.xp_reply =
(bool_t (*) __P((SVCXPRT *, struct rpc_msg *)))abort;
(bool_t (*)(SVCXPRT *, struct rpc_msg *))abort;
ops.xp_freeargs =
(bool_t (*) __P((SVCXPRT *, xdrproc_t, caddr_t)))abort;
(bool_t (*)(SVCXPRT *, xdrproc_t, caddr_t))abort;
ops.xp_destroy = svc_vc_destroy;
ops2.xp_control = svc_vc_rendezvous_control;
}

View File

@@ -1,7 +1,7 @@
.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
.\" $NetBSD: xdr.3,v 1.12 2009/10/13 21:39:55 joerg Exp $
.\" $NetBSD: xdr.3,v 1.14 2011/07/08 19:28:22 wiz Exp $
.\"
.Dd April 17, 2003
.Dd July 4, 2011
.Dt XDR 3
.Os
.Sh NAME
@@ -31,6 +31,7 @@
.Nm xdr_reference ,
.Nm xdr_setpos ,
.Nm xdr_short ,
.Nm xdr_sizeof ,
.Nm xdrstdio_create ,
.Nm xdr_string ,
.Nm xdr_u_char ,
@@ -99,6 +100,8 @@
.Fn xdr_setpos "XDR *xdrs" "u_int pos"
.Ft int
.Fn xdr_short "XDR *xdrs" "short *sp"
.Ft nsigned long
.Fn xdr_sizeof "xdrproc_t func" "void *data"
.Ft void
.Fn xdrstdio_create "XDR *xdrs" "FILE *file" "enum xdr_op op"
.Ft int
@@ -378,6 +381,11 @@ another.
A filter primitive that translates between C short integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.
.It Fn xdr_sizeof
This routine returns the amount of memory required to encode
.Fa data
using filter
.Fa func .
.It Fn xdrstdio_create
This routine initializes the XDR stream object pointed to by
.Fa xdrs .

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr.c,v 1.28 2006/05/14 02:15:31 christos Exp $ */
/* $NetBSD: xdr.c,v 1.31 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr.c 1.35 87/08/12";
static char *sccsid = "@(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr.c,v 1.28 2006/05/14 02:15:31 christos Exp $");
__RCSID("$NetBSD: xdr.c,v 1.31 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -108,9 +108,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
* Not a filter, but a convenient utility nonetheless
*/
void
xdr_free(proc, objp)
xdrproc_t proc;
char *objp;
xdr_free(xdrproc_t proc, char *objp)
{
XDR x;
@@ -122,10 +120,7 @@ xdr_free(proc, objp)
* XDR nothing
*/
bool_t
xdr_void(/* xdrs, addr */)
/* XDR *xdrs; */
/* caddr_t addr; */
{
xdr_void(void) {
return (TRUE);
}
@@ -135,9 +130,7 @@ xdr_void(/* xdrs, addr */)
* XDR integers
*/
bool_t
xdr_int(xdrs, ip)
XDR *xdrs;
int *ip;
xdr_int(XDR *xdrs, int *ip)
{
long l;
@@ -168,9 +161,7 @@ xdr_int(xdrs, ip)
* XDR unsigned integers
*/
bool_t
xdr_u_int(xdrs, up)
XDR *xdrs;
u_int *up;
xdr_u_int(XDR *xdrs, u_int *up)
{
u_long l;
@@ -203,9 +194,7 @@ xdr_u_int(xdrs, up)
* same as xdr_u_long - open coded to save a proc call!
*/
bool_t
xdr_long(xdrs, lp)
XDR *xdrs;
long *lp;
xdr_long(XDR *xdrs, long *lp)
{
_DIAGASSERT(xdrs != NULL);
@@ -228,9 +217,7 @@ xdr_long(xdrs, lp)
* same as xdr_long - open coded to save a proc call!
*/
bool_t
xdr_u_long(xdrs, ulp)
XDR *xdrs;
u_long *ulp;
xdr_u_long(XDR *xdrs, u_long *ulp)
{
_DIAGASSERT(xdrs != NULL);
@@ -254,9 +241,7 @@ xdr_u_long(xdrs, ulp)
* same as xdr_u_int32_t - open coded to save a proc call!
*/
bool_t
xdr_int32_t(xdrs, int32_p)
XDR *xdrs;
int32_t *int32_p;
xdr_int32_t(XDR *xdrs, int32_t *int32_p)
{
long l;
@@ -288,9 +273,7 @@ xdr_int32_t(xdrs, int32_p)
* same as xdr_int32_t - open coded to save a proc call!
*/
bool_t
xdr_u_int32_t(xdrs, u_int32_p)
XDR *xdrs;
u_int32_t *u_int32_p;
xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
{
u_long l;
@@ -322,9 +305,7 @@ xdr_u_int32_t(xdrs, u_int32_p)
* XDR short integers
*/
bool_t
xdr_short(xdrs, sp)
XDR *xdrs;
short *sp;
xdr_short(XDR *xdrs, short *sp)
{
long l;
@@ -355,9 +336,7 @@ xdr_short(xdrs, sp)
* XDR unsigned short integers
*/
bool_t
xdr_u_short(xdrs, usp)
XDR *xdrs;
u_short *usp;
xdr_u_short(XDR *xdrs, u_short *usp)
{
u_long l;
@@ -389,9 +368,7 @@ xdr_u_short(xdrs, usp)
* XDR 16-bit integers
*/
bool_t
xdr_int16_t(xdrs, int16_p)
XDR *xdrs;
int16_t *int16_p;
xdr_int16_t(XDR *xdrs, int16_t *int16_p)
{
long l;
@@ -422,9 +399,7 @@ xdr_int16_t(xdrs, int16_p)
* XDR unsigned 16-bit integers
*/
bool_t
xdr_u_int16_t(xdrs, u_int16_p)
XDR *xdrs;
u_int16_t *u_int16_p;
xdr_u_int16_t(XDR *xdrs, u_int16_t *u_int16_p)
{
u_long l;
@@ -456,9 +431,7 @@ xdr_u_int16_t(xdrs, u_int16_p)
* XDR a char
*/
bool_t
xdr_char(xdrs, cp)
XDR *xdrs;
char *cp;
xdr_char(XDR *xdrs, char *cp)
{
int i;
@@ -477,9 +450,7 @@ xdr_char(xdrs, cp)
* XDR an unsigned char
*/
bool_t
xdr_u_char(xdrs, cp)
XDR *xdrs;
u_char *cp;
xdr_u_char(XDR *xdrs, u_char *cp)
{
u_int u;
@@ -498,9 +469,7 @@ xdr_u_char(xdrs, cp)
* XDR booleans
*/
bool_t
xdr_bool(xdrs, bp)
XDR *xdrs;
bool_t *bp;
xdr_bool(XDR *xdrs, bool_t *bp)
{
long lb;
@@ -531,9 +500,7 @@ xdr_bool(xdrs, bp)
* XDR enumerations
*/
bool_t
xdr_enum(xdrs, ep)
XDR *xdrs;
enum_t *ep;
xdr_enum(XDR *xdrs, enum_t *ep)
{
long l;
@@ -566,10 +533,7 @@ xdr_enum(xdrs, ep)
* cp points to the opaque object and cnt gives the byte length.
*/
bool_t
xdr_opaque(xdrs, cp, cnt)
XDR *xdrs;
caddr_t cp;
u_int cnt;
xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt)
{
u_int rndup;
static int crud[BYTES_PER_XDR_UNIT];
@@ -620,11 +584,7 @@ xdr_opaque(xdrs, cp, cnt)
* If *cpp is NULL maxsize bytes are allocated
*/
bool_t
xdr_bytes(xdrs, cpp, sizep, maxsize)
XDR *xdrs;
char **cpp;
u_int *sizep;
u_int maxsize;
xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
{
char *sp; /* sp is the actual string pointer */
u_int nodesize;
@@ -682,9 +642,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
* Implemented here due to commonality of the object.
*/
bool_t
xdr_netobj(xdrs, np)
XDR *xdrs;
struct netobj *np;
xdr_netobj(XDR *xdrs, struct netobj *np)
{
_DIAGASSERT(xdrs != NULL);
@@ -705,12 +663,13 @@ xdr_netobj(xdrs, np)
* If there is no specific or default routine an error is returned.
*/
bool_t
xdr_union(xdrs, dscmp, unp, choices, dfault)
XDR *xdrs;
enum_t *dscmp; /* enum to decide which arm to work on */
char *unp; /* the union itself */
const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
xdrproc_t dfault; /* default xdr routine */
xdr_union(
XDR *xdrs,
enum_t *dscmp, /* enum to decide which arm to work on */
char *unp, /* the union itself */
const struct xdr_discrim *choices, /* [value, xdr proc] for each arm */
xdrproc_t dfault /* default xdr routine */
)
{
enum_t dscm;
@@ -760,14 +719,12 @@ xdr_union(xdrs, dscmp, unp, choices, dfault)
* of the string as specified by a protocol.
*/
bool_t
xdr_string(xdrs, cpp, maxsize)
XDR *xdrs;
char **cpp;
u_int maxsize;
xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
{
char *sp; /* sp is the actual string pointer */
u_int size = 0; /* XXX: GCC */
u_int nodesize;
size_t len;
_DIAGASSERT(xdrs != NULL);
_DIAGASSERT(cpp != NULL);
@@ -784,7 +741,9 @@ xdr_string(xdrs, cpp, maxsize)
}
/* FALLTHROUGH */
case XDR_ENCODE:
size = strlen(sp);
len = strlen(sp);
_DIAGASSERT(__type_fit(u_int, len));
size = (u_int)len;
break;
case XDR_DECODE:
break;
@@ -832,9 +791,7 @@ xdr_string(xdrs, cpp, maxsize)
* routines like clnt_call
*/
bool_t
xdr_wrapstring(xdrs, cpp)
XDR *xdrs;
char **cpp;
xdr_wrapstring(XDR *xdrs, char **cpp)
{
_DIAGASSERT(xdrs != NULL);
@@ -855,9 +812,7 @@ xdr_wrapstring(xdrs, cpp)
* XDR 64-bit integers
*/
bool_t
xdr_int64_t(xdrs, llp)
XDR *xdrs;
int64_t *llp;
xdr_int64_t(XDR *xdrs, int64_t *llp)
{
u_long ul[2];
@@ -866,8 +821,10 @@ xdr_int64_t(xdrs, llp)
switch (xdrs->x_op) {
case XDR_ENCODE:
ul[0] = (u_long)((u_int64_t)*llp >> 32) & 0xffffffff;
ul[1] = (u_long)((u_int64_t)*llp) & 0xffffffff;
ul[0] = (u_long)(((uint64_t)*llp >> 32) &
(uint64_t)0xffffffffULL);
ul[1] = (u_long)(((uint64_t)*llp) &
(uint64_t)0xffffffffULL);
if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
return (FALSE);
return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
@@ -891,9 +848,7 @@ xdr_int64_t(xdrs, llp)
* XDR unsigned 64-bit integers
*/
bool_t
xdr_u_int64_t(xdrs, ullp)
XDR *xdrs;
u_int64_t *ullp;
xdr_u_int64_t(XDR *xdrs, u_int64_t *ullp)
{
u_long ul[2];
@@ -902,8 +857,8 @@ xdr_u_int64_t(xdrs, ullp)
switch (xdrs->x_op) {
case XDR_ENCODE:
ul[0] = (u_long)(*ullp >> 32) & 0xffffffff;
ul[1] = (u_long)(*ullp) & 0xffffffff;
ul[0] = (u_long)(*ullp >> 32) & 0xffffffffUL;
ul[1] = (u_long)(*ullp) & 0xffffffffUL;
if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
return (FALSE);
return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
@@ -927,9 +882,7 @@ xdr_u_int64_t(xdrs, ullp)
* XDR hypers
*/
bool_t
xdr_hyper(xdrs, llp)
XDR *xdrs;
longlong_t *llp;
xdr_hyper(XDR *xdrs, longlong_t *llp)
{
_DIAGASSERT(xdrs != NULL);
@@ -947,9 +900,7 @@ xdr_hyper(xdrs, llp)
* XDR unsigned hypers
*/
bool_t
xdr_u_hyper(xdrs, ullp)
XDR *xdrs;
u_longlong_t *ullp;
xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp)
{
_DIAGASSERT(xdrs != NULL);
@@ -967,9 +918,7 @@ xdr_u_hyper(xdrs, ullp)
* XDR longlong_t's
*/
bool_t
xdr_longlong_t(xdrs, llp)
XDR *xdrs;
longlong_t *llp;
xdr_longlong_t(XDR *xdrs, longlong_t *llp)
{
_DIAGASSERT(xdrs != NULL);
@@ -987,9 +936,7 @@ xdr_longlong_t(xdrs, llp)
* XDR u_longlong_t's
*/
bool_t
xdr_u_longlong_t(xdrs, ullp)
XDR *xdrs;
u_longlong_t *ullp;
xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp)
{
_DIAGASSERT(xdrs != NULL);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_array.c,v 1.16 2005/08/05 10:39:05 wiz Exp $ */
/* $NetBSD: xdr_array.c,v 1.17 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_array.c,v 1.16 2005/08/05 10:39:05 wiz Exp $");
__RCSID("$NetBSD: xdr_array.c,v 1.17 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -72,13 +72,8 @@ __weak_alias(xdr_vector,_xdr_vector)
* xdr procedure to call to handle each element of the array.
*/
bool_t
xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
XDR *xdrs;
caddr_t *addrp; /* array pointer */
u_int *sizep; /* number of elements */
u_int maxsize; /* max numberof elements */
u_int elsize; /* size in bytes of each element */
xdrproc_t elproc; /* xdr routine to handle each element */
xdr_array(XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize,
xdrproc_t elproc)
{
u_int i;
caddr_t target = *addrp;
@@ -149,12 +144,8 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
* > xdr_elem: routine to XDR each element
*/
bool_t
xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
XDR *xdrs;
char *basep;
u_int nelem;
u_int elemsize;
xdrproc_t xdr_elem;
xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize,
xdrproc_t xdr_elem)
{
u_int i;
char *elptr;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_float.c,v 1.35 2009/02/14 06:26:42 lukem Exp $ */
/* $NetBSD: xdr_float.c,v 1.37 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_float.c,v 1.35 2009/02/14 06:26:42 lukem Exp $");
__RCSID("$NetBSD: xdr_float.c,v 1.37 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -109,9 +109,7 @@ static struct sgl_limits {
#endif /* vax */
bool_t
xdr_float(xdrs, fp)
XDR *xdrs;
float *fp;
xdr_float(XDR *xdrs, float *fp)
{
#ifndef IEEEFP
struct ieee_single is;
@@ -125,7 +123,7 @@ xdr_float(xdrs, fp)
#ifdef IEEEFP
return (XDR_PUTINT32(xdrs, (int32_t *)(void *)fp));
#else
vs = *((struct vax_single *)fp);
vs = *((struct vax_single *)(void *)fp);
for (i = 0, lim = sgl_limits;
i < sizeof(sgl_limits)/sizeof(struct sgl_limits);
i++, lim++) {
@@ -147,7 +145,7 @@ xdr_float(xdrs, fp)
#ifdef IEEEFP
return (XDR_GETINT32(xdrs, (int32_t *)(void *)fp));
#else
vsp = (struct vax_single *)fp;
vsp = (struct vax_single *)(void *)fp;
if (!XDR_GETINT32(xdrs, (int32_t *)(void *)&is))
return (FALSE);
for (i = 0, lim = sgl_limits;
@@ -161,7 +159,7 @@ xdr_float(xdrs, fp)
}
vsp->exp = is.exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
vsp->mantissa2 = is.mantissa;
vsp->mantissa1 = (is.mantissa >> 16);
vsp->mantissa1 = ((unsigned int)is.mantissa >> 16);
doneit:
vsp->sign = is.sign;
return (TRUE);
@@ -211,9 +209,7 @@ static struct dbl_limits {
bool_t
xdr_double(xdrs, dp)
XDR *xdrs;
double *dp;
xdr_double(XDR *xdrs, double *dp)
{
#ifdef IEEEFP
int32_t *i32p;
@@ -245,7 +241,7 @@ xdr_double(xdrs, dp)
#endif
return (rv);
#else
vd = *((struct vax_double *)dp);
vd = *((struct vax_double *)(void *)dp);
for (i = 0, lim = dbl_limits;
i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
i++, lim++) {
@@ -259,10 +255,11 @@ xdr_double(xdrs, dp)
}
}
id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
id.mantissa1 = (vd.mantissa1 << 13) | (vd.mantissa2 >> 3);
id.mantissa1 = (vd.mantissa1 << 13) |
((unsigned int)vd.mantissa2 >> 3);
id.mantissa2 = ((vd.mantissa2 & MASK(3)) << 29) |
(vd.mantissa3 << 13) |
((vd.mantissa4 >> 3) & MASK(13));
(((unsigned int)vd.mantissa4 >> 3) & MASK(13));
shipit:
id.sign = vd.sign;
lp = (int32_t *)(void *)&id;
@@ -300,10 +297,10 @@ xdr_double(xdrs, dp)
}
}
vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
vd.mantissa1 = (id.mantissa1 >> 13);
vd.mantissa1 = ((unsigned int)id.mantissa1 >> 13);
vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) |
(id.mantissa2 >> 29);
vd.mantissa3 = (id.mantissa2 >> 13);
((unsigned int)id.mantissa2 >> 29);
vd.mantissa3 = ((unsigned int)id.mantissa2 >> 13);
vd.mantissa4 = (id.mantissa2 << 3);
doneit:
vd.sign = id.sign;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_mem.c,v 1.17 2006/10/15 16:14:46 christos Exp $ */
/* $NetBSD: xdr_mem.c,v 1.18 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_mem.c,v 1.17 2006/10/15 16:14:46 christos Exp $");
__RCSID("$NetBSD: xdr_mem.c,v 1.18 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -65,18 +65,18 @@ __RCSID("$NetBSD: xdr_mem.c,v 1.17 2006/10/15 16:14:46 christos Exp $");
__weak_alias(xdrmem_create,_xdrmem_create)
#endif
static void xdrmem_destroy __P((XDR *));
static bool_t xdrmem_getlong_aligned __P((XDR *, long *));
static bool_t xdrmem_putlong_aligned __P((XDR *, const long *));
static bool_t xdrmem_getlong_unaligned __P((XDR *, long *));
static bool_t xdrmem_putlong_unaligned __P((XDR *, const long *));
static bool_t xdrmem_getbytes __P((XDR *, char *, u_int));
static bool_t xdrmem_putbytes __P((XDR *, const char *, u_int));
static void xdrmem_destroy(XDR *);
static bool_t xdrmem_getlong_aligned(XDR *, long *);
static bool_t xdrmem_putlong_aligned(XDR *, const long *);
static bool_t xdrmem_getlong_unaligned(XDR *, long *);
static bool_t xdrmem_putlong_unaligned(XDR *, const long *);
static bool_t xdrmem_getbytes(XDR *, char *, u_int);
static bool_t xdrmem_putbytes(XDR *, const char *, u_int);
/* XXX: w/64-bit pointers, u_int not enough! */
static u_int xdrmem_getpos __P((XDR *));
static bool_t xdrmem_setpos __P((XDR *, u_int));
static int32_t *xdrmem_inline_aligned __P((XDR *, u_int));
static int32_t *xdrmem_inline_unaligned __P((XDR *, u_int));
static u_int xdrmem_getpos(XDR *);
static bool_t xdrmem_setpos(XDR *, u_int);
static int32_t *xdrmem_inline_aligned(XDR *, u_int);
static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
static const struct xdr_ops xdrmem_ops_aligned = {
xdrmem_getlong_aligned,
@@ -107,11 +107,7 @@ static const struct xdr_ops xdrmem_ops_unaligned = {
* memory buffer.
*/
void
xdrmem_create(xdrs, addr, size, op)
XDR *xdrs;
char *addr;
u_int size;
enum xdr_op op;
xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
{
xdrs->x_op = op;
@@ -123,16 +119,13 @@ xdrmem_create(xdrs, addr, size, op)
/*ARGSUSED*/
static void
xdrmem_destroy(xdrs)
XDR *xdrs;
xdrmem_destroy(XDR *xdrs)
{
}
static bool_t
xdrmem_getlong_aligned(xdrs, lp)
XDR *xdrs;
long *lp;
xdrmem_getlong_aligned(XDR *xdrs, long *lp)
{
if (xdrs->x_handy < sizeof(int32_t))
@@ -144,9 +137,7 @@ xdrmem_getlong_aligned(xdrs, lp)
}
static bool_t
xdrmem_putlong_aligned(xdrs, lp)
XDR *xdrs;
const long *lp;
xdrmem_putlong_aligned(XDR *xdrs, const long *lp)
{
if (xdrs->x_handy < sizeof(int32_t))
@@ -158,9 +149,7 @@ xdrmem_putlong_aligned(xdrs, lp)
}
static bool_t
xdrmem_getlong_unaligned(xdrs, lp)
XDR *xdrs;
long *lp;
xdrmem_getlong_unaligned(XDR *xdrs, long *lp)
{
u_int32_t l;
@@ -174,9 +163,7 @@ xdrmem_getlong_unaligned(xdrs, lp)
}
static bool_t
xdrmem_putlong_unaligned(xdrs, lp)
XDR *xdrs;
const long *lp;
xdrmem_putlong_unaligned(XDR *xdrs, const long *lp)
{
u_int32_t l;
@@ -190,10 +177,7 @@ xdrmem_putlong_unaligned(xdrs, lp)
}
static bool_t
xdrmem_getbytes(xdrs, addr, len)
XDR *xdrs;
char *addr;
u_int len;
xdrmem_getbytes(XDR *xdrs, char *addr, u_int len)
{
if (xdrs->x_handy < len)
@@ -205,10 +189,7 @@ xdrmem_getbytes(xdrs, addr, len)
}
static bool_t
xdrmem_putbytes(xdrs, addr, len)
XDR *xdrs;
const char *addr;
u_int len;
xdrmem_putbytes(XDR *xdrs, const char *addr, u_int len)
{
if (xdrs->x_handy < len)
@@ -220,8 +201,7 @@ xdrmem_putbytes(xdrs, addr, len)
}
static u_int
xdrmem_getpos(xdrs)
XDR *xdrs;
xdrmem_getpos(XDR *xdrs)
{
/* XXX w/64-bit pointers, u_int not enough! */
@@ -229,9 +209,7 @@ xdrmem_getpos(xdrs)
}
static bool_t
xdrmem_setpos(xdrs, pos)
XDR *xdrs;
u_int pos;
xdrmem_setpos(XDR *xdrs, u_int pos)
{
char *newaddr = xdrs->x_base + pos;
char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy;
@@ -244,9 +222,7 @@ xdrmem_setpos(xdrs, pos)
}
static int32_t *
xdrmem_inline_aligned(xdrs, len)
XDR *xdrs;
u_int len;
xdrmem_inline_aligned(XDR *xdrs, u_int len)
{
int32_t *buf = 0;
@@ -260,9 +236,7 @@ xdrmem_inline_aligned(xdrs, len)
/* ARGSUSED */
static int32_t *
xdrmem_inline_unaligned(xdrs, len)
XDR *xdrs;
u_int len;
xdrmem_inline_unaligned(XDR *xdrs, u_int len)
{
return (0);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_rec.c,v 1.31 2010/11/23 14:02:01 christos Exp $ */
/* $NetBSD: xdr_rec.c,v 1.33 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_rec.c,v 1.31 2010/11/23 14:02:01 christos Exp $");
__RCSID("$NetBSD: xdr_rec.c,v 1.33 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -62,6 +62,7 @@ __RCSID("$NetBSD: xdr_rec.c,v 1.31 2010/11/23 14:02:01 christos Exp $");
#include <netinet/in.h>
#include <assert.h>
#include <err.h>
#include <stddef.h>
#include <stdio.h>
@@ -83,15 +84,15 @@ __weak_alias(xdrrec_eof,_xdrrec_eof)
__weak_alias(xdrrec_skiprecord,_xdrrec_skiprecord)
#endif
static bool_t xdrrec_getlong __P((XDR *, long *));
static bool_t xdrrec_putlong __P((XDR *, const long *));
static bool_t xdrrec_getbytes __P((XDR *, char *, u_int));
static bool_t xdrrec_getlong(XDR *, long *);
static bool_t xdrrec_putlong(XDR *, const long *);
static bool_t xdrrec_getbytes(XDR *, char *, u_int);
static bool_t xdrrec_putbytes __P((XDR *, const char *, u_int));
static u_int xdrrec_getpos __P((XDR *));
static bool_t xdrrec_setpos __P((XDR *, u_int));
static int32_t *xdrrec_inline __P((XDR *, u_int));
static void xdrrec_destroy __P((XDR *));
static bool_t xdrrec_putbytes(XDR *, const char *, u_int);
static u_int xdrrec_getpos(XDR *);
static bool_t xdrrec_setpos(XDR *, u_int);
static int32_t *xdrrec_inline(XDR *, u_int);
static void xdrrec_destroy(XDR *);
static const struct xdr_ops xdrrec_ops = {
xdrrec_getlong,
@@ -118,23 +119,23 @@ static const struct xdr_ops xdrrec_ops = {
* meet the needs of xdr and rpc based on tcp.
*/
#define LAST_FRAG ((u_int32_t)(1 << 31))
#define LAST_FRAG ((uint32_t)(1 << 31))
typedef struct rec_strm {
char *tcp_handle;
/*
* out-goung bits
*/
int (*writeit) __P((char *, char *, int));
int (*writeit)(char *, char *, int);
char *out_base; /* output buffer (points to frag header) */
char *out_finger; /* next output position */
char *out_boundry; /* data cannot up to this address */
u_int32_t *frag_header; /* beginning of curren fragment */
uint32_t *frag_header; /* beginning of curren fragment */
bool_t frag_sent; /* true if buffer sent in middle of record */
/*
* in-coming bits
*/
int (*readit) __P((char *, char *, int));
int (*readit)(char *, char *, int);
u_long in_size; /* fixed size of the input buffer */
char *in_base;
char *in_finger; /* location of next byte to be had */
@@ -146,7 +147,7 @@ typedef struct rec_strm {
bool_t nonblock;
bool_t in_haveheader;
u_int32_t in_header;
uint32_t in_header;
char *in_hdrp;
int in_hdrlen;
int in_reclen;
@@ -154,13 +155,13 @@ typedef struct rec_strm {
int in_maxrec;
} RECSTREAM;
static u_int fix_buf_size __P((u_int));
static bool_t flush_out __P((RECSTREAM *, bool_t));
static bool_t fill_input_buf __P((RECSTREAM *));
static bool_t get_input_bytes __P((RECSTREAM *, char *, u_int));
static bool_t set_input_fragment __P((RECSTREAM *));
static bool_t skip_input_bytes __P((RECSTREAM *, long));
static bool_t realloc_stream __P((RECSTREAM *, int));
static u_int fix_buf_size(u_int);
static bool_t flush_out(RECSTREAM *, bool_t);
static bool_t fill_input_buf(RECSTREAM *);
static bool_t get_input_bytes(RECSTREAM *, char *, u_int);
static bool_t set_input_fragment(RECSTREAM *);
static bool_t skip_input_bytes(RECSTREAM *, long);
static bool_t realloc_stream(RECSTREAM *, int);
/*
@@ -173,15 +174,15 @@ static bool_t realloc_stream __P((RECSTREAM *, int));
* calls expect that they take an opaque handle rather than an fd.
*/
void
xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
XDR *xdrs;
u_int sendsize;
u_int recvsize;
char *tcp_handle;
xdrrec_create(
XDR *xdrs,
u_int sendsize,
u_int recvsize,
char *tcp_handle,
/* like read, but pass it a tcp_handle, not sock */
int (*readit) __P((char *, char *, int));
int (*readit)(char *, char *, int),
/* like write, but pass it a tcp_handle, not sock */
int (*writeit) __P((char *, char *, int));
int (*writeit)(char *, char *, int))
{
RECSTREAM *rstrm = mem_alloc(sizeof(RECSTREAM));
@@ -219,8 +220,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
rstrm->readit = readit;
rstrm->writeit = writeit;
rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
rstrm->frag_header = (u_int32_t *)(void *)rstrm->out_base;
rstrm->out_finger += sizeof(u_int32_t);
rstrm->frag_header = (uint32_t *)(void *)rstrm->out_base;
rstrm->out_finger += sizeof(uint32_t);
rstrm->out_boundry += sendsize;
rstrm->frag_sent = FALSE;
rstrm->in_size = recvsize;
@@ -243,9 +244,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
*/
static bool_t
xdrrec_getlong(xdrs, lp)
XDR *xdrs;
long *lp;
xdrrec_getlong(XDR *xdrs, long *lp)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
int32_t *buflp = (int32_t *)(void *)(rstrm->in_finger);
@@ -254,22 +253,20 @@ xdrrec_getlong(xdrs, lp)
/* first try the inline, fast case */
if ((rstrm->fbtbc >= (long)sizeof(int32_t)) &&
(((uintptr_t)rstrm->in_boundry - (uintptr_t)buflp) >= sizeof(int32_t))) {
*lp = (long)ntohl((u_int32_t)(*buflp));
*lp = (long)ntohl((uint32_t)(*buflp));
rstrm->fbtbc -= sizeof(int32_t);
rstrm->in_finger += sizeof(int32_t);
} else {
if (! xdrrec_getbytes(xdrs, (char *)(void *)&mylong,
sizeof(int32_t)))
(u_int)sizeof(int32_t)))
return (FALSE);
*lp = (long)ntohl((u_int32_t)mylong);
*lp = (long)ntohl((uint32_t)mylong);
}
return (TRUE);
}
static bool_t
xdrrec_putlong(xdrs, lp)
XDR *xdrs;
const long *lp;
xdrrec_putlong(XDR *xdrs, const long *lp)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
int32_t *dest_lp = ((int32_t *)(void *)(rstrm->out_finger));
@@ -286,15 +283,12 @@ xdrrec_putlong(xdrs, lp)
dest_lp = ((int32_t *)(void *)(rstrm->out_finger));
rstrm->out_finger += sizeof(int32_t);
}
*dest_lp = (int32_t)htonl((u_int32_t)(*lp));
*dest_lp = (int32_t)htonl((uint32_t)(*lp));
return (TRUE);
}
static bool_t /* must manage buffers, fragments, and records */
xdrrec_getbytes(xdrs, addr, len)
XDR *xdrs;
char *addr;
u_int len;
xdrrec_getbytes(XDR *xdrs, char *addr, u_int len)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
u_int current;
@@ -319,10 +313,7 @@ xdrrec_getbytes(xdrs, addr, len)
}
static bool_t
xdrrec_putbytes(xdrs, addr, len)
XDR *xdrs;
const char *addr;
u_int len;
xdrrec_putbytes(XDR *xdrs, const char *addr, u_int len)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
size_t current;
@@ -334,7 +325,8 @@ xdrrec_putbytes(xdrs, addr, len)
memmove(rstrm->out_finger, addr, current);
rstrm->out_finger += current;
addr += current;
len -= current;
_DIAGASSERT(__type_fit(u_int, current));
len -= (u_int)current;
if (rstrm->out_finger == rstrm->out_boundry) {
rstrm->frag_sent = TRUE;
if (! flush_out(rstrm, FALSE))
@@ -345,8 +337,7 @@ xdrrec_putbytes(xdrs, addr, len)
}
static u_int
xdrrec_getpos(xdrs)
XDR *xdrs;
xdrrec_getpos(XDR *xdrs)
{
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
off_t pos;
@@ -371,9 +362,7 @@ xdrrec_getpos(xdrs)
}
static bool_t
xdrrec_setpos(xdrs, pos)
XDR *xdrs;
u_int pos;
xdrrec_setpos(XDR *xdrs, u_int pos)
{
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
u_int currpos = xdrrec_getpos(xdrs);
@@ -410,9 +399,7 @@ xdrrec_setpos(xdrs, pos)
}
static int32_t *
xdrrec_inline(xdrs, len)
XDR *xdrs;
u_int len;
xdrrec_inline(XDR *xdrs, u_int len)
{
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
int32_t *buf = NULL;
@@ -442,8 +429,7 @@ xdrrec_inline(xdrs, len)
}
static void
xdrrec_destroy(xdrs)
XDR *xdrs;
xdrrec_destroy(XDR *xdrs)
{
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
@@ -462,8 +448,7 @@ xdrrec_destroy(xdrs)
* this procedure to guarantee proper record alignment.
*/
bool_t
xdrrec_skiprecord(xdrs)
XDR *xdrs;
xdrrec_skiprecord(XDR *xdrs)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
enum xprt_stat xstat;
@@ -497,8 +482,7 @@ xdrrec_skiprecord(xdrs)
* after consuming the rest of the current record.
*/
bool_t
xdrrec_eof(xdrs)
XDR *xdrs;
xdrrec_eof(XDR *xdrs)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
@@ -521,24 +505,22 @@ xdrrec_eof(xdrs)
* pipelined procedure calls.) TRUE => immmediate flush to tcp connection.
*/
bool_t
xdrrec_endofrecord(xdrs, sendnow)
XDR *xdrs;
bool_t sendnow;
xdrrec_endofrecord(XDR *xdrs, bool_t sendnow)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
u_long len; /* fragment length */
if (sendnow || rstrm->frag_sent ||
((u_long)rstrm->out_finger + sizeof(u_int32_t) >=
((u_long)rstrm->out_finger + sizeof(uint32_t) >=
(u_long)rstrm->out_boundry)) {
rstrm->frag_sent = FALSE;
return (flush_out(rstrm, TRUE));
}
len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) -
sizeof(u_int32_t);
*(rstrm->frag_header) = htonl((u_int32_t)len | LAST_FRAG);
rstrm->frag_header = (u_int32_t *)(void *)rstrm->out_finger;
rstrm->out_finger += sizeof(u_int32_t);
sizeof(uint32_t);
*(rstrm->frag_header) = htonl((uint32_t)len | LAST_FRAG);
rstrm->frag_header = (uint32_t *)(void *)rstrm->out_finger;
rstrm->out_finger += sizeof(uint32_t);
return (TRUE);
}
@@ -547,10 +529,7 @@ xdrrec_endofrecord(xdrs, sendnow)
* Return true if a record is available in the buffer, false if not.
*/
bool_t
__xdrrec_getrec(xdrs, statp, expectdata)
XDR *xdrs;
enum xprt_stat *statp;
bool_t expectdata;
__xdrrec_getrec(XDR *xdrs, enum xprt_stat *statp, bool_t expectdata)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
ssize_t n;
@@ -568,7 +547,8 @@ __xdrrec_getrec(xdrs, statp, expectdata)
return FALSE;
}
rstrm->in_hdrp += n;
rstrm->in_hdrlen += n;
_DIAGASSERT(__type_fit(int, n));
rstrm->in_hdrlen += (int)n;
if (rstrm->in_hdrlen < (int)sizeof(rstrm->in_header)) {
*statp = XPRT_MOREREQS;
return FALSE;
@@ -607,7 +587,8 @@ __xdrrec_getrec(xdrs, statp, expectdata)
return FALSE;
}
rstrm->in_received += n;
_DIAGASSERT(__type_fit(int, n));
rstrm->in_received += (int)n;
if (rstrm->in_received == rstrm->in_reclen) {
rstrm->in_haveheader = FALSE;
@@ -628,9 +609,7 @@ __xdrrec_getrec(xdrs, statp, expectdata)
}
bool_t
__xdrrec_setnonblock(xdrs, maxrec)
XDR *xdrs;
int maxrec;
__xdrrec_setnonblock(XDR *xdrs, int maxrec)
{
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
@@ -646,39 +625,36 @@ __xdrrec_setnonblock(xdrs, maxrec)
* Internal useful routines
*/
static bool_t
flush_out(rstrm, eor)
RECSTREAM *rstrm;
bool_t eor;
flush_out(RECSTREAM *rstrm, bool_t eor)
{
u_int32_t eormask = (eor == TRUE) ? LAST_FRAG : 0;
u_int32_t len = (u_int32_t)((u_long)(rstrm->out_finger) -
(u_long)(rstrm->frag_header) - sizeof(u_int32_t));
uint32_t eormask = (eor == TRUE) ? LAST_FRAG : 0;
uint32_t len = (uint32_t)((u_long)(rstrm->out_finger) -
(u_long)(rstrm->frag_header) - sizeof(uint32_t));
*(rstrm->frag_header) = htonl(len | eormask);
len = (u_int32_t)((u_long)(rstrm->out_finger) -
len = (uint32_t)((u_long)(rstrm->out_finger) -
(u_long)(rstrm->out_base));
if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
!= (int)len)
return (FALSE);
rstrm->frag_header = (u_int32_t *)(void *)rstrm->out_base;
rstrm->out_finger = (char *)rstrm->out_base + sizeof(u_int32_t);
rstrm->frag_header = (uint32_t *)(void *)rstrm->out_base;
rstrm->out_finger = (char *)rstrm->out_base + sizeof(uint32_t);
return (TRUE);
}
static bool_t /* knows nothing about records! Only about input buffers */
fill_input_buf(rstrm)
RECSTREAM *rstrm;
fill_input_buf(RECSTREAM *rstrm)
{
char *where;
u_int32_t i;
uint32_t i;
int len;
if (rstrm->nonblock)
return FALSE;
where = rstrm->in_base;
i = (u_int32_t)((u_long)rstrm->in_boundry % BYTES_PER_XDR_UNIT);
i = (uint32_t)((u_long)rstrm->in_boundry % BYTES_PER_XDR_UNIT);
where += i;
len = (u_int32_t)(rstrm->in_size - i);
len = (uint32_t)(rstrm->in_size - i);
if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
return (FALSE);
rstrm->in_finger = where;
@@ -688,10 +664,7 @@ fill_input_buf(rstrm)
}
static bool_t /* knows nothing about records! Only about input buffers */
get_input_bytes(rstrm, addr, len)
RECSTREAM *rstrm;
char *addr;
u_int len;
get_input_bytes(RECSTREAM *rstrm, char *addr, u_int len)
{
u_int current;
@@ -704,8 +677,10 @@ get_input_bytes(rstrm, addr, len)
}
while (len > 0) {
current = ((uintptr_t)rstrm->in_boundry -
uintptr_t d = ((uintptr_t)rstrm->in_boundry -
(uintptr_t)rstrm->in_finger);
_DIAGASSERT(__type_fit(u_int, d));
current = (u_int)d;
if (current == 0) {
if (! fill_input_buf(rstrm))
return (FALSE);
@@ -721,14 +696,14 @@ get_input_bytes(rstrm, addr, len)
}
static bool_t /* next two bytes of the input stream are treated as a header */
set_input_fragment(rstrm)
RECSTREAM *rstrm;
set_input_fragment(RECSTREAM *rstrm)
{
u_int32_t header;
uint32_t header;
if (rstrm->nonblock)
return FALSE;
if (! get_input_bytes(rstrm, (char *)(void *)&header, sizeof(header)))
if (! get_input_bytes(rstrm, (char *)(void *)&header,
(u_int)sizeof(header)))
return (FALSE);
header = ntohl(header);
rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
@@ -747,21 +722,19 @@ set_input_fragment(rstrm)
}
static bool_t /* consumes input bytes; knows nothing about records! */
skip_input_bytes(rstrm, cnt)
RECSTREAM *rstrm;
long cnt;
skip_input_bytes(RECSTREAM *rstrm, long cnt)
{
u_int32_t current;
uint32_t current;
while (cnt > 0) {
current = (size_t)((long)rstrm->in_boundry -
current = (uint32_t)((long)rstrm->in_boundry -
(long)rstrm->in_finger);
if (current == 0) {
if (! fill_input_buf(rstrm))
return (FALSE);
continue;
}
current = ((u_int32_t)cnt < current) ? (u_int32_t)cnt : current;
current = ((uint32_t)cnt < current) ? (uint32_t)cnt : current;
rstrm->in_finger += current;
cnt -= current;
}
@@ -769,8 +742,7 @@ skip_input_bytes(rstrm, cnt)
}
static u_int
fix_buf_size(s)
u_int s;
fix_buf_size(u_int s)
{
if (s < 100)
@@ -782,9 +754,7 @@ fix_buf_size(s)
* Reallocate the input buffer for a non-block stream.
*/
static bool_t
realloc_stream(rstrm, size)
RECSTREAM *rstrm;
int size;
realloc_stream(RECSTREAM *rstrm, int size)
{
ptrdiff_t diff;
char *buf;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_reference.c,v 1.15 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: xdr_reference.c,v 1.16 2012/06/25 22:32:45 abs Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
static char *sccsid = "@(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_reference.c,v 1.15 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: xdr_reference.c,v 1.16 2012/06/25 22:32:45 abs Exp $");
#endif
#endif
@@ -73,11 +73,7 @@ __weak_alias(xdr_reference,_xdr_reference)
* proc is the routine to handle the referenced structure.
*/
bool_t
xdr_reference(xdrs, pp, size, proc)
XDR *xdrs;
caddr_t *pp; /* the pointer to work on */
u_int size; /* size of the object pointed to */
xdrproc_t proc; /* xdr routine to handle the object */
xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
{
caddr_t loc = *pp;
bool_t stat;
@@ -130,11 +126,7 @@ xdr_reference(xdrs, pp, size, proc)
*
*/
bool_t
xdr_pointer(xdrs,objpp,obj_size,xdr_obj)
XDR *xdrs;
char **objpp;
u_int obj_size;
xdrproc_t xdr_obj;
xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)
{
bool_t more_data;

170
lib/libc/rpc/xdr_sizeof.c Normal file
View File

@@ -0,0 +1,170 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* xdr_sizeof.c
*
* Copyright 1990 Sun Microsystems, Inc.
*
* General purpose routine to see how much space something will use
* when serialized using XDR.
*/
#include <sys/cdefs.h>
#if 0
__FBSDID("$FreeBSD: src/lib/libc/xdr/xdr_sizeof.c,v 1.5.38.1 2010/12/21 17:10:29 kensmith Exp $");
#else
__RCSID("$NetBSD: xdr_sizeof.c,v 1.4 2012/03/20 17:14:50 matt Exp $");
#endif
#include "namespace.h"
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <sys/types.h>
#include <stdlib.h>
#ifdef __weak_alias
__weak_alias(xdr_sizeof,_xdr_sizeof)
#endif
static bool_t x_putlong(XDR *, const long *);
static bool_t x_putbytes(XDR *, const char *, u_int);
static u_int x_getpostn(XDR *);
static bool_t x_setpostn(XDR *, u_int);
static int32_t *x_inline(XDR *, u_int);
static int harmless(void);
static void x_destroy(XDR *);
/* ARGSUSED */
static bool_t
x_putlong(XDR *xdrs, const long *longp)
{
xdrs->x_handy += BYTES_PER_XDR_UNIT;
return (TRUE);
}
/* ARGSUSED */
static bool_t
x_putbytes(XDR *xdrs, const char *bp, u_int len)
{
xdrs->x_handy += len;
return (TRUE);
}
static u_int
x_getpostn(XDR *xdrs)
{
return (xdrs->x_handy);
}
/* ARGSUSED */
static bool_t
x_setpostn(XDR *xdrs, u_int pos)
{
/* This is not allowed */
return (FALSE);
}
static int32_t *
x_inline(XDR *xdrs, u_int len)
{
if (len == 0) {
return (NULL);
}
if (xdrs->x_op != XDR_ENCODE) {
return (NULL);
}
if (len < (u_int)(uintptr_t)xdrs->x_base) {
/* x_private was already allocated */
xdrs->x_handy += len;
return ((int32_t *) xdrs->x_private);
} else {
/* Free the earlier space and allocate new area */
if (xdrs->x_private)
free(xdrs->x_private);
if ((xdrs->x_private = malloc(len)) == NULL) {
xdrs->x_base = 0;
return (NULL);
}
xdrs->x_base = (caddr_t)(uintptr_t)len;
xdrs->x_handy += len;
return ((int32_t *) xdrs->x_private);
}
}
static int
harmless(void)
{
/* Always return FALSE/NULL, as the case may be */
return (0);
}
static void
x_destroy(XDR *xdrs)
{
xdrs->x_handy = 0;
xdrs->x_base = 0;
if (xdrs->x_private) {
free(xdrs->x_private);
xdrs->x_private = NULL;
}
return;
}
unsigned long
xdr_sizeof(xdrproc_t func, void *data)
{
XDR x;
struct xdr_ops ops;
bool_t stat;
/* to stop ANSI-C compiler from complaining */
typedef bool_t (* dummyfunc1)(XDR *, long *);
typedef bool_t (* dummyfunc2)(XDR *, caddr_t, u_int);
ops.x_putlong = x_putlong;
ops.x_putbytes = x_putbytes;
ops.x_inline = x_inline;
ops.x_getpostn = x_getpostn;
ops.x_setpostn = x_setpostn;
ops.x_destroy = x_destroy;
/* the other harmless ones */
ops.x_getlong = (dummyfunc1) harmless;
ops.x_getbytes = (dummyfunc2) harmless;
x.x_op = XDR_ENCODE;
x.x_ops = &ops;
x.x_handy = 0;
x.x_private = (caddr_t) NULL;
x.x_base = (caddr_t) 0;
stat = func(&x, data);
if (x.x_private)
free(x.x_private);
return (stat == TRUE ? (unsigned) x.x_handy: 0);
}

View File

@@ -1,4 +1,4 @@
/* $NetBSD: xdr_stdio.c,v 1.17 2006/10/15 16:14:46 christos Exp $ */
/* $NetBSD: xdr_stdio.c,v 1.18 2012/03/20 17:14:50 matt Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";
#else
__RCSID("$NetBSD: xdr_stdio.c,v 1.17 2006/10/15 16:14:46 christos Exp $");
__RCSID("$NetBSD: xdr_stdio.c,v 1.18 2012/03/20 17:14:50 matt Exp $");
#endif
#endif
@@ -60,14 +60,14 @@ __RCSID("$NetBSD: xdr_stdio.c,v 1.17 2006/10/15 16:14:46 christos Exp $");
__weak_alias(xdrstdio_create,_xdrstdio_create)
#endif
static void xdrstdio_destroy __P((XDR *));
static bool_t xdrstdio_getlong __P((XDR *, long *));
static bool_t xdrstdio_putlong __P((XDR *, const long *));
static bool_t xdrstdio_getbytes __P((XDR *, char *, u_int));
static bool_t xdrstdio_putbytes __P((XDR *, const char *, u_int));
static u_int xdrstdio_getpos __P((XDR *));
static bool_t xdrstdio_setpos __P((XDR *, u_int));
static int32_t *xdrstdio_inline __P((XDR *, u_int));
static void xdrstdio_destroy(XDR *);
static bool_t xdrstdio_getlong(XDR *, long *);
static bool_t xdrstdio_putlong(XDR *, const long *);
static bool_t xdrstdio_getbytes(XDR *, char *, u_int);
static bool_t xdrstdio_putbytes(XDR *, const char *, u_int);
static u_int xdrstdio_getpos(XDR *);
static bool_t xdrstdio_setpos(XDR *, u_int);
static int32_t *xdrstdio_inline(XDR *, u_int);
/*
* Ops vector for stdio type XDR
@@ -90,10 +90,7 @@ static const struct xdr_ops xdrstdio_ops = {
* Operation flag is set to op.
*/
void
xdrstdio_create(xdrs, file, op)
XDR *xdrs;
FILE *file;
enum xdr_op op;
xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op)
{
xdrs->x_op = op;
@@ -108,17 +105,14 @@ xdrstdio_create(xdrs, file, op)
* Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
*/
static void
xdrstdio_destroy(xdrs)
XDR *xdrs;
xdrstdio_destroy(XDR *xdrs)
{
(void)fflush((FILE *)xdrs->x_private);
/* XXX: should we close the file ?? */
}
static bool_t
xdrstdio_getlong(xdrs, lp)
XDR *xdrs;
long *lp;
xdrstdio_getlong(XDR *xdrs, long *lp)
{
u_int32_t temp;
@@ -129,9 +123,7 @@ xdrstdio_getlong(xdrs, lp)
}
static bool_t
xdrstdio_putlong(xdrs, lp)
XDR *xdrs;
const long *lp;
xdrstdio_putlong(XDR *xdrs, const long *lp)
{
int32_t mycopy = htonl((u_int32_t)*lp);
@@ -141,10 +133,7 @@ xdrstdio_putlong(xdrs, lp)
}
static bool_t
xdrstdio_getbytes(xdrs, addr, len)
XDR *xdrs;
char *addr;
u_int len;
xdrstdio_getbytes(XDR *xdrs, char *addr, u_int len)
{
if ((len != 0) && (fread(addr, (size_t)len, 1, (FILE *)xdrs->x_private) != 1))
@@ -153,10 +142,7 @@ xdrstdio_getbytes(xdrs, addr, len)
}
static bool_t
xdrstdio_putbytes(xdrs, addr, len)
XDR *xdrs;
const char *addr;
u_int len;
xdrstdio_putbytes(XDR *xdrs, const char *addr, u_int len)
{
if ((len != 0) && (fwrite(addr, (size_t)len, 1,
@@ -166,17 +152,14 @@ xdrstdio_putbytes(xdrs, addr, len)
}
static u_int
xdrstdio_getpos(xdrs)
XDR *xdrs;
xdrstdio_getpos(XDR *xdrs)
{
return ((u_int) ftell((FILE *)xdrs->x_private));
}
static bool_t
xdrstdio_setpos(xdrs, pos)
XDR *xdrs;
u_int pos;
xdrstdio_setpos(XDR *xdrs, u_int pos)
{
return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
@@ -185,9 +168,7 @@ xdrstdio_setpos(xdrs, pos)
/* ARGSUSED */
static int32_t *
xdrstdio_inline(xdrs, len)
XDR *xdrs;
u_int len;
xdrstdio_inline(XDR *xdrs, u_int len)
{
/*