Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 773d1341 authored by Wei Wang's avatar Wei Wang Committed by android-build-merger
Browse files

dumpstate: change OOM adjustment proc interface for modern kernel am: 9c1f9bb7

am: 57ebf1c0

Change-Id: I300e5d35d38bf82b26681a45512e5b7947552c8a
parents d64e6684 57ebf1c0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1136,11 +1136,19 @@ int main(int argc, char *argv[]) {

    /* set as high priority, and protect from OOM killer */
    setpriority(PRIO_PROCESS, 0, -20);
    FILE *oom_adj = fopen("/proc/self/oom_adj", "we");

    FILE *oom_adj = fopen("/proc/self/oom_score_adj", "we");
    if (oom_adj) {
        fputs("-1000", oom_adj);
        fclose(oom_adj);
    } else {
        /* fallback to kernels <= 2.6.35 */
        oom_adj = fopen("/proc/self/oom_adj", "we");
        if (oom_adj) {
            fputs("-17", oom_adj);
            fclose(oom_adj);
        }
    }

    /* parse arguments */
    std::string args;