Commit | Line | Data |
---|---|---|
10544ee8 | 1 | /* |
c0c0989a MJ |
2 | * SPDX-License-Identifier: LGPL-2.1-or-later |
3 | * | |
4 | * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
5 | * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. | |
10544ee8 MD |
6 | * |
7 | * Userspace RCU header for LTTng-UST. Derived from liburcu | |
8 | * "bulletproof" flavor. | |
9 | * | |
10 | * Slower RCU read-side adapted for tracing library. Does not require thread | |
11 | * registration nor unregistration. Also signal-safe. | |
12 | * | |
10544ee8 MD |
13 | * LGPL-compatible code should include this header with : |
14 | * | |
15 | * #define _LGPL_SOURCE | |
16 | * #include <lttng/urcu-ust.h> | |
10544ee8 MD |
17 | */ |
18 | ||
c0c0989a MJ |
19 | #ifndef _LTTNG_UST_URCU_H |
20 | #define _LTTNG_UST_URCU_H | |
21 | ||
10544ee8 MD |
22 | #include <stdlib.h> |
23 | #include <pthread.h> | |
24 | ||
25 | #ifdef __cplusplus | |
26 | extern "C" { | |
27 | #endif | |
28 | ||
29 | /* | |
30 | * See lttng/urcu/pointer.h and lttng/urcu/static/pointer.h for pointer | |
31 | * publication headers. | |
32 | */ | |
33 | #include <lttng/urcu/pointer.h> | |
34 | ||
35 | #ifdef _LGPL_SOURCE | |
36 | ||
37 | #include <lttng/urcu/static/urcu-ust.h> | |
38 | ||
39 | /* | |
40 | * Mappings for static use of the userspace RCU library. | |
41 | * Should only be used in LGPL-compatible code. | |
42 | */ | |
43 | ||
44 | /* | |
45 | * lttng_ust_urcu_read_lock() | |
46 | * lttng_ust_urcu_read_unlock() | |
47 | * | |
48 | * Mark the beginning and end of a read-side critical section. | |
49 | */ | |
50 | #define lttng_ust_urcu_read_lock _lttng_ust_urcu_read_lock | |
51 | #define lttng_ust_urcu_read_unlock _lttng_ust_urcu_read_unlock | |
52 | #define lttng_ust_urcu_read_ongoing _lttng_ust_urcu_read_ongoing | |
53 | ||
54 | #else /* !_LGPL_SOURCE */ | |
55 | ||
56 | /* | |
57 | * library wrappers to be used by non-LGPL compatible source code. | |
58 | * See LGPL-only urcu/static/pointer.h for documentation. | |
59 | */ | |
60 | ||
61 | extern void lttng_ust_urcu_read_lock(void); | |
62 | extern void lttng_ust_urcu_read_unlock(void); | |
63 | extern int lttng_ust_urcu_read_ongoing(void); | |
64 | ||
65 | #endif /* !_LGPL_SOURCE */ | |
66 | ||
67 | extern void lttng_ust_urcu_synchronize_rcu(void); | |
68 | ||
69 | /* | |
70 | * lttng_ust_urcu_before_fork, lttng_ust_urcu_after_fork_parent and | |
71 | * lttng_ust_urcu_after_fork_child should be called around fork() system | |
72 | * calls when the child process is not expected to immediately perform | |
73 | * an exec(). For pthread users, see pthread_atfork(3). | |
74 | */ | |
75 | extern void lttng_ust_urcu_before_fork(void); | |
76 | extern void lttng_ust_urcu_after_fork_parent(void); | |
77 | extern void lttng_ust_urcu_after_fork_child(void); | |
78 | ||
79 | /* | |
80 | * In the UST version, thread registration is performed lazily, but it can be | |
81 | * forced by issuing an explicit lttng_ust_urcu_register_thread(). | |
82 | */ | |
83 | extern void lttng_ust_urcu_register_thread(void); | |
84 | ||
85 | #ifdef __cplusplus | |
86 | } | |
87 | #endif | |
88 | ||
89 | #endif /* _LTTNG_UST_URCU_H */ |