[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] tools/misc: add xen-wallclock command



On Fri, 2012-10-12 at 14:02 +0100, David Vrabel wrote:
> +int main(int argc, char *argv[])
> +{
> +    const static char sopts[] = "w";
> +    const static struct option lopts[] = {
> +        { "help", 0, NULL, 0 },
> +        { "systowc", 0, NULL, 'w' },
> +        { 0, 0, NULL, 0 },
> +    };
> +    int opt, opt_idx;
> +
> +    int systowc = 0;
> +    xc_interface *xch;
> +
> +    exe_name = argv[0];
> +
> +    while ( (opt = getopt_long(argc, argv, sopts, lopts, &opt_idx)) != -1 )
> +    {
> +        switch ( opt )
> +        {
> +        case 'w':
> +            systowc = 1;
> +            break;
> +        case 0:
> +            switch (opt_idx)
> +            {
> +            case 0:
> +                help();
> +            }
> +            break;
> +        default:
> +            usage(stderr);
> +            exit(1);
> +        }
> +    }
> +
> +    /* Valid combination of options? i.e., --systowc */
> +    if (!systowc)
> +    {
> +        usage(stderr);
> +        exit(1);
> +    }
> +
> +    xch = xc_interface_open(NULL, NULL, 0);
> +    if (xch == NULL)
> +    {

I forget: Does xc_interface_open log on error?

> +        exit(1);
> +    }
> +    xc_wallclock_sync(xch);

Worth logging if this fails?

I suppose we want to hold off on this and the first patch until the
Linux side is agreed and committed?

> +    xc_interface_close(xch);
> +
> +    return 0;
> +}



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.