]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - resources/cpucg/mngr/frm_cgcpu.c
Merge branch 'master' of git://frsh-forb.git.sourceforge.net/gitroot/frsh-forb/frsh
[frescor/frsh.git] / resources / cpucg / mngr / frm_cgcpu.c
index 57d01195c680b902c843acd83fad6a76621c6491..f9c288b0e67fa5d0105573c0e6347957962e5610 100644 (file)
@@ -134,11 +134,17 @@ int main(int argc, char *argv[])
        int ret;
        int  opt;
        forb_init_attr_t attr = { .orb_id = "org.frescor.frm.cgcpu" };
+       bool opt_daemon = false;
+       char *opt_pidfile = NULL;
 
        ul_logreg_domain(&ulogd_frm_cpucg);
 
-       while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
+       while ((opt = getopt_long(argc, argv, "d::hl:", &long_opts[0], NULL)) != EOF) {
                switch (opt) {
+                       case 'd':
+                               opt_daemon = true;
+                               opt_pidfile = optarg;
+                               break;
                        case 'l':
                                ul_log_domain_arg2levels(optarg);
                                break;
@@ -149,6 +155,9 @@ int main(int argc, char *argv[])
                }
        }
 
+       if (opt_daemon)
+               forb_daemon_prepare(opt_pidfile);
+
        orb = forb_init(&argc, &argv, &attr);
        if (!orb) error(1, errno, "forb_init");