```
After the commit 393ac29f0b8be068c8e, which force clearing p_klist onEVFILT_SIGNAL: do not use target process pointer on detach
the process structure reapIt is enough to know knlist to remove from it, the sys.kqueue.proc3_test.proc3 test startedand the list is
failing. The reason is that kqueue filter interface does not match theautodestroyed on last removal.
lifetime of the struct proc, the filter operates on knote list after thePR: 275286
process exited and even was reaped.```
To fix it, effectively change EVFILT_PROC in an opposite way comparing```
to the previous attempt: instead ofRevert "kqueue: on process exit, forcibly e-clean and destroy p_klistr its registered signal events"
on reap, detach the knote list existence from struct proc reuse, and
make it persistent, indexed by pid. This allows process knotes to
survive waitpid(2).
Keep p_klist as an optimization to avoid looking up knlist by pid inThis reverts commit 393ac29f0b8be068c8e46f76c2eeee07d20ea4df. A
many places. Butdifferent fix is following, instead of the process mutexwhich preserves semantic, process' knote listsrequired by the
are synchronized by dedicated leaf global mutex, which is also used to
synchronize lookup structure. If problematic, this mutex can be split
per pid hash value.
Fixes: 393ac29f0b8be068c8e46f76c2eeee07d20ea4df
PR: 275286sys.kqueue.proc3_test.proc3 test.
```