From 75ef36713a75bc46faf5b92a4442869ef6999c3a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 28 Aug 2013 12:40:20 +0100 Subject: [PATCH] overlay: Make it easier to renice Signed-off-by: Chris Wilson --- overlay/overlay.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/overlay/overlay.c b/overlay/overlay.c index 55c2aa3..6513786 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -774,13 +774,13 @@ int main(int argc, char **argv) struct overlay_context ctx; struct config config; int index, sample_period; - int daemonize = 1; + int daemonize = 1, renice = 0; int i; config_init(&config); opterr = 0; - while ((i = getopt_long(argc, argv, "c:f", long_options, &index)) != -1) { + while ((i = getopt_long(argc, argv, "c:fn?", long_options, &index)) != -1) { switch (i) { case 'c': config_parse_string(&config, optarg); @@ -797,6 +797,11 @@ int main(int argc, char **argv) case 'f': daemonize = 0; break; + case 'n': + renice = -20; + if (optarg) + renice = atoi(optarg); + break; } } @@ -820,6 +825,9 @@ int main(int argc, char **argv) if (daemonize && daemon(0, 0)) return EINVAL; + if (renice) + nice(renice); + signal(SIGUSR1, signal_snapshot); debugfs_init(); -- 2.7.4