This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] libxen-3.0 (libxc rewrite)

Christian Limpach wrote:

You mean like using `%m' in your format string to syslog(3)?
'%m' is a GNU extension.

While most other people's test code would look like this:

domid = dom_create_domain(3000, 0);
if (domid < 0)
 err(1, "dom_create_domain");

I claim that this is what more people are used to since most libraries
support this interface, i.e. return _value_ with documented specific
error values, failure condition in errno and error reporting using one
of the various standard functions.
There seems to be wide consensus on this one though and I don't seem to have the popular opinion. So perhaps we can comprimise. What about:

1) Have most functions return an integer. An error is indicated if the return is < 0. In the event of an error, the function will return -errno but make sure to set errno properly.

2) For functions that want to return addresses, they can do so and return NULL on error. Since all functions set errno properly, errno will have to be used for extended error conditions on these functions.

This should make everyone happy. Your code will work just fine and an application developer can avoid using errno. Thoughts?

Anthony Liguori


This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>