system/corennnnn
修订版 | a61755e5fca065dfc89c7639bb672c20a4f9854e (tree) |
---|---|
时间 | 2009-05-21 08:21:29 |
作者 | Android (Google) Code Review <android-gerrit@goog...> |
Commiter | Android (Google) Code Review |
Merge change 2077 into donut
* changes:
@@ -818,19 +818,6 @@ int adb_main(int is_daemon) | ||
818 | 818 | #if !ADB_HOST |
819 | 819 | int secure = 0; |
820 | 820 | char value[PROPERTY_VALUE_MAX]; |
821 | - | |
822 | - // prevent the OOM killer from killing us | |
823 | - char text[64]; | |
824 | - snprintf(text, sizeof text, "/proc/%d/oom_adj", (int)getpid()); | |
825 | - int fd = adb_open(text, O_WRONLY); | |
826 | - if (fd >= 0) { | |
827 | - // -17 should make us immune to OOM | |
828 | - snprintf(text, sizeof text, "%d", -17); | |
829 | - adb_write(fd, text, strlen(text)); | |
830 | - adb_close(fd); | |
831 | - } else { | |
832 | - D("adb: unable to open %s\n", text); | |
833 | - } | |
834 | 821 | #endif |
835 | 822 | |
836 | 823 | atexit(adb_cleanup); |
@@ -244,6 +244,18 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1 | ||
244 | 244 | cmd, strerror(errno), errno); |
245 | 245 | exit(-1); |
246 | 246 | } else { |
247 | +#if !ADB_HOST | |
248 | + // set child's OOM adjustment to zero | |
249 | + char text[64]; | |
250 | + snprintf(text, sizeof text, "/proc/%d/oom_adj", pid); | |
251 | + int fd = adb_open(text, O_WRONLY); | |
252 | + if (fd >= 0) { | |
253 | + adb_write(fd, "0", 1); | |
254 | + adb_close(fd); | |
255 | + } else { | |
256 | + D("adb: unable to open %s\n", text); | |
257 | + } | |
258 | +#endif | |
247 | 259 | return ptm; |
248 | 260 | } |
249 | 261 | #endif /* !HAVE_WIN32_PROC */ |