- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,410 +0,0 @@ |
1 |
-/* |
|
2 |
- * |
|
3 |
- * Copyright (C) 2001-2003 FhG Fokus |
|
4 |
- * |
|
5 |
- * Permission to use, copy, modify, and distribute this software for any |
|
6 |
- * purpose with or without fee is hereby granted, provided that the above |
|
7 |
- * copyright notice and this permission notice appear in all copies. |
|
8 |
- * |
|
9 |
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
10 |
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
11 |
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
12 |
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
13 |
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
14 |
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
15 |
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
16 |
- */ |
|
17 |
- |
|
18 |
-/*! |
|
19 |
-* \file |
|
20 |
-* \brief Kamailio core :: Kamailio locking library |
|
21 |
-* \ingroup core |
|
22 |
-* \author andrei |
|
23 |
-* Module: \ref core |
|
24 |
-* |
|
25 |
- * WARNING: do not include this file directly, use instead locking.h |
|
26 |
- * (unless you don't need to alloc/dealloc locks) |
|
27 |
- * |
|
28 |
- * |
|
29 |
-Implements: |
|
30 |
- |
|
31 |
- simple locks: |
|
32 |
- ------------- |
|
33 |
- gen_lock_t* lock_init(gen_lock_t* lock); - inits the lock |
|
34 |
- void lock_destroy(gen_lock_t* lock); - removes the lock (e.g sysv rmid) |
|
35 |
- void lock_get(gen_lock_t* lock); - lock (mutex down) |
|
36 |
- void lock_release(gen_lock_t* lock); - unlock (mutex up) |
|
37 |
- int lock_try(gen_lock_t* lock); - tries to get the lock, returns |
|
38 |
- 0 on success and !=0 on failure |
|
39 |
- |
|
40 |
- lock sets: |
|
41 |
- ---------- |
|
42 |
- gen_lock_set_t* lock_set_init(gen_lock_set_t* set); - inits the lock set |
|
43 |
- void lock_set_destroy(gen_lock_set_t* s); - removes the lock set |
|
44 |
- void lock_set_get(gen_lock_set_t* s, int i); - locks sem i from the set |
|
45 |
- void lock_set_release(gen_lock_set_t* s, int i) - unlocks sem i from the |
|
46 |
- set |
|
47 |
- int lock_set_try(gen_lock_set_t* s, int i); - tries to lock the sem i, |
|
48 |
- returns 0 on success and |
|
49 |
- !=0 on failure |
|
50 |
- |
|
51 |
- defines: |
|
52 |
- -------- |
|
53 |
- GEN_LOCK_T_PREFERRED - defined if using arrays of gen_lock_t is as good as |
|
54 |
- using a lock set (gen_lock_set_t). |
|
55 |
- In general is better to have the locks "close" or |
|
56 |
- inside the protected data structure rather then |
|
57 |
- having a separate array or lock set. However in some |
|
58 |
- case (e.g. SYSV_LOCKS) is better to use lock sets, |
|
59 |
- either due to lock number limitations, excesive |
|
60 |
- performance or memory overhead. In this cases |
|
61 |
- GEN_LOCK_T_PREFERRED will not be defined. |
|
62 |
- GEN_LOCK_T_UNLIMITED - defined if there is no system imposed limit on |
|
63 |
- the number of locks (other then the memory). |
|
64 |
- GEN_LOCK_SET_T_UNLIMITED |
|
65 |
- - like above but for the size of a lock set. |
|
66 |
- |
|
67 |
-WARNING: - lock_set_init may fail for large number of sems (e.g. sysv). |
|
68 |
- - signals are not treated! (some locks are "awakened" by the signals) |
|
69 |
-*/ |
|
70 |
- |
|
71 |
-#ifndef _lock_ops_h |
|
72 |
-#define _lock_ops_h |
|
73 |
- |
|
74 |
-#ifdef USE_FUTEX |
|
75 |
-#include "futexlock.h" |
|
76 |
-/* if no native atomic ops support => USE_FUTEX will be undefined */ |
|
77 |
-#endif |
|
78 |
- |
|
79 |
- |
|
80 |
-#ifdef USE_FUTEX |
|
81 |
- |
|
82 |
-typedef futex_lock_t gen_lock_t; |
|
83 |
- |
|
84 |
-#define lock_destroy(lock) /* do nothing */ |
|
85 |
-#define lock_init(lock) futex_init(lock) |
|
86 |
-#define lock_try(lock) futex_try(lock) |
|
87 |
-#define lock_get(lock) futex_get(lock) |
|
88 |
-#define lock_release(lock) futex_release(lock) |
|
89 |
- |
|
90 |
- |
|
91 |
-#elif defined FAST_LOCK |
|
92 |
-#include "fastlock.h" |
|
93 |
- |
|
94 |
-typedef fl_lock_t gen_lock_t; |
|
95 |
- |
|
96 |
- |
|
97 |
-#define lock_destroy(lock) /* do nothing */ |
|
98 |
- |
|
99 |
-inline static gen_lock_t* lock_init(gen_lock_t* lock) |
|
100 |
-{ |
|
101 |
- init_lock(*lock); |
|
102 |
- return lock; |
|
103 |
-} |
|
104 |
- |
|
105 |
-#define lock_try(lock) try_lock(lock) |
|
106 |
-#define lock_get(lock) get_lock(lock) |
|
107 |
-#define lock_release(lock) release_lock(lock) |
|
108 |
- |
|
109 |
- |
|
110 |
-#elif defined USE_PTHREAD_MUTEX |
|
111 |
-#include <pthread.h> |
|
112 |
- |
|
113 |
-typedef pthread_mutex_t gen_lock_t; |
|
114 |
- |
|
115 |
-#define lock_destroy(lock) /* do nothing */ |
|
116 |
- |
|
117 |
-inline static gen_lock_t* lock_init(gen_lock_t* lock) |
|
118 |
-{ |
|
119 |
- if (pthread_mutex_init(lock, 0)==0) return lock; |
|
120 |
- else return 0; |
|
121 |
-} |
|
122 |
- |
|
123 |
-#define lock_try(lock) pthread_mutex_trylock(lock) |
|
124 |
-#define lock_get(lock) pthread_mutex_lock(lock) |
|
125 |
-#define lock_release(lock) pthread_mutex_unlock(lock) |
|
126 |
- |
|
127 |
- |
|
128 |
- |
|
129 |
-#elif defined USE_POSIX_SEM |
|
130 |
-#include <semaphore.h> |
|
131 |
- |
|
132 |
-typedef sem_t gen_lock_t; |
|
133 |
- |
|
134 |
-#define lock_destroy(lock) /* do nothing */ |
|
135 |
- |
|
136 |
-inline static gen_lock_t* lock_init(gen_lock_t* lock) |
|
137 |
-{ |
|
138 |
- if (sem_init(lock, 1, 1)<0) return 0; |
|
139 |
- return lock; |
|
140 |
-} |
|
141 |
- |
|
142 |
-#define lock_try(lock) sem_trywait(lock) |
|
143 |
-#define lock_get(lock) sem_wait(lock) |
|
144 |
-#define lock_release(lock) sem_post(lock) |
|
145 |
- |
|
146 |
- |
|
147 |
-#elif defined USE_SYSV_SEM |
|
148 |
-#include <sys/ipc.h> |
|
149 |
-#include <sys/sem.h> |
|
150 |
- |
|
151 |
-#include <errno.h> |
|
152 |
-#include <string.h> |
|
153 |
-#include <sys/types.h> |
|
154 |
-#include <unistd.h> |
|
155 |
-#include "dprint.h" |
|
156 |
-#include "globals.h" /* uid */ |
|
157 |
- |
|
158 |
-#if ((defined(HAVE_UNION_SEMUN) || defined(__GNU_LIBRARY__) )&& !defined(_SEM_SEMUN_UNDEFINED)) |
|
159 |
- |
|
160 |
- /* union semun is defined by including sem.h */ |
|
161 |
-#else |
|
162 |
- /* according to X/OPEN we have to define it ourselves */ |
|
163 |
- union semun { |
|
164 |
- int val; /* value for SETVAL */ |
|
165 |
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ |
|
166 |
- unsigned short int *array; /* array for GETALL, SETALL */ |
|
167 |
- struct seminfo *__buf; /* buffer for IPC_INFO */ |
|
168 |
- }; |
|
169 |
-#endif |
|
170 |
- |
|
171 |
-typedef int gen_lock_t; |
|
172 |
- |
|
173 |
- |
|
174 |
- |
|
175 |
- |
|
176 |
-inline static gen_lock_t* lock_init(gen_lock_t* lock) |
|
177 |
-{ |
|
178 |
- union semun su; |
|
179 |
- int euid; |
|
180 |
- |
|
181 |
- euid=geteuid(); |
|
182 |
- if (uid && uid!=euid) |
|
183 |
- seteuid(uid); /* set euid to the cfg. requested one */ |
|
184 |
- *lock=semget(IPC_PRIVATE, 1, 0700); |
|
185 |
- if (uid && uid!=euid) |
|
186 |
- seteuid(euid); /* restore it */ |
|
187 |
- if (*lock==-1) return 0; |
|
188 |
- su.val=1; |
|
189 |
- if (semctl(*lock, 0, SETVAL, su)==-1){ |
|
190 |
- /* init error*/ |
|
191 |
- return 0; |
|
192 |
- } |
|
193 |
- return lock; |
|
194 |
-} |
|
195 |
- |
|
196 |
-inline static void lock_destroy(gen_lock_t* lock) |
|
197 |
-{ |
|
198 |
- semctl(*lock, 0, IPC_RMID, (union semun)(int)0); |
|
199 |
-} |
|
200 |
- |
|
201 |
- |
|
202 |
-/* returns 0 if it got the lock, -1 otherwise */ |
|
203 |
-inline static int lock_try(gen_lock_t* lock) |
|
204 |
-{ |
|
205 |
- struct sembuf sop; |
|
206 |
- |
|
207 |
- sop.sem_num=0; |
|
208 |
- sop.sem_op=-1; /* down */ |
|
209 |
- sop.sem_flg=IPC_NOWAIT; |
|
210 |
-tryagain: |
|
211 |
- if (semop(*lock, &sop, 1)==-1){ |
|
212 |
- if (errno==EAGAIN){ |
|
213 |
- return -1; |
|
214 |
- }else if (errno==EINTR){ |
|
215 |
- DBG("lock_get: signal received while waiting for on a mutex\n"); |
|
216 |
- goto tryagain; |
|
217 |
- }else{ |
|
218 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
219 |
- return -1; |
|
220 |
- } |
|
221 |
- } |
|
222 |
- return 0; |
|
223 |
-} |
|
224 |
- |
|
225 |
-inline static void lock_get(gen_lock_t* lock) |
|
226 |
-{ |
|
227 |
- struct sembuf sop; |
|
228 |
- |
|
229 |
- sop.sem_num=0; |
|
230 |
- sop.sem_op=-1; /* down */ |
|
231 |
- sop.sem_flg=0; |
|
232 |
-tryagain: |
|
233 |
- if (semop(*lock, &sop, 1)==-1){ |
|
234 |
- if (errno==EINTR){ |
|
235 |
- DBG("lock_get: signal received while waiting for on a mutex\n"); |
|
236 |
- goto tryagain; |
|
237 |
- }else{ |
|
238 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
239 |
- } |
|
240 |
- } |
|
241 |
-} |
|
242 |
- |
|
243 |
-inline static void lock_release(gen_lock_t* lock) |
|
244 |
-{ |
|
245 |
- struct sembuf sop; |
|
246 |
- |
|
247 |
- sop.sem_num=0; |
|
248 |
- sop.sem_op=1; /* up */ |
|
249 |
- sop.sem_flg=0; |
|
250 |
-tryagain: |
|
251 |
- if (semop(*lock, &sop, 1)==-1){ |
|
252 |
- if (errno==EINTR){ |
|
253 |
- /* very improbable*/ |
|
254 |
- DBG("lock_release: signal received while releasing a mutex\n"); |
|
255 |
- goto tryagain; |
|
256 |
- }else{ |
|
257 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
258 |
- } |
|
259 |
- } |
|
260 |
-} |
|
261 |
- |
|
262 |
- |
|
263 |
-#else |
|
264 |
-#error "no locking method selected" |
|
265 |
-#endif |
|
266 |
- |
|
267 |
- |
|
268 |
-/* lock sets */ |
|
269 |
- |
|
270 |
-#if defined(FAST_LOCK) || defined(USE_PTHREAD_MUTEX) || \ |
|
271 |
- defined(USE_POSIX_SEM) || defined(USE_FUTEX) |
|
272 |
-#define GEN_LOCK_T_PREFERRED |
|
273 |
-#define GEN_LOCK_T_PREFERED /* backwards compat. */ |
|
274 |
-#define GEN_LOCK_T_UNLIMITED |
|
275 |
-#define GEN_LOCK_SET_T_UNLIMITED |
|
276 |
- |
|
277 |
-struct gen_lock_set_t_ { |
|
278 |
- long size; |
|
279 |
- gen_lock_t* locks; |
|
280 |
-}; /* must be aligned (32 bits or 64 depending on the arch)*/ |
|
281 |
-typedef struct gen_lock_set_t_ gen_lock_set_t; |
|
282 |
- |
|
283 |
- |
|
284 |
-#define lock_set_destroy(lock_set) /* do nothing */ |
|
285 |
- |
|
286 |
-inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
|
287 |
-{ |
|
288 |
- int r; |
|
289 |
- for (r=0; r<s->size; r++) if (lock_init(&s->locks[r])==0) return 0; |
|
290 |
- return s; |
|
291 |
-} |
|
292 |
- |
|
293 |
-/* WARNING: no boundary checks!*/ |
|
294 |
-#define lock_set_try(set, i) lock_try(&set->locks[i]) |
|
295 |
-#define lock_set_get(set, i) lock_get(&set->locks[i]) |
|
296 |
-#define lock_set_release(set, i) lock_release(&set->locks[i]) |
|
297 |
- |
|
298 |
-#elif defined(USE_SYSV_SEM) |
|
299 |
-#undef GEN_LOCK_T_PREFERRED |
|
300 |
-#undef GEN_LOCK_T_PREFERED /* backwards compat. */ |
|
301 |
-#undef GEN_LOCK_T_UNLIMITED |
|
302 |
-#undef GEN_LOCK_SET_T_UNLIMITED |
|
303 |
-#define GEN_LOCK_T_LIMITED |
|
304 |
-#define GEN_LOCK_SET_T_LIMITED |
|
305 |
- |
|
306 |
-struct gen_lock_set_t_ { |
|
307 |
- int size; |
|
308 |
- int semid; |
|
309 |
-}; |
|
310 |
- |
|
311 |
- |
|
312 |
-typedef struct gen_lock_set_t_ gen_lock_set_t; |
|
313 |
-inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
|
314 |
-{ |
|
315 |
- union semun su; |
|
316 |
- int r; |
|
317 |
- int euid; |
|
318 |
- |
|
319 |
- euid=geteuid(); |
|
320 |
- if (uid && uid!=euid) |
|
321 |
- seteuid(uid); /* set euid to the cfg. requested one */ |
|
322 |
- s->semid=semget(IPC_PRIVATE, s->size, 0700); |
|
323 |
- if (uid && uid!=euid) |
|
324 |
- seteuid(euid); /* restore euid */ |
|
325 |
- if (s->semid==-1){ |
|
326 |
- LM_CRIT("(SYSV): semget (..., %d, 0700) failed: %s\n", |
|
327 |
- s->size, strerror(errno)); |
|
328 |
- return 0; |
|
329 |
- } |
|
330 |
- su.val=1; |
|
331 |
- for (r=0; r<s->size; r++){ |
|
332 |
- if (semctl(s->semid, r, SETVAL, su)==-1){ |
|
333 |
- LM_CRIT("(SYSV): semctl failed on sem %d: %s\n", r, strerror(errno)); |
|
334 |
- semctl(s->semid, 0, IPC_RMID, (union semun)(int)0); |
|
335 |
- return 0; |
|
336 |
- } |
|
337 |
- } |
|
338 |
- return s; |
|
339 |
-} |
|
340 |
- |
|
341 |
-inline static void lock_set_destroy(gen_lock_set_t* s) |
|
342 |
-{ |
|
343 |
- semctl(s->semid, 0, IPC_RMID, (union semun)(int)0); |
|
344 |
-} |
|
345 |
- |
|
346 |
- |
|
347 |
-/* returns 0 if it "gets" the lock, -1 otherwise */ |
|
348 |
-inline static int lock_set_try(gen_lock_set_t* s, int n) |
|
349 |
-{ |
|
350 |
- struct sembuf sop; |
|
351 |
- |
|
352 |
- sop.sem_num=n; |
|
353 |
- sop.sem_op=-1; /* down */ |
|
354 |
- sop.sem_flg=IPC_NOWAIT; |
|
355 |
-tryagain: |
|
356 |
- if (semop(s->semid, &sop, 1)==-1){ |
|
357 |
- if (errno==EAGAIN){ |
|
358 |
- return -1; |
|
359 |
- }else if (errno==EINTR){ |
|
360 |
- DBG("lock_get: signal received while waiting for on a mutex\n"); |
|
361 |
- goto tryagain; |
|
362 |
- }else{ |
|
363 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
364 |
- return -1; |
|
365 |
- } |
|
366 |
- } |
|
367 |
- return 0; |
|
368 |
-} |
|
369 |
- |
|
370 |
- |
|
371 |
-inline static void lock_set_get(gen_lock_set_t* s, int n) |
|
372 |
-{ |
|
373 |
- struct sembuf sop; |
|
374 |
- sop.sem_num=n; |
|
375 |
- sop.sem_op=-1; /* down */ |
|
376 |
- sop.sem_flg=0; |
|
377 |
-tryagain: |
|
378 |
- if (semop(s->semid, &sop, 1)==-1){ |
|
379 |
- if (errno==EINTR){ |
|
380 |
- DBG("lock_set_get: signal received while waiting on a mutex\n"); |
|
381 |
- goto tryagain; |
|
382 |
- }else{ |
|
383 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
384 |
- } |
|
385 |
- } |
|
386 |
-} |
|
387 |
- |
|
388 |
-inline static void lock_set_release(gen_lock_set_t* s, int n) |
|
389 |
-{ |
|
390 |
- struct sembuf sop; |
|
391 |
- sop.sem_num=n; |
|
392 |
- sop.sem_op=1; /* up */ |
|
393 |
- sop.sem_flg=0; |
|
394 |
-tryagain: |
|
395 |
- if (semop(s->semid, &sop, 1)==-1){ |
|
396 |
- if (errno==EINTR){ |
|
397 |
- /* very improbable */ |
|
398 |
- DBG("lock_set_release: signal received while releasing mutex\n"); |
|
399 |
- goto tryagain; |
|
400 |
- }else{ |
|
401 |
- LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
402 |
- } |
|
403 |
- } |
|
404 |
-} |
|
405 |
-#else |
|
406 |
-#error "no lock set method selected" |
|
407 |
-#endif |
|
408 |
- |
|
409 |
- |
|
410 |
-#endif |
... | ... |
@@ -1,4 +1,3 @@ |
1 |
-/* $Id$ */ |
|
2 | 1 |
/* |
3 | 2 |
* |
4 | 3 |
* Copyright (C) 2001-2003 FhG Fokus |
... | ... |
@@ -16,25 +15,16 @@ |
16 | 15 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 16 |
*/ |
18 | 17 |
|
19 |
-/* |
|
20 |
- * ser locking library |
|
18 |
+/*! |
|
19 |
+* \file |
|
20 |
+* \brief Kamailio core :: Kamailio locking library |
|
21 |
+* \ingroup core |
|
22 |
+* \author andrei |
|
23 |
+* Module: \ref core |
|
24 |
+* |
|
21 | 25 |
* WARNING: do not include this file directly, use instead locking.h |
22 | 26 |
* (unless you don't need to alloc/dealloc locks) |
23 | 27 |
* |
24 |
- * 2002-12-16 created by andrei |
|
25 |
- * 2003-02-20 s/gen_lock_t/gen_lock_t/ to avoid a type conflict |
|
26 |
- * on solaris (andrei) |
|
27 |
- * 2003-03-05 lock set support added for FAST_LOCK & SYSV (andrei) |
|
28 |
- * 2003-03-06 removed *_alloc,*_dealloc & moved them to lock_alloc.h |
|
29 |
- * renamed locking.h to lock_ops.h (all this to solve |
|
30 |
- * the locking.h<->shm_mem.h interdependency) (andrei) |
|
31 |
- * 2003-03-10 lock set support added also for PTHREAD_MUTEX & POSIX_SEM |
|
32 |
- * (andrei) |
|
33 |
- * 2003-03-17 possible signal interruptions treated for sysv (andrei) |
|
34 |
- * 2004-07-28 s/lock_set_t/gen_lock_set_t/ because of a type conflict |
|
35 |
- * on darwin (andrei) |
|
36 |
- * 2006-04-04 added lock_try(lock) and lock_set_try(s,i) (andrei) |
|
37 |
- * 2007-05-13 added futex support (andrei) |
|
38 | 28 |
* |
39 | 29 |
Implements: |
40 | 30 |
|
... | ... |
@@ -225,8 +225,7 @@ tryagain: |
225 | 225 |
DBG("lock_get: signal received while waiting for on a mutex\n"); |
226 | 226 |
goto tryagain; |
227 | 227 |
}else{ |
228 |
- LOG(L_CRIT, "ERROR: lock_get sysv: %s (%d)\n", strerror(errno), |
|
229 |
- errno); |
|
228 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
230 | 229 |
return -1; |
231 | 230 |
} |
232 | 231 |
} |
... | ... |
@@ -246,8 +245,7 @@ tryagain: |
246 | 245 |
DBG("lock_get: signal received while waiting for on a mutex\n"); |
247 | 246 |
goto tryagain; |
248 | 247 |
}else{ |
249 |
- LOG(L_CRIT, "ERROR: lock_get sysv: %s (%d)\n", strerror(errno), |
|
250 |
- errno); |
|
248 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
251 | 249 |
} |
252 | 250 |
} |
253 | 251 |
} |
... | ... |
@@ -266,8 +264,7 @@ tryagain: |
266 | 264 |
DBG("lock_release: signal received while releasing a mutex\n"); |
267 | 265 |
goto tryagain; |
268 | 266 |
}else{ |
269 |
- LOG(L_CRIT, "ERROR: lock_release sysv: %s (%d)\n", |
|
270 |
- strerror(errno), errno); |
|
267 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
271 | 268 |
} |
272 | 269 |
} |
273 | 270 |
} |
... | ... |
@@ -336,16 +333,14 @@ inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
336 | 333 |
if (uid && uid!=euid) |
337 | 334 |
seteuid(euid); /* restore euid */ |
338 | 335 |
if (s->semid==-1){ |
339 |
- LOG(L_CRIT, "ERROR: lock_set_init (SYSV): semget (..., %d, 0700)" |
|
340 |
- " failed: %s\n", |
|
336 |
+ LM_CRIT("(SYSV): semget (..., %d, 0700) failed: %s\n", |
|
341 | 337 |
s->size, strerror(errno)); |
342 | 338 |
return 0; |
343 | 339 |
} |
344 | 340 |
su.val=1; |
345 | 341 |
for (r=0; r<s->size; r++){ |
346 | 342 |
if (semctl(s->semid, r, SETVAL, su)==-1){ |
347 |
- LOG(L_CRIT, "ERROR: lock_set_init (SYSV): semctl failed on sem %d" |
|
348 |
- ": %s\n", r, strerror(errno)); |
|
343 |
+ LM_CRIT("(SYSV): semctl failed on sem %d: %s\n", r, strerror(errno)); |
|
349 | 344 |
semctl(s->semid, 0, IPC_RMID, (union semun)(int)0); |
350 | 345 |
return 0; |
351 | 346 |
} |
... | ... |
@@ -375,8 +370,7 @@ tryagain: |
375 | 370 |
DBG("lock_get: signal received while waiting for on a mutex\n"); |
376 | 371 |
goto tryagain; |
377 | 372 |
}else{ |
378 |
- LOG(L_CRIT, "ERROR: lock_get sysv: %s (%d)\n", strerror(errno), |
|
379 |
- errno); |
|
373 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
380 | 374 |
return -1; |
381 | 375 |
} |
382 | 376 |
} |
... | ... |
@@ -396,8 +390,7 @@ tryagain: |
396 | 390 |
DBG("lock_set_get: signal received while waiting on a mutex\n"); |
397 | 391 |
goto tryagain; |
398 | 392 |
}else{ |
399 |
- LOG(L_CRIT, "ERROR: lock_set_get sysv: %s (%d)\n", |
|
400 |
- strerror(errno), errno); |
|
393 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
401 | 394 |
} |
402 | 395 |
} |
403 | 396 |
} |
... | ... |
@@ -415,8 +408,7 @@ tryagain: |
415 | 408 |
DBG("lock_set_release: signal received while releasing mutex\n"); |
416 | 409 |
goto tryagain; |
417 | 410 |
}else{ |
418 |
- LOG(L_CRIT, "ERROR: lock_set_release sysv: %s (%d)\n", |
|
419 |
- strerror(errno), errno); |
|
411 |
+ LM_CRIT("sysv: %s (%d)\n", strerror(errno), errno); |
|
420 | 412 |
} |
421 | 413 |
} |
422 | 414 |
} |
... | ... |
@@ -34,6 +34,7 @@ |
34 | 34 |
* 2004-07-28 s/lock_set_t/gen_lock_set_t/ because of a type conflict |
35 | 35 |
* on darwin (andrei) |
36 | 36 |
* 2006-04-04 added lock_try(lock) and lock_set_try(s,i) (andrei) |
37 |
+ * 2007-05-13 added futex support (andrei) |
|
37 | 38 |
* |
38 | 39 |
Implements: |
39 | 40 |
|
... | ... |
@@ -44,7 +45,7 @@ Implements: |
44 | 45 |
void lock_get(gen_lock_t* lock); - lock (mutex down) |
45 | 46 |
void lock_release(gen_lock_t* lock); - unlock (mutex up) |
46 | 47 |
int lock_try(gen_lock_t* lock); - tries to get the lock, returns |
47 |
- 0 on success and -1 on failure |
|
48 |
+ 0 on success and !=0 on failure |
|
48 | 49 |
|
49 | 50 |
lock sets: |
50 | 51 |
---------- |
... | ... |
@@ -55,7 +56,7 @@ Implements: |
55 | 56 |
set |
56 | 57 |
int lock_set_try(gen_lock_set_t* s, int i); - tries to lock the sem i, |
57 | 58 |
returns 0 on success and |
58 |
- -1 on failure |
|
59 |
+ !=0 on failure |
|
59 | 60 |
|
60 | 61 |
defines: |
61 | 62 |
-------- |
... | ... |
@@ -80,8 +81,24 @@ WARNING: - lock_set_init may fail for large number of sems (e.g. sysv). |
80 | 81 |
#ifndef _lock_ops_h |
81 | 82 |
#define _lock_ops_h |
82 | 83 |
|
84 |
+#ifdef USE_FUTEX |
|
85 |
+#include "futexlock.h" |
|
86 |
+/* if no native atomic ops support => USE_FUTEX will be undefined */ |
|
87 |
+#endif |
|
88 |
+ |
|
89 |
+ |
|
90 |
+#ifdef USE_FUTEX |
|
91 |
+ |
|
92 |
+typedef futex_lock_t gen_lock_t; |
|
93 |
+ |
|
94 |
+#define lock_destroy(lock) /* do nothing */ |
|
95 |
+#define lock_init(lock) futex_init(lock) |
|
96 |
+#define lock_try(lock) futex_try(lock) |
|
97 |
+#define lock_get(lock) futex_get(lock) |
|
98 |
+#define lock_release(lock) futex_release(lock) |
|
99 |
+ |
|
83 | 100 |
|
84 |
-#ifdef FAST_LOCK |
|
101 |
+#elif defined FAST_LOCK |
|
85 | 102 |
#include "fastlock.h" |
86 | 103 |
|
87 | 104 |
typedef fl_lock_t gen_lock_t; |
... | ... |
@@ -263,7 +280,8 @@ tryagain: |
263 | 280 |
|
264 | 281 |
/* lock sets */ |
265 | 282 |
|
266 |
-#if defined(FAST_LOCK) || defined(USE_PTHREAD_MUTEX) || defined(USE_POSIX_SEM) |
|
283 |
+#if defined(FAST_LOCK) || defined(USE_PTHREAD_MUTEX) || \ |
|
284 |
+ defined(USE_POSIX_SEM) || defined(USE_FUTEX) |
|
267 | 285 |
#define GEN_LOCK_T_PREFERRED |
268 | 286 |
#define GEN_LOCK_T_PREFERED /* backwards compat. */ |
269 | 287 |
#define GEN_LOCK_T_UNLIMITED |
... | ... |
@@ -3,26 +3,17 @@ |
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2001-2003 FhG Fokus |
5 | 5 |
* |
6 |
- * This file is part of ser, a free SIP server. |
|
6 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
7 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
8 |
+ * copyright notice and this permission notice appear in all copies. |
|
7 | 9 |
* |
8 |
- * ser is free software; you can redistribute it and/or modify |
|
9 |
- * it under the terms of the GNU General Public License as published by |
|
10 |
- * the Free Software Foundation; either version 2 of the License, or |
|
11 |
- * (at your option) any later version |
|
12 |
- * |
|
13 |
- * For a license to use the ser software under conditions |
|
14 |
- * other than those described here, or to purchase support for this |
|
15 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
- * info@iptel.org |
|
17 |
- * |
|
18 |
- * ser is distributed in the hope that it will be useful, |
|
19 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
- * GNU General Public License for more details. |
|
22 |
- * |
|
23 |
- * You should have received a copy of the GNU General Public License |
|
24 |
- * along with this program; if not, write to the Free Software |
|
25 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
10 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
11 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
12 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
13 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
14 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
15 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
16 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
26 | 17 |
*/ |
27 | 18 |
|
28 | 19 |
/* |
... | ... |
@@ -65,6 +56,22 @@ Implements: |
65 | 56 |
int lock_set_try(gen_lock_set_t* s, int i); - tries to lock the sem i, |
66 | 57 |
returns 0 on success and |
67 | 58 |
-1 on failure |
59 |
+ |
|
60 |
+ defines: |
|
61 |
+ -------- |
|
62 |
+ GEN_LOCK_T_PREFERRED - defined if using arrays of gen_lock_t is as good as |
|
63 |
+ using a lock set (gen_lock_set_t). |
|
64 |
+ In general is better to have the locks "close" or |
|
65 |
+ inside the protected data structure rather then |
|
66 |
+ having a separate array or lock set. However in some |
|
67 |
+ case (e.g. SYSV_LOCKS) is better to use lock sets, |
|
68 |
+ either due to lock number limitations, excesive |
|
69 |
+ performance or memory overhead. In this cases |
|
70 |
+ GEN_LOCK_T_PREFERRED will not be defined. |
|
71 |
+ GEN_LOCK_T_UNLIMITED - defined if there is no system imposed limit on |
|
72 |
+ the number of locks (other then the memory). |
|
73 |
+ GEN_LOCK_SET_T_UNLIMITED |
|
74 |
+ - like above but for the size of a lock set. |
|
68 | 75 |
|
69 | 76 |
WARNING: - lock_set_init may fail for large number of sems (e.g. sysv). |
70 | 77 |
- signals are not treated! (some locks are "awakened" by the signals) |
... | ... |
@@ -257,7 +264,10 @@ tryagain: |
257 | 264 |
/* lock sets */ |
258 | 265 |
|
259 | 266 |
#if defined(FAST_LOCK) || defined(USE_PTHREAD_MUTEX) || defined(USE_POSIX_SEM) |
260 |
-#define GEN_LOCK_T_PREFERED |
|
267 |
+#define GEN_LOCK_T_PREFERRED |
|
268 |
+#define GEN_LOCK_T_PREFERED /* backwards compat. */ |
|
269 |
+#define GEN_LOCK_T_UNLIMITED |
|
270 |
+#define GEN_LOCK_SET_T_UNLIMITED |
|
261 | 271 |
|
262 | 272 |
struct gen_lock_set_t_ { |
263 | 273 |
long size; |
... | ... |
@@ -281,7 +291,12 @@ inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
281 | 291 |
#define lock_set_release(set, i) lock_release(&set->locks[i]) |
282 | 292 |
|
283 | 293 |
#elif defined(USE_SYSV_SEM) |
284 |
-#undef GEN_LOCK_T_PREFERED |
|
294 |
+#undef GEN_LOCK_T_PREFERRED |
|
295 |
+#undef GEN_LOCK_T_PREFERED /* backwards compat. */ |
|
296 |
+#undef GEN_LOCK_T_UNLIMITED |
|
297 |
+#undef GEN_LOCK_SET_T_UNLIMITED |
|
298 |
+#define GEN_LOCK_T_LIMITED |
|
299 |
+#define GEN_LOCK_SET_T_LIMITED |
|
285 | 300 |
|
286 | 301 |
struct gen_lock_set_t_ { |
287 | 302 |
int size; |
... | ... |
@@ -42,6 +42,7 @@ |
42 | 42 |
* 2003-03-17 possible signal interruptions treated for sysv (andrei) |
43 | 43 |
* 2004-07-28 s/lock_set_t/gen_lock_set_t/ because of a type conflict |
44 | 44 |
* on darwin (andrei) |
45 |
+ * 2006-04-04 added lock_try(lock) and lock_set_try(s,i) (andrei) |
|
45 | 46 |
* |
46 | 47 |
Implements: |
47 | 48 |
|
... | ... |
@@ -51,13 +52,19 @@ Implements: |
51 | 52 |
void lock_destroy(gen_lock_t* lock); - removes the lock (e.g sysv rmid) |
52 | 53 |
void lock_get(gen_lock_t* lock); - lock (mutex down) |
53 | 54 |
void lock_release(gen_lock_t* lock); - unlock (mutex up) |
55 |
+ int lock_try(gen_lock_t* lock); - tries to get the lock, returns |
|
56 |
+ 0 on success and -1 on failure |
|
54 | 57 |
|
55 |
- lock sets: [implemented only for FL & SYSV so far] |
|
58 |
+ lock sets: |
|
56 | 59 |
---------- |
57 | 60 |
gen_lock_set_t* lock_set_init(gen_lock_set_t* set); - inits the lock set |
58 | 61 |
void lock_set_destroy(gen_lock_set_t* s); - removes the lock set |
59 | 62 |
void lock_set_get(gen_lock_set_t* s, int i); - locks sem i from the set |
60 |
- void lock_set_release(gen_lock_set_t* s, int i) - unlocks sem i from the set |
|
63 |
+ void lock_set_release(gen_lock_set_t* s, int i) - unlocks sem i from the |
|
64 |
+ set |
|
65 |
+ int lock_set_try(gen_lock_set_t* s, int i); - tries to lock the sem i, |
|
66 |
+ returns 0 on success and |
|
67 |
+ -1 on failure |
|
61 | 68 |
|
62 | 69 |
WARNING: - lock_set_init may fail for large number of sems (e.g. sysv). |
63 | 70 |
- signals are not treated! (some locks are "awakened" by the signals) |
... | ... |
@@ -81,9 +88,11 @@ inline static gen_lock_t* lock_init(gen_lock_t* lock) |
81 | 88 |
return lock; |
82 | 89 |
} |
83 | 90 |
|
91 |
+#define lock_try(lock) try_lock(lock) |
|
84 | 92 |
#define lock_get(lock) get_lock(lock) |
85 | 93 |
#define lock_release(lock) release_lock(lock) |
86 | 94 |
|
95 |
+ |
|
87 | 96 |
#elif defined USE_PTHREAD_MUTEX |
88 | 97 |
#include <pthread.h> |
89 | 98 |
|
... | ... |
@@ -97,6 +106,7 @@ inline static gen_lock_t* lock_init(gen_lock_t* lock) |
97 | 106 |
else return 0; |
98 | 107 |
} |
99 | 108 |
|
109 |
+#define lock_try(lock) pthread_mutex_trylock(lock) |
|
100 | 110 |
#define lock_get(lock) pthread_mutex_lock(lock) |
101 | 111 |
#define lock_release(lock) pthread_mutex_unlock(lock) |
102 | 112 |
|
... | ... |
@@ -115,6 +125,7 @@ inline static gen_lock_t* lock_init(gen_lock_t* lock) |
115 | 125 |
return lock; |
116 | 126 |
} |
117 | 127 |
|
128 |
+#define lock_try(lock) sem_trywait(lock) |
|
118 | 129 |
#define lock_get(lock) sem_wait(lock) |
119 | 130 |
#define lock_release(lock) sem_post(lock) |
120 | 131 |
|
... | ... |
@@ -174,6 +185,30 @@ inline static void lock_destroy(gen_lock_t* lock) |
174 | 185 |
} |
175 | 186 |
|
176 | 187 |
|
188 |
+/* returns 0 if it got the lock, -1 otherwise */ |
|
189 |
+inline static int lock_try(gen_lock_t* lock) |
|
190 |
+{ |
|
191 |
+ struct sembuf sop; |
|
192 |
+ |
|
193 |
+ sop.sem_num=0; |
|
194 |
+ sop.sem_op=-1; /* down */ |
|
195 |
+ sop.sem_flg=IPC_NOWAIT; |
|
196 |
+tryagain: |
|
197 |
+ if (semop(*lock, &sop, 1)==-1){ |
|
198 |
+ if (errno==EAGAIN){ |
|
199 |
+ return -1; |
|
200 |
+ }else if (errno==EINTR){ |
|
201 |
+ DBG("lock_get: signal received while waiting for on a mutex\n"); |
|
202 |
+ goto tryagain; |
|
203 |
+ }else{ |
|
204 |
+ LOG(L_CRIT, "ERROR: lock_get sysv: %s (%d)\n", strerror(errno), |
|
205 |
+ errno); |
|
206 |
+ return -1; |
|
207 |
+ } |
|
208 |
+ } |
|
209 |
+ return 0; |
|
210 |
+} |
|
211 |
+ |
|
177 | 212 |
inline static void lock_get(gen_lock_t* lock) |
178 | 213 |
{ |
179 | 214 |
struct sembuf sop; |
... | ... |
@@ -241,6 +276,7 @@ inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
241 | 276 |
} |
242 | 277 |
|
243 | 278 |
/* WARNING: no boundary checks!*/ |
279 |
+#define lock_set_try(set, i) lock_try(&set->locks[i]) |
|
244 | 280 |
#define lock_set_get(set, i) lock_get(&set->locks[i]) |
245 | 281 |
#define lock_set_release(set, i) lock_release(&set->locks[i]) |
246 | 282 |
|
... | ... |
@@ -289,6 +325,32 @@ inline static void lock_set_destroy(gen_lock_set_t* s) |
289 | 325 |
semctl(s->semid, 0, IPC_RMID, (union semun)(int)0); |
290 | 326 |
} |
291 | 327 |
|
328 |
+ |
|
329 |
+/* returns 0 if it "gets" the lock, -1 otherwise */ |
|
330 |
+inline static int lock_set_try(gen_lock_set_t* s, int n) |
|
331 |
+{ |
|
332 |
+ struct sembuf sop; |
|
333 |
+ |
|
334 |
+ sop.sem_num=n; |
|
335 |
+ sop.sem_op=-1; /* down */ |
|
336 |
+ sop.sem_flg=IPC_NOWAIT; |
|
337 |
+tryagain: |
|
338 |
+ if (semop(s->semid, &sop, 1)==-1){ |
|
339 |
+ if (errno==EAGAIN){ |
|
340 |
+ return -1; |
|
341 |
+ }else if (errno==EINTR){ |
|
342 |
+ DBG("lock_get: signal received while waiting for on a mutex\n"); |
|
343 |
+ goto tryagain; |
|
344 |
+ }else{ |
|
345 |
+ LOG(L_CRIT, "ERROR: lock_get sysv: %s (%d)\n", strerror(errno), |
|
346 |
+ errno); |
|
347 |
+ return -1; |
|
348 |
+ } |
|
349 |
+ } |
|
350 |
+ return 0; |
|
351 |
+} |
|
352 |
+ |
|
353 |
+ |
|
292 | 354 |
inline static void lock_set_get(gen_lock_set_t* s, int n) |
293 | 355 |
{ |
294 | 356 |
struct sembuf sop; |
... | ... |
@@ -123,6 +123,13 @@ inline static gen_lock_t* lock_init(gen_lock_t* lock) |
123 | 123 |
#include <sys/ipc.h> |
124 | 124 |
#include <sys/sem.h> |
125 | 125 |
|
126 |
+#include <errno.h> |
|
127 |
+#include <string.h> |
|
128 |
+#include <sys/types.h> |
|
129 |
+#include <unistd.h> |
|
130 |
+#include "dprint.h" |
|
131 |
+#include "globals.h" /* uid */ |
|
132 |
+ |
|
126 | 133 |
#if ((defined(HAVE_UNION_SEMUN) || defined(__GNU_LIBRARY__) )&& !defined(_SEM_SEMUN_UNDEFINED)) |
127 | 134 |
|
128 | 135 |
/* union semun is defined by including sem.h */ |
... | ... |
@@ -144,8 +151,14 @@ typedef int gen_lock_t; |
144 | 151 |
inline static gen_lock_t* lock_init(gen_lock_t* lock) |
145 | 152 |
{ |
146 | 153 |
union semun su; |
154 |
+ int euid; |
|
147 | 155 |
|
156 |
+ euid=geteuid(); |
|
157 |
+ if (uid && uid!=euid) |
|
158 |
+ seteuid(uid); /* set euid to the cfg. requested one */ |
|
148 | 159 |
*lock=semget(IPC_PRIVATE, 1, 0700); |
160 |
+ if (uid && uid!=euid) |
|
161 |
+ seteuid(euid); /* restore it */ |
|
149 | 162 |
if (*lock==-1) return 0; |
150 | 163 |
su.val=1; |
151 | 164 |
if (semctl(*lock, 0, SETVAL, su)==-1){ |
... | ... |
@@ -245,11 +258,18 @@ inline static gen_lock_set_t* lock_set_init(gen_lock_set_t* s) |
245 | 258 |
{ |
246 | 259 |
union semun su; |
247 | 260 |
int r; |
248 |
- |
|
261 |
+ int euid; |
|
262 |
+ |
|
263 |
+ euid=geteuid(); |
|
264 |
+ if (uid && uid!=euid) |
|
265 |
+ seteuid(uid); /* set euid to the cfg. requested one */ |
|
249 | 266 |
s->semid=semget(IPC_PRIVATE, s->size, 0700); |
267 |
+ if (uid && uid!=euid) |
|
268 |
+ seteuid(euid); /* restore euid */ |
|
250 | 269 |
if (s->semid==-1){ |
251 |
- LOG(L_CRIT, "ERROR: lock_set_init (SYSV): semget failed: %s\n", |
|
252 |
- strerror(errno)); |
|
270 |
+ LOG(L_CRIT, "ERROR: lock_set_init (SYSV): semget (..., %d, 0700)" |
|
271 |
+ " failed: %s\n", |
|
272 |
+ s->size, strerror(errno)); |
|
253 | 273 |
return 0; |
254 | 274 |
} |
255 | 275 |
su.val=1; |
... | ... |
@@ -40,6 +40,8 @@ |
40 | 40 |
* 2003-03-10 lock set support added also for PTHREAD_MUTEX & POSIX_SEM |
41 | 41 |
* (andrei) |
42 | 42 |
* 2003-03-17 possible signal interruptions treated for sysv (andrei) |
43 |
+ * 2004-07-28 s/lock_set_t/gen_lock_set_t/ because of a type conflict |
|
44 |
+ * on darwin (andrei) |
|
43 | 45 |
* |
44 | 46 |
Implements: |
45 | 47 |
|
... | ... |
@@ -52,10 +54,10 @@ Implements: |
52 | 54 |
|
53 | 55 |
lock sets: [implemented only for FL & SYSV so far] |
54 | 56 |
---------- |
55 |
- lock_set_t* lock_set_init(lock_set_t* set); - inits the lock set |
|
56 |
- void lock_set_destroy(lock_set_t* s); - removes the lock set |
|
57 |
- void lock_set_get(lock_set_t* s, int i); - locks sem i from the set |
|
58 |
- void lock_set_release(lock_set_t* s, int i) - unlocks sem i from the set |
|
57 |
+ gen_lock_set_t* lock_set_init(gen_lock_set_t* set); - inits the lock set |
|
58 |
+ void lock_set_destroy(gen_lock_set_t* s); - removes the lock set |
|
59 |
+ void lock_set_get(gen_lock_set_t* s, int i); - locks sem i from the set |
|
60 |
+ void lock_set_release(gen_lock_set_t* s, int i) - unlocks sem i from the set |
|
59 | 61 |
|
60 | 62 |
WARNING: - lock_set_init may fail for large number of sems (e.g. sysv). |
61 | 63 |
- signals are not treated! (some locks are "awakened" by the signals) |
... | ... |
@@ -209,16 +211,16 @@ tryagain: |
209 | 211 |
#if defined(FAST_LOCK) || defined(USE_PTHREAD_MUTEX) || defined(USE_POSIX_SEM) |
210 | 212 |
#define GEN_LOCK_T_PREFERED |
211 | 213 |
|
212 |
-struct lock_set_t_ { |
|
214 |
+struct gen_lock_set_t_ { |
|
213 | 215 |
long size; |
214 | 216 |
gen_lock_t* locks; |
215 | 217 |
}; /* must be aligned (32 bits or 64 depending on the arch)*/ |
216 |
-typedef struct lock_set_t_ lock_set_t; |
|
218 |
+typedef struct gen_lock_set_t_ gen_lock_set_t; |
|
217 | 219 |
|
218 | 220 |
|
219 | 221 |
#define lock_set_destroy(lock_set) /* do nothing */ |
220 | 222 |
|
221 |
-inline static lock_set_t* lock_set_init(lock_set_t* s) |
|