diff options
author | sangelovic <angelovic.s@gmail.com> | 2019-06-12 11:50:07 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-01-06 19:22:26 -0800 |
commit | b2baaae2711d098c06423858662e29a8375fe6b8 (patch) | |
tree | e0aa103d7e518f6c3d69708df7a3fae52a87dc40 /meta-oe/recipes-core/sdbus-c++ | |
parent | e70fc74473a2df1609530a32e3a8c039702eeb07 (diff) | |
download | meta-openembedded-b2baaae2711d098c06423858662e29a8375fe6b8.tar.gz |
sdbus-c++: Introduce recipes for sdbus-c++ library and its tools
sdbus-c++ is a high-level, expressive, easy-to-use C++ D-Bus client library written on top of systemd D-Bus client C library.
Signed-off-by: Stanislav Angelovic <angelovic.s@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-core/sdbus-c++')
27 files changed, 2734 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-0.7.6/run-ptest b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-0.7.6/run-ptest new file mode 100755 index 0000000000..f6ade0c7e4 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-0.7.6/run-ptest | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | set -e | ||
3 | set -o pipefail | ||
4 | |||
5 | SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
6 | |||
7 | ${SCRIPTPATH}/../tests/sdbus-c++-unit-tests 2>&1 | \ | ||
8 | sed -r 's/^\[\s+OK\s+\] (.*) \([0-9]+\sms\)$/OK: \1 /' | \ | ||
9 | sed -r 's/^\[\s+FAILED\s+\] (.*) \([0-9]+\sms\)$/FAILED: \1 /' | \ | ||
10 | awk '{if ($1 == "OK:" || $1 == "FAILED:") {print $0}}' | ||
11 | |||
12 | ${SCRIPTPATH}/../tests/sdbus-c++-integration-tests 2>&1 | \ | ||
13 | sed -r 's/^\[\s+OK\s+\] (.*) \([0-9]+\sms\)$/OK: \1 /' | \ | ||
14 | sed -r 's/^\[\s+FAILED\s+\] (.*) \([0-9]+\sms\)$/FAILED: \1 /' | \ | ||
15 | awk '{if ($1 == "OK:" || $1 == "FAILED:") {print $0}}' | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0001-do-not-disable-buffer-in-writing-files.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0001-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..2f4daf8665 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0001-do-not-disable-buffer-in-writing-files.patch | |||
@@ -0,0 +1,413 @@ | |||
1 | From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Fri, 1 Mar 2019 15:22:15 +0800 | ||
4 | Subject: [PATCH] do not disable buffer in writing files | ||
5 | |||
6 | Do not disable buffer in writing files, otherwise we get | ||
7 | failure at boot for musl like below. | ||
8 | |||
9 | [!!!!!!] Failed to allocate manager object. | ||
10 | |||
11 | And there will be other failures, critical or not critical. | ||
12 | This is specific to musl. | ||
13 | |||
14 | Upstream-Status: Inappropriate [musl] | ||
15 | |||
16 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
17 | [Rebased for v242] | ||
18 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
19 | [rebased for systemd 243] | ||
20 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
21 | --- | ||
22 | src/basic/cgroup-util.c | 14 +++++++------- | ||
23 | src/basic/procfs-util.c | 4 ++-- | ||
24 | src/basic/smack-util.c | 2 +- | ||
25 | src/basic/util.c | 2 +- | ||
26 | src/binfmt/binfmt.c | 6 +++--- | ||
27 | src/core/main.c | 4 ++-- | ||
28 | src/core/smack-setup.c | 8 ++++---- | ||
29 | src/hibernate-resume/hibernate-resume.c | 2 +- | ||
30 | src/libsystemd/sd-device/sd-device.c | 2 +- | ||
31 | src/login/logind-dbus.c | 2 +- | ||
32 | src/nspawn/nspawn-cgroup.c | 2 +- | ||
33 | src/nspawn/nspawn.c | 6 +++--- | ||
34 | src/shared/sysctl-util.c | 2 +- | ||
35 | src/sleep/sleep.c | 10 +++++----- | ||
36 | src/udev/udevadm-trigger.c | 2 +- | ||
37 | src/udev/udevd.c | 2 +- | ||
38 | src/vconsole/vconsole-setup.c | 2 +- | ||
39 | 17 files changed, 36 insertions(+), 36 deletions(-) | ||
40 | |||
41 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c | ||
42 | index 7b5839ccd6..18f6e8ffc8 100644 | ||
43 | --- a/src/basic/cgroup-util.c | ||
44 | +++ b/src/basic/cgroup-util.c | ||
45 | @@ -860,7 +860,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { | ||
46 | |||
47 | xsprintf(c, PID_FMT "\n", pid); | ||
48 | |||
49 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
50 | + r = write_string_file(fs, c, 0); | ||
51 | if (r < 0) | ||
52 | return r; | ||
53 | |||
54 | @@ -1142,7 +1142,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
55 | |||
56 | sc = strstrip(contents); | ||
57 | if (isempty(sc)) { | ||
58 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
59 | + r = write_string_file(fs, agent, 0); | ||
60 | if (r < 0) | ||
61 | return r; | ||
62 | } else if (!path_equal(sc, agent)) | ||
63 | @@ -1160,7 +1160,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
64 | |||
65 | sc = strstrip(contents); | ||
66 | if (streq(sc, "0")) { | ||
67 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
68 | + r = write_string_file(fs, "1", 0); | ||
69 | if (r < 0) | ||
70 | return r; | ||
71 | |||
72 | @@ -1187,7 +1187,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
73 | if (r < 0) | ||
74 | return r; | ||
75 | |||
76 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
77 | + r = write_string_file(fs, "0", 0); | ||
78 | if (r < 0) | ||
79 | return r; | ||
80 | |||
81 | @@ -1197,7 +1197,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
82 | if (r < 0) | ||
83 | return r; | ||
84 | |||
85 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
86 | + r = write_string_file(fs, "", 0); | ||
87 | if (r < 0) | ||
88 | return r; | ||
89 | |||
90 | @@ -2053,7 +2053,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri | ||
91 | if (r < 0) | ||
92 | return r; | ||
93 | |||
94 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
95 | + return write_string_file(p, value, 0); | ||
96 | } | ||
97 | |||
98 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { | ||
99 | @@ -2697,7 +2697,7 @@ int cg_enable_everywhere( | ||
100 | return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); | ||
101 | } | ||
102 | |||
103 | - r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
104 | + r = write_string_stream(f, s, 0); | ||
105 | if (r < 0) { | ||
106 | log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", | ||
107 | FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); | ||
108 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
109 | index 42ce53d5aa..57512532a6 100644 | ||
110 | --- a/src/basic/procfs-util.c | ||
111 | +++ b/src/basic/procfs-util.c | ||
112 | @@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { | ||
113 | * decrease it, as threads-max is the much more relevant sysctl. */ | ||
114 | if (limit > pid_max-1) { | ||
115 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ | ||
116 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
117 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); | ||
118 | if (r < 0) | ||
119 | return r; | ||
120 | } | ||
121 | |||
122 | sprintf(buffer, "%" PRIu64, limit); | ||
123 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
124 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); | ||
125 | if (r < 0) { | ||
126 | uint64_t threads_max; | ||
127 | |||
128 | diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c | ||
129 | index 123d00e13e..e7ea78f349 100644 | ||
130 | --- a/src/basic/smack-util.c | ||
131 | +++ b/src/basic/smack-util.c | ||
132 | @@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { | ||
133 | return 0; | ||
134 | |||
135 | p = procfs_file_alloca(pid, "attr/current"); | ||
136 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
137 | + r = write_string_file(p, label, 0); | ||
138 | if (r < 0) | ||
139 | return r; | ||
140 | |||
141 | diff --git a/src/basic/util.c b/src/basic/util.c | ||
142 | index 93d610bc98..97dca64f73 100644 | ||
143 | --- a/src/basic/util.c | ||
144 | +++ b/src/basic/util.c | ||
145 | @@ -294,7 +294,7 @@ void disable_coredumps(void) { | ||
146 | if (detect_container() > 0) | ||
147 | return; | ||
148 | |||
149 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
150 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); | ||
151 | if (r < 0) | ||
152 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); | ||
153 | } | ||
154 | diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c | ||
155 | index aa9d811f2e..8c7f2dae7a 100644 | ||
156 | --- a/src/binfmt/binfmt.c | ||
157 | +++ b/src/binfmt/binfmt.c | ||
158 | @@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { | ||
159 | if (!fn) | ||
160 | return log_oom(); | ||
161 | |||
162 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
163 | + return write_string_file(fn, "-1", 0); | ||
164 | } | ||
165 | |||
166 | static int apply_rule(const char *rule) { | ||
167 | @@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { | ||
168 | |||
169 | (void) delete_rule(rule); | ||
170 | |||
171 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
172 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); | ||
173 | if (r < 0) | ||
174 | return log_error_errno(r, "Failed to add binary format: %m"); | ||
175 | |||
176 | @@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) { | ||
177 | } | ||
178 | |||
179 | /* Flush out all rules */ | ||
180 | - (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
181 | + (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); | ||
182 | |||
183 | STRV_FOREACH(f, files) { | ||
184 | k = apply_file(*f, true); | ||
185 | diff --git a/src/core/main.c b/src/core/main.c | ||
186 | index bcce7178a8..4199cedab9 100644 | ||
187 | --- a/src/core/main.c | ||
188 | +++ b/src/core/main.c | ||
189 | @@ -1285,7 +1285,7 @@ static int bump_unix_max_dgram_qlen(void) { | ||
190 | if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) | ||
191 | return 0; | ||
192 | |||
193 | - r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); | ||
194 | + r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); | ||
195 | if (r < 0) | ||
196 | return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, | ||
197 | "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); | ||
198 | @@ -1509,7 +1509,7 @@ static void initialize_core_pattern(bool skip_setup) { | ||
199 | if (getpid_cached() != 1) | ||
200 | return; | ||
201 | |||
202 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
203 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); | ||
204 | if (r < 0) | ||
205 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); | ||
206 | } | ||
207 | diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c | ||
208 | index b95e6239d4..fdbdaaaccb 100644 | ||
209 | --- a/src/core/smack-setup.c | ||
210 | +++ b/src/core/smack-setup.c | ||
211 | @@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) { | ||
212 | } | ||
213 | |||
214 | #ifdef SMACK_RUN_LABEL | ||
215 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
216 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); | ||
217 | if (r < 0) | ||
218 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); | ||
219 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
220 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); | ||
221 | if (r < 0) | ||
222 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); | ||
223 | r = write_string_file("/sys/fs/smackfs/netlabel", | ||
224 | - "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
225 | + "0.0.0.0/0 " SMACK_RUN_LABEL, 0); | ||
226 | if (r < 0) | ||
227 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); | ||
228 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
229 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); | ||
230 | if (r < 0) | ||
231 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); | ||
232 | #endif | ||
233 | diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c | ||
234 | index 17e7cd1a00..87a7667716 100644 | ||
235 | --- a/src/hibernate-resume/hibernate-resume.c | ||
236 | +++ b/src/hibernate-resume/hibernate-resume.c | ||
237 | @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { | ||
238 | return EXIT_FAILURE; | ||
239 | } | ||
240 | |||
241 | - r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
242 | + r = write_string_file("/sys/power/resume", major_minor, 0); | ||
243 | if (r < 0) { | ||
244 | log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); | ||
245 | return EXIT_FAILURE; | ||
246 | diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c | ||
247 | index c4a7f2f3d3..bcac758284 100644 | ||
248 | --- a/src/libsystemd/sd-device/sd-device.c | ||
249 | +++ b/src/libsystemd/sd-device/sd-device.c | ||
250 | @@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, | ||
251 | if (!value) | ||
252 | return -ENOMEM; | ||
253 | |||
254 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); | ||
255 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); | ||
256 | if (r < 0) { | ||
257 | if (r == -ELOOP) | ||
258 | return -EINVAL; | ||
259 | diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c | ||
260 | index 30b9a66334..cc1d577933 100644 | ||
261 | --- a/src/login/logind-dbus.c | ||
262 | +++ b/src/login/logind-dbus.c | ||
263 | @@ -1325,7 +1325,7 @@ static int trigger_device(Manager *m, sd_device *d) { | ||
264 | if (!t) | ||
265 | return -ENOMEM; | ||
266 | |||
267 | - (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
268 | + (void) write_string_file(t, "change", 0); | ||
269 | } | ||
270 | |||
271 | return 0; | ||
272 | diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c | ||
273 | index 0462b46413..7c53d41483 100644 | ||
274 | --- a/src/nspawn/nspawn-cgroup.c | ||
275 | +++ b/src/nspawn/nspawn-cgroup.c | ||
276 | @@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { | ||
277 | fn = strjoina(tree, cgroup, "/cgroup.procs"); | ||
278 | |||
279 | sprintf(pid_string, PID_FMT, pid); | ||
280 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); | ||
281 | + r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); | ||
282 | if (r < 0) { | ||
283 | log_error_errno(r, "Failed to move process: %m"); | ||
284 | goto finish; | ||
285 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c | ||
286 | index 2aec8041f0..841542f2f3 100644 | ||
287 | --- a/src/nspawn/nspawn.c | ||
288 | +++ b/src/nspawn/nspawn.c | ||
289 | @@ -2357,7 +2357,7 @@ static int reset_audit_loginuid(void) { | ||
290 | if (streq(p, "4294967295")) | ||
291 | return 0; | ||
292 | |||
293 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
294 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); | ||
295 | if (r < 0) { | ||
296 | log_error_errno(r, | ||
297 | "Failed to reset audit login UID. This probably means that your kernel is too\n" | ||
298 | @@ -3566,13 +3566,13 @@ static int setup_uid_map(pid_t pid) { | ||
299 | |||
300 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); | ||
301 | xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); | ||
302 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
303 | + r = write_string_file(uid_map, line, 0); | ||
304 | if (r < 0) | ||
305 | return log_error_errno(r, "Failed to write UID map: %m"); | ||
306 | |||
307 | /* We always assign the same UID and GID ranges */ | ||
308 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); | ||
309 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
310 | + r = write_string_file(uid_map, line, 0); | ||
311 | if (r < 0) | ||
312 | return log_error_errno(r, "Failed to write GID map: %m"); | ||
313 | |||
314 | diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c | ||
315 | index 93bdcf11bf..68cddb7a9f 100644 | ||
316 | --- a/src/shared/sysctl-util.c | ||
317 | +++ b/src/shared/sysctl-util.c | ||
318 | @@ -88,7 +88,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c | ||
319 | |||
320 | log_debug("Setting '%s' to '%s'", p, value); | ||
321 | |||
322 | - return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); | ||
323 | + return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); | ||
324 | } | ||
325 | |||
326 | int sysctl_read(const char *property, char **content) { | ||
327 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c | ||
328 | index b9fe96635d..f168d7f890 100644 | ||
329 | --- a/src/sleep/sleep.c | ||
330 | +++ b/src/sleep/sleep.c | ||
331 | @@ -54,7 +54,7 @@ static int write_hibernate_location_info(void) { | ||
332 | |||
333 | /* if it's a swap partition, we just write the disk to /sys/power/resume */ | ||
334 | if (streq(type, "partition")) { | ||
335 | - r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
336 | + r = write_string_file("/sys/power/resume", device, 0); | ||
337 | if (r < 0) | ||
338 | return log_debug_errno(r, "Failed to write partition device to /sys/power/resume: %m"); | ||
339 | |||
340 | @@ -98,14 +98,14 @@ static int write_hibernate_location_info(void) { | ||
341 | |||
342 | offset = fiemap->fm_extents[0].fe_physical / page_size(); | ||
343 | xsprintf(offset_str, "%" PRIu64, offset); | ||
344 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
345 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); | ||
346 | if (r < 0) | ||
347 | return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str); | ||
348 | |||
349 | log_debug("Wrote calculated resume_offset value to /sys/power/resume_offset: %s", offset_str); | ||
350 | |||
351 | xsprintf(device_str, "%lx", (unsigned long)stb.st_dev); | ||
352 | - r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
353 | + r = write_string_file("/sys/power/resume", device_str, 0); | ||
354 | if (r < 0) | ||
355 | return log_debug_errno(r, "Failed to write device '%s': %m", device_str); | ||
356 | |||
357 | @@ -121,7 +121,7 @@ static int write_mode(char **modes) { | ||
358 | STRV_FOREACH(mode, modes) { | ||
359 | int k; | ||
360 | |||
361 | - k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
362 | + k = write_string_file("/sys/power/disk", *mode, 0); | ||
363 | if (k >= 0) | ||
364 | return 0; | ||
365 | |||
366 | @@ -140,7 +140,7 @@ static int write_state(FILE **f, char **states) { | ||
367 | STRV_FOREACH(state, states) { | ||
368 | int k; | ||
369 | |||
370 | - k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
371 | + k = write_string_stream(*f, *state, 0); | ||
372 | if (k >= 0) | ||
373 | return 0; | ||
374 | log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); | ||
375 | diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c | ||
376 | index 77d95e513f..25ce4abfb1 100644 | ||
377 | --- a/src/udev/udevadm-trigger.c | ||
378 | +++ b/src/udev/udevadm-trigger.c | ||
379 | @@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se | ||
380 | if (!filename) | ||
381 | return log_oom(); | ||
382 | |||
383 | - r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
384 | + r = write_string_file(filename, action, 0); | ||
385 | if (r < 0) { | ||
386 | log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r, | ||
387 | "Failed to write '%s' to '%s': %m", action, filename); | ||
388 | diff --git a/src/udev/udevd.c b/src/udev/udevd.c | ||
389 | index cb5123042a..ea309a9e7f 100644 | ||
390 | --- a/src/udev/udevd.c | ||
391 | +++ b/src/udev/udevd.c | ||
392 | @@ -1113,7 +1113,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) { | ||
393 | |||
394 | filename = strjoina(syspath, "/uevent"); | ||
395 | log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); | ||
396 | - r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
397 | + r = write_string_file(filename, "change", 0); | ||
398 | if (r < 0) | ||
399 | return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); | ||
400 | return 0; | ||
401 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c | ||
402 | index 75d052ae70..5a15c939d8 100644 | ||
403 | --- a/src/vconsole/vconsole-setup.c | ||
404 | +++ b/src/vconsole/vconsole-setup.c | ||
405 | @@ -117,7 +117,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { | ||
406 | static int toggle_utf8_sysfs(bool utf8) { | ||
407 | int r; | ||
408 | |||
409 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
410 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); | ||
411 | if (r < 0) | ||
412 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); | ||
413 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-don-t-use-glibc-specific-qsort_r.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-don-t-use-glibc-specific-qsort_r.patch new file mode 100644 index 0000000000..c6213ab88e --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-don-t-use-glibc-specific-qsort_r.patch | |||
@@ -0,0 +1,163 @@ | |||
1 | From 1eb84534dea05d41afed1d898cba212ad7d310dd Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 13:41:41 +0800 | ||
4 | Subject: [PATCH 02/24] don't use glibc-specific qsort_r | ||
5 | |||
6 | Upstream-Status: Inappropriate [musl specific] | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | [Rebased for v241] | ||
10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
11 | [Rebased for v242] | ||
12 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
13 | --- | ||
14 | src/basic/sort-util.h | 14 -------------- | ||
15 | src/libsystemd/sd-hwdb/hwdb-util.c | 19 ++++++++++++++----- | ||
16 | src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ | ||
17 | 3 files changed, 38 insertions(+), 31 deletions(-) | ||
18 | |||
19 | diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h | ||
20 | index e029f8646e..27d68b341c 100644 | ||
21 | --- a/src/basic/sort-util.h | ||
22 | +++ b/src/basic/sort-util.h | ||
23 | @@ -54,17 +54,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn | ||
24 | int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ | ||
25 | qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ | ||
26 | }) | ||
27 | - | ||
28 | -static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) { | ||
29 | - if (nmemb <= 1) | ||
30 | - return; | ||
31 | - | ||
32 | - assert(base); | ||
33 | - qsort_r(base, nmemb, size, compar, userdata); | ||
34 | -} | ||
35 | - | ||
36 | -#define typesafe_qsort_r(p, n, func, userdata) \ | ||
37 | - ({ \ | ||
38 | - int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ | ||
39 | - qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ | ||
40 | - }) | ||
41 | diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c | ||
42 | index c83575c7c8..72f8f3a050 100644 | ||
43 | --- a/src/libsystemd/sd-hwdb/hwdb-util.c | ||
44 | +++ b/src/libsystemd/sd-hwdb/hwdb-util.c | ||
45 | @@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) { | ||
46 | |||
47 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); | ||
48 | |||
49 | -static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) { | ||
50 | - return strcmp(trie->strings->buf + a->key_off, | ||
51 | - trie->strings->buf + b->key_off); | ||
52 | +static struct trie *trie_node_add_value_trie; | ||
53 | +static int trie_values_cmp(const void *v1, const void *v2) { | ||
54 | + const struct trie_value_entry *a = v1; | ||
55 | + const struct trie_value_entry *b = v2; | ||
56 | + | ||
57 | + return strcmp(trie_node_add_value_trie->strings->buf + a->key_off, | ||
58 | + trie_node_add_value_trie->strings->buf + b->key_off); | ||
59 | } | ||
60 | |||
61 | static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
62 | @@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
63 | .value_off = v, | ||
64 | }; | ||
65 | |||
66 | - val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); | ||
67 | + trie_node_add_value_trie = trie; | ||
68 | + val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
69 | + trie_node_add_value_trie = NULL; | ||
70 | + | ||
71 | if (val) { | ||
72 | /* At this point we have 2 identical properties on the same match-string. | ||
73 | * Since we process files in order, we just replace the previous value. */ | ||
74 | @@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
75 | .line_number = line_number, | ||
76 | }; | ||
77 | node->values_count++; | ||
78 | - typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); | ||
79 | + trie_node_add_value_trie = trie; | ||
80 | + qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
81 | + trie_node_add_value_trie = NULL; | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | diff --git a/src/shared/format-table.c b/src/shared/format-table.c | ||
86 | index a5c0a99b08..d595cbe372 100644 | ||
87 | --- a/src/shared/format-table.c | ||
88 | +++ b/src/shared/format-table.c | ||
89 | @@ -850,31 +850,33 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t | ||
90 | return CMP(index_a, index_b); | ||
91 | } | ||
92 | |||
93 | -static int table_data_compare(const size_t *a, const size_t *b, Table *t) { | ||
94 | +static Table *user_table; | ||
95 | +static int table_data_compare(const void *x, const void *y) { | ||
96 | + const size_t *a = x, *b=y; | ||
97 | size_t i; | ||
98 | int r; | ||
99 | |||
100 | - assert(t); | ||
101 | - assert(t->sort_map); | ||
102 | + assert(user_table); | ||
103 | + assert(user_table->sort_map); | ||
104 | |||
105 | /* Make sure the header stays at the beginning */ | ||
106 | - if (*a < t->n_columns && *b < t->n_columns) | ||
107 | + if (*a < user_table->n_columns && *b < user_table->n_columns) | ||
108 | return 0; | ||
109 | - if (*a < t->n_columns) | ||
110 | + if (*a < user_table->n_columns) | ||
111 | return -1; | ||
112 | - if (*b < t->n_columns) | ||
113 | + if (*b < user_table->n_columns) | ||
114 | return 1; | ||
115 | |||
116 | /* Order other lines by the sorting map */ | ||
117 | - for (i = 0; i < t->n_sort_map; i++) { | ||
118 | + for (i = 0; i < user_table->n_sort_map; i++) { | ||
119 | TableData *d, *dd; | ||
120 | |||
121 | - d = t->data[*a + t->sort_map[i]]; | ||
122 | - dd = t->data[*b + t->sort_map[i]]; | ||
123 | + d = user_table->data[*a + user_table->sort_map[i]]; | ||
124 | + dd = user_table->data[*b + user_table->sort_map[i]]; | ||
125 | |||
126 | r = cell_data_compare(d, *a, dd, *b); | ||
127 | if (r != 0) | ||
128 | - return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r; | ||
129 | + return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r; | ||
130 | } | ||
131 | |||
132 | /* Order identical lines by the order there were originally added in */ | ||
133 | @@ -1107,7 +1109,12 @@ int table_print(Table *t, FILE *f) { | ||
134 | for (i = 0; i < n_rows; i++) | ||
135 | sorted[i] = i * t->n_columns; | ||
136 | |||
137 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); | ||
138 | + if (n_rows <= 1) | ||
139 | + return 0; | ||
140 | + assert(sorted); | ||
141 | + user_table = t; | ||
142 | + qsort(sorted, n_rows, sizeof(size_t), table_data_compare); | ||
143 | + user_table = NULL; | ||
144 | } | ||
145 | |||
146 | if (t->display_map) | ||
147 | @@ -1534,7 +1541,12 @@ int table_to_json(Table *t, JsonVariant **ret) { | ||
148 | for (i = 0; i < n_rows; i++) | ||
149 | sorted[i] = i * t->n_columns; | ||
150 | |||
151 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); | ||
152 | + if (n_rows <= 1) | ||
153 | + return 0; | ||
154 | + assert(sorted); | ||
155 | + user_table = t; | ||
156 | + qsort(sorted, n_rows, sizeof(size_t), table_data_compare); | ||
157 | + user_table = NULL; | ||
158 | } | ||
159 | |||
160 | if (t->display_map) | ||
161 | -- | ||
162 | 2.11.0 | ||
163 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-src-login-brightness.c-include-sys-wait.h.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-src-login-brightness.c-include-sys-wait.h.patch new file mode 100644 index 0000000000..dcae668dcb --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0002-src-login-brightness.c-include-sys-wait.h.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | Include sys/wait.h | ||
2 | |||
3 | Fixes: | ||
4 | src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? | ||
5 | 158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w); | ||
6 | | ^~~~~~~ | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
11 | --- | ||
12 | src/login/logind-brightness.c | 1 + | ||
13 | 1 file changed, 1 insertion(+) | ||
14 | |||
15 | diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c | ||
16 | index 8dfa97d7ae..bddd4a2727 100644 | ||
17 | --- a/src/login/logind-brightness.c | ||
18 | +++ b/src/login/logind-brightness.c | ||
19 | @@ -1,5 +1,6 @@ | ||
20 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
21 | |||
22 | +#include <sys/wait.h> | ||
23 | #include "bus-util.h" | ||
24 | #include "device-util.h" | ||
25 | #include "hash-funcs.h" | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch new file mode 100644 index 0000000000..2e39f7a2e1 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch | |||
@@ -0,0 +1,63 @@ | |||
1 | From a9421d55102fc84f77f7c21a2479fcd00652b896 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 13:55:12 +0800 | ||
4 | Subject: [PATCH 03/24] missing_type.h: add __compare_fn_t and comparison_fn_t | ||
5 | |||
6 | Make it work with musl where comparison_fn_t and __compare_fn_t | ||
7 | is not provided. | ||
8 | |||
9 | Upstream-Status: Inappropriate [musl specific] | ||
10 | |||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | [Rebased for v242] | ||
13 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
14 | --- | ||
15 | src/basic/missing_type.h | 9 +++++++++ | ||
16 | src/basic/sort-util.h | 1 + | ||
17 | src/journal/catalog.c | 1 + | ||
18 | 3 files changed, 11 insertions(+) | ||
19 | |||
20 | diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h | ||
21 | index bf8a6caa1b..2134fe5095 100644 | ||
22 | --- a/src/basic/missing_type.h | ||
23 | +++ b/src/basic/missing_type.h | ||
24 | @@ -10,3 +10,12 @@ | ||
25 | #if !HAVE_CHAR16_T | ||
26 | #define char16_t uint16_t | ||
27 | #endif | ||
28 | + | ||
29 | +#ifndef __GLIBC__ | ||
30 | +typedef int (*comparison_fn_t)(const void *, const void *); | ||
31 | +#endif | ||
32 | + | ||
33 | +#ifndef __COMPAR_FN_T | ||
34 | +#define __COMPAR_FN_T | ||
35 | +typedef int (*__compar_fn_t)(const void *, const void *); | ||
36 | +#endif | ||
37 | diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h | ||
38 | index e029f86..7247d40 100644 | ||
39 | --- a/src/basic/sort-util.h | ||
40 | +++ b/src/basic/sort-util.h | ||
41 | @@ -4,6 +4,7 @@ | ||
42 | #include <stdlib.h> | ||
43 | |||
44 | #include "macro.h" | ||
45 | +#include "missing.h" | ||
46 | |||
47 | void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, | ||
48 | __compar_d_fn_t compar, void *arg); | ||
49 | diff --git a/src/journal/catalog.c b/src/journal/catalog.c | ||
50 | index 7beffc1e1a..4818a2e5cc 100644 | ||
51 | --- a/src/journal/catalog.c | ||
52 | +++ b/src/journal/catalog.c | ||
53 | @@ -29,6 +29,7 @@ | ||
54 | #include "string-util.h" | ||
55 | #include "strv.h" | ||
56 | #include "tmpfile-util.h" | ||
57 | +#include "missing.h" | ||
58 | |||
59 | const char * const catalog_file_dirs[] = { | ||
60 | "/usr/local/lib/systemd/catalog/", | ||
61 | -- | ||
62 | 2.11.0 | ||
63 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-src-basic-copy.c-include-signal.h.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-src-basic-copy.c-include-signal.h.patch new file mode 100644 index 0000000000..7ee0d48fa6 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-src-basic-copy.c-include-signal.h.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | Include signal.h | ||
2 | |||
3 | Fixes several signal set related errors: | ||
4 | src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration] | ||
5 | src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration] | ||
6 | src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function) | ||
7 | src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration] | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
12 | --- | ||
13 | src/basic/copy.c | 1 + | ||
14 | 1 file changed, 1 insertion(+) | ||
15 | |||
16 | diff --git a/src/basic/copy.c b/src/basic/copy.c | ||
17 | index ca311e021e..3cf7fc1697 100644 | ||
18 | --- a/src/basic/copy.c | ||
19 | +++ b/src/basic/copy.c | ||
20 | @@ -12,6 +12,7 @@ | ||
21 | #include <sys/xattr.h> | ||
22 | #include <time.h> | ||
23 | #include <unistd.h> | ||
24 | +#include <signal.h> | ||
25 | |||
26 | #include "alloc-util.h" | ||
27 | #include "btrfs-util.h" | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-add-fallback-parse_printf_format-implementation.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-add-fallback-parse_printf_format-implementation.patch new file mode 100644 index 0000000000..a2aad40ac2 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-add-fallback-parse_printf_format-implementation.patch | |||
@@ -0,0 +1,432 @@ | |||
1 | From 7bcf3b166694090497a0acd2c5299e4e04fcc9b6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 14:04:21 +0800 | ||
4 | Subject: [PATCH 04/24] add fallback parse_printf_format implementation | ||
5 | |||
6 | Upstream-Status: Inappropriate [musl specific] | ||
7 | |||
8 | Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
11 | [rebased for systemd 243] | ||
12 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
13 | --- | ||
14 | meson.build | 1 + | ||
15 | src/basic/meson.build | 5 + | ||
16 | src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++++++++++ | ||
17 | src/basic/parse-printf-format.h | 57 +++++++++ | ||
18 | src/basic/stdio-util.h | 2 +- | ||
19 | src/journal/journal-send.c | 2 +- | ||
20 | 6 files changed, 338 insertions(+), 2 deletions(-) | ||
21 | create mode 100644 src/basic/parse-printf-format.c | ||
22 | create mode 100644 src/basic/parse-printf-format.h | ||
23 | |||
24 | diff --git a/meson.build b/meson.build | ||
25 | index 79b762faeb..7f8c679411 100644 | ||
26 | --- a/meson.build | ||
27 | +++ b/meson.build | ||
28 | @@ -613,6 +613,7 @@ endif | ||
29 | foreach header : ['crypt.h', | ||
30 | 'linux/memfd.h', | ||
31 | 'linux/vm_sockets.h', | ||
32 | + 'printf.h', | ||
33 | 'sys/auxv.h', | ||
34 | 'valgrind/memcheck.h', | ||
35 | 'valgrind/valgrind.h', | ||
36 | diff --git a/src/basic/meson.build b/src/basic/meson.build | ||
37 | index d6caf28f14..32c1acf349 100644 | ||
38 | --- a/src/basic/meson.build | ||
39 | +++ b/src/basic/meson.build | ||
40 | @@ -312,6 +312,11 @@ foreach item : [['af', af_list_txt, 'af', ''], | ||
41 | endforeach | ||
42 | |||
43 | basic_sources += generated_gperf_headers | ||
44 | + | ||
45 | +if conf.get('HAVE_PRINTF_H') != 1 | ||
46 | + basic_sources += [files('parse-printf-format.c')] | ||
47 | +endif | ||
48 | + | ||
49 | basic_gcrypt_sources = files( | ||
50 | 'gcrypt-util.c', | ||
51 | 'gcrypt-util.h') | ||
52 | diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c | ||
53 | new file mode 100644 | ||
54 | index 0000000000..49437e5445 | ||
55 | --- /dev/null | ||
56 | +++ b/src/basic/parse-printf-format.c | ||
57 | @@ -0,0 +1,273 @@ | ||
58 | +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ | ||
59 | + | ||
60 | +/*** | ||
61 | + This file is part of systemd. | ||
62 | + | ||
63 | + Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> | ||
64 | + | ||
65 | + With parts from the musl C library | ||
66 | + Copyright 2005-2014 Rich Felker, et al. | ||
67 | + | ||
68 | + systemd is free software; you can redistribute it and/or modify it | ||
69 | + under the terms of the GNU Lesser General Public License as published by | ||
70 | + the Free Software Foundation; either version 2.1 of the License, or | ||
71 | + (at your option) any later version. | ||
72 | + | ||
73 | + systemd is distributed in the hope that it will be useful, but | ||
74 | + WITHOUT ANY WARRANTY; without even the implied warranty of | ||
75 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
76 | + Lesser General Public License for more details. | ||
77 | + | ||
78 | + You should have received a copy of the GNU Lesser General Public License | ||
79 | + along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
80 | +***/ | ||
81 | + | ||
82 | +#include <stddef.h> | ||
83 | +#include <string.h> | ||
84 | + | ||
85 | +#include "parse-printf-format.h" | ||
86 | + | ||
87 | +static const char *consume_nonarg(const char *fmt) | ||
88 | +{ | ||
89 | + do { | ||
90 | + if (*fmt == '\0') | ||
91 | + return fmt; | ||
92 | + } while (*fmt++ != '%'); | ||
93 | + return fmt; | ||
94 | +} | ||
95 | + | ||
96 | +static const char *consume_num(const char *fmt) | ||
97 | +{ | ||
98 | + for (;*fmt >= '0' && *fmt <= '9'; fmt++) | ||
99 | + /* do nothing */; | ||
100 | + return fmt; | ||
101 | +} | ||
102 | + | ||
103 | +static const char *consume_argn(const char *fmt, size_t *arg) | ||
104 | +{ | ||
105 | + const char *p = fmt; | ||
106 | + size_t val = 0; | ||
107 | + | ||
108 | + if (*p < '1' || *p > '9') | ||
109 | + return fmt; | ||
110 | + do { | ||
111 | + val = 10*val + (*p++ - '0'); | ||
112 | + } while (*p >= '0' && *p <= '9'); | ||
113 | + | ||
114 | + if (*p != '$') | ||
115 | + return fmt; | ||
116 | + *arg = val; | ||
117 | + return p+1; | ||
118 | +} | ||
119 | + | ||
120 | +static const char *consume_flags(const char *fmt) | ||
121 | +{ | ||
122 | + while (1) { | ||
123 | + switch (*fmt) { | ||
124 | + case '#': | ||
125 | + case '0': | ||
126 | + case '-': | ||
127 | + case ' ': | ||
128 | + case '+': | ||
129 | + case '\'': | ||
130 | + case 'I': | ||
131 | + fmt++; | ||
132 | + continue; | ||
133 | + } | ||
134 | + return fmt; | ||
135 | + } | ||
136 | +} | ||
137 | + | ||
138 | +enum state { | ||
139 | + BARE, | ||
140 | + LPRE, | ||
141 | + LLPRE, | ||
142 | + HPRE, | ||
143 | + HHPRE, | ||
144 | + BIGLPRE, | ||
145 | + ZTPRE, | ||
146 | + JPRE, | ||
147 | + STOP | ||
148 | +}; | ||
149 | + | ||
150 | +enum type { | ||
151 | + NONE, | ||
152 | + PTR, | ||
153 | + INT, | ||
154 | + UINT, | ||
155 | + ULLONG, | ||
156 | + LONG, | ||
157 | + ULONG, | ||
158 | + SHORT, | ||
159 | + USHORT, | ||
160 | + CHAR, | ||
161 | + UCHAR, | ||
162 | + LLONG, | ||
163 | + SIZET, | ||
164 | + IMAX, | ||
165 | + UMAX, | ||
166 | + PDIFF, | ||
167 | + UIPTR, | ||
168 | + DBL, | ||
169 | + LDBL, | ||
170 | + MAXTYPE | ||
171 | +}; | ||
172 | + | ||
173 | +static const short pa_types[MAXTYPE] = { | ||
174 | + [NONE] = PA_INT, | ||
175 | + [PTR] = PA_POINTER, | ||
176 | + [INT] = PA_INT, | ||
177 | + [UINT] = PA_INT, | ||
178 | + [ULLONG] = PA_INT | PA_FLAG_LONG_LONG, | ||
179 | + [LONG] = PA_INT | PA_FLAG_LONG, | ||
180 | + [ULONG] = PA_INT | PA_FLAG_LONG, | ||
181 | + [SHORT] = PA_INT | PA_FLAG_SHORT, | ||
182 | + [USHORT] = PA_INT | PA_FLAG_SHORT, | ||
183 | + [CHAR] = PA_CHAR, | ||
184 | + [UCHAR] = PA_CHAR, | ||
185 | + [LLONG] = PA_INT | PA_FLAG_LONG_LONG, | ||
186 | + [SIZET] = PA_INT | PA_FLAG_LONG, | ||
187 | + [IMAX] = PA_INT | PA_FLAG_LONG_LONG, | ||
188 | + [UMAX] = PA_INT | PA_FLAG_LONG_LONG, | ||
189 | + [PDIFF] = PA_INT | PA_FLAG_LONG_LONG, | ||
190 | + [UIPTR] = PA_INT | PA_FLAG_LONG, | ||
191 | + [DBL] = PA_DOUBLE, | ||
192 | + [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE | ||
193 | +}; | ||
194 | + | ||
195 | +#define S(x) [(x)-'A'] | ||
196 | +#define E(x) (STOP + (x)) | ||
197 | + | ||
198 | +static const unsigned char states[]['z'-'A'+1] = { | ||
199 | + { /* 0: bare types */ | ||
200 | + S('d') = E(INT), S('i') = E(INT), | ||
201 | + S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT), | ||
202 | + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), | ||
203 | + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), | ||
204 | + S('c') = E(CHAR),S('C') = E(INT), | ||
205 | + S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR), | ||
206 | + S('m') = E(NONE), | ||
207 | + S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, | ||
208 | + S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE | ||
209 | + }, { /* 1: l-prefixed */ | ||
210 | + S('d') = E(LONG), S('i') = E(LONG), | ||
211 | + S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG), | ||
212 | + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), | ||
213 | + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), | ||
214 | + S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR), | ||
215 | + S('l') = LLPRE | ||
216 | + }, { /* 2: ll-prefixed */ | ||
217 | + S('d') = E(LLONG), S('i') = E(LLONG), | ||
218 | + S('o') = E(ULLONG),S('u') = E(ULLONG), | ||
219 | + S('x') = E(ULLONG),S('X') = E(ULLONG), | ||
220 | + S('n') = E(PTR) | ||
221 | + }, { /* 3: h-prefixed */ | ||
222 | + S('d') = E(SHORT), S('i') = E(SHORT), | ||
223 | + S('o') = E(USHORT),S('u') = E(USHORT), | ||
224 | + S('x') = E(USHORT),S('X') = E(USHORT), | ||
225 | + S('n') = E(PTR), | ||
226 | + S('h') = HHPRE | ||
227 | + }, { /* 4: hh-prefixed */ | ||
228 | + S('d') = E(CHAR), S('i') = E(CHAR), | ||
229 | + S('o') = E(UCHAR),S('u') = E(UCHAR), | ||
230 | + S('x') = E(UCHAR),S('X') = E(UCHAR), | ||
231 | + S('n') = E(PTR) | ||
232 | + }, { /* 5: L-prefixed */ | ||
233 | + S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL), | ||
234 | + S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL), | ||
235 | + S('n') = E(PTR) | ||
236 | + }, { /* 6: z- or t-prefixed (assumed to be same size) */ | ||
237 | + S('d') = E(PDIFF),S('i') = E(PDIFF), | ||
238 | + S('o') = E(SIZET),S('u') = E(SIZET), | ||
239 | + S('x') = E(SIZET),S('X') = E(SIZET), | ||
240 | + S('n') = E(PTR) | ||
241 | + }, { /* 7: j-prefixed */ | ||
242 | + S('d') = E(IMAX), S('i') = E(IMAX), | ||
243 | + S('o') = E(UMAX), S('u') = E(UMAX), | ||
244 | + S('x') = E(UMAX), S('X') = E(UMAX), | ||
245 | + S('n') = E(PTR) | ||
246 | + } | ||
247 | +}; | ||
248 | + | ||
249 | +size_t parse_printf_format(const char *fmt, size_t n, int *types) | ||
250 | +{ | ||
251 | + size_t i = 0; | ||
252 | + size_t last = 0; | ||
253 | + | ||
254 | + memset(types, 0, n); | ||
255 | + | ||
256 | + while (1) { | ||
257 | + size_t arg; | ||
258 | + unsigned int state; | ||
259 | + | ||
260 | + fmt = consume_nonarg(fmt); | ||
261 | + if (*fmt == '\0') | ||
262 | + break; | ||
263 | + if (*fmt == '%') { | ||
264 | + fmt++; | ||
265 | + continue; | ||
266 | + } | ||
267 | + arg = 0; | ||
268 | + fmt = consume_argn(fmt, &arg); | ||
269 | + /* flags */ | ||
270 | + fmt = consume_flags(fmt); | ||
271 | + /* width */ | ||
272 | + if (*fmt == '*') { | ||
273 | + size_t warg = 0; | ||
274 | + fmt = consume_argn(fmt+1, &warg); | ||
275 | + if (warg == 0) | ||
276 | + warg = ++i; | ||
277 | + if (warg > last) | ||
278 | + last = warg; | ||
279 | + if (warg <= n && types[warg-1] == NONE) | ||
280 | + types[warg-1] = INT; | ||
281 | + } else | ||
282 | + fmt = consume_num(fmt); | ||
283 | + /* precision */ | ||
284 | + if (*fmt == '.') { | ||
285 | + fmt++; | ||
286 | + if (*fmt == '*') { | ||
287 | + size_t parg = 0; | ||
288 | + fmt = consume_argn(fmt+1, &parg); | ||
289 | + if (parg == 0) | ||
290 | + parg = ++i; | ||
291 | + if (parg > last) | ||
292 | + last = parg; | ||
293 | + if (parg <= n && types[parg-1] == NONE) | ||
294 | + types[parg-1] = INT; | ||
295 | + } else { | ||
296 | + if (*fmt == '-') | ||
297 | + fmt++; | ||
298 | + fmt = consume_num(fmt); | ||
299 | + } | ||
300 | + } | ||
301 | + /* length modifier and conversion specifier */ | ||
302 | + state = BARE; | ||
303 | + do { | ||
304 | + unsigned char c = *fmt++; | ||
305 | + | ||
306 | + if (c < 'A' || c > 'z') | ||
307 | + continue; | ||
308 | + state = states[state]S(c); | ||
309 | + if (state == 0) | ||
310 | + continue; | ||
311 | + } while (state < STOP); | ||
312 | + | ||
313 | + if (state == E(NONE)) | ||
314 | + continue; | ||
315 | + | ||
316 | + if (arg == 0) | ||
317 | + arg = ++i; | ||
318 | + if (arg > last) | ||
319 | + last = arg; | ||
320 | + if (arg <= n) | ||
321 | + types[arg-1] = state - STOP; | ||
322 | + } | ||
323 | + | ||
324 | + if (last > n) | ||
325 | + last = n; | ||
326 | + for (i = 0; i < last; i++) | ||
327 | + types[i] = pa_types[types[i]]; | ||
328 | + | ||
329 | + return last; | ||
330 | +} | ||
331 | diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h | ||
332 | new file mode 100644 | ||
333 | index 0000000000..47be7522d7 | ||
334 | --- /dev/null | ||
335 | +++ b/src/basic/parse-printf-format.h | ||
336 | @@ -0,0 +1,57 @@ | ||
337 | +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ | ||
338 | + | ||
339 | +/*** | ||
340 | + This file is part of systemd. | ||
341 | + | ||
342 | + Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> | ||
343 | + | ||
344 | + With parts from the GNU C Library | ||
345 | + Copyright 1991-2014 Free Software Foundation, Inc. | ||
346 | + | ||
347 | + systemd is free software; you can redistribute it and/or modify it | ||
348 | + under the terms of the GNU Lesser General Public License as published by | ||
349 | + the Free Software Foundation; either version 2.1 of the License, or | ||
350 | + (at your option) any later version. | ||
351 | + | ||
352 | + systemd is distributed in the hope that it will be useful, but | ||
353 | + WITHOUT ANY WARRANTY; without even the implied warranty of | ||
354 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
355 | + Lesser General Public License for more details. | ||
356 | + | ||
357 | + You should have received a copy of the GNU Lesser General Public License | ||
358 | + along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
359 | +***/ | ||
360 | + | ||
361 | +#pragma once | ||
362 | + | ||
363 | +#include "config.h" | ||
364 | + | ||
365 | +#if HAVE_PRINTF_H | ||
366 | +#include <printf.h> | ||
367 | +#else | ||
368 | + | ||
369 | +#include <stddef.h> | ||
370 | + | ||
371 | +enum { /* C type: */ | ||
372 | + PA_INT, /* int */ | ||
373 | + PA_CHAR, /* int, cast to char */ | ||
374 | + PA_WCHAR, /* wide char */ | ||
375 | + PA_STRING, /* const char *, a '\0'-terminated string */ | ||
376 | + PA_WSTRING, /* const wchar_t *, wide character string */ | ||
377 | + PA_POINTER, /* void * */ | ||
378 | + PA_FLOAT, /* float */ | ||
379 | + PA_DOUBLE, /* double */ | ||
380 | + PA_LAST | ||
381 | +}; | ||
382 | + | ||
383 | +/* Flag bits that can be set in a type returned by `parse_printf_format'. */ | ||
384 | +#define PA_FLAG_MASK 0xff00 | ||
385 | +#define PA_FLAG_LONG_LONG (1 << 8) | ||
386 | +#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG | ||
387 | +#define PA_FLAG_LONG (1 << 9) | ||
388 | +#define PA_FLAG_SHORT (1 << 10) | ||
389 | +#define PA_FLAG_PTR (1 << 11) | ||
390 | + | ||
391 | +size_t parse_printf_format(const char *fmt, size_t n, int *types); | ||
392 | + | ||
393 | +#endif /* HAVE_PRINTF_H */ | ||
394 | diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h | ||
395 | index c3b9448d4f..2937aa13b1 100644 | ||
396 | --- a/src/basic/stdio-util.h | ||
397 | +++ b/src/basic/stdio-util.h | ||
398 | @@ -1,13 +1,13 @@ | ||
399 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
400 | #pragma once | ||
401 | |||
402 | -#include <printf.h> | ||
403 | #include <stdarg.h> | ||
404 | #include <stdio.h> | ||
405 | #include <sys/types.h> | ||
406 | |||
407 | #include "macro.h" | ||
408 | #include "memory-util.h" | ||
409 | +#include "parse-printf-format.h" | ||
410 | |||
411 | #define snprintf_ok(buf, len, fmt, ...) \ | ||
412 | ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) | ||
413 | diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c | ||
414 | index 5ef11fa1a4..6384ab620c 100644 | ||
415 | --- a/src/journal/journal-send.c | ||
416 | +++ b/src/journal/journal-send.c | ||
417 | @@ -2,7 +2,6 @@ | ||
418 | |||
419 | #include <errno.h> | ||
420 | #include <fcntl.h> | ||
421 | -#include <printf.h> | ||
422 | #include <stddef.h> | ||
423 | #include <sys/socket.h> | ||
424 | #include <sys/un.h> | ||
425 | @@ -21,6 +20,7 @@ | ||
426 | #include "stdio-util.h" | ||
427 | #include "string-util.h" | ||
428 | #include "tmpfile-util.h" | ||
429 | +#include "parse-printf-format.h" | ||
430 | |||
431 | #define SNDBUF_SIZE (8*1024*1024) | ||
432 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch new file mode 100644 index 0000000000..0f75e8c12d --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | Handle __cpu_mask usage | ||
2 | |||
3 | Fixes errors: | ||
4 | |||
5 | src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function) | ||
6 | src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function) | ||
7 | |||
8 | __cpu_mask is an internal type of glibc's cpu_set implementation, not | ||
9 | part of the POSIX definition, which is problematic when building with | ||
10 | musl, which does not define a matching type. From inspection of musl's | ||
11 | sched.h, however, it is clear that the corresponding type would be | ||
12 | unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So, | ||
13 | add a typedef to cpu-set-util.h defining __cpu_mask appropriately. | ||
14 | |||
15 | Upstream-Status: Inappropriate [musl specific] | ||
16 | |||
17 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
18 | --- | ||
19 | src/shared/cpu-set-util.h | 2 ++ | ||
20 | src/test/test-sizeof.c | 2 +- | ||
21 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h | ||
24 | index 27812dfd59..f698f9df83 100644 | ||
25 | --- a/src/shared/cpu-set-util.h | ||
26 | +++ b/src/shared/cpu-set-util.h | ||
27 | @@ -6,6 +6,8 @@ | ||
28 | #include "macro.h" | ||
29 | #include "missing_syscall.h" | ||
30 | |||
31 | +typedef unsigned long __cpu_mask; | ||
32 | + | ||
33 | /* This wraps the libc interface with a variable to keep the allocated size. */ | ||
34 | typedef struct CPUSet { | ||
35 | cpu_set_t *set; | ||
36 | diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c | ||
37 | index a710db5370..d1601ad929 100644 | ||
38 | --- a/src/test/test-sizeof.c | ||
39 | +++ b/src/test/test-sizeof.c | ||
40 | @@ -1,6 +1,5 @@ | ||
41 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
42 | |||
43 | -#include <sched.h> | ||
44 | #include <stdio.h> | ||
45 | #include <string.h> | ||
46 | |||
47 | @@ -8,6 +7,7 @@ | ||
48 | #include <float.h> | ||
49 | |||
50 | #include "time-util.h" | ||
51 | +#include "cpu-set-util.h" | ||
52 | |||
53 | /* Print information about various types. Useful when diagnosing | ||
54 | * gcc diagnostics on an unfamiliar architecture. */ | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0005-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..adfc3b7861 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0005-src-basic-missing.h-check-for-missing-strndupa.patch | |||
@@ -0,0 +1,442 @@ | |||
1 | From 399fd3eda3045636a70da438a0fd1406cc332ed1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 14:18:21 +0800 | ||
4 | Subject: [PATCH 05/24] src/basic/missing.h: check for missing strndupa | ||
5 | |||
6 | include missing.h for definition of strndupa | ||
7 | |||
8 | Upstream-Status: Inappropriate [musl specific] | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | [Rebased for v242] | ||
13 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
14 | [rebased for systemd 243] | ||
15 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
16 | --- | ||
17 | meson.build | 1 + | ||
18 | src/backlight/backlight.c | 1 + | ||
19 | src/basic/env-util.c | 1 + | ||
20 | src/basic/missing_stdlib.h | 12 ++++++++++++ | ||
21 | src/basic/mkdir.c | 1 + | ||
22 | src/basic/parse-util.c | 1 + | ||
23 | src/basic/proc-cmdline.c | 1 + | ||
24 | src/basic/procfs-util.c | 1 + | ||
25 | src/basic/time-util.c | 1 + | ||
26 | src/core/dbus-cgroup.c | 1 + | ||
27 | src/core/dbus-util.c | 1 + | ||
28 | src/core/kmod-setup.c | 1 + | ||
29 | src/core/service.c | 1 + | ||
30 | src/journal/journalctl.c | 1 + | ||
31 | src/libsystemd/sd-bus/bus-message.c | 1 + | ||
32 | src/libsystemd/sd-bus/bus-objects.c | 1 + | ||
33 | src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + | ||
34 | src/locale/keymap-util.c | 1 + | ||
35 | src/login/pam_systemd.c | 1 + | ||
36 | src/network/generator/network-generator.c | 1 + | ||
37 | src/nspawn/nspawn-settings.c | 1 + | ||
38 | src/shared/dns-domain.c | 1 + | ||
39 | src/shared/journal-importer.c | 1 + | ||
40 | src/shared/logs-show.c | 1 + | ||
41 | src/shared/pager.c | 1 + | ||
42 | src/shared/path-lookup.c | 1 + | ||
43 | src/shared/uid-range.c | 1 + | ||
44 | src/socket-proxy/socket-proxyd.c | 1 + | ||
45 | src/test/test-hexdecoct.c | 1 + | ||
46 | src/udev/udev-builtin-path_id.c | 1 + | ||
47 | src/udev/udev-event.c | 1 + | ||
48 | src/udev/udev-rules.c | 1 + | ||
49 | 32 files changed, 43 insertions(+) | ||
50 | |||
51 | diff --git a/meson.build b/meson.build | ||
52 | index 7f8c679411..81c061b768 100644 | ||
53 | --- a/meson.build | ||
54 | +++ b/meson.build | ||
55 | @@ -506,6 +506,7 @@ foreach ident : [ | ||
56 | #include <unistd.h>'''], | ||
57 | ['get_mempolicy', '''#include <stdlib.h> | ||
58 | #include <unistd.h>'''], | ||
59 | + ['strndupa' , '''#include <string.h>'''], | ||
60 | ] | ||
61 | |||
62 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') | ||
63 | diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c | ||
64 | index dfd6805398..c2b2ace6ec 100644 | ||
65 | --- a/src/backlight/backlight.c | ||
66 | +++ b/src/backlight/backlight.c | ||
67 | @@ -17,6 +17,7 @@ | ||
68 | #include "string-util.h" | ||
69 | #include "strv.h" | ||
70 | #include "util.h" | ||
71 | +#include "missing.h" | ||
72 | |||
73 | static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { | ||
74 | const char *subsystem, *sysname, *value; | ||
75 | diff --git a/src/basic/env-util.c b/src/basic/env-util.c | ||
76 | index a6503cf2b6..ceef9a62c8 100644 | ||
77 | --- a/src/basic/env-util.c | ||
78 | +++ b/src/basic/env-util.c | ||
79 | @@ -16,6 +16,7 @@ | ||
80 | #include "string-util.h" | ||
81 | #include "strv.h" | ||
82 | #include "utf8.h" | ||
83 | +#include "missing.h" | ||
84 | |||
85 | #define VALID_CHARS_ENV_NAME \ | ||
86 | DIGITS LETTERS \ | ||
87 | diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h | ||
88 | index 188a8d4406..1e16ec287a 100644 | ||
89 | --- a/src/basic/missing_stdlib.h | ||
90 | +++ b/src/basic/missing_stdlib.h | ||
91 | @@ -11,3 +11,15 @@ | ||
92 | # error "neither secure_getenv nor __secure_getenv are available" | ||
93 | # endif | ||
94 | #endif | ||
95 | + | ||
96 | +/* string.h */ | ||
97 | +#if ! HAVE_STRNDUPA | ||
98 | +#define strndupa(s, n) \ | ||
99 | + ({ \ | ||
100 | + const char *__old = (s); \ | ||
101 | + size_t __len = strnlen(__old, (n)); \ | ||
102 | + char *__new = (char *)alloca(__len + 1); \ | ||
103 | + __new[__len] = '\0'; \ | ||
104 | + (char *)memcpy(__new, __old, __len); \ | ||
105 | + }) | ||
106 | +#endif | ||
107 | diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c | ||
108 | index 6b82eab640..51c6b78615 100644 | ||
109 | --- a/src/basic/mkdir.c | ||
110 | +++ b/src/basic/mkdir.c | ||
111 | @@ -14,6 +14,7 @@ | ||
112 | #include "stat-util.h" | ||
113 | #include "stdio-util.h" | ||
114 | #include "user-util.h" | ||
115 | +#include "missing.h" | ||
116 | |||
117 | int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) { | ||
118 | struct stat st; | ||
119 | diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c | ||
120 | index 115a1494a2..07a34bfd53 100644 | ||
121 | --- a/src/basic/parse-util.c | ||
122 | +++ b/src/basic/parse-util.c | ||
123 | @@ -20,6 +20,7 @@ | ||
124 | #include "process-util.h" | ||
125 | #include "stat-util.h" | ||
126 | #include "string-util.h" | ||
127 | +#include "missing.h" | ||
128 | |||
129 | int parse_boolean(const char *v) { | ||
130 | if (!v) | ||
131 | diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c | ||
132 | index 09169cf963..f411ba897f 100644 | ||
133 | --- a/src/basic/proc-cmdline.c | ||
134 | +++ b/src/basic/proc-cmdline.c | ||
135 | @@ -15,6 +15,7 @@ | ||
136 | #include "string-util.h" | ||
137 | #include "util.h" | ||
138 | #include "virt.h" | ||
139 | +#include "missing.h" | ||
140 | |||
141 | int proc_cmdline(char **ret) { | ||
142 | const char *e; | ||
143 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
144 | index 7aaf95bfce..42ce53d5aa 100644 | ||
145 | --- a/src/basic/procfs-util.c | ||
146 | +++ b/src/basic/procfs-util.c | ||
147 | @@ -11,6 +11,7 @@ | ||
148 | #include "procfs-util.h" | ||
149 | #include "stdio-util.h" | ||
150 | #include "string-util.h" | ||
151 | +#include "missing.h" | ||
152 | |||
153 | int procfs_tasks_get_limit(uint64_t *ret) { | ||
154 | _cleanup_free_ char *value = NULL; | ||
155 | diff --git a/src/basic/time-util.c b/src/basic/time-util.c | ||
156 | index 3018e81acb..4e2b3b66c1 100644 | ||
157 | --- a/src/basic/time-util.c | ||
158 | +++ b/src/basic/time-util.c | ||
159 | @@ -28,6 +28,7 @@ | ||
160 | #include "string-util.h" | ||
161 | #include "strv.h" | ||
162 | #include "time-util.h" | ||
163 | +#include "missing.h" | ||
164 | |||
165 | static clockid_t map_clock_id(clockid_t c) { | ||
166 | |||
167 | diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c | ||
168 | index 2f2313c599..c9937f9d62 100644 | ||
169 | --- a/src/core/dbus-cgroup.c | ||
170 | +++ b/src/core/dbus-cgroup.c | ||
171 | @@ -15,6 +15,7 @@ | ||
172 | #include "fileio.h" | ||
173 | #include "limits-util.h" | ||
174 | #include "path-util.h" | ||
175 | +#include "missing.h" | ||
176 | |||
177 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy); | ||
178 | |||
179 | diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c | ||
180 | index 7862beaacb..19f6968cfe 100644 | ||
181 | --- a/src/core/dbus-util.c | ||
182 | +++ b/src/core/dbus-util.c | ||
183 | @@ -7,6 +7,7 @@ | ||
184 | #include "unit-printf.h" | ||
185 | #include "user-util.h" | ||
186 | #include "unit.h" | ||
187 | +#include "missing.h" | ||
188 | |||
189 | int bus_property_get_triggered_unit( | ||
190 | sd_bus *bus, | ||
191 | diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c | ||
192 | index a91cfebc67..a45961013f 100644 | ||
193 | --- a/src/core/kmod-setup.c | ||
194 | +++ b/src/core/kmod-setup.c | ||
195 | @@ -11,6 +11,7 @@ | ||
196 | #include "kmod-setup.h" | ||
197 | #include "macro.h" | ||
198 | #include "string-util.h" | ||
199 | +#include "missing.h" | ||
200 | |||
201 | #if HAVE_KMOD | ||
202 | #include <libkmod.h> | ||
203 | diff --git a/src/core/service.c b/src/core/service.c | ||
204 | index 73b3c9c316..ef74f00a08 100644 | ||
205 | --- a/src/core/service.c | ||
206 | +++ b/src/core/service.c | ||
207 | @@ -43,6 +43,7 @@ | ||
208 | #include "unit.h" | ||
209 | #include "utf8.h" | ||
210 | #include "util.h" | ||
211 | +#include "missing.h" | ||
212 | |||
213 | static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { | ||
214 | [SERVICE_DEAD] = UNIT_INACTIVE, | ||
215 | diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c | ||
216 | index 6d6bb1cf63..6666349a35 100644 | ||
217 | --- a/src/journal/journalctl.c | ||
218 | +++ b/src/journal/journalctl.c | ||
219 | @@ -70,6 +70,7 @@ | ||
220 | #include "unit-name.h" | ||
221 | #include "user-util.h" | ||
222 | #include "varlink.h" | ||
223 | +#include "missing.h" | ||
224 | |||
225 | #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) | ||
226 | |||
227 | diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c | ||
228 | index eb029e4453..f31fe9d5a8 100644 | ||
229 | --- a/src/libsystemd/sd-bus/bus-message.c | ||
230 | +++ b/src/libsystemd/sd-bus/bus-message.c | ||
231 | @@ -21,6 +21,7 @@ | ||
232 | #include "strv.h" | ||
233 | #include "time-util.h" | ||
234 | #include "utf8.h" | ||
235 | +#include "missing.h" | ||
236 | |||
237 | static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); | ||
238 | |||
239 | diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c | ||
240 | index ae643cacc7..1b752271a5 100644 | ||
241 | --- a/src/libsystemd/sd-bus/bus-objects.c | ||
242 | +++ b/src/libsystemd/sd-bus/bus-objects.c | ||
243 | @@ -13,6 +13,7 @@ | ||
244 | #include "set.h" | ||
245 | #include "string-util.h" | ||
246 | #include "strv.h" | ||
247 | +#include "missing.h" | ||
248 | |||
249 | static int node_vtable_get_userdata( | ||
250 | sd_bus *bus, | ||
251 | diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c | ||
252 | index 8de0a859ee..4fd0a2e692 100644 | ||
253 | --- a/src/libsystemd/sd-bus/test-bus-benchmark.c | ||
254 | +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c | ||
255 | @@ -14,6 +14,7 @@ | ||
256 | #include "missing_resource.h" | ||
257 | #include "time-util.h" | ||
258 | #include "util.h" | ||
259 | +#include "missing.h" | ||
260 | |||
261 | #define MAX_SIZE (2*1024*1024) | ||
262 | |||
263 | diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c | ||
264 | index f8c36c94f5..41f5606aea 100644 | ||
265 | --- a/src/locale/keymap-util.c | ||
266 | +++ b/src/locale/keymap-util.c | ||
267 | @@ -22,6 +22,7 @@ | ||
268 | #include "string-util.h" | ||
269 | #include "strv.h" | ||
270 | #include "tmpfile-util.h" | ||
271 | +#include "missing.h" | ||
272 | |||
273 | static bool startswith_comma(const char *s, const char *prefix) { | ||
274 | s = startswith(s, prefix); | ||
275 | diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c | ||
276 | index 3f762cbbc3..005cfea658 100644 | ||
277 | --- a/src/login/pam_systemd.c | ||
278 | +++ b/src/login/pam_systemd.c | ||
279 | @@ -28,6 +28,7 @@ | ||
280 | #include "hostname-util.h" | ||
281 | #include "login-util.h" | ||
282 | #include "macro.h" | ||
283 | +#include "missing.h" | ||
284 | #include "parse-util.h" | ||
285 | #include "path-util.h" | ||
286 | #include "process-util.h" | ||
287 | diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c | ||
288 | index 0b5af33566..9c808cd014 100644 | ||
289 | --- a/src/network/generator/network-generator.c | ||
290 | +++ b/src/network/generator/network-generator.c | ||
291 | @@ -13,6 +13,7 @@ | ||
292 | #include "string-table.h" | ||
293 | #include "string-util.h" | ||
294 | #include "strv.h" | ||
295 | +#include "missing.h" | ||
296 | |||
297 | /* | ||
298 | # .network | ||
299 | diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c | ||
300 | index 3a99736813..279fea4d88 100644 | ||
301 | --- a/src/nspawn/nspawn-settings.c | ||
302 | +++ b/src/nspawn/nspawn-settings.c | ||
303 | @@ -16,6 +16,7 @@ | ||
304 | #include "strv.h" | ||
305 | #include "user-util.h" | ||
306 | #include "util.h" | ||
307 | +#include "missing.h" | ||
308 | |||
309 | Settings *settings_new(void) { | ||
310 | Settings *s; | ||
311 | diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c | ||
312 | index f62ad0a0f5..f1a27e158d 100644 | ||
313 | --- a/src/shared/dns-domain.c | ||
314 | +++ b/src/shared/dns-domain.c | ||
315 | @@ -24,6 +24,7 @@ | ||
316 | #include "string-util.h" | ||
317 | #include "strv.h" | ||
318 | #include "utf8.h" | ||
319 | +#include "missing.h" | ||
320 | |||
321 | int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { | ||
322 | const char *n; | ||
323 | diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c | ||
324 | index 7c4fc7021d..a6ff2214df 100644 | ||
325 | --- a/src/shared/journal-importer.c | ||
326 | +++ b/src/shared/journal-importer.c | ||
327 | @@ -14,6 +14,7 @@ | ||
328 | #include "parse-util.h" | ||
329 | #include "string-util.h" | ||
330 | #include "unaligned.h" | ||
331 | +#include "missing.h" | ||
332 | |||
333 | enum { | ||
334 | IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ | ||
335 | diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c | ||
336 | index b615c70dff..75b26e9c21 100644 | ||
337 | --- a/src/shared/logs-show.c | ||
338 | +++ b/src/shared/logs-show.c | ||
339 | @@ -39,6 +39,7 @@ | ||
340 | #include "time-util.h" | ||
341 | #include "utf8.h" | ||
342 | #include "util.h" | ||
343 | +#include "missing.h" | ||
344 | |||
345 | /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ | ||
346 | #define PRINT_LINE_THRESHOLD 3 | ||
347 | diff --git a/src/shared/pager.c b/src/shared/pager.c | ||
348 | index 7c20b100b4..e4209d3a95 100644 | ||
349 | --- a/src/shared/pager.c | ||
350 | +++ b/src/shared/pager.c | ||
351 | @@ -25,6 +25,7 @@ | ||
352 | #include "strv.h" | ||
353 | #include "terminal-util.h" | ||
354 | #include "util.h" | ||
355 | +#include "missing.h" | ||
356 | |||
357 | static pid_t pager_pid = 0; | ||
358 | |||
359 | diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c | ||
360 | index 6bf0ff0316..f6c8009cd2 100644 | ||
361 | --- a/src/shared/path-lookup.c | ||
362 | +++ b/src/shared/path-lookup.c | ||
363 | @@ -20,6 +20,7 @@ | ||
364 | #include "tmpfile-util.h" | ||
365 | #include "user-util.h" | ||
366 | #include "util.h" | ||
367 | +#include "missing.h" | ||
368 | |||
369 | int xdg_user_runtime_dir(char **ret, const char *suffix) { | ||
370 | const char *e; | ||
371 | diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c | ||
372 | index 7cb7d8a477..8b12b91084 100644 | ||
373 | --- a/src/shared/uid-range.c | ||
374 | +++ b/src/shared/uid-range.c | ||
375 | @@ -9,6 +9,7 @@ | ||
376 | #include "sort-util.h" | ||
377 | #include "uid-range.h" | ||
378 | #include "user-util.h" | ||
379 | +#include "missing.h" | ||
380 | |||
381 | static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { | ||
382 | assert(range); | ||
383 | diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c | ||
384 | index abbbc9f2d6..6179b5851e 100644 | ||
385 | --- a/src/socket-proxy/socket-proxyd.c | ||
386 | +++ b/src/socket-proxy/socket-proxyd.c | ||
387 | @@ -28,6 +28,7 @@ | ||
388 | #include "socket-util.h" | ||
389 | #include "string-util.h" | ||
390 | #include "util.h" | ||
391 | +#include "missing.h" | ||
392 | |||
393 | #define BUFFER_SIZE (256 * 1024) | ||
394 | |||
395 | diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c | ||
396 | index 52217429b1..a05e7782f6 100644 | ||
397 | --- a/src/test/test-hexdecoct.c | ||
398 | +++ b/src/test/test-hexdecoct.c | ||
399 | @@ -6,6 +6,7 @@ | ||
400 | #include "hexdecoct.h" | ||
401 | #include "macro.h" | ||
402 | #include "string-util.h" | ||
403 | +#include "missing.h" | ||
404 | |||
405 | static void test_hexchar(void) { | ||
406 | assert_se(hexchar(0xa) == 'a'); | ||
407 | diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c | ||
408 | index e8f1ce1354..8693cb02a4 100644 | ||
409 | --- a/src/udev/udev-builtin-path_id.c | ||
410 | +++ b/src/udev/udev-builtin-path_id.c | ||
411 | @@ -23,6 +23,7 @@ | ||
412 | #include "strv.h" | ||
413 | #include "sysexits.h" | ||
414 | #include "udev-builtin.h" | ||
415 | +#include "missing.h" | ||
416 | |||
417 | _printf_(2,3) | ||
418 | static void path_prepend(char **path, const char *fmt, ...) { | ||
419 | diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c | ||
420 | index 8cfa2cdf23..b0670c77ec 100644 | ||
421 | --- a/src/udev/udev-event.c | ||
422 | +++ b/src/udev/udev-event.c | ||
423 | @@ -35,6 +35,7 @@ | ||
424 | #include "udev-util.h" | ||
425 | #include "udev-watch.h" | ||
426 | #include "user-util.h" | ||
427 | +#include "missing.h" | ||
428 | |||
429 | typedef struct Spawn { | ||
430 | sd_device *device; | ||
431 | diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c | ||
432 | index 1642f10535..fe2aa75478 100644 | ||
433 | --- a/src/udev/udev-rules.c | ||
434 | +++ b/src/udev/udev-rules.c | ||
435 | @@ -28,6 +28,7 @@ | ||
436 | #include "udev-event.h" | ||
437 | #include "udev-rules.h" | ||
438 | #include "user-util.h" | ||
439 | +#include "missing.h" | ||
440 | |||
441 | #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") | ||
442 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0006-Include-netinet-if_ether.h.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0006-Include-netinet-if_ether.h.patch new file mode 100644 index 0000000000..6d73d715ce --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0006-Include-netinet-if_ether.h.patch | |||
@@ -0,0 +1,227 @@ | |||
1 | Include netinet/if_ether.h | ||
2 | |||
3 | Fixes | ||
4 | /path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' | ||
5 | struct ethhdr { | ||
6 | ^~~~~~ | ||
7 | |||
8 | and related arphdr, arpreq, and arpreq_old errors | ||
9 | /path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr' | ||
10 | struct arphdr { | ||
11 | ^~~~~~ | ||
12 | |||
13 | The latter requires removing some includes of net/if_arp.h to avoid | ||
14 | conflicting with netinet/if_ether.h. | ||
15 | |||
16 | Upstream-Status: Inappropriate [musl specific] | ||
17 | |||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
20 | [rebased for systemd 243] | ||
21 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
22 | |||
23 | Upstream-Status: Inappropriate [musl specific] | ||
24 | |||
25 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
26 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
27 | [rebased for systemd 243] | ||
28 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
29 | --- | ||
30 | src/libsystemd-network/sd-dhcp6-client.c | 1 - | ||
31 | src/libsystemd/sd-netlink/netlink-types.c | 1 + | ||
32 | src/machine/machine-dbus.c | 1 + | ||
33 | src/network/netdev/macsec.c | 1 + | ||
34 | src/network/netdev/netdev.c | 1 + | ||
35 | src/network/networkd-brvlan.c | 1 + | ||
36 | src/network/networkd-dhcp-common.c | 1 + | ||
37 | src/network/networkd-dhcp4.c | 2 +- | ||
38 | src/network/networkd-dhcp6.c | 2 +- | ||
39 | src/network/networkd-link.c | 2 +- | ||
40 | src/network/networkd-network.c | 1 + | ||
41 | src/shared/ethtool-util.c | 1 + | ||
42 | src/shared/ethtool-util.h | 1 + | ||
43 | src/udev/net/link-config.c | 1 + | ||
44 | src/udev/udev-builtin-net_setup_link.c | 1 + | ||
45 | 15 files changed, 14 insertions(+), 4 deletions(-) | ||
46 | |||
47 | diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c | ||
48 | index d7a5349c70..68b41dfb6c 100644 | ||
49 | --- a/src/libsystemd-network/sd-dhcp6-client.c | ||
50 | +++ b/src/libsystemd-network/sd-dhcp6-client.c | ||
51 | @@ -6,7 +6,6 @@ | ||
52 | #include <errno.h> | ||
53 | #include <string.h> | ||
54 | #include <sys/ioctl.h> | ||
55 | -#include <linux/if_arp.h> | ||
56 | #include <linux/if_infiniband.h> | ||
57 | |||
58 | #include "sd-dhcp6-client.h" | ||
59 | diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c | ||
60 | index de9b8b21ab..f64f6500f7 100644 | ||
61 | --- a/src/libsystemd/sd-netlink/netlink-types.c | ||
62 | +++ b/src/libsystemd/sd-netlink/netlink-types.c | ||
63 | @@ -3,6 +3,7 @@ | ||
64 | #include <netinet/in.h> | ||
65 | #include <stdint.h> | ||
66 | #include <sys/socket.h> | ||
67 | +#include <netinet/if_ether.h> | ||
68 | #include <linux/can/vxcan.h> | ||
69 | #include <linux/netlink.h> | ||
70 | #include <linux/rtnetlink.h> | ||
71 | diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c | ||
72 | index 0d58b5eb8b..01093c1f62 100644 | ||
73 | --- a/src/machine/machine-dbus.c | ||
74 | +++ b/src/machine/machine-dbus.c | ||
75 | @@ -4,6 +4,7 @@ | ||
76 | #include <string.h> | ||
77 | #include <sys/mount.h> | ||
78 | #include <sys/wait.h> | ||
79 | +#include <netinet/if_ether.h> | ||
80 | |||
81 | /* When we include libgen.h because we need dirname() we immediately | ||
82 | * undefine basename() since libgen.h defines it as a macro to the POSIX | ||
83 | diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c | ||
84 | index cf281e75a6..269dc618ff 100644 | ||
85 | --- a/src/network/netdev/macsec.c | ||
86 | +++ b/src/network/netdev/macsec.c | ||
87 | @@ -1,5 +1,6 @@ | ||
88 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
89 | |||
90 | +#include <netinet/if_ether.h> | ||
91 | #include <netinet/in.h> | ||
92 | #include <linux/if_ether.h> | ||
93 | #include <linux/if_macsec.h> | ||
94 | diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c | ||
95 | index 7735b455b7..ed4eda4a44 100644 | ||
96 | --- a/src/network/netdev/netdev.c | ||
97 | +++ b/src/network/netdev/netdev.c | ||
98 | @@ -1,5 +1,6 @@ | ||
99 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
100 | |||
101 | +#include <netinet/if_ether.h> | ||
102 | #include <net/if.h> | ||
103 | #include <netinet/in.h> | ||
104 | |||
105 | diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c | ||
106 | index c3c5d535ac..ebea408c89 100644 | ||
107 | --- a/src/network/networkd-brvlan.c | ||
108 | +++ b/src/network/networkd-brvlan.c | ||
109 | @@ -4,6 +4,7 @@ | ||
110 | ***/ | ||
111 | |||
112 | #include <netinet/in.h> | ||
113 | +#include <netinet/if_ether.h> | ||
114 | #include <linux/if_bridge.h> | ||
115 | #include <stdbool.h> | ||
116 | |||
117 | diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c | ||
118 | index 626b975839..42fe92f320 100644 | ||
119 | --- a/src/network/networkd-dhcp-common.c | ||
120 | +++ b/src/network/networkd-dhcp-common.c | ||
121 | @@ -1,6 +1,7 @@ | ||
122 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
123 | |||
124 | #include "networkd-dhcp-common.h" | ||
125 | +#include <netinet/if_ether.h> | ||
126 | #include "networkd-network.h" | ||
127 | #include "parse-util.h" | ||
128 | #include "string-table.h" | ||
129 | diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c | ||
130 | index 662770b50e..c6ab62a94d 100644 | ||
131 | --- a/src/network/networkd-dhcp4.c | ||
132 | +++ b/src/network/networkd-dhcp4.c | ||
133 | @@ -1,8 +1,8 @@ | ||
134 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
135 | |||
136 | +#include <netinet/if_ether.h> | ||
137 | #include <netinet/in.h> | ||
138 | #include <linux/if.h> | ||
139 | -#include <linux/if_arp.h> | ||
140 | |||
141 | #include "alloc-util.h" | ||
142 | #include "hostname-util.h" | ||
143 | diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c | ||
144 | index 8ad736a82b..f41b4d834e 100644 | ||
145 | --- a/src/network/networkd-dhcp6.c | ||
146 | +++ b/src/network/networkd-dhcp6.c | ||
147 | @@ -3,9 +3,9 @@ | ||
148 | Copyright © 2014 Intel Corporation. All rights reserved. | ||
149 | ***/ | ||
150 | |||
151 | +#include <netinet/if_ether.h> | ||
152 | #include <netinet/in.h> | ||
153 | #include <linux/if.h> | ||
154 | -#include <linux/if_arp.h> | ||
155 | #include "sd-radv.h" | ||
156 | |||
157 | #include "sd-dhcp6-client.h" | ||
158 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c | ||
159 | index f5bb78890a..f13a36b791 100644 | ||
160 | --- a/src/network/networkd-link.c | ||
161 | +++ b/src/network/networkd-link.c | ||
162 | @@ -1,8 +1,8 @@ | ||
163 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
164 | |||
165 | +#include <netinet/if_ether.h> | ||
166 | #include <netinet/in.h> | ||
167 | #include <linux/if.h> | ||
168 | -#include <linux/if_arp.h> | ||
169 | #include <unistd.h> | ||
170 | |||
171 | #include "alloc-util.h" | ||
172 | diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c | ||
173 | index 2b8d0eb2fb..2f79ef25cd 100644 | ||
174 | --- a/src/network/networkd-network.c | ||
175 | +++ b/src/network/networkd-network.c | ||
176 | @@ -1,5 +1,6 @@ | ||
177 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
178 | |||
179 | +#include <netinet/if_ether.h> | ||
180 | #include <net/if.h> | ||
181 | #include <netinet/in.h> | ||
182 | #include <linux/netdevice.h> | ||
183 | diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c | ||
184 | index b0961df72e..53fcbbd84b 100644 | ||
185 | --- a/src/shared/ethtool-util.c | ||
186 | +++ b/src/shared/ethtool-util.c | ||
187 | @@ -1,5 +1,6 @@ | ||
188 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
189 | |||
190 | +#include <netinet/if_ether.h> | ||
191 | #include <net/if.h> | ||
192 | #include <sys/ioctl.h> | ||
193 | #include <linux/ethtool.h> | ||
194 | diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h | ||
195 | index 8b32b243f3..262b819976 100644 | ||
196 | --- a/src/shared/ethtool-util.h | ||
197 | +++ b/src/shared/ethtool-util.h | ||
198 | @@ -2,6 +2,7 @@ | ||
199 | #pragma once | ||
200 | |||
201 | #include <macro.h> | ||
202 | +#include <netinet/if_ether.h> | ||
203 | #include <linux/ethtool.h> | ||
204 | |||
205 | #include "conf-parser.h" | ||
206 | diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c | ||
207 | index d44af64d5e..fd052f1591 100644 | ||
208 | --- a/src/udev/net/link-config.c | ||
209 | +++ b/src/udev/net/link-config.c | ||
210 | @@ -1,5 +1,6 @@ | ||
211 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
212 | |||
213 | +#include <netinet/if_ether.h> | ||
214 | #include <linux/netdevice.h> | ||
215 | #include <netinet/ether.h> | ||
216 | |||
217 | diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c | ||
218 | index ee3ca9fa38..9aa4e82874 100644 | ||
219 | --- a/src/udev/udev-builtin-net_setup_link.c | ||
220 | +++ b/src/udev/udev-builtin-net_setup_link.c | ||
221 | @@ -1,5 +1,6 @@ | ||
222 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
223 | |||
224 | +#include <netinet/if_ether.h> | ||
225 | #include "device-util.h" | ||
226 | #include "alloc-util.h" | ||
227 | #include "link-config.h" | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch new file mode 100644 index 0000000000..34f7f5fb74 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch | |||
@@ -0,0 +1,153 @@ | |||
1 | From f8a239b182158ca0a537ba053cb0e6bad9c3a2fb Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 14:56:21 +0800 | ||
4 | Subject: [PATCH 07/24] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not | ||
5 | defined | ||
6 | |||
7 | If the standard library doesn't provide brace | ||
8 | expansion users just won't get it. | ||
9 | |||
10 | Dont use GNU GLOB extentions on non-glibc systems | ||
11 | |||
12 | Conditionalize use of GLOB_ALTDIRFUNC | ||
13 | |||
14 | Upstream-Status: Inappropriate [musl specific] | ||
15 | |||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
18 | [rebased for systemd 243] | ||
19 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
20 | --- | ||
21 | src/basic/glob-util.c | 12 ++++++++++++ | ||
22 | src/test/test-glob-util.c | 16 ++++++++++++++++ | ||
23 | src/tmpfiles/tmpfiles.c | 10 ++++++++++ | ||
24 | 3 files changed, 38 insertions(+) | ||
25 | |||
26 | diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c | ||
27 | index b335af8d97..2cdfc11f16 100644 | ||
28 | --- a/src/basic/glob-util.c | ||
29 | +++ b/src/basic/glob-util.c | ||
30 | @@ -14,6 +14,12 @@ | ||
31 | #include "path-util.h" | ||
32 | #include "strv.h" | ||
33 | |||
34 | +/* Don't fail if the standard library | ||
35 | + * doesn't provide brace expansion */ | ||
36 | +#ifndef GLOB_BRACE | ||
37 | +#define GLOB_BRACE 0 | ||
38 | +#endif | ||
39 | + | ||
40 | static void closedir_wrapper(void* v) { | ||
41 | (void) closedir(v); | ||
42 | } | ||
43 | @@ -21,6 +27,7 @@ static void closedir_wrapper(void* v) { | ||
44 | int safe_glob(const char *path, int flags, glob_t *pglob) { | ||
45 | int k; | ||
46 | |||
47 | +#ifdef GLOB_ALTDIRFUNC | ||
48 | /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ | ||
49 | assert(!(flags & GLOB_ALTDIRFUNC)); | ||
50 | |||
51 | @@ -34,9 +41,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { | ||
52 | pglob->gl_lstat = lstat; | ||
53 | if (!pglob->gl_stat) | ||
54 | pglob->gl_stat = stat; | ||
55 | +#endif | ||
56 | |||
57 | errno = 0; | ||
58 | +#ifdef GLOB_ALTDIRFUNC | ||
59 | k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob); | ||
60 | +#else | ||
61 | + k = glob(path, flags, NULL, pglob); | ||
62 | +#endif | ||
63 | if (k == GLOB_NOMATCH) | ||
64 | return -ENOENT; | ||
65 | if (k == GLOB_NOSPACE) | ||
66 | diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c | ||
67 | index b4f41445fe..f0d474ed14 100644 | ||
68 | --- a/src/test/test-glob-util.c | ||
69 | +++ b/src/test/test-glob-util.c | ||
70 | @@ -13,6 +13,12 @@ | ||
71 | #include "rm-rf.h" | ||
72 | #include "tmpfile-util.h" | ||
73 | |||
74 | +/* Don't fail if the standard library | ||
75 | + * doesn't provide brace expansion */ | ||
76 | +#ifndef GLOB_BRACE | ||
77 | +#define GLOB_BRACE 0 | ||
78 | +#endif | ||
79 | + | ||
80 | static void test_glob_exists(void) { | ||
81 | char name[] = "/tmp/test-glob_exists.XXXXXX"; | ||
82 | int fd = -1; | ||
83 | @@ -40,11 +46,13 @@ static void test_glob_no_dot(void) { | ||
84 | const char *fn; | ||
85 | |||
86 | _cleanup_globfree_ glob_t g = { | ||
87 | +#ifdef GLOB_ALTDIRFUNC | ||
88 | .gl_closedir = closedir_wrapper, | ||
89 | .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot, | ||
90 | .gl_opendir = (void *(*)(const char *)) opendir, | ||
91 | .gl_lstat = lstat, | ||
92 | .gl_stat = stat, | ||
93 | +#endif | ||
94 | }; | ||
95 | |||
96 | int r; | ||
97 | @@ -52,11 +60,19 @@ static void test_glob_no_dot(void) { | ||
98 | assert_se(mkdtemp(template)); | ||
99 | |||
100 | fn = strjoina(template, "/*"); | ||
101 | +#ifdef GLOB_ALTDIRFUNC | ||
102 | r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); | ||
103 | +#else | ||
104 | + r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); | ||
105 | +#endif | ||
106 | assert_se(r == GLOB_NOMATCH); | ||
107 | |||
108 | fn = strjoina(template, "/.*"); | ||
109 | +#ifdef GLOB_ALTDIRFUNC | ||
110 | r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); | ||
111 | +#else | ||
112 | + r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); | ||
113 | +#endif | ||
114 | assert_se(r == GLOB_NOMATCH); | ||
115 | |||
116 | (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); | ||
117 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c | ||
118 | index 3c30612af1..14bc428085 100644 | ||
119 | --- a/src/tmpfiles/tmpfiles.c | ||
120 | +++ b/src/tmpfiles/tmpfiles.c | ||
121 | @@ -63,6 +63,12 @@ | ||
122 | #include "umask-util.h" | ||
123 | #include "user-util.h" | ||
124 | |||
125 | +/* Don't fail if the standard library | ||
126 | + * doesn't provide brace expansion */ | ||
127 | +#ifndef GLOB_BRACE | ||
128 | +#define GLOB_BRACE 0 | ||
129 | +#endif | ||
130 | + | ||
131 | /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates | ||
132 | * them in the file system. This is intended to be used to create | ||
133 | * properly owned directories beneath /tmp, /var/tmp, /run, which are | ||
134 | @@ -1853,7 +1859,9 @@ finish: | ||
135 | |||
136 | static int glob_item(Item *i, action_t action) { | ||
137 | _cleanup_globfree_ glob_t g = { | ||
138 | +#ifdef GLOB_ALTDIRFUNC | ||
139 | .gl_opendir = (void *(*)(const char *)) opendir_nomod, | ||
140 | +#endif | ||
141 | }; | ||
142 | int r = 0, k; | ||
143 | char **fn; | ||
144 | @@ -1873,7 +1881,9 @@ static int glob_item(Item *i, action_t action) { | ||
145 | |||
146 | static int glob_item_recursively(Item *i, fdaction_t action) { | ||
147 | _cleanup_globfree_ glob_t g = { | ||
148 | +#ifdef GLOB_ALTDIRFUNC | ||
149 | .gl_opendir = (void *(*)(const char *)) opendir_nomod, | ||
150 | +#endif | ||
151 | }; | ||
152 | int r = 0, k; | ||
153 | char **fn; | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0008-add-missing-FTW_-macros-for-musl.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0008-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 0000000000..d5f2349f2b --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0008-add-missing-FTW_-macros-for-musl.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 6cd17c753d2c0a90fc791f69bbc694cbc8556a4f Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:00:06 +0800 | ||
4 | Subject: [PATCH 08/24] add missing FTW_ macros for musl | ||
5 | |||
6 | This is to avoid build failures like below for musl. | ||
7 | |||
8 | locale-util.c:296:24: error: 'FTW_STOP' undeclared | ||
9 | |||
10 | Upstream-Status: Inappropriate [musl specific] | ||
11 | |||
12 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
13 | --- | ||
14 | src/basic/missing_type.h | 20 ++++++++++++++++++++ | ||
15 | 1 file changed, 20 insertions(+) | ||
16 | |||
17 | diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h | ||
18 | index c487e65..23602eb 100644 | ||
19 | --- a/src/basic/missing_type.h | ||
20 | +++ b/src/basic/missing_type.h | ||
21 | @@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *); | ||
22 | #define __COMPAR_FN_T | ||
23 | typedef int (*__compar_fn_t)(const void *, const void *); | ||
24 | #endif | ||
25 | + | ||
26 | +#ifndef FTW_ACTIONRETVAL | ||
27 | +#define FTW_ACTIONRETVAL 16 | ||
28 | +#endif | ||
29 | + | ||
30 | +#ifndef FTW_CONTINUE | ||
31 | +#define FTW_CONTINUE 0 | ||
32 | +#endif | ||
33 | + | ||
34 | +#ifndef FTW_STOP | ||
35 | +#define FTW_STOP 1 | ||
36 | +#endif | ||
37 | + | ||
38 | +#ifndef FTW_SKIP_SUBTREE | ||
39 | +#define FTW_SKIP_SUBTREE 2 | ||
40 | +#endif | ||
41 | + | ||
42 | +#ifndef FTW_SKIP_SIBLINGS | ||
43 | +#define FTW_SKIP_SIBLINGS 3 | ||
44 | +#endif | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch new file mode 100644 index 0000000000..8bacd0289d --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | From f1f4b4f9684fed185bfa8b9ed409cdf241657e99 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:03:47 +0800 | ||
4 | Subject: [PATCH 10/24] fix missing of __register_atfork for non-glibc builds | ||
5 | |||
6 | Upstream-Status: Inappropriate [musl specific] | ||
7 | |||
8 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
9 | --- | ||
10 | src/basic/process-util.c | 7 +++++++ | ||
11 | 1 file changed, 7 insertions(+) | ||
12 | |||
13 | diff --git a/src/basic/process-util.c b/src/basic/process-util.c | ||
14 | index 78ce43b..aec2daf 100644 | ||
15 | --- a/src/basic/process-util.c | ||
16 | +++ b/src/basic/process-util.c | ||
17 | @@ -22,6 +22,9 @@ | ||
18 | #if HAVE_VALGRIND_VALGRIND_H | ||
19 | #include <valgrind/valgrind.h> | ||
20 | #endif | ||
21 | +#ifndef __GLIBC__ | ||
22 | +#include <pthread.h> | ||
23 | +#endif | ||
24 | |||
25 | #include "alloc-util.h" | ||
26 | #include "architecture.h" | ||
27 | @@ -1160,11 +1163,15 @@ void reset_cached_pid(void) { | ||
28 | cached_pid = CACHED_PID_UNSET; | ||
29 | } | ||
30 | |||
31 | +#ifdef __GLIBC__ | ||
32 | /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc | ||
33 | * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against | ||
34 | * libpthread, as it is part of glibc anyway. */ | ||
35 | extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); | ||
36 | extern void* __dso_handle _weak_; | ||
37 | +#else | ||
38 | +#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) | ||
39 | +#endif | ||
40 | |||
41 | pid_t getpid_cached(void) { | ||
42 | static bool installed = false; | ||
43 | -- | ||
44 | 2.7.4 | ||
45 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0011-Use-uintmax_t-for-handling-rlim_t.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0011-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..d6eda9c038 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0011-Use-uintmax_t-for-handling-rlim_t.patch | |||
@@ -0,0 +1,97 @@ | |||
1 | From e3f847bd0338d27aff3335b42661d8a4b66b965e Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:12:41 +0800 | ||
4 | Subject: [PATCH 11/24] Use uintmax_t for handling rlim_t | ||
5 | |||
6 | PRIu{32,64} is not right format to represent rlim_t type | ||
7 | therefore use %ju and typecast the rlim_t variables to | ||
8 | uintmax_t. | ||
9 | |||
10 | Fixes portablility errors like | ||
11 | |||
12 | execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] | ||
13 | | fprintf(f, "%s%s: " RLIM_FMT "\n", | ||
14 | | ^~~~~~~~ | ||
15 | | prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); | ||
16 | | ~~~~~~~~~~~~~~~~~~~~~~ | ||
17 | |||
18 | Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] | ||
19 | |||
20 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
21 | [Rebased for v241] | ||
22 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
23 | --- | ||
24 | src/basic/format-util.h | 8 +------- | ||
25 | src/basic/rlimit-util.c | 10 +++++----- | ||
26 | src/core/execute.c | 4 ++-- | ||
27 | 3 files changed, 8 insertions(+), 14 deletions(-) | ||
28 | |||
29 | diff --git a/src/basic/format-util.h b/src/basic/format-util.h | ||
30 | index dece5d3..dbb87bc 100644 | ||
31 | --- a/src/basic/format-util.h | ||
32 | +++ b/src/basic/format-util.h | ||
33 | @@ -42,13 +42,7 @@ | ||
34 | # define PRI_TIMEX "li" | ||
35 | #endif | ||
36 | |||
37 | -#if SIZEOF_RLIM_T == 8 | ||
38 | -# define RLIM_FMT "%" PRIu64 | ||
39 | -#elif SIZEOF_RLIM_T == 4 | ||
40 | -# define RLIM_FMT "%" PRIu32 | ||
41 | -#else | ||
42 | -# error Unknown rlim_t size | ||
43 | -#endif | ||
44 | +#define RLIM_FMT "%ju" | ||
45 | |||
46 | #if SIZEOF_DEV_T == 8 | ||
47 | # define DEV_FMT "%" PRIu64 | ||
48 | diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c | ||
49 | index 74b3a02..b02c03c 100644 | ||
50 | --- a/src/basic/rlimit-util.c | ||
51 | +++ b/src/basic/rlimit-util.c | ||
52 | @@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { | ||
53 | if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) | ||
54 | s = strdup("infinity"); | ||
55 | else if (rl->rlim_cur >= RLIM_INFINITY) | ||
56 | - (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); | ||
57 | + (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); | ||
58 | else if (rl->rlim_max >= RLIM_INFINITY) | ||
59 | - (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); | ||
60 | + (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); | ||
61 | else if (rl->rlim_cur == rl->rlim_max) | ||
62 | - (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); | ||
63 | + (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); | ||
64 | else | ||
65 | - (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); | ||
66 | + (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); | ||
67 | |||
68 | if (!s) | ||
69 | return -ENOMEM; | ||
70 | @@ -404,7 +404,7 @@ int rlimit_nofile_safe(void) { | ||
71 | |||
72 | rl.rlim_cur = FD_SETSIZE; | ||
73 | if (setrlimit(RLIMIT_NOFILE, &rl) < 0) | ||
74 | - return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); | ||
75 | + return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); | ||
76 | |||
77 | return 1; | ||
78 | } | ||
79 | diff --git a/src/core/execute.c b/src/core/execute.c | ||
80 | index a708231..e2b8748 100644 | ||
81 | --- a/src/core/execute.c | ||
82 | +++ b/src/core/execute.c | ||
83 | @@ -4220,9 +4220,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { | ||
84 | for (i = 0; i < RLIM_NLIMITS; i++) | ||
85 | if (c->rlimit[i]) { | ||
86 | fprintf(f, "%sLimit%s: " RLIM_FMT "\n", | ||
87 | - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); | ||
88 | + prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); | ||
89 | fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", | ||
90 | - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); | ||
91 | + prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); | ||
92 | } | ||
93 | |||
94 | if (c->ioprio_set) { | ||
95 | -- | ||
96 | 2.7.4 | ||
97 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch new file mode 100644 index 0000000000..914589dbd3 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From d3d65d4036670cbd5129fe55c09ca391286ef4b3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Wed, 28 Feb 2018 21:25:22 -0800 | ||
4 | Subject: [PATCH 14/24] test-sizeof.c: Disable tests for missing typedefs in | ||
5 | musl | ||
6 | |||
7 | Upstream-Status: Inappropriate [musl specific] | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
11 | --- | ||
12 | src/test/test-sizeof.c | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c | ||
16 | index 35b0876..e78e7ca 100644 | ||
17 | --- a/src/test/test-sizeof.c | ||
18 | +++ b/src/test/test-sizeof.c | ||
19 | @@ -41,8 +41,10 @@ int main(void) { | ||
20 | info(unsigned); | ||
21 | info(long unsigned); | ||
22 | info(long long unsigned); | ||
23 | +#ifdef __GLIBC__ | ||
24 | info(__syscall_ulong_t); | ||
25 | info(__syscall_slong_t); | ||
26 | +#endif | ||
27 | |||
28 | info(float); | ||
29 | info(double); | ||
30 | @@ -60,7 +62,9 @@ int main(void) { | ||
31 | info(ssize_t); | ||
32 | info(time_t); | ||
33 | info(usec_t); | ||
34 | +#ifdef __GLIBC__ | ||
35 | info(__time_t); | ||
36 | +#endif | ||
37 | info(pid_t); | ||
38 | info(uid_t); | ||
39 | info(gid_t); | ||
40 | -- | ||
41 | 2.7.4 | ||
42 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch new file mode 100644 index 0000000000..fd407f604d --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From 48c628f532f6025c2d1646b6819cd81eb789d7fb Mon Sep 17 00:00:00 2001 | ||
2 | From: Andre McCurdy <armccurdy@gmail.com> | ||
3 | Date: Tue, 10 Oct 2017 14:33:30 -0700 | ||
4 | Subject: [PATCH 15/24] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() | ||
5 | |||
6 | Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right | ||
7 | thing to do and it's not portable (not supported by musl). See: | ||
8 | |||
9 | http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html | ||
10 | http://www.openwall.com/lists/musl/2015/02/05/2 | ||
11 | |||
12 | Note that laccess() is never passing AT_EACCESS so a lot of the | ||
13 | discussion in the links above doesn't apply. Note also that | ||
14 | (currently) all systemd callers of laccess() pass mode as F_OK, so | ||
15 | only check for existence of a file, not access permissions. | ||
16 | Therefore, in this case, the only distiction between faccessat() | ||
17 | with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour | ||
18 | for broken symlinks; laccess() on a broken symlink will succeed with | ||
19 | (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). | ||
20 | |||
21 | The laccess() macros was added to systemd some time ago and it's not | ||
22 | clear if or why it needs to return success for broken symlinks. Maybe | ||
23 | just historical and not actually necessary or desired behaviour? | ||
24 | |||
25 | Upstream-Status: Inappropriate [musl specific] | ||
26 | |||
27 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | ||
28 | --- | ||
29 | src/basic/fs-util.h | 22 +++++++++++++++++++++- | ||
30 | src/shared/base-filesystem.c | 6 +++--- | ||
31 | 2 files changed, 24 insertions(+), 4 deletions(-) | ||
32 | |||
33 | diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h | ||
34 | index 7ad030b..d4cb1e9 100644 | ||
35 | --- a/src/basic/fs-util.h | ||
36 | +++ b/src/basic/fs-util.h | ||
37 | @@ -32,7 +32,27 @@ int fchmod_opath(int fd, mode_t m); | ||
38 | |||
39 | int fd_warn_permissions(const char *path, int fd); | ||
40 | |||
41 | -#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) | ||
42 | +/* | ||
43 | + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to | ||
44 | + do and it's not portable (not supported by musl). See: | ||
45 | + | ||
46 | + http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html | ||
47 | + http://www.openwall.com/lists/musl/2015/02/05/2 | ||
48 | + | ||
49 | + Note that laccess() is never passing AT_EACCESS so a lot of the discussion in | ||
50 | + the links above doesn't apply. Note also that (currently) all systemd callers | ||
51 | + of laccess() pass mode as F_OK, so only check for existence of a file, not | ||
52 | + access permissions. Therefore, in this case, the only distiction between | ||
53 | + faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the | ||
54 | + behaviour for broken symlinks; laccess() on a broken symlink will succeed | ||
55 | + with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). | ||
56 | + | ||
57 | + The laccess() macros was added to systemd some time ago and it's not clear if | ||
58 | + or why it needs to return success for broken symlinks. Maybe just historical | ||
59 | + and not actually necessary or desired behaviour? | ||
60 | +*/ | ||
61 | + | ||
62 | +#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) | ||
63 | |||
64 | int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); | ||
65 | int touch(const char *path); | ||
66 | diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c | ||
67 | index 89d7a7d..34b4ad5 100644 | ||
68 | --- a/src/shared/base-filesystem.c | ||
69 | +++ b/src/shared/base-filesystem.c | ||
70 | @@ -53,7 +53,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
71 | return log_error_errno(errno, "Failed to open root file system: %m"); | ||
72 | |||
73 | for (i = 0; i < ELEMENTSOF(table); i ++) { | ||
74 | - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) | ||
75 | + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) | ||
76 | continue; | ||
77 | |||
78 | if (table[i].target) { | ||
79 | @@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
80 | |||
81 | /* check if one of the targets exists */ | ||
82 | NULSTR_FOREACH(s, table[i].target) { | ||
83 | - if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0) | ||
84 | + if (faccessat(fd, s, F_OK, 0) < 0) | ||
85 | continue; | ||
86 | |||
87 | /* check if a specific file exists at the target path */ | ||
88 | @@ -72,7 +72,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
89 | if (!p) | ||
90 | return log_oom(); | ||
91 | |||
92 | - if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0) | ||
93 | + if (faccessat(fd, p, F_OK, 0) < 0) | ||
94 | continue; | ||
95 | } | ||
96 | |||
97 | -- | ||
98 | 2.7.4 | ||
99 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch new file mode 100644 index 0000000000..d5565698aa --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From af76c973e41929360a6e021f2ff9a7fc1d7994e9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 27 May 2018 08:36:44 -0700 | ||
4 | Subject: [PATCH 16/24] Define glibc compatible basename() for non-glibc | ||
5 | systems | ||
6 | |||
7 | Fixes builds with musl, even though systemd is adamant about | ||
8 | using non-posix basename implementation, we have a way out | ||
9 | |||
10 | Upstream-Status: Inappropriate [musl specific] | ||
11 | |||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | src/machine/machine-dbus.c | 4 ++++ | ||
15 | 1 file changed, 4 insertions(+) | ||
16 | |||
17 | diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c | ||
18 | index 7a558df..eca7d4b 100644 | ||
19 | --- a/src/machine/machine-dbus.c | ||
20 | +++ b/src/machine/machine-dbus.c | ||
21 | @@ -11,6 +11,10 @@ | ||
22 | #include <libgen.h> | ||
23 | #undef basename | ||
24 | |||
25 | +#if !defined(__GLIBC__) | ||
26 | +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) | ||
27 | +#endif | ||
28 | + | ||
29 | #include "alloc-util.h" | ||
30 | #include "bus-common-errors.h" | ||
31 | #include "bus-internal.h" | ||
32 | -- | ||
33 | 2.7.4 | ||
34 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch new file mode 100644 index 0000000000..24e24e8e5a --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From c7a4efb8bccb52e1714c151929c23e12bde59b82 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Wed, 4 Jul 2018 15:00:44 +0800 | ||
4 | Subject: [PATCH 17/24] Do not disable buffering when writing to oom_score_adj | ||
5 | |||
6 | On musl, disabling buffering when writing to oom_score_adj will | ||
7 | cause the following error. | ||
8 | |||
9 | Failed to adjust OOM setting: Invalid argument | ||
10 | |||
11 | This error appears for systemd-udevd.service and dbus.service. | ||
12 | This is because kernel receives '-' instead of the whole '-900' | ||
13 | if buffering is disabled. | ||
14 | |||
15 | This is libc implementation specific, as glibc does not have this issue. | ||
16 | |||
17 | Upstream-Status: Inappropriate [musl specific] | ||
18 | |||
19 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
20 | [rebased for systemd 243] | ||
21 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
22 | --- | ||
23 | src/basic/process-util.c | 2 +- | ||
24 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
25 | |||
26 | diff --git a/src/basic/process-util.c b/src/basic/process-util.c | ||
27 | index b1c08fcade..0a7a1f7d89 100644 | ||
28 | --- a/src/basic/process-util.c | ||
29 | +++ b/src/basic/process-util.c | ||
30 | @@ -1474,7 +1474,7 @@ int set_oom_score_adjust(int value) { | ||
31 | sprintf(t, "%i", value); | ||
32 | |||
33 | return write_string_file("/proc/self/oom_score_adj", t, | ||
34 | - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); | ||
35 | + WRITE_STRING_FILE_VERIFY_ON_FAILURE); | ||
36 | } | ||
37 | |||
38 | static const char *const ioprio_class_table[] = { | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch new file mode 100644 index 0000000000..5901772998 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From fffb2810611b4a26f5c6c0958093b5b3b7d4cd99 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Tue, 10 Jul 2018 15:40:17 +0800 | ||
4 | Subject: [PATCH 18/24] distinguish XSI-compliant strerror_r from GNU-specifi | ||
5 | strerror_r | ||
6 | |||
7 | XSI-compliant strerror_r and GNU-specifi strerror_r are different. | ||
8 | |||
9 | int strerror_r(int errnum, char *buf, size_t buflen); | ||
10 | /* XSI-compliant */ | ||
11 | |||
12 | char *strerror_r(int errnum, char *buf, size_t buflen); | ||
13 | /* GNU-specific */ | ||
14 | |||
15 | We need to distinguish between them. Otherwise, we'll get an int value | ||
16 | assigned to (char *) variable, resulting in segment fault. | ||
17 | |||
18 | Upstream-Status: Inappropriate [musl specific] | ||
19 | |||
20 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
21 | --- | ||
22 | src/journal/journal-send.c | 5 +++++ | ||
23 | src/libsystemd/sd-bus/bus-error.c | 5 +++++ | ||
24 | 2 files changed, 10 insertions(+) | ||
25 | |||
26 | diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c | ||
27 | index 3fea912..4f1e592 100644 | ||
28 | --- a/src/journal/journal-send.c | ||
29 | +++ b/src/journal/journal-send.c | ||
30 | @@ -337,7 +337,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove | ||
31 | char* j; | ||
32 | |||
33 | errno = 0; | ||
34 | +#ifndef __GLIBC__ | ||
35 | + strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); | ||
36 | + j = buffer + 8 + k; | ||
37 | +#else | ||
38 | j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); | ||
39 | +#endif | ||
40 | if (errno == 0) { | ||
41 | char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; | ||
42 | |||
43 | diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c | ||
44 | index dc95237..bdda30f 100644 | ||
45 | --- a/src/libsystemd/sd-bus/bus-error.c | ||
46 | +++ b/src/libsystemd/sd-bus/bus-error.c | ||
47 | @@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { | ||
48 | return; | ||
49 | |||
50 | errno = 0; | ||
51 | +#ifndef __GLIBC__ | ||
52 | + strerror_r(error, m, k); | ||
53 | + x = m; | ||
54 | +#else | ||
55 | x = strerror_r(error, m, k); | ||
56 | +#endif | ||
57 | if (errno == ERANGE || strlen(x) >= k - 1) { | ||
58 | free(m); | ||
59 | k *= 2; | ||
60 | -- | ||
61 | 2.7.4 | ||
62 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch new file mode 100644 index 0000000000..35cc66ff66 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 969ab9e68249fd383f4b513b1c9306bdac4ae9b2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:18:00 +0800 | ||
4 | Subject: [PATCH 19/24] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP | ||
5 | |||
6 | for currently unknown reasons they get exported to the shared libries | ||
7 | even without being listed in the sym file | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | [Rebased for v241] | ||
13 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
14 | --- | ||
15 | src/libsystemd/sd-bus/bus-error.c | 4 ++-- | ||
16 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c | ||
19 | index bdda30f..e21853c 100644 | ||
20 | --- a/src/libsystemd/sd-bus/bus-error.c | ||
21 | +++ b/src/libsystemd/sd-bus/bus-error.c | ||
22 | @@ -54,8 +54,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { | ||
23 | }; | ||
24 | |||
25 | /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ | ||
26 | -extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[]; | ||
27 | -extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[]; | ||
28 | +extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_; | ||
29 | +extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_; | ||
30 | |||
31 | /* Additional maps registered with sd_bus_error_add_map() are in this | ||
32 | * NULL terminated array */ | ||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0020-missing_type.h-add-__compar_d_fn_t-definition.patch new file mode 100644 index 0000000000..753d5116ac --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0020-missing_type.h-add-__compar_d_fn_t-definition.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 75c06e3e2a4760b36fffd95cdf5535b8ad73c481 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:27:54 +0800 | ||
4 | Subject: [PATCH 20/24] missing_type.h: add __compar_d_fn_t definition | ||
5 | |||
6 | Fix the following compile failure: | ||
7 | src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'? | ||
8 | |||
9 | Upstream-Status: Inappropriate [musl specific] | ||
10 | |||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | --- | ||
13 | src/basic/missing_type.h | 1 + | ||
14 | 1 file changed, 1 insertion(+) | ||
15 | |||
16 | diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h | ||
17 | index 7d7c1e4..85902ab 100644 | ||
18 | --- a/src/basic/missing_type.h | ||
19 | +++ b/src/basic/missing_type.h | ||
20 | @@ -13,6 +13,7 @@ | ||
21 | |||
22 | #ifndef __GLIBC__ | ||
23 | typedef int (*comparison_fn_t)(const void *, const void *); | ||
24 | +typedef int (*__compar_d_fn_t) (const void *, const void *, void *); | ||
25 | #endif | ||
26 | |||
27 | #ifndef __COMPAR_FN_T | ||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0021-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0021-avoid-redefinition-of-prctl_mm_map-structure.patch new file mode 100644 index 0000000000..cdddf83890 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0021-avoid-redefinition-of-prctl_mm_map-structure.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 3fbf61d54b82fc9bf21d8039bfd89dc9efc5bbcd Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 15:44:54 +0800 | ||
4 | Subject: [PATCH 21/24] avoid redefinition of prctl_mm_map structure | ||
5 | |||
6 | Fix the following compile failure: | ||
7 | error: redefinition of 'struct prctl_mm_map' | ||
8 | |||
9 | Upstream-Status: Inappropriate [musl specific] | ||
10 | |||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | --- | ||
13 | src/basic/missing_prctl.h | 2 ++ | ||
14 | 1 file changed, 2 insertions(+) | ||
15 | |||
16 | diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h | ||
17 | index f80cd17..47e4893 100644 | ||
18 | --- a/src/basic/missing_prctl.h | ||
19 | +++ b/src/basic/missing_prctl.h | ||
20 | @@ -1,7 +1,9 @@ | ||
21 | /* SPDX-License-Identifier: LGPL-2.1+ */ | ||
22 | #pragma once | ||
23 | |||
24 | +#ifdef __GLIBC__ | ||
25 | #include <linux/prctl.h> | ||
26 | +#endif | ||
27 | |||
28 | /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ | ||
29 | #ifndef PR_CAP_AMBIENT | ||
30 | -- | ||
31 | 2.11.0 | ||
32 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0024-test-json.c-define-M_PIl.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0024-test-json.c-define-M_PIl.patch new file mode 100644 index 0000000000..0e5629d37b --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0024-test-json.c-define-M_PIl.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 902412c271e0c5d9cb93b10ec0fb5b119b393474 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 25 Feb 2019 16:53:06 +0800 | ||
4 | Subject: [PATCH 24/24] test-json.c: define M_PIl | ||
5 | |||
6 | Fix the following compile failure: | ||
7 | src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? | ||
8 | |||
9 | Upstream-Status: Inappropriate [musl specific] | ||
10 | |||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | --- | ||
13 | src/test/test-json.c | 4 ++++ | ||
14 | 1 file changed, 4 insertions(+) | ||
15 | |||
16 | diff --git a/src/test/test-json.c b/src/test/test-json.c | ||
17 | index 9b8a2a9..efc746c 100644 | ||
18 | --- a/src/test/test-json.c | ||
19 | +++ b/src/test/test-json.c | ||
20 | @@ -11,6 +11,10 @@ | ||
21 | #include "tests.h" | ||
22 | #include "util.h" | ||
23 | |||
24 | +#ifndef M_PIl | ||
25 | +#define M_PIl 3.141592653589793238462643383279502884L | ||
26 | +#endif | ||
27 | + | ||
28 | static void test_tokenizer(const char *data, ...) { | ||
29 | unsigned line = 0, column = 0; | ||
30 | void *state = NULL; | ||
31 | -- | ||
32 | 2.11.0 | ||
33 | |||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/static-libsystemd-pkgconfig.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/static-libsystemd-pkgconfig.patch new file mode 100644 index 0000000000..eb018bbcc4 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/static-libsystemd-pkgconfig.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | Index: git/src/libsystemd/libsystemd.pc.in | ||
2 | =================================================================== | ||
3 | --- git.orig/src/libsystemd/libsystemd.pc.in | ||
4 | +++ git/src/libsystemd/libsystemd.pc.in | ||
5 | @@ -16,5 +16,5 @@ Name: systemd | ||
6 | Description: systemd Library | ||
7 | URL: @PROJECT_URL@ | ||
8 | Version: @PROJECT_VERSION@ | ||
9 | -Libs: -L${libdir} -lsystemd | ||
10 | +Libs: -L${libdir} -lsystemd -lrt -lmount -lcap | ||
11 | Cflags: -I${includedir} | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_243.bb b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_243.bb new file mode 100644 index 0000000000..c8e81a4123 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_243.bb | |||
@@ -0,0 +1,69 @@ | |||
1 | SUMMARY = "libsystemd static library" | ||
2 | DESCRIPTION = "libsystemd static library built specifically as an integral component of sdbus-c++" | ||
3 | |||
4 | SECTION = "libs" | ||
5 | |||
6 | LICENSE = "LGPLv2.1+" | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" | ||
8 | |||
9 | inherit meson pkgconfig | ||
10 | |||
11 | DEPENDS += "gperf-native gettext-native util-linux libcap" | ||
12 | |||
13 | SRCREV = "efb536d0cbe2e58f80e501d19999928c75e08f6a" | ||
14 | SRCBRANCH = "v243-stable" | ||
15 | SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" | ||
16 | |||
17 | SRC_URI += "file://static-libsystemd-pkgconfig.patch" | ||
18 | |||
19 | # patches needed by musl | ||
20 | SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}" | ||
21 | SRC_URI_MUSL = "\ | ||
22 | file://0002-don-t-use-glibc-specific-qsort_r.patch \ | ||
23 | file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ | ||
24 | file://0004-add-fallback-parse_printf_format-implementation.patch \ | ||
25 | file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ | ||
26 | file://0006-Include-netinet-if_ether.h.patch \ | ||
27 | file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch \ | ||
28 | file://0008-add-missing-FTW_-macros-for-musl.patch \ | ||
29 | file://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ | ||
30 | file://0011-Use-uintmax_t-for-handling-rlim_t.patch \ | ||
31 | file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ | ||
32 | file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ | ||
33 | file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ | ||
34 | file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ | ||
35 | file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ | ||
36 | file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ | ||
37 | file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \ | ||
38 | file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \ | ||
39 | file://0024-test-json.c-define-M_PIl.patch \ | ||
40 | file://0001-do-not-disable-buffer-in-writing-files.patch \ | ||
41 | file://0002-src-login-brightness.c-include-sys-wait.h.patch \ | ||
42 | file://0003-src-basic-copy.c-include-signal.h.patch \ | ||
43 | file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch \ | ||
44 | " | ||
45 | |||
46 | PACKAGECONFIG ??= "gshadow idn" | ||
47 | PACKAGECONFIG_remove_libc-musl = " gshadow idn" | ||
48 | PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" | ||
49 | PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" | ||
50 | |||
51 | EXTRA_OEMESON += "-Dstatic-libsystemd=pic" | ||
52 | |||
53 | S = "${WORKDIR}/git" | ||
54 | |||
55 | do_compile() { | ||
56 | ninja -v ${PARALLEL_MAKE} version.h | ||
57 | ninja -v ${PARALLEL_MAKE} libsystemd.a | ||
58 | } | ||
59 | |||
60 | do_install () { | ||
61 | install -d ${D}${libdir} | ||
62 | install ${B}/libsystemd.a ${D}${libdir} | ||
63 | |||
64 | install -d ${D}${includedir}/systemd | ||
65 | install ${S}/src/systemd/*.h ${D}${includedir}/systemd | ||
66 | |||
67 | install -d ${D}${libdir}/pkgconfig | ||
68 | install ${B}/src/libsystemd/libsystemd.pc ${D}${libdir}/pkgconfig | ||
69 | } | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-tools-native_0.7.6.bb b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-tools-native_0.7.6.bb new file mode 100644 index 0000000000..6492c23680 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-tools-native_0.7.6.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | SUMMARY = "sdbus-c++ native tools" | ||
2 | DESCRIPTION = "Native interface code generator for development with sdbus-c++" | ||
3 | |||
4 | LICENSE = "LGPLv2.1" | ||
5 | LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742" | ||
6 | |||
7 | inherit cmake native | ||
8 | |||
9 | DEPENDS += "expat" | ||
10 | |||
11 | SRCREV = "5121d46eed42231285c18d317a9f48e0b2849d5e" | ||
12 | SRC_URI = "git://github.com/Kistler-Group/sdbus-cpp.git;protocol=https;branch=master;subpath=tools" | ||
13 | |||
14 | S = "${WORKDIR}/tools" | ||
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++_0.7.6.bb b/meta-oe/recipes-core/sdbus-c++/sdbus-c++_0.7.6.bb new file mode 100644 index 0000000000..57774cbdf7 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++_0.7.6.bb | |||
@@ -0,0 +1,32 @@ | |||
1 | SUMMARY = "sdbus-c++" | ||
2 | DESCRIPTION = "High-level C++ D-Bus library designed to provide easy-to-use yet powerful API in modern C++" | ||
3 | |||
4 | SECTION = "libs" | ||
5 | |||
6 | LICENSE = "LGPLv2.1" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742" | ||
8 | |||
9 | inherit cmake pkgconfig systemd ptest | ||
10 | |||
11 | PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'with-external-libsystemd', 'with-builtin-libsystemd', d)} \ | ||
12 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)}" | ||
13 | PACKAGECONFIG[with-builtin-libsystemd] = ",,sdbus-c++-libsystemd,libcap" | ||
14 | PACKAGECONFIG[with-external-libsystemd] = ",,systemd,libsystemd" | ||
15 | PACKAGECONFIG[with-tests] = "-DBUILD_TESTS=ON -DTESTS_INSTALL_PATH=${libdir}/${BPN}/tests,-DBUILD_TESTS=OFF" | ||
16 | |||
17 | DEPENDS += "expat" | ||
18 | |||
19 | SRCREV = "5121d46eed42231285c18d317a9f48e0b2849d5e" | ||
20 | SRC_URI = "git://github.com/Kistler-Group/sdbus-cpp.git;protocol=https;branch=master" | ||
21 | SRC_URI += "file://run-ptest" | ||
22 | |||
23 | EXTRA_OECMAKE = "-DBUILD_CODE_GEN=ON \ | ||
24 | -DBUILD_DOC=ON \ | ||
25 | -DBUILD_DOXYGEN_DOC=OFF" | ||
26 | |||
27 | S = "${WORKDIR}/git" | ||
28 | |||
29 | FILES_${PN}_remove = "${sysconfdir}" | ||
30 | FILES_${PN}-ptest += "${sysconfdir}/dbus-1/system.d/" | ||
31 | FILES_${PN}-ptest += "${libdir}/${BPN}/tests" | ||
32 | FILES_${PN}-dev += "${bindir}/sdbus-c++-xml2cpp" | ||