ReactOS 0.4.15-dev-7788-g1ad9096
mt_misc.c
Go to the documentation of this file.
1#include <wintirpc.h>
2
3//#include <sys/cdefs.h>
4//#include <pthread.h>
5#include <reentrant.h>
6#include <rpc/rpc.h>
7//#include <sys/time.h>
8#include <stdlib.h>
9#include <string.h>
10
11/*
12 * XXX
13 * For Windows, these must initialized in the DLLMain() function.
14 * Cannot do static initialization!!
15 * XXX
16 */
17
18/* protects the services list (svc.c) */
20
21/* protects svc_fdset and the xports[] array */
23
24/* protects the RPCBIND address cache */
26
27/* protects authdes cache (svcauth_des.c) */
29
30/* serializes authdes ops initializations */
32
33/* protects des stats list */
35
36#ifdef KERBEROS
37/* auth_kerb.c serialization */
38mutex_t authkerb_lock = PTHREAD_MUTEX_INITIALIZER;
39/* protects kerb stats list */
40mutex_t svcauthkerbstats_lock = PTHREAD_MUTEX_INITIALIZER;
41#endif /* KERBEROS */
42
43/* auth_none.c serialization */
45
46/* protects the Auths list (svc_auth.c) */
48
49/* protects client-side fd lock array */
51
52/* clnt_raw.c serialization */
54
55/* domainname and domain_fd (getdname.c) and default_domain (rpcdname.c) */
57
58/* dupreq variables (svc_dg.c) */
60
61/* protects first_time and hostname (key_call.c) */
63
64/* serializes rpc_trace() (rpc_trace.c) */
66
67/* loopnconf (rpcb_clnt.c) */
69
70/* serializes ops initializations */
72
73/* protects ``port'' static in bindresvport() */
75
76/* protects proglst list (svc_simple.c) */
78
79/* serializes clnt_com_create() (rpc_soc.c) */
81
82/* svc_raw.c serialization */
84
85/* protects TSD key creation */
87
88/* Library global tsd keys */
95
96/* xprtlist (svc_generic.c) */
98
99/* serializes calls to public key routines */
101
102/* netconfig serialization */
104
105#ifdef _WIN32
106/*
107 * Initialize all the mutexes (CriticalSections)
108 */
109void multithread_init(void)
110{
132}
133#endif
134
135#undef rpc_createerr
136
138
139struct rpc_createerr *
141{
142 struct rpc_createerr *rce_addr;
143
145 if (rce_key == -1)
146 rce_key = TlsAlloc(); //thr_keycreate(&rce_key, free);
148
149 rce_addr = (struct rpc_createerr *)thr_getspecific(rce_key);
150 if (!rce_addr) {
151 rce_addr = (struct rpc_createerr *)
152 malloc(sizeof (struct rpc_createerr));
153 if (!rce_addr ||
154 thr_setspecific(rce_key, (void *) rce_addr) == 0) {
155 if (rce_addr)
156 free(rce_addr);
157 return (&rpc_createerr);
158 }
159 memset(rce_addr, 0, sizeof (struct rpc_createerr));
160 }
161 return (rce_addr);
162}
163
165{
166 if (clnt_broadcast_key != -1)
168 if (rpc_call_key != -1)
170 if (tcp_key != -1)
172 if (udp_key != -1)
174 if (nc_key != -1)
176 if (rce_key != -1)
178 return;
179}
180
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
thread_key_t nc_key
Definition: mt_misc.c:93
mutex_t portnum_lock
Definition: mt_misc.c:74
void tsd_key_delete(void)
Definition: mt_misc.c:164
mutex_t rpcsoc_lock
Definition: mt_misc.c:80
mutex_t serialize_pkey
Definition: mt_misc.c:100
mutex_t libnsl_trace_lock
Definition: mt_misc.c:65
mutex_t loopnconf_lock
Definition: mt_misc.c:68
thread_key_t rpc_call_key
Definition: mt_misc.c:90
struct rpc_createerr * __rpc_createerr()
Definition: mt_misc.c:140
mutex_t proglst_lock
Definition: mt_misc.c:77
thread_key_t rce_key
Definition: mt_misc.c:94
mutex_t nc_lock
Definition: mt_misc.c:103
mutex_t dname_lock
Definition: mt_misc.c:56
mutex_t authnone_lock
Definition: mt_misc.c:44
mutex_t clnt_fd_lock
Definition: mt_misc.c:50
rwlock_t svc_lock
Definition: mt_misc.c:19
mutex_t xprtlist_lock
Definition: mt_misc.c:97
mutex_t dupreq_lock
Definition: mt_misc.c:59
mutex_t authdes_lock
Definition: mt_misc.c:28
mutex_t authdes_ops_lock
Definition: mt_misc.c:31
thread_key_t tcp_key
Definition: mt_misc.c:91
thread_key_t udp_key
Definition: mt_misc.c:92
mutex_t tsd_lock
Definition: mt_misc.c:86
mutex_t ops_lock
Definition: mt_misc.c:71
rwlock_t svc_fd_lock
Definition: mt_misc.c:22
mutex_t svcraw_lock
Definition: mt_misc.c:83
mutex_t authsvc_lock
Definition: mt_misc.c:47
thread_key_t clnt_broadcast_key
Definition: mt_misc.c:89
rwlock_t rpcbaddr_cache_lock
Definition: mt_misc.c:25
mutex_t svcauthdesstats_lock
Definition: mt_misc.c:34
mutex_t keyserv_lock
Definition: mt_misc.c:62
mutex_t clntraw_lock
Definition: mt_misc.c:53
#define thr_setspecific(k, p)
Definition: reentrant.h:146
#define mutex_lock(m)
Definition: reentrant.h:128
#define thr_getspecific(k)
Definition: reentrant.h:147
#define mutex_unlock(m)
Definition: reentrant.h:129
#define thread_key_t
Definition: reentrant.h:124
#define thr_keydelete(k)
Definition: reentrant.h:145
#define memset(x, y, z)
Definition: compat.h:39
Definition: module.h:456
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
void multithread_init(void)