salimma / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone
99043cc
From b6570de4b8a1195a3f1e5a412909f9c3e454d250 Mon Sep 17 00:00:00 2001
99043cc
From: Kay Sievers <kay@vrfy.org>
99043cc
Date: Mon, 4 Jun 2012 16:41:10 +0200
99043cc
Subject: [PATCH] remove support for deprecated /proc/self/oom_adj (cherry
99043cc
 picked from commit
99043cc
 8600c525cb1420570e7670c963abd19c5696b683)
99043cc
99043cc
---
99043cc
 src/core/dbus-execute.c |    8 --------
99043cc
 src/core/execute.c      |   19 +++----------------
99043cc
 2 files changed, 3 insertions(+), 24 deletions(-)
99043cc
99043cc
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
99043cc
index 1812e61..49040d9 100644
99043cc
--- a/src/core/dbus-execute.c
99043cc
+++ b/src/core/dbus-execute.c
99043cc
@@ -83,14 +83,6 @@ int bus_execute_append_oom_score_adjust(DBusMessageIter *i, const char *property
99043cc
                 if (read_one_line_file("/proc/self/oom_score_adj", &t) >= 0) {
99043cc
                         safe_atoi(t, &n);
99043cc
                         free(t);
99043cc
-                } else if (read_one_line_file("/proc/self/oom_adj", &t) >= 0) {
99043cc
-                        safe_atoi(t, &n);
99043cc
-                        free(t);
99043cc
-
99043cc
-                        if (n == OOM_ADJUST_MAX)
99043cc
-                                n = OOM_SCORE_ADJ_MAX;
99043cc
-                        else
99043cc
-                                n = (n * OOM_SCORE_ADJ_MAX) / -OOM_DISABLE;
99043cc
                 }
99043cc
         }
99043cc
 
99043cc
diff --git a/src/core/execute.c b/src/core/execute.c
99043cc
index 688ec4b..a5e857d 100644
99043cc
--- a/src/core/execute.c
99043cc
+++ b/src/core/execute.c
99043cc
@@ -1129,22 +1129,9 @@ int exec_spawn(ExecCommand *command,
99043cc
                         char_array_0(t);
99043cc
 
99043cc
                         if (write_one_line_file("/proc/self/oom_score_adj", t) < 0) {
99043cc
-                                /* Compatibility with Linux <= 2.6.35 */
99043cc
-
99043cc
-                                int adj;
99043cc
-
99043cc
-                                adj = (context->oom_score_adjust * -OOM_DISABLE) / OOM_SCORE_ADJ_MAX;
99043cc
-                                adj = CLAMP(adj, OOM_DISABLE, OOM_ADJUST_MAX);
99043cc
-
99043cc
-                                snprintf(t, sizeof(t), "%i", adj);
99043cc
-                                char_array_0(t);
99043cc
-
99043cc
-                                if (write_one_line_file("/proc/self/oom_adj", t) < 0
99043cc
-                                    && errno != EACCES) {
99043cc
-                                        err = -errno;
99043cc
-                                        r = EXIT_OOM_ADJUST;
99043cc
-                                        goto fail_child;
99043cc
-                                }
99043cc
+                                err = -errno;
99043cc
+                                r = EXIT_OOM_ADJUST;
99043cc
+                                goto fail_child;
99043cc
                         }
99043cc
                 }
99043cc