diff options
author | Mark Salyzyn <salyzyn@google.com> | 2013-12-26 15:13:36 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-02-26 09:55:03 -0800 |
commit | 882f856668331488d9bbaec429de7aac5d7978c9 (patch) | |
tree | 94f0adea893204241992d01898150048a4e17e95 /logd | |
parent | c03e72cc1c155ff668df8df1caec363b07347d0d (diff) | |
download | system_core-882f856668331488d9bbaec429de7aac5d7978c9.zip system_core-882f856668331488d9bbaec429de7aac5d7978c9.tar.gz system_core-882f856668331488d9bbaec429de7aac5d7978c9.tar.bz2 |
logd: Add SCHED_BATCH to reduce priority
(cherry picked from commit 85620a1bfff1824687fd1cb14c8e1a9b2683c061)
Change-Id: Id25cdef0dd7f8c5e154a0da2db2dd0554849babc
Diffstat (limited to 'logd')
-rw-r--r-- | logd/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/logd/main.cpp b/logd/main.cpp index 667e5bb..1891206 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -17,6 +17,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <sched.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -32,6 +33,13 @@ #include "LogListener.h" static int drop_privs() { + struct sched_param param; + memset(¶m, 0, sizeof(param)); + + if (sched_setscheduler((pid_t) 0, SCHED_BATCH, ¶m) < 0) { + return -1; + } + if (prctl(PR_SET_KEEPCAPS, 1) < 0) { return -1; } |