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

Commit 7d716902 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

Change-Id: Iaddcad2ac045e5f0ecb37ab3db6439f578804da9
parents 0da11044 9c1f9bb7
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1121,11 +1121,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;