[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 7/7] tools/livepatch: Exit with 2 if a timeout occurs
On Mon, Dec 12, 2016 at 04:18:10PM +0000, Ross Lagerwall wrote: > Exit with 0 for success. > Exit with 1 for an error. > Exit with 2 if the operation should be retried for any reason (e.g. a > timeout or because another operation was in progress). > > This allows a program or script driving xen-livepatch to determine if > the operation should be retried without parsing the output. > > Fix a number of incorrect uses of errno after an operation that could > set it (e.g. fprintf, close). This should probably be split out to another patch so that it can be backported to 4.7 and 4.8? > { > @@ -485,7 +490,24 @@ int main(int argc, char *argv[]) > > xc_interface_close(xch); > > - return !!ret; > + /* > + * Exitcode 0 for success. > + * Exitcode 1 for an error. > + * Exitcode 2 if the operation should be retried for any reason (e.g. a > + * timeout or because another operation was in progress). > + */ > + > +#define EXIT_TIMEOUT (EXIT_FAILURE + 1) I doubt there would be any other value used for EXIT_FAILURE, but to make sure the code matches the comment, please: BUILD_BUG_ON(EXIT_SUCCESS != 0); BUILD_BUG_ON(EXIT_FAILURE != 1); > + switch ( ret ) > + { > + case 0: > + return EXIT_SUCCESS; > + case EAGAIN: > + case EBUSY: > + return EXIT_TIMEOUT; > + default: > + return EXIT_FAILURE; > + } > } > > /* > -- > 2.7.4 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |