WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Anthony Liguori <aliguori@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxen-3.0 (libxc rewrite)
From: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Date: Tue, 22 Mar 2005 16:01:46 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 22 Mar 2005 16:03:26 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4240340F.8080600@xxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
References: <423F3BB5.3020600@xxxxxxxxxx> <3d8eece2050322030245ed31b@xxxxxxxxxxxxxx> <4240340F.8080600@xxxxxxxxxx>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Tue, Mar 22, 2005 at 09:04:47AM -0600, Anthony Liguori wrote:
> Christian Limpach wrote:
> >On Mon, 21 Mar 2005 15:25:09 -0600, Anthony Liguori <aliguori@xxxxxxxxxx> 
> >wrote:
> >>o Provide consistent error semantics for all functions (-errno is
> >>returned on error).
> >Why -errno?  What's wrong with regular errno, like used everywhere
> >else in userspace?
> >
> errno's a global variable and it's way to easy to lose it's value.  For 
> instance:
> 
> if (read(fd, buffer, sizeof(buffer)) == -1) {
>    close(fd);
>    perror("read");
> }
> 
> Doesn't do what you'd expect.  It gets particularly hairy when you're 
> not sure what functions modify errno and which functions don't.

I think it does what I expect.  And it seems to work for a lot of
libraries just fine.  By not using the global errno, you're preventing
people from using perror, warn, err and the likes.  Also some of the
interfaces in your library are slightly awkward because you're wasting
the return parameter to return the failure reason.

Even if we don't use the global errno, I'm still wondering why you're
returning -errno and not errno?

    christian



-------------------------------------------------------
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
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel