From 1f5986bf651597e82ddc6941484606855b45be92 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Thu, 27 May 2010 07:36:24 +0000 Subject: =?UTF-8?q?2010-05-27=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * librpc/include/rpc/clnt.h, librpc/include/rpc/rpc_msg.h, librpc/src/rpc/clnt_generic.c, librpc/src/rpc/clnt_raw.c, librpc/src/rpc/clnt_tcp.c, librpc/src/rpc/clnt_udp.c, librpc/src/rpc/pmap_clnt.c, librpc/src/rpc/pmap_getmaps.c librpc/src/rpc/pmap_getport.c: Partial merger from freebsd (portability fixes). --- cpukit/librpc/src/rpc/clnt_generic.c | 8 ++++---- cpukit/librpc/src/rpc/clnt_raw.c | 12 ++++++------ cpukit/librpc/src/rpc/clnt_tcp.c | 16 ++++++++-------- cpukit/librpc/src/rpc/clnt_udp.c | 20 ++++++++++---------- cpukit/librpc/src/rpc/pmap_clnt.c | 8 ++++---- cpukit/librpc/src/rpc/pmap_getmaps.c | 12 +++++++----- cpukit/librpc/src/rpc/pmap_getport.c | 14 ++++++++------ 7 files changed, 47 insertions(+), 43 deletions(-) (limited to 'cpukit/librpc/src/rpc') diff --git a/cpukit/librpc/src/rpc/clnt_generic.c b/cpukit/librpc/src/rpc/clnt_generic.c index 4abaca1456..232af02cd7 100644 --- a/cpukit/librpc/src/rpc/clnt_generic.c +++ b/cpukit/librpc/src/rpc/clnt_generic.c @@ -53,10 +53,10 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_generic.c,v 1.9 1999/08/28 */ CLIENT * clnt_create( - char *hostname, - u_long prog, - u_long vers, - char *proto) + const char *hostname, + rpcprog_t prog, + rpcvers_t vers, + const char *proto) { struct hostent *h; struct protoent *p; diff --git a/cpukit/librpc/src/rpc/clnt_raw.c b/cpukit/librpc/src/rpc/clnt_raw.c index 6c604a3a72..c522cecc7e 100644 --- a/cpukit/librpc/src/rpc/clnt_raw.c +++ b/cpukit/librpc/src/rpc/clnt_raw.c @@ -69,10 +69,10 @@ struct clnt_raw_private { }; #define clntraw_private (rtems_rpc_task_variables->clnt_raw_private) -static enum clnt_stat clntraw_call(CLIENT *h, u_long proc, xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults, caddr_t resultsp, struct timeval timeout); +static enum clnt_stat clntraw_call(CLIENT *h, rpcproc_t proc, xdrproc_t xargs, void *argsp, xdrproc_t xresults, void *resultsp, struct timeval timeout); static void clntraw_abort(void); static void clntraw_geterr(CLIENT *h, struct rpc_err*); -static bool_t clntraw_freeres(CLIENT *, xdrproc_t, caddr_t); +static bool_t clntraw_freeres(CLIENT *, xdrproc_t, void*); static bool_t clntraw_control(CLIENT *, int, char *); static void clntraw_destroy(CLIENT *); @@ -134,11 +134,11 @@ clntraw_create( static enum clnt_stat clntraw_call( CLIENT *h, - u_long proc, + rpcproc_t proc, xdrproc_t xargs, - caddr_t argsp, + void *argsp, xdrproc_t xresults, - caddr_t resultsp, + void *resultsp, struct timeval timeout ) { struct clnt_raw_private *clp = clntraw_private; @@ -216,7 +216,7 @@ static bool_t clntraw_freeres( CLIENT *cl, xdrproc_t xdr_res, - caddr_t res_ptr ) + void *res_ptr ) { struct clnt_raw_private *clp = clntraw_private; XDR *xdrs = &clp->xdr_stream; diff --git a/cpukit/librpc/src/rpc/clnt_tcp.c b/cpukit/librpc/src/rpc/clnt_tcp.c index 3873d99a18..91df7112a4 100644 --- a/cpukit/librpc/src/rpc/clnt_tcp.c +++ b/cpukit/librpc/src/rpc/clnt_tcp.c @@ -72,10 +72,10 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_tcp.c,v 1.14 2000/01/27 23 static int readtcp(char *, char*, int); static int writetcp(char *, char*, int); -static enum clnt_stat clnttcp_call(CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clnttcp_call(CLIENT *, rpcproc_t, xdrproc_t, void*, xdrproc_t, void*, struct timeval); static void clnttcp_abort(void); static void clnttcp_geterr(CLIENT *, struct rpc_err*); -static bool_t clnttcp_freeres(CLIENT *, xdrproc_t, caddr_t); +static bool_t clnttcp_freeres(CLIENT *, xdrproc_t, void*); static bool_t clnttcp_control(CLIENT *, int, char *); static void clnttcp_destroy(CLIENT *); @@ -120,8 +120,8 @@ struct ct_data { CLIENT * clnttcp_create( struct sockaddr_in *raddr, - u_long prog, - u_long vers, + rpcprog_t prog, /* program number */ + rpcvers_t vers, /* version number */ int *sockp, u_int sendsz, u_int recvsz) @@ -240,11 +240,11 @@ fooy: static enum clnt_stat clnttcp_call( CLIENT *h, - u_long proc, + rpcproc_t proc, xdrproc_t xdr_args, - caddr_t args_ptr, + void *args_ptr, xdrproc_t xdr_results, - caddr_t results_ptr, + void *results_ptr, struct timeval timeout) { struct ct_data *ct = (struct ct_data *) h->cl_private; @@ -351,7 +351,7 @@ static bool_t clnttcp_freeres( CLIENT *cl, xdrproc_t xdr_res, - caddr_t res_ptr) + void *res_ptr) { struct ct_data *ct; XDR *xdrs; diff --git a/cpukit/librpc/src/rpc/clnt_udp.c b/cpukit/librpc/src/rpc/clnt_udp.c index 513da51284..44338ae406 100644 --- a/cpukit/librpc/src/rpc/clnt_udp.c +++ b/cpukit/librpc/src/rpc/clnt_udp.c @@ -58,10 +58,10 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_udp.c,v 1.15 2000/01/27 23 /* * UDP bases client side rpc operations */ -static enum clnt_stat clntudp_call(CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clntudp_call(CLIENT *, rpcproc_t, xdrproc_t, void*, xdrproc_t, void*, struct timeval); static void clntudp_abort(void); static void clntudp_geterr(CLIENT *, struct rpc_err*); -static bool_t clntudp_freeres(CLIENT *, xdrproc_t, caddr_t); +static bool_t clntudp_freeres(CLIENT *, xdrproc_t, void*); static bool_t clntudp_control(CLIENT *, int, char *); static void clntudp_destroy(CLIENT *); @@ -112,8 +112,8 @@ struct cu_data { CLIENT * clntudp_bufcreate( struct sockaddr_in *raddr, - u_long program, - u_long version, + rpcprog_t program, /* program number */ + rpcvers_t version, /* version number */ struct timeval wait, int *sockp, u_int sendsz, @@ -206,8 +206,8 @@ fooy: CLIENT * clntudp_create( struct sockaddr_in *raddr, - u_long program, - u_long version, + rpcprog_t program, /* program number */ + rpcvers_t version, /* version number */ struct timeval wait, int *sockp) { @@ -219,11 +219,11 @@ clntudp_create( static enum clnt_stat clntudp_call( CLIENT *cl, /* client handle */ - u_long proc, /* procedure number */ + rpcproc_t proc, /* procedure number */ xdrproc_t xargs, /* xdr routine for args */ - caddr_t argsp, /* pointer to args */ + void *argsp, /* pointer to args */ xdrproc_t xresults, /* xdr routine for results */ - caddr_t resultsp, /* pointer to results */ + void *resultsp, /* pointer to results */ struct timeval utimeout ) /* seconds to wait before giving up */ { struct cu_data *cu = (struct cu_data *)cl->cl_private; @@ -423,7 +423,7 @@ static bool_t clntudp_freeres( CLIENT *cl, xdrproc_t xdr_res, - caddr_t res_ptr) + void *res_ptr) { struct cu_data *cu = (struct cu_data *)cl->cl_private; XDR *xdrs = &(cu->cu_outxdrs); diff --git a/cpukit/librpc/src/rpc/pmap_clnt.c b/cpukit/librpc/src/rpc/pmap_clnt.c index 8dcb1824f3..7c02867ea2 100644 --- a/cpukit/librpc/src/rpc/pmap_clnt.c +++ b/cpukit/librpc/src/rpc/pmap_clnt.c @@ -72,7 +72,7 @@ pmap_set( { struct sockaddr_in myaddress; int socket = -1; - register CLIENT *client; + CLIENT *client; struct pmap parms; bool_t rslt; struct stat st; @@ -97,7 +97,7 @@ pmap_set( parms.pm_vers = version; parms.pm_prot = protocol; parms.pm_port = port; - if (CLNT_CALL(client, PMAPPROC_SET, xdr_pmap, &parms, xdr_bool, &rslt, + if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, &parms, (xdrproc_t)xdr_bool, &rslt, tottimeout) != RPC_SUCCESS) { clnt_perror(client, "Cannot register service"); return (FALSE); @@ -109,7 +109,7 @@ pmap_set( } /* - * Remove the mapping between program,version and port. + * Remove the mapping between program, version and port. * Calls the pmap service remotely to do the un-mapping. */ bool_t @@ -142,7 +142,7 @@ pmap_unset( parms.pm_prog = program; parms.pm_vers = version; parms.pm_port = parms.pm_prot = 0; - CLNT_CALL(client, PMAPPROC_UNSET, xdr_pmap, &parms, xdr_bool, &rslt, + CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, &parms, (xdrproc_t)xdr_bool, &rslt, tottimeout); CLNT_DESTROY(client); if (socket != -1) diff --git a/cpukit/librpc/src/rpc/pmap_getmaps.c b/cpukit/librpc/src/rpc/pmap_getmaps.c index 83514644e4..b284b57254 100644 --- a/cpukit/librpc/src/rpc/pmap_getmaps.c +++ b/cpukit/librpc/src/rpc/pmap_getmaps.c @@ -66,19 +66,21 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_getmaps.c,v 1.11 2000/01/2 struct pmaplist * pmap_getmaps(struct sockaddr_in *address) { - struct pmaplist *head = (struct pmaplist *)NULL; + struct pmaplist *head = NULL; int socket = -1; struct timeval minutetimeout; - register CLIENT *client; + CLIENT *client; minutetimeout.tv_sec = 60; minutetimeout.tv_usec = 0; address->sin_port = htons(PMAPPORT); client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket, 50, 500); - if (client != (CLIENT *)NULL) { - if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist, - &head, minutetimeout) != RPC_SUCCESS) { + if (client != NULL) { + if (CLNT_CALL(client, (rpcproc_t)PMAPPROC_DUMP, + (xdrproc_t)xdr_void, NULL, + (xdrproc_t)xdr_pmaplist, &head, minutetimeout) != + RPC_SUCCESS) { clnt_perror(client, "pmap_getmaps rpc problem"); } CLNT_DESTROY(client); diff --git a/cpukit/librpc/src/rpc/pmap_getport.c b/cpukit/librpc/src/rpc/pmap_getport.c index 405d5ec546..c75b4d5444 100644 --- a/cpukit/librpc/src/rpc/pmap_getport.c +++ b/cpukit/librpc/src/rpc/pmap_getport.c @@ -52,8 +52,8 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_getport.c,v 1.10 2000/01/2 #include #include -static struct timeval timeout = { 5, 0 }; -static struct timeval tottimeout = { 60, 0 }; +static const struct timeval timeout = { 5, 0 }; +static const struct timeval tottimeout = { 60, 0 }; /* * Find the mapped port for program,version. @@ -69,19 +69,21 @@ pmap_getport( { u_short port = 0; int socket = -1; - register CLIENT *client; + CLIENT *client; struct pmap parms; address->sin_port = htons(PMAPPORT); client = clntudp_bufcreate(address, PMAPPROG, PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); - if (client != (CLIENT *)NULL) { + if (client != NULL) { parms.pm_prog = program; parms.pm_vers = version; parms.pm_prot = protocol; parms.pm_port = 0; /* not needed or used */ - if (CLNT_CALL(client, PMAPPROC_GETPORT, xdr_pmap, &parms, - xdr_u_short, &port, tottimeout) != RPC_SUCCESS){ + if (CLNT_CALL(client, (rpcproc_t)PMAPPROC_GETPORT, + (xdrproc_t)xdr_pmap, + &parms, (xdrproc_t)xdr_u_short, &port, tottimeout) != + RPC_SUCCESS){ rpc_createerr.cf_stat = RPC_PMAPFAILURE; clnt_geterr(client, &rpc_createerr.cf_error); } else if (port == 0) { -- cgit v1.2.3