Skip to content
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be added to supervise-deamon for consistency.

.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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why strdup?

Copy link
Contributor

@N-R-K N-R-K Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The  implementation  of  getenv() is not required to be reentrant.  The string pointed to by the return value of getenv() may be statically allocated,
and can be modified by a subsequent call to getenv(), putenv(3), setenv(3), or unsetenv(3).

Okay, I see.

}

// 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