aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Whitlock <gentoo@mattwhitlock.name>2021-07-31 17:13:21 -0400
committerMike Frysinger <vapier@gmail.com>2021-08-17 00:57:47 -0400
commit5f6d7ac028b4e3c208a74465c54f235d5bf34a93 (patch)
tree9c142c5534cdd1d8a56d6ae877a35683519054e4 /src
parent7cedc4942b8e52d9bab6f4aa7bb595c53aa6fdb1 (diff)
supervise-daemon: implement SSD_IONICELEVEL
supervise-daemon was apparently overlooked when support for the SSD_IONICELEVEL environment variable was added. This commit brings supervise-daemon up to parity with start-stop-daemon with respect to this environment variable.
Diffstat (limited to 'src')
-rw-r--r--src/rc/supervise-daemon.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index fcd76c10..6e2b4331 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -423,7 +423,8 @@ static void child_process(char *exec, char **argv)
if ((strncmp(env->value, "RC_", 3) == 0 &&
strncmp(env->value, "RC_SERVICE=", 11) != 0 &&
strncmp(env->value, "RC_SVCNAME=", 11) != 0) ||
- strncmp(env->value, "SSD_NICELEVEL=", 14) == 0)
+ strncmp(env->value, "SSD_NICELEVEL=", 14) == 0 ||
+ strncmp(env->value, "SSD_IONICELEVEL=", 16) == 0)
{
p = strchr(env->value, '=');
*p = '\0';
@@ -733,6 +734,17 @@ int main(int argc, char **argv)
if (sscanf(tmp, "%d", &nicelevel) != 1)
eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)",
applet, tmp);
+ if ((tmp = getenv("SSD_IONICELEVEL"))) {
+ int n = sscanf(tmp, "%d:%d", &ionicec, &ioniced);
+ if (n != 1 && n != 2)
+ eerror("%s: invalid ionice level `%s' (SSD_IONICELEVEL)",
+ applet, tmp);
+ if (ionicec == 0)
+ ioniced = 0;
+ else if (ionicec == 3)
+ ioniced = 7;
+ ionicec <<= 13; /* class shift */
+ }
/* Get our user name and initial dir */
p = getenv("USER");