[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.