git: kqueue: Make EVFILT_USER event behaviour more consistent.

Imre Vadasz ivadasz at crater.dragonflybsd.org
Wed Aug 23 12:03:42 PDT 2017


commit cf83cc1901df816457f1aae6fa950a10fc75754b
Author: Imre Vadász <imre at vdsz.com>
Date:   Sat Aug 19 21:50:28 2017 +0200

    kqueue: Make EVFILT_USER event behaviour more consistent.
    
    * Stop abusing the kn->kn_sfflags value for storing the current state of
      the EVFILT_USER filter. Instead use kn->kn_fflags like other filters.
      Similarly store the data value in kn->kn_data instead of kn->kn_sdata.
      This means that the fflags value gets reset when EV_CLEAR was specified
      when adding the event, and the event is received by userspace. This
      behaviour is consistent with existing kqueue filters, and allows using
      EVFILT_USER properly as an edge-triggered event when using the fflags,
      and not just level-triggered.
    
    * Don't clear kn->kn_fflags when the event is modified with EV_CLEAR. Doing
      this wasn't affecting the actual state of the EVFILT_USER event before
      this change (since the state was kept in kn->kn_sfflags instead).
    
    * All this also avoids blindly copying the fflags value that was specified
      when adding the event. Instead the NOTE_FFLAGSMASK mask is applied, and
      the NOTE_FF* options are used, so the returned fflags value should now
      always only have the lower 24 bits set.
    
    * Make setting the fflags and data value when adding the event work as
      might be expected.

Summary of changes:
 sys/kern/kern_event.c | 50 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 43 insertions(+), 7 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/cf83cc1901df816457f1aae6fa950a10fc75754b


-- 
DragonFly BSD source repository



More information about the Commits mailing list