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>, <Christian.Limpach@xxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] libxen-3.0 (libxc rewrite)
From: "Ian Pratt" <m+Ian.Pratt@xxxxxxxxxxxx>
Date: Tue, 22 Mar 2005 16:00:36 -0000
Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxxx>, <ian.pratt@xxxxxxxxxxxx>
Delivery-date: Tue, 22 Mar 2005 16:02:39 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
Thread-index: AcUu8PsVscdXuRWuTpGH4Jg8VNOznwABNq9w
Thread-topic: [Xen-devel] [PATCH] libxen-3.0 (libxc rewrite)
> >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.

Personally, I think the best approach is to stick with the existing C
convention that everyone is already well familiar with, and have a
separate errno variable. This means we can then have functions return
pointers etc rather than having to pass them by reference, which is
undeniably ugly. 

I notice that you store the fd of the priv_cmd in a static variable. I
guess this is OK, but I think I still prefer a way of explicit way of
closing the fd. You'd also have to be a little bit careful about someone
forking then two guys trying to open the fd at the same time.

Ian



-------------------------------------------------------
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_idh82&alloc_id148&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel