OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The following is duplicated from base/process_utils.h. | 5 // The following is duplicated from base/process_utils.h. |
6 // We shouldn't link against C++ code in a setuid binary. | 6 // We shouldn't link against C++ code in a setuid binary. |
7 | 7 |
8 #ifndef SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ | 8 #ifndef SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ |
9 #define SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ | 9 #define SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ |
10 | 10 |
11 #include <stdbool.h> | 11 #include <stdbool.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 | 13 |
14 #include "base/base_export.h" | |
15 | |
16 // This adjusts /proc/process/oom_score_adj so the Linux OOM killer | 14 // This adjusts /proc/process/oom_score_adj so the Linux OOM killer |
17 // will prefer certain process types over others. The range for the | 15 // will prefer certain process types over others. The range for the |
18 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. | 16 // adjustment is [-1000, 1000], with [0, 1000] being user accessible. |
19 // | 17 // |
20 // If the Linux system isn't new enough to use oom_score_adj, then we | 18 // If the Linux system isn't new enough to use oom_score_adj, then we |
21 // try to set the older oom_adj value instead, scaling the score to | 19 // try to set the older oom_adj value instead, scaling the score to |
22 // the required range of [0, 15]. This may result in some aliasing of | 20 // the required range of [0, 15]. This may result in some aliasing of |
23 // values, of course. | 21 // values, of course. |
24 BASE_EXPORT bool AdjustOOMScore(pid_t process, int score); | 22 bool AdjustOOMScore(pid_t process, int score); |
25 | 23 |
26 // This adjusts /sys/kernel/mm/chromeos-low_mem/margin so that | 24 // This adjusts /sys/kernel/mm/chromeos-low_mem/margin so that |
27 // the kernel notifies us that we are low on memory when less than | 25 // the kernel notifies us that we are low on memory when less than |
28 // |margin_mb| megabytes are available. Setting |margin_mb| to -1 | 26 // |margin_mb| megabytes are available. Setting |margin_mb| to -1 |
29 // turns off low memory notification. | 27 // turns off low memory notification. |
30 BASE_EXPORT bool AdjustLowMemoryMargin(int64_t margin_mb); | 28 bool AdjustLowMemoryMargin(int64_t margin_mb); |
31 | 29 |
32 #endif // SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ | 30 #endif // SANDBOX_LINUX_SUID_PROCESS_UTIL_H_ |
OLD | NEW |