summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch413
1 files changed, 0 insertions, 413 deletions
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
deleted file mode 100644
index 675fd20f11..0000000000
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ /dev/null
@@ -1,413 +0,0 @@
1From 564dba5ad0cd884e3f69fa19ca64095413578ea5 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800
4Subject: [PATCH 22/26] do not disable buffer in writing files
5
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21---
22 src/basic/cgroup-util.c | 10 +++++-----
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/cgroup-setup.c | 4 ++--
35 src/shared/sysctl-util.c | 2 +-
36 src/sleep/sleep.c | 8 ++++----
37 src/udev/udevadm-trigger.c | 2 +-
38 src/udev/udevd.c | 2 +-
39 src/vconsole/vconsole-setup.c | 2 +-
40 18 files changed, 35 insertions(+), 35 deletions(-)
41
42diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
43index bb960f183c..cb804c5f4b 100644
44--- a/src/basic/cgroup-util.c
45+++ b/src/basic/cgroup-util.c
46@@ -759,7 +759,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
47
48 sc = strstrip(contents);
49 if (isempty(sc)) {
50- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
51+ r = write_string_file(fs, agent, 0);
52 if (r < 0)
53 return r;
54 } else if (!path_equal(sc, agent))
55@@ -777,7 +777,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
56
57 sc = strstrip(contents);
58 if (streq(sc, "0")) {
59- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
60+ r = write_string_file(fs, "1", 0);
61 if (r < 0)
62 return r;
63
64@@ -804,7 +804,7 @@ int cg_uninstall_release_agent(const char *controller) {
65 if (r < 0)
66 return r;
67
68- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
69+ r = write_string_file(fs, "0", 0);
70 if (r < 0)
71 return r;
72
73@@ -814,7 +814,7 @@ int cg_uninstall_release_agent(const char *controller) {
74 if (r < 0)
75 return r;
76
77- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
78+ r = write_string_file(fs, "", 0);
79 if (r < 0)
80 return r;
81
82@@ -1646,7 +1646,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
83 if (r < 0)
84 return r;
85
86- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
87+ return write_string_file(p, value, 0);
88 }
89
90 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
91diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
92index 8f9eee8d36..480f8cc0b4 100644
93--- a/src/basic/procfs-util.c
94+++ b/src/basic/procfs-util.c
95@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
96 * decrease it, as threads-max is the much more relevant sysctl. */
97 if (limit > pid_max-1) {
98 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
99- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
100+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
101 if (r < 0)
102 return r;
103 }
104
105 sprintf(buffer, "%" PRIu64, limit);
106- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
107+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
108 if (r < 0) {
109 uint64_t threads_max;
110
111diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
112index 3362ee3924..80c0f2a52e 100644
113--- a/src/basic/smack-util.c
114+++ b/src/basic/smack-util.c
115@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
116 return 0;
117
118 p = procfs_file_alloca(pid, "attr/current");
119- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
120+ r = write_string_file(p, label, 0);
121 if (r < 0)
122 return r;
123
124diff --git a/src/basic/util.c b/src/basic/util.c
125index f98ecf3858..13e0f7431f 100644
126--- a/src/basic/util.c
127+++ b/src/basic/util.c
128@@ -267,7 +267,7 @@ void disable_coredumps(void) {
129 if (detect_container() > 0)
130 return;
131
132- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
133+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
134 if (r < 0)
135 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
136 }
137diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
138index 43ed2f385b..37a6f578f7 100644
139--- a/src/binfmt/binfmt.c
140+++ b/src/binfmt/binfmt.c
141@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
142 if (!fn)
143 return log_oom();
144
145- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
146+ return write_string_file(fn, "-1", 0);
147 }
148
149 static int apply_rule(const char *rule) {
150@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
151
152 (void) delete_rule(rule);
153
154- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
155+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
156 if (r < 0)
157 return log_error_errno(r, "Failed to add binary format: %m");
158
159@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) {
160 }
161
162 /* Flush out all rules */
163- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
164+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
165
166 STRV_FOREACH(f, files) {
167 k = apply_file(*f, true);
168diff --git a/src/core/main.c b/src/core/main.c
169index a280b756ff..334532cd42 100644
170--- a/src/core/main.c
171+++ b/src/core/main.c
172@@ -1382,7 +1382,7 @@ static int bump_unix_max_dgram_qlen(void) {
173 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
174 return 0;
175
176- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
177+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
178 if (r < 0)
179 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
180 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
181@@ -1666,7 +1666,7 @@ static void initialize_core_pattern(bool skip_setup) {
182 if (getpid_cached() != 1)
183 return;
184
185- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
186+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
187 if (r < 0)
188 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
189 }
190diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
191index 1fe592af70..603942a000 100644
192--- a/src/core/smack-setup.c
193+++ b/src/core/smack-setup.c
194@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
195 }
196
197 #ifdef SMACK_RUN_LABEL
198- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
199+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
200 if (r < 0)
201 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
202- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
203+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
204 if (r < 0)
205 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
206 r = write_string_file("/sys/fs/smackfs/netlabel",
207- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
208+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
209 if (r < 0)
210 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
211- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
212+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
213 if (r < 0)
214 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
215 #endif
216diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
217index d8f91f4e66..a088e6e2d8 100644
218--- a/src/hibernate-resume/hibernate-resume.c
219+++ b/src/hibernate-resume/hibernate-resume.c
220@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
221 return EXIT_FAILURE;
222 }
223
224- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
225+ r = write_string_file("/sys/power/resume", major_minor, 0);
226 if (r < 0) {
227 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
228 return EXIT_FAILURE;
229diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
230index d06f90ce1d..43d0a58750 100644
231--- a/src/libsystemd/sd-device/sd-device.c
232+++ b/src/libsystemd/sd-device/sd-device.c
233@@ -1976,7 +1976,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
234 if (!value)
235 return -ENOMEM;
236
237- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
238+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
239 if (r < 0) {
240 if (r == -ELOOP)
241 return -EINVAL;
242diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
243index 7d757aa286..a5d9da5b7e 100644
244--- a/src/login/logind-dbus.c
245+++ b/src/login/logind-dbus.c
246@@ -1330,7 +1330,7 @@ static int trigger_device(Manager *m, sd_device *d) {
247 if (!t)
248 return -ENOMEM;
249
250- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
251+ (void) write_string_file(t, "change", 0);
252 }
253
254 return 0;
255diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
256index cb01b25bc6..e92051268b 100644
257--- a/src/nspawn/nspawn-cgroup.c
258+++ b/src/nspawn/nspawn-cgroup.c
259@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
260 fn = strjoina(tree, cgroup, "/cgroup.procs");
261
262 sprintf(pid_string, PID_FMT, pid);
263- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
264+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
265 if (r < 0) {
266 log_error_errno(r, "Failed to move process: %m");
267 goto finish;
268diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
269index 3528b7ff14..11b0c20f95 100644
270--- a/src/nspawn/nspawn.c
271+++ b/src/nspawn/nspawn.c
272@@ -2667,7 +2667,7 @@ static int reset_audit_loginuid(void) {
273 if (streq(p, "4294967295"))
274 return 0;
275
276- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
277+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
278 if (r < 0) {
279 log_error_errno(r,
280 "Failed to reset audit login UID. This probably means that your kernel is too\n"
281@@ -3920,13 +3920,13 @@ static int setup_uid_map(pid_t pid) {
282
283 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
284 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
285- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
286+ r = write_string_file(uid_map, line, 0);
287 if (r < 0)
288 return log_error_errno(r, "Failed to write UID map: %m");
289
290 /* We always assign the same UID and GID ranges */
291 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
292- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
293+ r = write_string_file(uid_map, line, 0);
294 if (r < 0)
295 return log_error_errno(r, "Failed to write GID map: %m");
296
297diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
298index f197f715c7..077f893177 100644
299--- a/src/shared/cgroup-setup.c
300+++ b/src/shared/cgroup-setup.c
301@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
302
303 xsprintf(c, PID_FMT "\n", pid);
304
305- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
306+ r = write_string_file(fs, c, 0);
307 if (r < 0)
308 return r;
309
310@@ -799,7 +799,7 @@ int cg_enable_everywhere(
311 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
312 }
313
314- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
315+ r = write_string_stream(f, s, 0);
316 if (r < 0) {
317 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
318 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
319diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
320index 670c33108b..7c7c3dcfb6 100644
321--- a/src/shared/sysctl-util.c
322+++ b/src/shared/sysctl-util.c
323@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
324
325 log_debug("Setting '%s' to '%s'", p, value);
326
327- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
328+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
329 }
330
331 int sysctl_read(const char *property, char **content) {
332diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
333index 39ab554290..d0e566645d 100644
334--- a/src/sleep/sleep.c
335+++ b/src/sleep/sleep.c
336@@ -48,7 +48,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
337 assert(hibernate_location->swap);
338
339 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
340- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
341+ r = write_string_file("/sys/power/resume", resume_str, 0);
342 if (r < 0)
343 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
344 hibernate_location->swap->device, resume_str);
345@@ -75,7 +75,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
346 }
347
348 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
349- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
350+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
351 if (r < 0)
352 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
353 hibernate_location->swap->device, offset_str);
354@@ -92,7 +92,7 @@ static int write_mode(char **modes) {
355 STRV_FOREACH(mode, modes) {
356 int k;
357
358- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
359+ k = write_string_file("/sys/power/disk", *mode, 0);
360 if (k >= 0)
361 return 0;
362
363@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) {
364 STRV_FOREACH(state, states) {
365 int k;
366
367- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
368+ k = write_string_stream(*f, *state, 0);
369 if (k >= 0)
370 return 0;
371 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
372diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
373index 5c74184c33..65f528314e 100644
374--- a/src/udev/udevadm-trigger.c
375+++ b/src/udev/udevadm-trigger.c
376@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set **settle_s
377 if (!filename)
378 return log_oom();
379
380- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
381+ r = write_string_file(filename, action, 0);
382 if (r < 0) {
383 bool ignore = IN_SET(r, -ENOENT, -ENODEV);
384
385diff --git a/src/udev/udevd.c b/src/udev/udevd.c
386index d24b8d4398..d123a43904 100644
387--- a/src/udev/udevd.c
388+++ b/src/udev/udevd.c
389@@ -1192,7 +1192,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
390
391 filename = strjoina(syspath, "/uevent");
392 log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
393- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
394+ r = write_string_file(filename, "change", 0);
395 if (r < 0)
396 return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
397 return 0;
398diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
399index b28e2853e1..115b7233a0 100644
400--- a/src/vconsole/vconsole-setup.c
401+++ b/src/vconsole/vconsole-setup.c
402@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
403 static int toggle_utf8_sysfs(bool utf8) {
404 int r;
405
406- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
407+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
408 if (r < 0)
409 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
410
411--
4122.27.0
413