CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/05/13 15:34:37

Modified files:
        sys/net        : bpf.c bpfdesc.h 

Log message:
bpf(4): separate descriptor non-blocking status from read timeout

If you set FIONBIO on a bpf(4) descriptor you enable non-blocking mode
and also clobber any read timeout set for the descriptor.  The reverse
is also true: do BIOCSRTIMEOUT and you'll set a timeout and
simultaneously disable non-blocking status.  The two are mutually
exclusive.

This relationship is undocumented and might cause a bug.  At the
very least it makes reasoning about the code difficult.

This patch adds a new member to bpf_d, bd_rnonblock, to store the
non-blocking status of the descriptor.  The read timeout is still
kept in bd_rtout.

With this in place, non-blocking status and the read timeout can
coexist.  Setting one state does not clear the other, and vice versa.

Separating the two states also clears the way for changing the bpf(4)
read timeout to use the system clock instead of ticks.  More on that
in a later patch.

With insight from dlg@ regarding the purpose of the read timeout.

ok dlg@

Reply via email to