[RFC] Improve libnl non-blocking behaviour
Holger Eitzenberger
holger at eitzenberger.org
Mon Feb 25 12:33:11 EST 2013
Hi Thomas,
I noticed that nl_recvmsgs_default() does return 0 instead of
-NLE_AGAIN when looping on a non-blocking file descriptor. And in
nl_recv() I see this:
if (errno == EAGAIN || errno == EWOULDBLOCK) {
NL_DBG(3, "recvmsg() returned EAGAIN||EWOULDBLOCK,
aborting\n");
retval = 0;
goto abort;
}
Is this intended?
I'm asking because with non-blocking programs you often have read-like
loops from the file descriptor until EGAIN is returned.
The patchlet attached changes retval to -NLE_AGAIN in this case.
And I have a test program which then works as intended. Does this
make sense? I haven't tested for the actual performance improvement
though, but I can if need be.
When doing so it could also make sense to remove the debug message in
this case, because by returning -NLE_AGAIN to the program the NL_DBG()
is somewhat duplicate information.
Any comments appreciated.
/Holger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libnl-nl-recv-return-NLE_AGAIN.diff
Type: text/x-diff
Size: 504 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20130225/08909eea/attachment.bin>
More information about the libnl
mailing list