[sheepdog] [PATCH v2] add foreground option

Liu Yuan namei.unix at gmail.com
Wed Mar 25 03:13:02 CET 2015


On Wed, Mar 18, 2015 at 06:07:49PM +0300, Vasiliy Tolstov wrote:
> Signed-off-by: Vasiliy Tolstov <v.tolstov at selfip.ru>
> ---
>  sheep/sheep.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index fc53ec9..86444b0 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 daemonize = true;
>  	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':
> +			daemonize = false;
> +			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 (daemonize && log_dst_type == LOG_DST_STDOUT)
> +		daemonize = false;
> +
> +	if (lock_and_daemon(daemonize, dir)) {
>  		free(argp);
>  		goto cleanup_dir;
>  	}
> -- 
> 2.2.2
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog

foreground was removed by following commit:


commit 275dcf916ed0a4a61a755654c2ed3072ab2059af
Author: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Date:   Mon Jan 20 13:09:28 2014 +0900

    logger: add a unified log destination option and syslog support
    
    This patch adds a new parameter "dst=" to the "-l" option for
    specifying logging destination. Possible parameters are below:
    - default: a dedicated file under sheep's directory
    - syslog: standard syslog
    - stdout: standard output
    
    In addition, this patch removes "-o" option and "-f" option, previous
    options for logging with stdout and let sheep run as a foreground
    process. Now it is replaced with "-l dst=stdout".
    
    Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
    Signed-off-by: Liu Yuan <namei.unix at gmail.com>

-----------------------------------------------------------------------

If you just want to see log in stdout, you can try -l dst=stdout'. Any other
reason to bring this back?

Thanks,
Yuan



More information about the sheepdog mailing list