[libvirt] [PATCH 05/11] Add a generic internal API for handling any FD based stream

Eric Blake eblake at redhat.com
Wed Nov 3 16:38:33 UTC 2010

On 11/03/2010 07:23 AM, Daniel P. Berrange wrote:
>>   I was wondering about reusing saferead/write but they have a different
>> semantic on blocking,
> Yep,  saferead/write cannot be used on any FD with O_NONBLOCK
> set, because they'll just spin in a 100% CPU loop whenever
> EAGAIN occurs, until they get nbytes worth of data.

Is it worth teaching saferead/write to use fcntl() to determine if an fd
is O_NONBLOCK?  And if so, should it outright reject an O_NONBLOCK fd
(to help us diagnose bugs) or be documented as allowing an EAGAIN
failure on non-blocking fds?

Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101103/4015abb3/attachment-0001.sig>

More information about the libvir-list mailing list