logd: Add SCHED_BATCH to reduce priority
Change-Id: Id25cdef0dd7f8c5e154a0da2db2dd0554849babc
This commit is contained in:
parent
c46f77bd2a
commit
85620a1bff
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue