[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 15/10/12 10:35, Ian Campbell wrote:
> 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?

Yes.

>> +        exit(1);
>> +    }
>> +    xc_wallclock_sync(xch);
> 
> Worth logging if this fails?

Yes.

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

Yes.

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

David

_______________________________________________
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®.