7 #include <shlib-compat.h>
8 #include <libc-symbols.h>
11 /* Variable used in non-threaded applications or for the first thread. */
12 static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem
;
13 static __thread
struct rpc_thread_variables
*thread_rpc_vars
14 attribute_tls_model_ie
;
17 * Task-variable destructor
20 __rpc_thread_destroy (void)
22 struct rpc_thread_variables
*tvp
= thread_rpc_vars
;
25 __rpc_thread_svc_cleanup ();
26 __rpc_thread_clnt_cleanup ();
27 __rpc_thread_key_cleanup ();
28 free (tvp
->clnt_perr_buf_s
);
29 free (tvp
->clntraw_private_s
);
30 free (tvp
->svcraw_private_s
);
31 free (tvp
->authdes_cache_s
);
32 free (tvp
->authdes_lru_s
);
33 free (tvp
->svc_xports_s
);
34 free (tvp
->svc_pollfd_s
);
35 if (tvp
!= &__libc_tsd_RPC_VARS_mem
)
37 thread_rpc_vars
= NULL
;
42 * Initialize RPC multi-threaded operation
45 rpc_thread_multi (void)
47 thread_rpc_vars
= &__libc_tsd_RPC_VARS_mem
;
51 struct rpc_thread_variables
*
52 __rpc_thread_variables (void)
54 __libc_once_define (static, once
);
55 struct rpc_thread_variables
*tvp
= thread_rpc_vars
;
58 __libc_once (once
, rpc_thread_multi
);
59 tvp
= thread_rpc_vars
;
61 tvp
= calloc (1, sizeof *tvp
);
63 thread_rpc_vars
= tvp
;
70 /* Global variables If we're single-threaded, or if this is the first
71 thread using the variable, use the existing global variable. This
72 provides backwards compatibility for existing applications which
73 dynamically link against this code. */
80 __rpc_thread_svc_fdset (void)
82 struct rpc_thread_variables
*tvp
;
84 tvp
= __rpc_thread_variables ();
85 if (tvp
== &__libc_tsd_RPC_VARS_mem
)
87 return &tvp
->svc_fdset_s
;
89 libc_hidden_nolink_sunrpc (__rpc_thread_svc_fdset
, GLIBC_2_2_3
)
91 struct rpc_createerr
*
92 __rpc_thread_createerr (void)
94 struct rpc_thread_variables
*tvp
;
96 tvp
= __rpc_thread_variables ();
97 if (tvp
== &__libc_tsd_RPC_VARS_mem
)
98 return &rpc_createerr
;
99 return &tvp
->rpc_createerr_s
;
101 libc_hidden_nolink_sunrpc (__rpc_thread_createerr
, GLIBC_2_2_3
)
104 __rpc_thread_svc_pollfd (void)
106 struct rpc_thread_variables
*tvp
;
108 tvp
= __rpc_thread_variables ();
109 if (tvp
== &__libc_tsd_RPC_VARS_mem
)
111 return &tvp
->svc_pollfd_s
;
113 #ifdef EXPORT_RPC_SYMBOLS
114 libc_hidden_def (__rpc_thread_svc_pollfd
)
116 libc_hidden_nolink_sunrpc (__rpc_thread_svc_pollfd
, GLIBC_2_2_3
)
120 __rpc_thread_svc_max_pollfd (void)
122 struct rpc_thread_variables
*tvp
;
124 tvp
= __rpc_thread_variables ();
125 if (tvp
== &__libc_tsd_RPC_VARS_mem
)
126 return &svc_max_pollfd
;
127 return &tvp
->svc_max_pollfd_s
;
129 #ifdef EXPORT_RPC_SYMBOLS
130 libc_hidden_def (__rpc_thread_svc_max_pollfd
)
132 libc_hidden_nolink_sunrpc (__rpc_thread_svc_max_pollfd
, GLIBC_2_2_3
)