Does FreeBSD have sendmmsg or recvmmsg system calls?

Mark Delany c2h at romeo.emu.st
Mon Jan 4 09:11:09 UTC 2016


On 04Jan16, Konstantin Belousov allegedly wrote:
> On Sun, Jan 03, 2016 at 09:47:20PM +0000, Mark Delany wrote:
> > Eg, if a signal arrives after
> > more than zero packets have been processed by recvmmsg() what is the
> > correct return value? -1 or the count of messages returned?
> 
> This is really not a question to consider different answers. Unix
> already made a (right, IMO) decision there, e.g. for read(2) syscall.
> If any data was actually read, the length of the consumed data must be
> returned, and not the error.

So the error is lost? In that case, recvmmsg() is not the same as an
iteration over recvmsg().

Besides, a signal isn't necessarily an error. Think SIGALRM.

The point is that recvmmsg() may have populated the struct mmsghdr*
with a number of inbound messages then it is interrupted by a signal.

It then has a choice of telling user space that it has 'n' messages to
be processed or -1/EINTR that a signal occurred.

If the choice is the former, then the signal is lost. If the choice is
the latter then 'n' messages are lost. There is no return possible
which indicates that there are messages *and* a signal.

Thinking out loud here: are there any other "batch" system calls like
recvmmsg() that can offer guidance?


Mark.


More information about the freebsd-net mailing list