From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DA40513832E for ; Tue, 26 Jul 2016 17:32:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1C9521C012; Tue, 26 Jul 2016 17:32:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 845DE21C012 for ; Tue, 26 Jul 2016 17:32:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1CE5E340C20 for ; Tue, 26 Jul 2016 17:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 565707D5 for ; Tue, 26 Jul 2016 17:32:41 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1469554239.94b98430cb83a8f4e62d837100fc357e9eb12ca6.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: man/, src/rc/, etc/ X-VCS-Repository: proj/openrc X-VCS-Files: etc/rc.conf man/start-stop-daemon.8 src/rc/start-stop-daemon.c X-VCS-Directories: etc/ src/rc/ man/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 94b98430cb83a8f4e62d837100fc357e9eb12ca6 X-VCS-Branch: master Date: Tue, 26 Jul 2016 17:32:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bf61c9c9-1b1c-4631-980e-7ad054558254 X-Archives-Hash: ff922932962a87b730fe5493160d2f7c commit: 94b98430cb83a8f4e62d837100fc357e9eb12ca6 Author: Kenneth Lakin gmail com> AuthorDate: Tue Nov 3 11:33:06 2015 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue Jul 26 17:30:39 2016 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=94b98430 start-stop-daemon: Add SSD_IONICELEVEL This is the disk IO counterpart to SSD_NICELEVEL. Modified by William Hubbs to add the variable to the start-stop-daemon man page. This fixes #69. etc/rc.conf | 3 +++ man/start-stop-daemon.8 | 4 ++++ src/rc/start-stop-daemon.c | 14 +++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/etc/rc.conf b/etc/rc.conf index 80f68dd..cbb660a 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -117,6 +117,9 @@ # Some daemons are started and stopped via start-stop-daemon. # We can set some things on a per service basis, like the nicelevel. #SSD_NICELEVEL="-19" +# Or the ionice level. The format is class[:data] , just like the +# --ionice start-stop-daemon parameter. +#SSD_IONICELEVEL="2:2" # Pass ulimit parameters # If you are using bash in POSIX mode for your shell, note that the diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8 index c328895..112cd5f 100644 --- a/man/start-stop-daemon.8 +++ b/man/start-stop-daemon.8 @@ -153,6 +153,10 @@ The retry specification can be either a timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5). .El .Sh ENVIRONMENT +.Va SSD_IONICELEVEL +can also set the IO scheduling priority of the daemon, but the command line +option takes precedence. +.Pp .Va SSD_NICELEVEL can also set the scheduling priority of the daemon, but the command line option takes precedence. diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 27939c2..188169f 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -696,6 +696,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"); @@ -1195,7 +1206,8 @@ int main(int argc, char **argv) if ((strncmp(env->value, "RC_", 3) == 0 && strncmp(env->value, "RC_SERVICE=", 10) != 0 && strncmp(env->value, "RC_SVCNAME=", 10) != 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';