diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-25 15:17:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-25 15:18:39 +0100 |
commit | 39f9812315546b8b5044d8372c7e9c3055151882 (patch) | |
tree | 1e19cf508a19d28fff3f7ad54a572bc7d4a2f402 /overlay | |
parent | d929102591b25c1e9bf95ee58d95f86869e268fd (diff) |
overlay: Detach from terminal
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/overlay.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/overlay/overlay.c b/overlay/overlay.c index a1d21df0..67c4a86c 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -734,12 +734,13 @@ int main(int argc, char **argv) struct overlay_context ctx; struct config config; int index, sample_period; + int daemonize = 1; int i; config_init(&config); opterr = 0; - while ((i = getopt_long(argc, argv, "c:", long_options, &index)) != -1) { + while ((i = getopt_long(argc, argv, "c:f", long_options, &index)) != -1) { switch (i) { case 'c': config_parse_string(&config, optarg); @@ -750,6 +751,9 @@ int main(int argc, char **argv) case 'P': config_set_value(&config, "window", "position", optarg); break; + case 'f': + daemonize = 0; + break; } } @@ -770,6 +774,9 @@ int main(int argc, char **argv) if (ctx.surface == NULL) return ENOMEM; + if (daemonize && daemon(0, 0)) + return EINVAL; + signal(SIGUSR1, signal_snapshot); debugfs_init(); |