Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Aug 2014 13:39:43 +0400
From:      Fedor Indutny <fedor@indutny.com>
To:        freebsd-current@freebsd.org
Cc:        Mark Johnston <markj@freebsd.org>
Subject:   KQueue 0-length UDP packet
Message-ID:  <CAEv2VfLoPiDtEmwJyWMGJuTOaPUTUJoD3B6VQDBE=4A6U4o4-A@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello!

I'm trying to figure out, why this code:

https://github.com/indutny/0-udp

Which basically sends a 0-length UDP packet to a server and polls
kqueue events on the server fd.

Return 1 kevent on FreeBSD, and blocks indefinitely without
returning any events on OSX.

So far I could see that FreeBSD and OSX are treating NOTE_LOWAT
differently:

*
https://github.com/opensource-apple/xnu/blob/2fa84067f6cdeb23267f877ca4fd26201316da1b/bsd/kern/uipc_socket.c#L4461
*
https://github.com/freebsd/freebsd/blob/6901832d8588537c81afbdb91d1a22deb5582c47/sys/kern/uipc_socket.c#L3163-L3164

FreeBSD's NOTE_LOWAT is overriding SO_RCVLOWAT, and OSX is using
SO_RVCLOWAT as a minimum value. But, since NOTE_LOWAT is not
involved here by default, I'm failing to see where exactly this
event could pass through kqueue filter.

Could anyone with UDP and/or KQueue implementation knowledge
share some insights with me?

Thank you very much!
Fedor.

(NOTE: Duplicate, first email wasn't posted, because I wasn't subscribed to
the ML)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAEv2VfLoPiDtEmwJyWMGJuTOaPUTUJoD3B6VQDBE=4A6U4o4-A>