Am I crazy, or is `pwait` totally broken on FreeBSD 15?
I started noticing various daemons not restarting properly. rc.subr calls wait_for_pids, which calls pwait(1) on the daemon's PID. Occasionally, when running `service foo restart`, I'll get an error saying "foo already running!"
After some investigation, it looks like pwait returns a few milliseconds before the process actually terminates.
Caught in the act...this should NOT be possible:
$ kill 97891; pwait 97891; ps -p 97891
PID TT STAT TIME COMMAND
97891 - REJ 0:01.20 invidious
$ kill -0 97891
kill: 97891: No such process
Must be a race condition somewhere?