]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r336761 & r336781:
authordab <dab@FreeBSD.org>
Tue, 7 Aug 2018 14:39:00 +0000 (14:39 +0000)
committerdab <dab@FreeBSD.org>
Tue, 7 Aug 2018 14:39:00 +0000 (14:39 +0000)
commita1143bbcefc092238acc75578211f8938cddd8c8
treea6671bee3cf9f950831b3681ecf5448685c9454d
parent036ed545d3c5402c2e446ee4a79c61b741b7ec7e
MFC r336761 & r336781:

Allow a EVFILT_TIMER kevent to be updated.

If a timer is updated (re-added) with a different time period
(specified in the .data field of the kevent), the new time period has
no effect; the timer will not expire until the original time has
elapsed. This violates the documented behavior as the kqueue(2) man
page says (in part) "Re-adding an existing event will modify the
parameters of the original event, and not result in a duplicate
entry."

This modification, adapted from a patch submitted by cem@ to PR214987,
fixes the kqueue system to allow updating a timer entry. The kevent
timer behavior is changed to:

  * When a timer is re-added, update the timer parameters to and
    re-start the timer using the new parameters.
  * Allow updating both active and already expired timers.
  * When the timer has already expired, dequeue any undelivered events
    and clear the count of expirations.

All of these changes address the original PR and also bring the
FreeBSD and macOS kevent timer behaviors into agreement.

A few other changes were made along the way:

  * Update the kqueue(2) man page to reflect the new timer behavior.
  * Fix man page style issues in kqueue(2) diagnosed by igor.
  * Update the timer libkqueue system test to test for the updated
    timer behavior.
  * Fix the (test) libkqueue common.h file so that it includes
    config.h which defines various HAVE_* feature defines, before the
    #if tests for such variables in common.h. This enables the use of
    the actual err(3) family of functions.
  * Fix the usages of the err(3) functions in the tests for incorrect
    type of variables. Those were formerly undiagnosed due to the
    disablement of the err(3) functions (see previous bullet point).

PR: 214987
Relnotes: yes
Sponsored by: Dell EMC
lib/libc/sys/kqueue.2
sys/kern/kern_event.c
tests/sys/kqueue/libkqueue/common.h
tests/sys/kqueue/libkqueue/main.c
tests/sys/kqueue/libkqueue/timer.c