diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch | 530 |
1 files changed, 530 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..0bbc6bbac7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch | |||
@@ -0,0 +1,530 @@ | |||
1 | From eaf26fdad00448b8cd336eb5db51e0baa8d8e588 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Mon, 16 Dec 2024 14:37:25 +0800 | ||
4 | Subject: [PATCH 12/26] 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 | [rebased for systemd 254] | ||
22 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
23 | [rebased for systemd 255.1] | ||
24 | --- | ||
25 | src/basic/cgroup-util.c | 4 ++-- | ||
26 | src/basic/namespace-util.c | 4 ++-- | ||
27 | src/basic/procfs-util.c | 4 ++-- | ||
28 | src/basic/sysctl-util.c | 2 +- | ||
29 | src/binfmt/binfmt.c | 6 +++--- | ||
30 | src/core/cgroup.c | 2 +- | ||
31 | src/core/ipe-setup.c | 2 +- | ||
32 | src/core/main.c | 2 +- | ||
33 | src/core/smack-setup.c | 6 +++--- | ||
34 | src/home/homework.c | 2 +- | ||
35 | src/libsystemd/sd-device/sd-device.c | 2 +- | ||
36 | src/nspawn/nspawn-cgroup.c | 2 +- | ||
37 | src/nspawn/nspawn.c | 6 +++--- | ||
38 | src/shared/binfmt-util.c | 2 +- | ||
39 | src/shared/cgroup-setup.c | 12 ++++++------ | ||
40 | src/shared/coredump-util.c | 2 +- | ||
41 | src/shared/hibernate-util.c | 4 ++-- | ||
42 | src/shared/smack-util.c | 2 +- | ||
43 | src/sleep/sleep.c | 2 +- | ||
44 | src/storagetm/storagetm.c | 24 ++++++++++++------------ | ||
45 | src/vconsole/vconsole-setup.c | 2 +- | ||
46 | 21 files changed, 47 insertions(+), 47 deletions(-) | ||
47 | |||
48 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c | ||
49 | index 309dccb45a..7aec5072a0 100644 | ||
50 | --- a/src/basic/cgroup-util.c | ||
51 | +++ b/src/basic/cgroup-util.c | ||
52 | @@ -495,7 +495,7 @@ int cg_kill_kernel_sigkill(const char *path) { | ||
53 | if (r < 0) | ||
54 | return r; | ||
55 | |||
56 | - r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
57 | + r = write_string_file(killfile, "1", 0); | ||
58 | if (r < 0) | ||
59 | return log_debug_errno(r, "Failed to write to cgroup.kill for cgroup '%s': %m", path); | ||
60 | |||
61 | @@ -1721,7 +1721,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri | ||
62 | if (r < 0) | ||
63 | return r; | ||
64 | |||
65 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
66 | + return write_string_file(p, value, 0); | ||
67 | } | ||
68 | |||
69 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { | ||
70 | diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c | ||
71 | index 332e8cdfd5..804498127d 100644 | ||
72 | --- a/src/basic/namespace-util.c | ||
73 | +++ b/src/basic/namespace-util.c | ||
74 | @@ -359,12 +359,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { | ||
75 | freeze(); | ||
76 | |||
77 | xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); | ||
78 | - r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
79 | + r = write_string_file(path, uid_map, 0); | ||
80 | if (r < 0) | ||
81 | return log_debug_errno(r, "Failed to write UID map: %m"); | ||
82 | |||
83 | xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); | ||
84 | - r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
85 | + r = write_string_file(path, gid_map, 0); | ||
86 | if (r < 0) | ||
87 | return log_debug_errno(r, "Failed to write GID map: %m"); | ||
88 | |||
89 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
90 | index d7cfcd9105..58fb5918a3 100644 | ||
91 | --- a/src/basic/procfs-util.c | ||
92 | +++ b/src/basic/procfs-util.c | ||
93 | @@ -63,13 +63,13 @@ int procfs_tasks_set_limit(uint64_t limit) { | ||
94 | * decrease it, as threads-max is the much more relevant sysctl. */ | ||
95 | if (limit > pid_max-1) { | ||
96 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ | ||
97 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
98 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); | ||
99 | if (r < 0) | ||
100 | return r; | ||
101 | } | ||
102 | |||
103 | sprintf(buffer, "%" PRIu64, limit); | ||
104 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
105 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); | ||
106 | if (r < 0) { | ||
107 | uint64_t threads_max; | ||
108 | |||
109 | diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c | ||
110 | index 2feb4917d7..4c74620a00 100644 | ||
111 | --- a/src/basic/sysctl-util.c | ||
112 | +++ b/src/basic/sysctl-util.c | ||
113 | @@ -97,7 +97,7 @@ int sysctl_write_full(const char *property, const char *value, Hashmap **shadow) | ||
114 | if (r < 0) | ||
115 | return r; | ||
116 | |||
117 | - return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); | ||
118 | + return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0 | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); | ||
119 | } | ||
120 | |||
121 | int sysctl_writef(const char *property, const char *format, ...) { | ||
122 | diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c | ||
123 | index d21f3f79ff..258607cc7e 100644 | ||
124 | --- a/src/binfmt/binfmt.c | ||
125 | +++ b/src/binfmt/binfmt.c | ||
126 | @@ -30,7 +30,7 @@ static bool arg_unregister = false; | ||
127 | |||
128 | static int delete_rule(const char *rulename) { | ||
129 | const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); | ||
130 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
131 | + return write_string_file(fn, "-1", 0); | ||
132 | } | ||
133 | |||
134 | static int apply_rule(const char *filename, unsigned line, const char *rule) { | ||
135 | @@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) { | ||
136 | if (r >= 0) | ||
137 | log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); | ||
138 | |||
139 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
140 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); | ||
141 | if (r < 0) | ||
142 | return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", | ||
143 | filename, line, rulename); | ||
144 | @@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) { | ||
145 | return r; | ||
146 | |||
147 | /* Flush out all rules */ | ||
148 | - r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
149 | + r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); | ||
150 | if (r < 0) | ||
151 | log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); | ||
152 | else | ||
153 | diff --git a/src/core/cgroup.c b/src/core/cgroup.c | ||
154 | index 6933aae54d..ab6fccc0e4 100644 | ||
155 | --- a/src/core/cgroup.c | ||
156 | +++ b/src/core/cgroup.c | ||
157 | @@ -5175,7 +5175,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { | ||
158 | if (r < 0) | ||
159 | return r; | ||
160 | |||
161 | - r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
162 | + r = write_string_file(path, one_zero(objective == FREEZER_FROZEN), 0); | ||
163 | if (r < 0) | ||
164 | return r; | ||
165 | |||
166 | diff --git a/src/core/ipe-setup.c b/src/core/ipe-setup.c | ||
167 | index 4648d43829..80d03d87d4 100644 | ||
168 | --- a/src/core/ipe-setup.c | ||
169 | +++ b/src/core/ipe-setup.c | ||
170 | @@ -94,7 +94,7 @@ int ipe_setup(void) { | ||
171 | if (!activate_path) | ||
172 | return log_oom(); | ||
173 | |||
174 | - r = write_string_file(activate_path, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
175 | + r = write_string_file(activate_path, "1", 0); | ||
176 | if (r == -ESTALE) { | ||
177 | log_debug_errno(r, | ||
178 | "IPE policy %s is already loaded with a version that is equal or higher, skipping.", | ||
179 | diff --git a/src/core/main.c b/src/core/main.c | ||
180 | index 172742c769..e68ce2a6d8 100644 | ||
181 | --- a/src/core/main.c | ||
182 | +++ b/src/core/main.c | ||
183 | @@ -1826,7 +1826,7 @@ static void initialize_core_pattern(bool skip_setup) { | ||
184 | if (getpid_cached() != 1) | ||
185 | return; | ||
186 | |||
187 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
188 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); | ||
189 | if (r < 0) | ||
190 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", | ||
191 | arg_early_core_pattern); | ||
192 | diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c | ||
193 | index 7ea902b6f9..ee4cd56023 100644 | ||
194 | --- a/src/core/smack-setup.c | ||
195 | +++ b/src/core/smack-setup.c | ||
196 | @@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) { | ||
197 | } | ||
198 | |||
199 | #if HAVE_SMACK_RUN_LABEL | ||
200 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
201 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); | ||
202 | if (r < 0) | ||
203 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); | ||
204 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
205 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); | ||
206 | if (r < 0) | ||
207 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); | ||
208 | r = write_string_file("/sys/fs/smackfs/netlabel", | ||
209 | "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
210 | if (r < 0) | ||
211 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); | ||
212 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
213 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); | ||
214 | if (r < 0) | ||
215 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); | ||
216 | #endif | ||
217 | diff --git a/src/home/homework.c b/src/home/homework.c | ||
218 | index 00e74894b3..7457113efe 100644 | ||
219 | --- a/src/home/homework.c | ||
220 | +++ b/src/home/homework.c | ||
221 | @@ -304,7 +304,7 @@ static void drop_caches_now(void) { | ||
222 | * for details. We write "3" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but | ||
223 | * not more. */ | ||
224 | |||
225 | - r = write_string_file("/proc/sys/vm/drop_caches", "3\n", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
226 | + r = write_string_file("/proc/sys/vm/drop_caches", "3\n", 0); | ||
227 | if (r < 0) | ||
228 | log_warning_errno(r, "Failed to drop caches, ignoring: %m"); | ||
229 | else | ||
230 | diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c | ||
231 | index 01fa90b1ff..83ab655bf4 100644 | ||
232 | --- a/src/libsystemd/sd-device/sd-device.c | ||
233 | +++ b/src/libsystemd/sd-device/sd-device.c | ||
234 | @@ -2564,7 +2564,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, | ||
235 | if (!value) | ||
236 | return -ENOMEM; | ||
237 | |||
238 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); | ||
239 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); | ||
240 | if (r < 0) { | ||
241 | /* On failure, clear cache entry, as we do not know how it fails. */ | ||
242 | device_remove_cached_sysattr_value(device, sysattr); | ||
243 | diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c | ||
244 | index 4f28b4a225..c899c218b2 100644 | ||
245 | --- a/src/nspawn/nspawn-cgroup.c | ||
246 | +++ b/src/nspawn/nspawn-cgroup.c | ||
247 | @@ -93,7 +93,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { | ||
248 | fn = strjoina(tree, cgroup, "/cgroup.procs"); | ||
249 | |||
250 | sprintf(pid_string, PID_FMT, pid); | ||
251 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); | ||
252 | + r = write_string_file(fn, pid_string, 0|WRITE_STRING_FILE_MKDIR_0755); | ||
253 | if (r < 0) { | ||
254 | log_error_errno(r, "Failed to move process: %m"); | ||
255 | goto finish; | ||
256 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c | ||
257 | index 500725d35f..745b6815db 100644 | ||
258 | --- a/src/nspawn/nspawn.c | ||
259 | +++ b/src/nspawn/nspawn.c | ||
260 | @@ -2857,7 +2857,7 @@ static int reset_audit_loginuid(void) { | ||
261 | if (streq(p, "4294967295")) | ||
262 | return 0; | ||
263 | |||
264 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
265 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); | ||
266 | if (r < 0) { | ||
267 | log_error_errno(r, | ||
268 | "Failed to reset audit login UID. This probably means that your kernel is too\n" | ||
269 | @@ -4588,7 +4588,7 @@ static int setup_uid_map( | ||
270 | return log_oom(); | ||
271 | |||
272 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); | ||
273 | - r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
274 | + r = write_string_file(uid_map, s, 0); | ||
275 | if (r < 0) | ||
276 | return log_error_errno(r, "Failed to write UID map: %m"); | ||
277 | |||
278 | @@ -4598,7 +4598,7 @@ static int setup_uid_map( | ||
279 | return log_oom(); | ||
280 | |||
281 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); | ||
282 | - r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
283 | + r = write_string_file(uid_map, s, 0); | ||
284 | if (r < 0) | ||
285 | return log_error_errno(r, "Failed to write GID map: %m"); | ||
286 | |||
287 | diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c | ||
288 | index a26175474b..1413a9c72c 100644 | ||
289 | --- a/src/shared/binfmt-util.c | ||
290 | +++ b/src/shared/binfmt-util.c | ||
291 | @@ -46,7 +46,7 @@ int disable_binfmt(void) { | ||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | - r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
296 | + r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); | ||
297 | if (r < 0) | ||
298 | return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); | ||
299 | |||
300 | diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c | ||
301 | index 49d40f60d8..0f4aa8512a 100644 | ||
302 | --- a/src/shared/cgroup-setup.c | ||
303 | +++ b/src/shared/cgroup-setup.c | ||
304 | @@ -369,7 +369,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { | ||
305 | |||
306 | xsprintf(c, PID_FMT "\n", pid); | ||
307 | |||
308 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
309 | + r = write_string_file(fs, c, 0); | ||
310 | if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0) | ||
311 | /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ | ||
312 | return -EUCLEAN; | ||
313 | @@ -399,7 +399,7 @@ int cg_fd_attach(int fd, pid_t pid) { | ||
314 | |||
315 | xsprintf(c, PID_FMT "\n", pid); | ||
316 | |||
317 | - return write_string_file_at(fd, "cgroup.procs", c, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
318 | + return write_string_file_at(fd, "cgroup.procs", c, 0); | ||
319 | } | ||
320 | |||
321 | int cg_attach_fallback(const char *controller, const char *path, pid_t pid) { | ||
322 | @@ -1049,7 +1049,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
323 | |||
324 | sc = strstrip(contents); | ||
325 | if (isempty(sc)) { | ||
326 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
327 | + r = write_string_file(fs, agent, 0); | ||
328 | if (r < 0) | ||
329 | return r; | ||
330 | } else if (!path_equal(sc, agent)) | ||
331 | @@ -1067,7 +1067,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
332 | |||
333 | sc = strstrip(contents); | ||
334 | if (streq(sc, "0")) { | ||
335 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
336 | + r = write_string_file(fs, "1", 0); | ||
337 | if (r < 0) | ||
338 | return r; | ||
339 | |||
340 | @@ -1094,7 +1094,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
341 | if (r < 0) | ||
342 | return r; | ||
343 | |||
344 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
345 | + r = write_string_file(fs, "0", 0); | ||
346 | if (r < 0) | ||
347 | return r; | ||
348 | |||
349 | @@ -1104,7 +1104,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
350 | if (r < 0) | ||
351 | return r; | ||
352 | |||
353 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
354 | + r = write_string_file(fs, "", 0); | ||
355 | if (r < 0) | ||
356 | return r; | ||
357 | |||
358 | diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c | ||
359 | index 805503f366..3234a1d76e 100644 | ||
360 | --- a/src/shared/coredump-util.c | ||
361 | +++ b/src/shared/coredump-util.c | ||
362 | @@ -180,7 +180,7 @@ void disable_coredumps(void) { | ||
363 | if (detect_container() > 0) | ||
364 | return; | ||
365 | |||
366 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
367 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); | ||
368 | if (r < 0) | ||
369 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); | ||
370 | } | ||
371 | diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c | ||
372 | index 1213fdc2c7..4c26e6a4ee 100644 | ||
373 | --- a/src/shared/hibernate-util.c | ||
374 | +++ b/src/shared/hibernate-util.c | ||
375 | @@ -498,7 +498,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { | ||
376 | |||
377 | /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so | ||
378 | * fail gracefully if it doesn't exist and we're only overwriting it with 0. */ | ||
379 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
380 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); | ||
381 | if (r == -ENOENT) { | ||
382 | if (offset != 0) | ||
383 | return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), | ||
384 | @@ -514,7 +514,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { | ||
385 | log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.", | ||
386 | offset_str, device); | ||
387 | |||
388 | - r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
389 | + r = write_string_file("/sys/power/resume", devno_str, 0); | ||
390 | if (r < 0) | ||
391 | return log_error_errno(r, | ||
392 | "Failed to write device '%s' (%s) to /sys/power/resume: %m", | ||
393 | diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c | ||
394 | index d0a79b2635..0c82d9943a 100644 | ||
395 | --- a/src/shared/smack-util.c | ||
396 | +++ b/src/shared/smack-util.c | ||
397 | @@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { | ||
398 | return 0; | ||
399 | |||
400 | p = procfs_file_alloca(pid, "attr/current"); | ||
401 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
402 | + r = write_string_file(p, label, 0); | ||
403 | if (r < 0) | ||
404 | return r; | ||
405 | |||
406 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c | ||
407 | index 181bb4ccef..2dbb3f4bc6 100644 | ||
408 | --- a/src/sleep/sleep.c | ||
409 | +++ b/src/sleep/sleep.c | ||
410 | @@ -158,7 +158,7 @@ static int write_mode(const char *path, char * const *modes) { | ||
411 | assert(path); | ||
412 | |||
413 | STRV_FOREACH(mode, modes) { | ||
414 | - r = write_string_file(path, *mode, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
415 | + r = write_string_file(path, *mode, 0); | ||
416 | if (r >= 0) { | ||
417 | log_debug("Using sleep mode '%s' for %s.", *mode, path); | ||
418 | return 0; | ||
419 | diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c | ||
420 | index ca8e886d37..5c27c54f09 100644 | ||
421 | --- a/src/storagetm/storagetm.c | ||
422 | +++ b/src/storagetm/storagetm.c | ||
423 | @@ -197,7 +197,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) { | ||
424 | if (!enable_fn) | ||
425 | return log_oom(); | ||
426 | |||
427 | - r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
428 | + r = write_string_file_at(namespaces_fd, enable_fn, "0", 0); | ||
429 | if (r < 0) | ||
430 | log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name); | ||
431 | |||
432 | @@ -265,7 +265,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
433 | _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */ | ||
434 | |||
435 | /* The default string stored in 'attr_model' is "Linux" btw. */ | ||
436 | - r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
437 | + r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0); | ||
438 | if (r < 0) | ||
439 | log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w); | ||
440 | } | ||
441 | @@ -279,7 +279,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
442 | return log_oom(); | ||
443 | |||
444 | /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */ | ||
445 | - r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
446 | + r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0); | ||
447 | if (r < 0) | ||
448 | log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated); | ||
449 | } | ||
450 | @@ -306,7 +306,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
451 | if (!truncated) | ||
452 | return log_oom(); | ||
453 | |||
454 | - r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
455 | + r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0); | ||
456 | if (r < 0) | ||
457 | log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated); | ||
458 | } | ||
459 | @@ -356,7 +356,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co | ||
460 | id = id128_digest(j, l); | ||
461 | } | ||
462 | |||
463 | - r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
464 | + r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0); | ||
465 | if (r < 0) | ||
466 | log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id)); | ||
467 | |||
468 | @@ -419,7 +419,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi | ||
469 | if (subsystem_fd < 0) | ||
470 | return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j); | ||
471 | |||
472 | - r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
473 | + r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0); | ||
474 | if (r < 0) | ||
475 | return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m"); | ||
476 | |||
477 | @@ -434,11 +434,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi | ||
478 | |||
479 | /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others | ||
480 | * via configfs, and by including the PID it's clear to who the stuff belongs. */ | ||
481 | - r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
482 | + r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0); | ||
483 | if (r < 0) | ||
484 | return log_error_errno(r, "Failed to write 'device_path' attribute: %m"); | ||
485 | |||
486 | - r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
487 | + r = write_string_file_at(namespace_fd, "enable", "1", 0); | ||
488 | if (r < 0) | ||
489 | return log_error_errno(r, "Failed to write 'enable' attribute: %m"); | ||
490 | |||
491 | @@ -568,19 +568,19 @@ static int nvme_port_add_portnr( | ||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | - r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
496 | + r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0); | ||
497 | if (r < 0) | ||
498 | return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr); | ||
499 | |||
500 | - r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
501 | + r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0); | ||
502 | if (r < 0) | ||
503 | return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr); | ||
504 | |||
505 | - r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
506 | + r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0); | ||
507 | if (r < 0) | ||
508 | return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr); | ||
509 | |||
510 | - r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
511 | + r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0); | ||
512 | if (r < 0) | ||
513 | return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr); | ||
514 | |||
515 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c | ||
516 | index ba742dda69..6f20e81615 100644 | ||
517 | --- a/src/vconsole/vconsole-setup.c | ||
518 | +++ b/src/vconsole/vconsole-setup.c | ||
519 | @@ -277,7 +277,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { | ||
520 | static int toggle_utf8_sysfs(bool utf8) { | ||
521 | int r; | ||
522 | |||
523 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
524 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); | ||
525 | if (r < 0) | ||
526 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); | ||
527 | |||
528 | -- | ||
529 | 2.34.1 | ||
530 | |||