summaryrefslogtreecommitdiffstats
path: root/src/daemon.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
commitd4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c (patch)
treefaac99f51f182bb8c0a03e95e393d421ac9ddf42 /src/daemon.c
parentNew upstream version 1.9.0+dfsg (diff)
downloadnetdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.tar.xz
netdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.zip
New upstream version 1.10.0+dfsgupstream/1.10.0+dfsg
Diffstat (limited to 'src/daemon.c')
-rw-r--r--src/daemon.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/daemon.c b/src/daemon.c
index 5c5333a36..471c62c6e 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -121,10 +121,10 @@ int become_user(const char *username, int pid_fd) {
}
#ifndef OOM_SCORE_ADJ_MAX
-#define OOM_SCORE_ADJ_MAX 1000
+#define OOM_SCORE_ADJ_MAX (1000)
#endif
#ifndef OOM_SCORE_ADJ_MIN
-#define OOM_SCORE_ADJ_MIN -1000
+#define OOM_SCORE_ADJ_MIN (-1000)
#endif
static void oom_score_adj(void) {
@@ -265,6 +265,7 @@ static void sched_setscheduler_set(void) {
for(i = 0 ; scheduler_defaults[i].name ; i++) {
if(!strcmp(name, scheduler_defaults[i].name)) {
found = 1;
+ policy = scheduler_defaults[i].policy;
priority = scheduler_defaults[i].priority;
flags = scheduler_defaults[i].flags;
@@ -275,14 +276,16 @@ static void sched_setscheduler_set(void) {
priority = (int)config_get_number(CONFIG_SECTION_GLOBAL, "process scheduling priority", priority);
#ifdef HAVE_SCHED_GET_PRIORITY_MIN
+ errno = 0;
if(priority < sched_get_priority_min(policy)) {
- error("scheduler %s priority %d is below the minimum %d. Using the minimum.", name, priority, sched_get_priority_min(policy));
+ error("scheduler %s (%d) priority %d is below the minimum %d. Using the minimum.", name, policy, priority, sched_get_priority_min(policy));
priority = sched_get_priority_min(policy);
}
#endif
#ifdef HAVE_SCHED_GET_PRIORITY_MAX
+ errno = 0;
if(priority > sched_get_priority_max(policy)) {
- error("scheduler %s priority %d is above the maximum %d. Using the maximum.", name, priority, sched_get_priority_max(policy));
+ error("scheduler %s (%d) priority %d is above the maximum %d. Using the maximum.", name, policy, priority, sched_get_priority_max(policy));
priority = sched_get_priority_max(policy);
}
#endif
@@ -291,7 +294,7 @@ static void sched_setscheduler_set(void) {
}
if(!found) {
- error("Unknown scheduling policy %s - falling back to nice()", name);
+ error("Unknown scheduling policy '%s' - falling back to nice", name);
goto fallback;
}
@@ -299,12 +302,13 @@ static void sched_setscheduler_set(void) {
.sched_priority = priority
};
+ errno = 0;
i = sched_setscheduler(0, policy, &param);
if(i != 0) {
- error("Cannot adjust netdata scheduling policy to %s (%d), with priority %d. Falling back to nice", name, policy, priority);
+ error("Cannot adjust netdata scheduling policy to %s (%d), with priority %d. Falling back to nice.", name, policy, priority);
}
else {
- debug(D_SYSTEM, "Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority);
+ info("Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority);
if(!(flags & SCHED_FLAG_USE_NICE))
return;
}