summaryrefslogtreecommitdiffstats
path: root/freebsd/lib/libc/rpc/svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/lib/libc/rpc/svc.c')
-rw-r--r--freebsd/lib/libc/rpc/svc.c111
1 files changed, 37 insertions, 74 deletions
diff --git a/freebsd/lib/libc/rpc/svc.c b/freebsd/lib/libc/rpc/svc.c
index 709bfffa..64b79036 100644
--- a/freebsd/lib/libc/rpc/svc.c
+++ b/freebsd/lib/libc/rpc/svc.c
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
* The services list
* Each entry represents a set of procedures (an rpc program).
* The dispatch routine takes request structs and runs the
- * apropriate procedure.
+ * appropriate procedure.
*/
static struct svc_callout {
struct svc_callout *sc_next;
@@ -86,6 +86,9 @@ static struct svc_callout {
void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
} *svc_head;
+SVCXPRT **__svc_xports;
+int __svc_maxrec;
+
static struct svc_callout *svc_find(rpcprog_t, rpcvers_t,
struct svc_callout **, char *);
static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
@@ -96,8 +99,7 @@ static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
* Activate a transport handle.
*/
void
-xprt_register(xprt)
- SVCXPRT *xprt;
+xprt_register(SVCXPRT *xprt)
{
int sock;
@@ -139,9 +141,7 @@ __xprt_unregister_unlocked(SVCXPRT *xprt)
* De-activate a transport handle.
*/
static void
-__xprt_do_unregister(xprt, dolock)
- SVCXPRT *xprt;
- bool_t dolock;
+__xprt_do_unregister(SVCXPRT *xprt, bool_t dolock)
{
int sock;
@@ -170,12 +170,9 @@ __xprt_do_unregister(xprt, dolock)
* program number comes in.
*/
bool_t
-svc_reg(xprt, prog, vers, dispatch, nconf)
- SVCXPRT *xprt;
- const rpcprog_t prog;
- const rpcvers_t vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- const struct netconfig *nconf;
+svc_reg(SVCXPRT *xprt, const rpcprog_t prog, const rpcvers_t vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ const struct netconfig *nconf)
{
bool_t dummy;
struct svc_callout *prev;
@@ -203,8 +200,7 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
rwlock_wrlock(&svc_lock);
if ((s = svc_find(prog, vers, &prev, netid)) != NULL) {
- if (netid)
- free(netid);
+ free(netid);
if (s->sc_dispatch == dispatch)
goto rpcb_it; /* he is registering another xptr */
rwlock_unlock(&svc_lock);
@@ -212,8 +208,7 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
}
s = mem_alloc(sizeof (struct svc_callout));
if (s == NULL) {
- if (netid)
- free(netid);
+ free(netid);
rwlock_unlock(&svc_lock);
return (FALSE);
}
@@ -244,9 +239,7 @@ rpcb_it:
* Remove a service program from the callout list.
*/
void
-svc_unreg(prog, vers)
- const rpcprog_t prog;
- const rpcvers_t vers;
+svc_unreg(const rpcprog_t prog, const rpcvers_t vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -277,12 +270,9 @@ svc_unreg(prog, vers)
* program number comes in.
*/
bool_t
-svc_register(xprt, prog, vers, dispatch, protocol)
- SVCXPRT *xprt;
- u_long prog;
- u_long vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- int protocol;
+svc_register(SVCXPRT *xprt, u_long prog, u_long vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ int protocol)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -317,9 +307,7 @@ pmap_it:
* Remove a service program from the callout list.
*/
void
-svc_unregister(prog, vers)
- u_long prog;
- u_long vers;
+svc_unregister(u_long prog, u_long vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -344,11 +332,8 @@ svc_unregister(prog, vers)
* struct.
*/
static struct svc_callout *
-svc_find(prog, vers, prev, netid)
- rpcprog_t prog;
- rpcvers_t vers;
- struct svc_callout **prev;
- char *netid;
+svc_find(rpcprog_t prog, rpcvers_t vers, struct svc_callout **prev,
+ char *netid)
{
struct svc_callout *s, *p;
@@ -372,10 +357,8 @@ svc_find(prog, vers, prev, netid)
* Send a reply to an rpc request
*/
bool_t
-svc_sendreply(xprt, xdr_results, xdr_location)
- SVCXPRT *xprt;
- xdrproc_t xdr_results;
- void * xdr_location;
+svc_sendreply(SVCXPRT *xprt, xdrproc_t xdr_results,
+ void * xdr_location)
{
struct rpc_msg rply;
@@ -394,8 +377,7 @@ svc_sendreply(xprt, xdr_results, xdr_location)
* No procedure error reply
*/
void
-svcerr_noproc(xprt)
- SVCXPRT *xprt;
+svcerr_noproc(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -412,8 +394,7 @@ svcerr_noproc(xprt)
* Can't decode args error reply
*/
void
-svcerr_decode(xprt)
- SVCXPRT *xprt;
+svcerr_decode(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -430,8 +411,7 @@ svcerr_decode(xprt)
* Some system error
*/
void
-svcerr_systemerr(xprt)
- SVCXPRT *xprt;
+svcerr_systemerr(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -452,31 +432,27 @@ svcerr_systemerr(xprt)
* protocol: the portmapper (or rpc binder).
*/
void
-__svc_versquiet_on(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_on(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags |= SVC_VERSQUIET;
}
void
-__svc_versquiet_off(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_off(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags &= ~SVC_VERSQUIET;
}
void
-svc_versquiet(xprt)
- SVCXPRT *xprt;
+svc_versquiet(SVCXPRT *xprt)
{
__svc_versquiet_on(xprt);
}
int
-__svc_versquiet_get(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_get(SVCXPRT *xprt)
{
return (SVC_EXT(xprt)->xp_flags & SVC_VERSQUIET);
@@ -487,9 +463,7 @@ __svc_versquiet_get(xprt)
* Authentication error reply
*/
void
-svcerr_auth(xprt, why)
- SVCXPRT *xprt;
- enum auth_stat why;
+svcerr_auth(SVCXPRT *xprt, enum auth_stat why)
{
struct rpc_msg rply;
@@ -506,8 +480,7 @@ svcerr_auth(xprt, why)
* Auth too weak error reply
*/
void
-svcerr_weakauth(xprt)
- SVCXPRT *xprt;
+svcerr_weakauth(SVCXPRT *xprt)
{
assert(xprt != NULL);
@@ -519,8 +492,7 @@ svcerr_weakauth(xprt)
* Program unavailable error reply
*/
void
-svcerr_noprog(xprt)
- SVCXPRT *xprt;
+svcerr_noprog(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -537,10 +509,7 @@ svcerr_noprog(xprt)
* Program version mismatch error reply
*/
void
-svcerr_progvers(xprt, low_vers, high_vers)
- SVCXPRT *xprt;
- rpcvers_t low_vers;
- rpcvers_t high_vers;
+svcerr_progvers(SVCXPRT *xprt, rpcvers_t low_vers, rpcvers_t high_vers)
{
struct rpc_msg rply;
@@ -562,7 +531,7 @@ svcerr_progvers(xprt, low_vers, high_vers)
* parameters.
*/
SVCXPRT *
-svc_xprt_alloc()
+svc_xprt_alloc(void)
{
SVCXPRT *xprt;
SVCXPRT_EXT *ext;
@@ -587,8 +556,7 @@ svc_xprt_alloc()
* Free a server transport structure.
*/
void
-svc_xprt_free(xprt)
- SVCXPRT *xprt;
+svc_xprt_free(SVCXPRT *xprt)
{
mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT));
@@ -614,8 +582,7 @@ svc_xprt_free(xprt)
*/
void
-svc_getreq(rdfds)
- int rdfds;
+svc_getreq(int rdfds)
{
fd_set readfds;
@@ -625,8 +592,7 @@ svc_getreq(rdfds)
}
void
-svc_getreqset(readfds)
- fd_set *readfds;
+svc_getreqset(fd_set *readfds)
{
int bit, fd;
fd_mask mask, *maskp;
@@ -646,8 +612,7 @@ svc_getreqset(readfds)
}
void
-svc_getreq_common(fd)
- int fd;
+svc_getreq_common(int fd)
{
SVCXPRT *xprt;
struct svc_req r;
@@ -742,9 +707,7 @@ call_done:
void
-svc_getreq_poll(pfdp, pollretval)
- struct pollfd *pfdp;
- int pollretval;
+svc_getreq_poll(struct pollfd *pfdp, int pollretval)
{
int i;
int fds_found;