kernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug)
commit7eea59b754f37d04a34589c316dcf30bcd8e2b88
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 4 Jun 2020 23:33:04 +0000 (4 16:33 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 4 Jun 2020 23:33:04 +0000 (4 16:33 -0700)
tree2728ca8fc966c2130ee587f0011ed49e16f8f3e8
parentfe0a2b7ee2f3ae57d34cc1e19532586c5d2e350f
kernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug)

* Fix a bug where large timeouts or very small timeouts could
  overflow the ustimeout variable.  Change the internal timeout
  cap to ensure that no overflow occurs.

* Fix another bug where the internal timeout cap could cause
  ppoll() to return early.  Internal tsleep (etc) timeouts
  need to be ignored because the external timeout might be
  larger and will handle the error return for us when it is
  checked.

* Refactor kern_kevent() to be somewhat more efficient.

Reported-by: rsmarples
sys/kern/kern_event.c
sys/sys/event.h