Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start-stop-daemon: support cpu scheduler env variable #693

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions man/start-stop-daemon.8
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ option takes precedence.
can also set the scheduling priority of the daemon, but the command line
option takes precedence.
.Pp
.Va SSD_CPUSCHEDULER
can also set the CPU scheduler of the daemon, but the command line
option takes precedence.
.Pp
.Va SSD_CPUSCHEDULER_PRIO
can also set the CPU scheduling priority of the daemon, but the command line
option takes precedence.
.Pp
.Va SSD_OOM_SCORE_ADJ
can also set the OOM score adjustment of the daemon, but the command line
option takes precedence.
Expand Down
13 changes: 13 additions & 0 deletions src/start-stop-daemon/start-stop-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,19 @@ int main(int argc, char **argv)
eerror("%s: invalid oom_score_adj `%s' (SSD_OOM_SCORE_ADJ)",
applet, tmp);

// Handle SSD_CPUSCHEDULER for scheduler type
if ((tmp = getenv("SSD_CPUSCHEDULER"))) {
scheduler = strdup(tmp);
}

// Handle SSD_CPUSCHEDULER_PRIO for scheduler priority
if ((tmp = getenv("SSD_CPUSCHEDULER_PRIO"))) {
if (sscanf(tmp, "%d", &sched_prio) != 1) {
eerror("%s: invalid scheduler priority `%s' (SSD_CPUSCHEDULER_PRIO)",
applet, tmp);
}
}

/* Get our user name and initial dir */
p = getenv("USER");
home = getenv("HOME");
Expand Down
Loading