[sheepdog] [PATCH v7 5/6] shepherd: a new cluster manager specialized for sheepdog

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Mar 11 08:54:32 CET 2013


At Mon, 11 Mar 2013 15:14:01 +0900,
MORITA Kazutaka wrote:
> 
> At Mon, 11 Mar 2013 12:48:57 +0900,
> Hitoshi Mitake wrote:
> > 
> > +
> > +static struct option const long_options[] = {
> > +	{ "port", required_argument, NULL, 'p' },
> > +	{ "address", required_argument, NULL, 'a' },
> > +	{ "foreground", no_argument, NULL, 'f' },
> > +	{ "debug", no_argument, NULL, 'd' },
> > +	{ "log-file", no_argument, NULL, 'l' },
> > +	{ "log-format", required_argument, NULL, 'F' },
> > +	{ NULL, 0, NULL, 0 },
> > +};
> 
> Please include a help option.

Thanks for your pointing. I'll add a help option and employ sd_option
for shepherd.

> 
> > +	while ((ch = getopt_long(argc, argv, short_options, long_options,
> > +				 &longindex)) >= 0) {
> > +		switch (ch) {
> > +		case 'p':
> > +			port = strtol(optarg, &p, 10);
> > +			if (p == optarg) {
> > +				fprintf(stderr, "invalid port: %s", optarg);
> 
> Missing "\n".
> 
> > +				exit(1);
> > +			}
> > +			break;
> > +		case 'a':
> > +			bindaddr = optarg;
> > +			break;
> > +		case 'f':
> > +			daemonize = false;
> > +			break;
> > +		case 'd':
> > +			log_level = SDOG_DEBUG;
> > +			break;
> > +		case 'l':
> > +			log_file = optarg;
> > +			break;
> > +		case 'F':
> > +			log_format = optarg;
> > +			break;
> > +		default:
> > +			fprintf(stderr, "unknown option");
> 
> Same here.
> 
> 
> > +			exit(1);
> > +			break;
> > +		}
> > +	}
> > +
> > +	if (daemonize) {
> > +		ret = daemon(0, 0);
> > +
> > +		if (-1 == ret) {
> > +			fprintf(stderr, "daemon() failed: %m");
> 
> And here.
> 

Sorry, I'll add the required newlines in the next series.

Thanks,
Hitoshi



More information about the sheepdog mailing list