knote_fork() may attempt to register an event after we have started to
close a kqueue. Check for KQ_CLOSING with the kqueue lock held before
resizing the fd table or creating a knote hash table, and before
inserting a new knote into one of the kqueue tables.
In knote_fork(), acquire the knlist lock before dropping the kqueue lock
and the in-flux state of the knote. Otherwise there is nothing
preventing the knote from being freed before the knlist lock is
reacquired. I believe the in-flux state is sufficient to prevent the
knote from being removed from the knlist while locks are dropped.
When initializing the kqueue hash table, respect the "waitok" parameter;
hashinit() uses M_WAITOK.