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