Signed-off-by: Vasiliy Tolstov <[email protected]>
---
 sheep/sheep.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index fc53ec9..58097ef 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -134,6 +134,7 @@ static struct sd_option sheep_options[] = {
         "specify the cluster driver (default: "DEFAULT_CLUSTER_DRIVER")",
         cluster_help},
        {'D', "directio", false, "use direct IO for backend store"},
+       {'f', "foreground", false, "make the program run in foreground"},
        {'g', "gateway", false, "make the program run as a gateway mode"},
        {'h', "help", false, "display this help and exit"},
        {'i', "ioaddr", true, "use separate network card to handle IO requests"
@@ -661,6 +662,7 @@ int main(int argc, char **argv)
        char *dir, *p, *pid_file = NULL, *bindaddr = NULL, log_path[PATH_MAX],
             *argp = NULL;
        bool explicit_addr = false;
+       bool foreground = false;
        int32_t nr_vnodes = -1;
        int64_t zone = -1;
        struct cluster_driver *cdrv;
@@ -718,6 +720,9 @@ int main(int argc, char **argv)
                case 'D':
                        sys->backend_dio = true;
                        break;
+               case 'f':
+                       foreground = true;
+                       break;
                case 'g':
                        if (nr_vnodes > 0) {
                                sd_err("Options '-g' and '-V' can not be both 
specified");
@@ -905,7 +910,10 @@ int main(int argc, char **argv)
 
        srandom(port);
 
-       if (lock_and_daemon(log_dst_type != LOG_DST_STDOUT, dir)) {
+       if (!foreground && log_dst_type == LOG_DST_STDOUT)
+               foreground = false;
+
+       if (lock_and_daemon(foreground, dir)) {
                free(argp);
                goto cleanup_dir;
        }
-- 
2.2.2

-- 
sheepdog mailing list
[email protected]
https://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to