summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 19:28:16 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-29 19:28:16 +0000
commitccd3e14531792b2479519272f47791e31ce2b3d2 (patch)
treed40aaf85218e97aa4defe8353b01f3e8aa20678d /sandbox
parentffbd023749d89bd737ec1d0a8d3f9385c95c1a78 (diff)
downloadchromium_src-ccd3e14531792b2479519272f47791e31ce2b3d2.zip
chromium_src-ccd3e14531792b2479519272f47791e31ce2b3d2.tar.gz
chromium_src-ccd3e14531792b2479519272f47791e31ce2b3d2.tar.bz2
cros: Remove unused low memory margin code from sandbox and zygote
This code is unused - it was probably added long ago when we were trying to figure out the correct value for the memory margin. Removing it will make it easier to remove the setuid sandbox. BUG=312388 TEST=compiles, usual browser_tests R=jln@chromium.org TBR=joi@chromium.org for removing an unused method from content/public/browser/zygote_host_linux.h Review URL: https://codereview.chromium.org/49843002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/linux/suid/common/sandbox.h3
-rw-r--r--sandbox/linux/suid/process_util_linux.c31
-rw-r--r--sandbox/linux/suid/sandbox.c10
3 files changed, 0 insertions, 44 deletions
diff --git a/sandbox/linux/suid/common/sandbox.h b/sandbox/linux/suid/common/sandbox.h
index aad4ff8..9345287 100644
--- a/sandbox/linux/suid/common/sandbox.h
+++ b/sandbox/linux/suid/common/sandbox.h
@@ -12,9 +12,6 @@ namespace sandbox {
// These are command line switches that may be used by other programs
// (e.g. Chrome) to construct a command line for the sandbox.
static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score";
-#if defined(OS_CHROMEOS)
-static const char kAdjustLowMemMarginSwitch[] = "--adjust-low-mem";
-#endif
static const char kSandboxDescriptorEnvironmentVarName[] = "SBX_D";
static const char kSandboxHelperPidEnvironmentVarName[] = "SBX_HELPER_PID";
diff --git a/sandbox/linux/suid/process_util_linux.c b/sandbox/linux/suid/process_util_linux.c
index 5e6b33b..78c27ef 100644
--- a/sandbox/linux/suid/process_util_linux.c
+++ b/sandbox/linux/suid/process_util_linux.c
@@ -24,10 +24,6 @@
static const int kMaxOomScore = 1000;
static const int kMaxOldOomScore = 15;
-// Kernel pseudo-file that allows setting of the low memory margin.
-static const char kLowMemMarginFile[] =
- "/sys/kernel/mm/chromeos-low_mem/margin";
-
// NOTE: This is not the only version of this function in the source:
// the base library (in process_util_linux.cc) also has its own C++ version.
bool AdjustOOMScore(pid_t process, int score) {
@@ -77,30 +73,3 @@ bool AdjustOOMScore(pid_t process, int score) {
close(fd);
return (bytes_written == len);
}
-
-bool AdjustLowMemoryMargin(int64_t margin_mb) {
- int file_descriptor = open(kLowMemMarginFile, O_WRONLY);
- if (file_descriptor < 0)
- return false;
-
- // Only allow those values which are reasonable, to prevent mischief.
- char value[21];
- switch (margin_mb) {
- case -1L:
- snprintf(value, sizeof(value), "off");
- break;
- case 0L:
- case 25L:
- case 50L:
- case 100L:
- case 200L:
- snprintf(value, sizeof(value), "%lld", (long long int)margin_mb);
- break;
- default:
- return false;
- }
-
- bool success = (write(file_descriptor, value, strlen(value)) >= 0);
- close(file_descriptor);
- return success;
-}
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c
index 32435a7..a161e19 100644
--- a/sandbox/linux/suid/sandbox.c
+++ b/sandbox/linux/suid/sandbox.c
@@ -450,16 +450,6 @@ int main(int argc, char **argv) {
return 1;
return AdjustOOMScore(pid, score);
}
-#if defined(OS_CHROMEOS)
- if (argc == 3 && (0 == strcmp(argv[1], kAdjustLowMemMarginSwitch))) {
- char* endptr = NULL;
- errno = 0;
- unsigned long margin_mb = strtoul(argv[2], &endptr, 10);
- if (!endptr || *endptr || errno != 0)
- return 1;
- return AdjustLowMemoryMargin(margin_mb);
- }
-#endif
// Protect the core setuid sandbox functionality with an API version
if (!CheckAndExportApiVersion()) {