qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov)


From: Gleb Natapov
Subject: Re: [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov)
Date: Fri, 16 Jan 2009 09:31:44 +0200

On Thu, Jan 15, 2009 at 10:20:33PM +0100, François Revol wrote:
> > Revision: 6324
> >           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6324
> > > Author:   aliguori
> > Date:     2009-01-15 20:44:26 +0000 (Thu, 15 Jan 2009)
> >
> > Log Message:
> > -----------
> > Return -errno on write failure (Gleb Natapov)
> 
> Nooooooooooo
> Please do not this bad broken Unix habit!
> errno and E* are negative in BeOS and Haiku and sometimes = to
> INT32_MIN which means negating it results in positive values or even
> overflows.
> 
This is how qemu block layer passes error reason to the caller. Not only
here but in other places too.

> 
> #if EINVAL > 0
> #define QERROR(e) (-(e)) /**< Returns a negative error code from a
> POSIX error code, to return from library functions. */
> #define QUNERROR(e) (-(e)) /**< Returns a POSIX error code from a
> library function error return value. */
> #else
> /* Some platforms have E* and errno already negated. */
> #define QERROR(e) (e)
> #define QUNERROR(e) (e)
> #endif
> 
> and return QERROR(errno) or return QERROR(EINVAL);
>
Patch to fix qemu on BeOS are welcomed :)
 
--
                        Gleb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]