[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v5 08/45] Return path: socket_writev_buffer: Blo

From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v5 08/45] Return path: socket_writev_buffer: Block even on non-blocking fd's
Date: Mon, 30 Mar 2015 20:22:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

"Dr. David Alan Gilbert" <address@hidden> writes:

> * Paolo Bonzini (address@hidden) wrote:
>> On 29/03/2015 06:07, David Gibson wrote:
>> > On Sat, Mar 28, 2015 at 04:30:06PM +0100, Paolo Bonzini wrote:
>> >> 
>> >> 
>> >> On 25/02/2015 17:51, Dr. David Alan Gilbert (git) wrote:
>> >>> +            if (err != EAGAIN) {
>> >> 
>> >> if (err != EAGAIN && err != EWOULDBLOCK)
>> > 
>> > I assume that's for the benefit of non-Linux hosts?  On Linux
>> Yes, that's just the standard idiom in QEMU.  This is generic code, so
>> assumption based on the host platform are not wise. :)
> Done; I didn't know of EWOULDBLOCK - and indeed as far as I can tell
> most places we only test for EAGAIN.

Bug unless the place in question is effectively #ifdef __GNU_LIBRARY__
or similar.


 -- Macro: int EAGAIN
     Resource temporarily unavailable; the call might work if you try
     again later.  The macro 'EWOULDBLOCK' is another name for 'EAGAIN';
     they are always the same in the GNU C Library.

     This error can happen in a few different situations:

        * An operation that would block was attempted on an object that
          has non-blocking mode selected.  Trying the same operation
          again will block until some external condition makes it
          possible to read, write, or connect (whatever the operation).
          You can use 'select' to find out when the operation will be
          possible; *note Waiting for I/O::.

          *Portability Note:* In many older Unix systems, this condition
          was indicated by 'EWOULDBLOCK', which was a distinct error
          code different from 'EAGAIN'.  To make your program portable,
          you should check for both codes and treat them the same.

        * A temporary resource shortage made an operation impossible.
          'fork' can return this error.  It indicates that the shortage
          is expected to pass, so your program can try the call again
          later and it may succeed.  It is probably a good idea to delay
          for a few seconds before trying it again, to allow time for
          other processes to release scarce resources.  Such shortages
          are usually fairly serious and affect the whole system, so
          usually an interactive program should report the error to the
          user and return to its command loop.

 -- Macro: int EWOULDBLOCK
     In the GNU C Library, this is another name for 'EAGAIN' (above).
     The values are always the same, on every operating system.

     C libraries in many older Unix systems have 'EWOULDBLOCK' as a
     separate error code.

reply via email to

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