Define data structures for internal thread-local "global" variables.
[kopensolaris-gnu/glibc.git] / include / rpc / rpc.h
1 #ifndef _RPC_RPC_H
2 #include <sunrpc/rpc/rpc.h>
3
4 /* Now define the internal interfaces.  */
5 extern unsigned long _create_xid (void);
6
7 /*
8  * Multi-threaded support
9  * Group all global and static variables into a single spot.
10  * This area is allocated on a per-thread basis
11  */
12 #ifdef _RPC_THREAD_SAFE_
13 struct rpc_thread_variables {
14         fd_set          svc_fdset_s;            /* Global, rpc_common.c */
15         struct rpc_createerr rpc_createerr_s;   /* Global, rpc_common.c */
16         struct pollfd   *svc_pollfd_s;          /* Global, rpc_common.c */
17         int             svc_max_pollfd_s;       /* Global, rpc_common.c */
18
19         void            *authnone_private_s;    /* auth_none.c */
20
21         void            *clnt_perr_buf_s;       /* clnt_perr.c */
22
23         void            *clntraw_private_s;     /* clnt_raw.c */
24
25         void            *callrpc_private_s;     /* clnt_simp.c */
26
27         void            *key_call_private_s;    /* key_call.c */
28
29         void            *authdes_cache_s;       /* svcauth_des.c */
30         void            *authdes_lru_s;         /* svcauth_des.c */
31
32         void            *svc_xports_s;          /* svc.c */
33         void            *svc_head_s;            /* svc.c */
34
35         void            *svcraw_private_s;      /* svc_raw.c */
36
37         void            *svcsimple_proglst_s;   /* svc_simple.c */
38         void            *svcsimple_transp_s;    /* svc_simple.c */
39 };
40
41 extern struct rpc_thread_variables *__rpc_thread_variables(void)
42      __attribute__ ((const));
43 extern void __rpc_thread_svc_cleanup (void);
44 extern void __rpc_thread_clnt_cleanup (void);
45 extern void __rpc_thread_key_cleanup (void);
46
47 extern void __rpc_thread_destroy (void);
48
49 #define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x)
50
51 /*
52  * Global variables
53  */
54 #define svc_fdset RPC_THREAD_VARIABLE(svc_fdset_s)
55 #define rpc_createerr RPC_THREAD_VARIABLE(rpc_createerr_s)
56 #define svc_pollfd RPC_THREAD_VARIABLE(svc_pollfd_s)
57 #define svc_max_pollfd RPC_THREAD_VARIABLE(svc_max_pollfd_s)
58
59 #endif /* _RPC_THREAD_SAFE_ */
60
61 #endif