]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
Merge branch 'master' of git://frsh-forb.git.sourceforge.net/gitroot/frsh-forb/frsh
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 21 Jan 2011 20:24:52 +0000 (21:24 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 21 Jan 2011 20:24:52 +0000 (21:24 +0100)
fres/cbroker/fcb.c
resources/cpu_aquosa/mngr/frm_aqcpu.c
resources/cpucg/mngr/frm_cgcpu.c

index b63e014971767298d9df75706a1f19ab9b9da51c..64180f0ab0557aa5a7d3c3192b259d52eb4352c2 100644 (file)
@@ -1507,7 +1507,7 @@ int main(int argc, char *argv[])
        };
        int  opt;
 
-       while ((opt = getopt_long(argc, argv, "d::l:", &long_opts[0], NULL)) != EOF) {
+       while ((opt = getopt_long(argc, argv, "d::hl:", &long_opts[0], NULL)) != EOF) {
                switch (opt) {
                        case 'l':
                                if (*optarg == '?') {
index fe657590c5126fa3a07f9ef93290ec7d76009d10..381ad70ad6b6aae5a8ec38f428303f875dccb29d 100644 (file)
@@ -116,6 +116,7 @@ static void
 usage(void)
 {
        printf("usage: frm_aqcpu [ options ]\n");
+       printf("  -d, --daemon [pid-file]   go to background after FORB initialization\n");
        printf("  -l, --loglevel <number>|<domain>=<number>,...\n");
 }
 
@@ -125,11 +126,17 @@ int main(int argc, char *argv[])
        int ret;
        forb_init_attr_t attr = { .orb_id = "org.frescor.frm.aqcpu" };
        int  opt;
+       bool opt_daemon = false;
+       char *opt_pidfile = NULL;
 
        ul_logreg_domain(&ulogd_frm_aqcpu);
 
-       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;
@@ -140,6 +147,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");
 
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");