* There are two sets of procedures here. The xprt routines are
* for handling transport handles. The svc routines handle the
* list of service routines.
- * Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ * Copyright (C) 2002-2019 Free Software Foundation, Inc.
* This file is part of the GNU C Library.
* Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with the GNU C Library; if not, see
- * <http://www.gnu.org/licenses/>.
+ * <https://www.gnu.org/licenses/>.
*
* Copyright (c) 2010, Oracle America, Inc.
*
#include <rpc/pmap_clnt.h>
#include <sys/poll.h>
#include <time.h>
+#include <shlib-compat.h>
-#ifdef _RPC_THREAD_SAFE_
#define xports RPC_THREAD_VARIABLE(svc_xports_s)
-#else
-static SVCXPRT **xports;
-#endif
#define NULL_SVC ((struct svc_callout *)0)
#define RQCRED_SIZE 400 /* this size is excessive */
void (*sc_dispatch) (struct svc_req *, SVCXPRT *);
bool_t sc_mapped;
};
-#ifdef _RPC_THREAD_SAFE_
#define svc_head RPC_THREAD_VARIABLE(svc_head_s)
-#else
-static struct svc_callout *svc_head;
-#endif
/* *************** SVCXPRT related stuff **************** */
if (xports == NULL)
{
- xports = (SVCXPRT **) malloc (_rpc_dtablesize () * sizeof (SVCXPRT *));
- if (xports == NULL) /* Donยดt add handle */
+ xports = (SVCXPRT **) calloc (_rpc_dtablesize (), sizeof (SVCXPRT *));
+ if (xports == NULL) /* Don't add handle */
return;
}
return s;
}
-
-static bool_t
-svc_is_mapped (rpcprog_t prog, rpcvers_t vers)
-{
- struct svc_callout *prev;
- register struct svc_callout *s;
- s = svc_find (prog, vers, &prev);
- return s!= NULL_SVC && s->sc_mapped;
-}
-
-
/* Add a service program to the callout list.
The dispatch routine will be called when a rpc request for this
program number comes in. */
if ((s = svc_find (prog, vers, &prev)) == NULL_SVC)
return;
+ bool is_mapped = s->sc_mapped;
if (prev == NULL_SVC)
svc_head = s->sc_next;
s->sc_next = NULL_SVC;
mem_free ((char *) s, (u_int) sizeof (struct svc_callout));
/* now unregister the information with the local binder service */
- if (! svc_is_mapped (prog, vers))
+ if (is_mapped)
pmap_unset (prog, vers);
}
libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0)
}
}
-#ifdef _RPC_THREAD_SAFE_
void
__rpc_thread_svc_cleanup (void)
while ((svcp = svc_head) != NULL)
svc_unregister (svcp->sc_prog, svcp->sc_vers);
}
-
-#endif /* _RPC_THREAD_SAFE_ */