0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From e480d28305907c3874f4e58b722b8aa43c3ac7a2 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] Do not disable buffering when writing to oom_score_adj
  5. On musl, disabling buffering when writing to oom_score_adj will
  6. cause the following error.
  7. Failed to adjust OOM setting: Invalid argument
  8. This error appears for systemd-udevd.service and dbus.service.
  9. This is because kernel receives '-' instead of the whole '-900'
  10. if buffering is disabled.
  11. This is libc implementation specific, as glibc does not have this issue.
  12. Upstream-Status: Inappropriate [musl specific]
  13. Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
  14. [rebased for systemd 243]
  15. Signed-off-by: Scott Murray <scott.murray@konsulko.com>
  16. ---
  17. src/basic/process-util.c | 2 +-
  18. 1 file changed, 1 insertion(+), 1 deletion(-)
  19. --- a/src/basic/process-util.c
  20. +++ b/src/basic/process-util.c
  21. @@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) {
  22. xsprintf(t, "%i", value);
  23. return write_string_file("/proc/self/oom_score_adj", t,
  24. - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
  25. + WRITE_STRING_FILE_VERIFY_ON_FAILURE);
  26. }
  27. int get_oom_score_adjust(int *ret) {