Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From bb28a9c870bb47dcdb1ccebaa8e3a5a86730a244 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
| 3 | Date: Wed, 4 Jul 2018 15:00:44 +0800 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 4 | Subject: [PATCH] Do not disable buffering when writing to oom_score_adj |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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> |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 20 | [rebased for systemd 243] |
| 21 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 23 | --- |
| 24 | src/basic/process-util.c | 2 +- |
| 25 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 26 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 27 | Index: systemd-stable/src/basic/process-util.c |
| 28 | =================================================================== |
| 29 | --- systemd-stable.orig/src/basic/process-util.c |
| 30 | +++ systemd-stable/src/basic/process-util.c |
| 31 | @@ -1536,7 +1536,7 @@ int set_oom_score_adjust(int value) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 32 | sprintf(t, "%i", value); |
| 33 | |
| 34 | return write_string_file("/proc/self/oom_score_adj", t, |
| 35 | - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); |
| 36 | + WRITE_STRING_FILE_VERIFY_ON_FAILURE); |
| 37 | } |
| 38 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 39 | int pidfd_get_pid(int fd, pid_t *ret) { |