From 284f07bd9d90386525abde6832e29c5539cd3c4d Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 17 Nov 2016 10:32:16 -0800 Subject: [PATCH] Remove dead code. At this point, we can't write to oom_score_adj anyway. Bug: https://code.google.com/p/android/issues/detail?id=227721 Test: boots, adb shell still works Change-Id: I07e6ad32765f6582f316973547a3a3d552808287 --- adb/shell_service.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp index e2b388bf3..4975fab99 100644 --- a/adb/shell_service.cpp +++ b/adb/shell_service.cpp @@ -106,20 +106,6 @@ namespace { -void init_subproc_child() -{ - setsid(); - - // Set OOM score adjustment to prevent killing - int fd = adb_open("/proc/self/oom_score_adj", O_WRONLY | O_CLOEXEC); - if (fd >= 0) { - adb_write(fd, "0", 1); - adb_close(fd); - } else { - D("adb: unable to update oom_score_adj"); - } -} - // Reads from |fd| until close or failure. std::string ReadAll(int fd) { char buffer[512]; @@ -316,7 +302,7 @@ bool Subprocess::ForkAndExec(std::string* error) { if (pid_ == 0) { // Subprocess child. - init_subproc_child(); + setsid(); if (type_ == SubprocessType::kPty) { child_stdinout_sfd.reset(OpenPtyChildFd(pts_name, &child_error_sfd));