From 56ba4b5b77879f43541cd47c59176acea2d8dcc6 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 30 Jan 2015 15:19:48 -0800 Subject: [PATCH] logd: logd placed into background cgroup Change-Id: I38d7be05ab77fc944a9dbef2b6575d4caa920d08 --- logd/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/logd/main.cpp b/logd/main.cpp index 946a9a0f7..7a1ae54f9 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "private/android_filesystem_config.h" #include "CommandListener.h" @@ -69,6 +70,10 @@ static int drop_privs() { struct sched_param param; memset(¶m, 0, sizeof(param)); + if (set_sched_policy(0, SP_BACKGROUND) < 0) { + return -1; + } + if (sched_setscheduler((pid_t) 0, SCHED_BATCH, ¶m) < 0) { return -1; }