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