[Asterisk-Dev] Re: EAGAIN rtp.c
Wolfgang S. Rupprecht
list+asterisk-dev at lists.wsrcc.com
Tue Jul 13 09:32:55 MST 2004
jacs at gnome.co.uk (Chris Stenton) writes:
> On Tue, 2004-07-13 at 06:18, James H. Cloos Jr. wrote:
> > >>>>> "Wolfgang" == Wolfgang S Rupprecht <list+asterisk-dev at lists.wsrcc.com> writes:
> > Wolfgang> Under unix and bsd EAGAIN simply means someone set the
> > Wolfgang> socket to non-blocking and proceeded to read the socket
> > Wolfgang> before any data arrived.
> > As kram told me: read the linux's udp.c. It returns an EAGAIN when
> > there is a checksum error.
> Well I would say that Linux udp.c returns the wrong error code. EAGAIN
> has always meant /* Resource temporarily unavailable */
Thanks. My point exactly. Although, I'm coming around a bit.
I can see how a kernel (say due to a badly ordered set of locks) can
get itself into a situation where things have progressed to the point
that a syscall has no choice but to return to userland, even if it has
no data to return to the user. The case of a packet with a bad
checksum might well be one of these. Poll() or select() says you have
a packet, you dive into the kernel to get it and the kernel code now
realizes it has no data for you after all. It needs to make excuses
as to why it can't give you a packet, but doesn't want you to get the
impression that the socket is closed with a permanent error. EAGAIN
would be the right errno for this case.
The bug, as I see it, is for the userland code to assume that this
EAGAIN return is due to a checksum problem. That is reading more into
things than is correct.
Wolfgang S. Rupprecht http://www.wsrcc.com/wolfgang/
openbsd amd64 http://www.wsrcc.com/wolfgang/ftp/asterisk-openbsd35.patch
More information about the asterisk-dev