blob: da56d8b4b61e5a9cc71af0b1f9c09e444aef7829 [file] [log] [blame]
Andrew Geisslerd5838332022-05-27 11:33:10 -05001From e480d28305907c3874f4e58b722b8aa43c3ac7a2 Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 4 Jul 2018 15:00:44 +0800
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
Brad Bishop19323692019-04-05 15:28:33 -04005
6On musl, disabling buffering when writing to oom_score_adj will
7cause the following error.
8
9 Failed to adjust OOM setting: Invalid argument
10
11This error appears for systemd-udevd.service and dbus.service.
12This is because kernel receives '-' instead of the whole '-900'
13if buffering is disabled.
14
15This is libc implementation specific, as glibc does not have this issue.
16
17Upstream-Status: Inappropriate [musl specific]
18
19Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Brad Bishopa34c0302019-09-23 22:34:48 -040020[rebased for systemd 243]
21Signed-off-by: Scott Murray <scott.murray@konsulko.com>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070022
Brad Bishop19323692019-04-05 15:28:33 -040023---
24 src/basic/process-util.c | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
Andrew Geisslerd1e89492021-02-12 15:35:20 -060027--- a/src/basic/process-util.c
28+++ b/src/basic/process-util.c
Andrew Geissler517393d2023-01-13 08:55:19 -060029@@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) {
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000030 xsprintf(t, "%i", value);
Brad Bishop19323692019-04-05 15:28:33 -040031
32 return write_string_file("/proc/self/oom_score_adj", t,
33- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
34+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
35 }
36
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000037 int get_oom_score_adjust(int *ret) {