From f1e4a4a403f740c153acfc0cd96ecc5aa542e341 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 20 Mar 2001 18:35:13 +0000 Subject: 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 . --- sunrpc/key_call.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sunrpc/key_call.c') diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c index 6e9d4a3..5df8f6f 100644 --- a/sunrpc/key_call.c +++ b/sunrpc/key_call.c @@ -359,7 +359,11 @@ struct key_call_private { pid_t pid; /* process-id at moment of creation */ uid_t uid; /* user-id at last authorization */ }; +#ifdef _RPC_THREAD_SAFE_ +#define key_call_private_main ((struct key_call_private *)RPC_THREAD_VARIABLE(key_call_private_s)) +#else static struct key_call_private *key_call_private_main; +#endif __libc_lock_define_initialized (static, keycall_lock) /* @@ -610,3 +614,17 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg, return key_call_keyenvoy (proc, xdr_arg, arg, xdr_rslt, rslt); #endif } + +#ifdef _RPC_THREAD_SAFE_ +void +__rpc_thread_key_cleanup (void) +{ + struct key_call_private *kcp = RPC_THREAD_VARIABLE(key_call_private_s); + + if (kcp) { + if (kcp->client) + clnt_destroy(kcp->client); + free (kcp); + } +} +#endif /* _RPC_THREAD_SAFE_ */ -- cgit v1.1