From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 2/2] tools/misc: add xen-wallclock command Date: Mon, 15 Oct 2012 13:25:10 +0100 Message-ID: <507C00A6.3020001@citrix.com> References: <1350046970-2591-1-git-send-email-david.vrabel@citrix.com> <1350046970-2591-3-git-send-email-david.vrabel@citrix.com> <1350293719.18058.13.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1350293719.18058.13.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org 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