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

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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