summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
blob: 531a562967c075d2e0b5b7924275121dec6af543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@arm.com>

From 26f2889113789c176273bd24fcd1592a8064c346 Mon Sep 17 00:00:00 2001
From: "Anthony G. Basile" <blueness@gentoo.org>
Date: Tue, 6 Jul 2021 07:54:47 -0600
Subject: [PATCH 1/2] Replace __BEGIN_DECLS and __END_DECLS with extern "C".

The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
glibc and uClibc, but not musl.  We replace them by the more general
extern "C" { ... } block exposed only if we have __cplusplus.

Forward ported from a patch by Anthony G. Basile <blueness@gentoo.org>.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
---
 include/libcgroup/config.h    | 8 ++++++--
 include/libcgroup/error.h     | 8 ++++++--
 include/libcgroup/groups.h    | 8 ++++++--
 include/libcgroup/init.h      | 8 ++++++--
 include/libcgroup/iterators.h | 8 ++++++--
 include/libcgroup/log.h       | 8 ++++++--
 include/libcgroup/tasks.h     | 8 ++++++--
 src/bindings/libcgroup.p      | 8 --------
 src/daemon/cgrulesengd.h      | 8 ++++++--
 src/libcgroup-internal.h      | 8 ++++++--
 src/tools/tools-common.h      | 8 ++++++--
 11 files changed, 60 insertions(+), 28 deletions(-)

diff --git a/include/libcgroup/config.h b/include/libcgroup/config.h
index 9aaa390..f835009 100644
--- a/include/libcgroup/config.h
+++ b/include/libcgroup/config.h
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_config 5. Configuration
@@ -128,6 +130,8 @@ int cgroup_config_create_template_group(
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /*_LIBCGROUP_CONFIG_H*/
diff --git a/include/libcgroup/error.h b/include/libcgroup/error.h
index 1dfdde9..14a6e16 100644
--- a/include/libcgroup/error.h
+++ b/include/libcgroup/error.h
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_errors 6. Error handling
@@ -99,6 +101,8 @@ int cgroup_get_last_errno(void);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_INIT_H */
diff --git a/include/libcgroup/groups.h b/include/libcgroup/groups.h
index 201558f..39ec3cd 100644
--- a/include/libcgroup/groups.h
+++ b/include/libcgroup/groups.h
@@ -11,7 +11,9 @@
 #include <stdbool.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Flags for cgroup_delete_cgroup_ext().
@@ -587,6 +589,8 @@ char *cgroup_get_cgroup_name(struct cgroup *cgroup);
  */
 
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_GROUPS_H */
diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h
index 5150f2f..ea2dcc9 100644
--- a/include/libcgroup/init.h
+++ b/include/libcgroup/init.h
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_init 1. Initialization
@@ -58,6 +60,8 @@ int cgroup_get_subsys_mount_point(const char *controller, char **mount_point);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_INIT_H */
diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h
index c6d453d..b3ba3af 100644
--- a/include/libcgroup/iterators.h
+++ b/include/libcgroup/iterators.h
@@ -11,7 +11,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_iterators 3. Iterators
@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(void **handle);
  * @}
  */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_ITERATORS_H */
diff --git a/include/libcgroup/log.h b/include/libcgroup/log.h
index 0dd03b4..f693473 100644
--- a/include/libcgroup/log.h
+++ b/include/libcgroup/log.h
@@ -11,7 +11,9 @@
 
 #include <stdarg.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_log 7. Logging
@@ -142,6 +144,8 @@ extern int cgroup_parse_log_level_str(const char *levelstr);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_LOG_H */
diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h
index aad438a..8553c30 100644
--- a/include/libcgroup/tasks.h
+++ b/include/libcgroup/tasks.h
@@ -12,7 +12,9 @@
 #include <stdbool.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** Flags for cgroup_change_cgroup_uid_gid(). */
 enum cgflags {
@@ -204,6 +206,8 @@ int cgroup_register_unchanged_process(pid_t pid, int flags);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_TASKS_H */
diff --git a/src/daemon/cgrulesengd.h b/src/daemon/cgrulesengd.h
index e273b4b..0b12076 100644
--- a/src/daemon/cgrulesengd.h
+++ b/src/daemon/cgrulesengd.h
@@ -17,7 +17,9 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "config.h"
 #include "libcgroup.h"
@@ -119,7 +121,9 @@ void cgre_flash_templates(int signum);
  */
 void cgre_catch_term(int signum);
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _CGRULESENGD_H */
 
diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h
index 1dfc92b..edc5abb 100644
--- a/src/libcgroup-internal.h
+++ b/src/libcgroup-internal.h
@@ -16,7 +16,9 @@
 
 #define __LIBCG_INTERNAL
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "config.h"
 #include <dirent.h>
@@ -407,6 +409,8 @@ int cgroupv2_controller_enabled(const char * const cg_name,
 
 #endif /* UNIT_TEST */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif
diff --git a/src/tools/tools-common.h b/src/tools/tools-common.h
index 292c408..e3541b1 100644
--- a/src/tools/tools-common.h
+++ b/src/tools/tools-common.h
@@ -18,7 +18,9 @@
 
 #define __TOOLS_COMMON
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 #include "config.h"
 #include <libcgroup.h>
 #include "../libcgroup-internal.h"
@@ -136,6 +138,8 @@ int parse_r_flag(const char * const program_name,
 
 #endif /* UNIT_TEST */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* TOOLS_COMMON */
-- 
2.32.0