aboutsummaryrefslogtreecommitdiff
path: root/sunrpc/svc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-03-20 18:35:13 +0000
committerUlrich Drepper <drepper@redhat.com>2001-03-20 18:35:13 +0000
commitf1e4a4a403f740c153acfc0cd96ecc5aa542e341 (patch)
tree55d564a6eba26109ea12055a24b7846c1a100fa4 /sunrpc/svc.c
parent373e6a512c30b2e34ac4a6f5b154edf45f400b35 (diff)
downloadglibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.zip
glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.gz
glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.bz2
Update.
* sunrpc/Makefile (routines): Add rpc_thread. (CPPFLAGS): Add -D_RPC_THREAD_SAFE. * sunrpc/rpc_thread.c: New file. * sunrpc/Versions [libc] (GLIBC_2.2.3): Export __rpc_thread_destroy. * sunrpc/auth_none.c: Don't use global variables. Access state in thread-local storage. * sunrpc/clnt_perr.c: Likewise. * sunrpc/clnt_raw.c: Likewise. * sunrpc/clnt_simp.c: Likewise. * sunrpc/key_call.c: Likewise. * sunrpc/rpc_common.c: Likewise. * sunrpc/svc.c: Likewise. * sunrpc/svc_raw.c: Likewise. * sunrpc/svc_simple.c: Likewise. * sunrpc/svcauth_des.c: Likewise. * hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add _HURD_THREADVAR_RPC_VARS. * sysdeps/generic/bits/libc-tsd.h: Mention _LIBC_TSD_KEY_RPC_VARS. * include/rpc/rpc.h: Define data structures for internal thread-local "global" variables. Based on patches by Eric Norum <eric.norum@usask.ca>.
Diffstat (limited to 'sunrpc/svc.c')
-rw-r--r--sunrpc/svc.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 4446692..6357d51 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -43,7 +43,11 @@
#include <rpc/pmap_clnt.h>
#include <sys/poll.h>
+#ifdef _RPC_THREAD_SAFE_
+#define xports ((SVCXPRT **)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 */
@@ -52,12 +56,17 @@ static SVCXPRT **xports;
Each entry represents a set of procedures (an rpc program).
The dispatch routine takes request structs and runs the
appropriate procedure. */
-static struct svc_callout {
+struct svc_callout {
struct svc_callout *sc_next;
rpcprog_t sc_prog;
rpcvers_t sc_vers;
void (*sc_dispatch) (struct svc_req *, SVCXPRT *);
-} *svc_head;
+};
+#ifdef _RPC_THREAD_SAFE_
+#define svc_head ((struct svc_callout *)RPC_THREAD_VARIABLE(svc_head_s))
+#else
+static struct svc_callout *svc_head;
+#endif
/* *************** SVCXPRT related stuff **************** */
@@ -464,3 +473,16 @@ svc_getreq_common (const int fd)
}
while (stat == XPRT_MOREREQS);
}
+
+#ifdef _RPC_THREAD_SAFE_
+
+void
+__rpc_thread_svc_cleanup (void)
+{
+ struct svc_callout *svcp;
+
+ while ((svcp = svc_head) != NULL)
+ svc_unregister (svcp->sc_prog, svcp->sc_vers);
+}
+
+#endif /* _RPC_THREAD_SAFE_ */