Patch makes some number of random fixes for hwpmc(4) after pho applied fuzzing to the hpwmc syscall. I intend to try to split the patch into logically separated commits, but it is too hard to do now if reviewers request changes.
First, r195005 is perhaps worse than the bug it fixed. The pmclog_configure_log() runs without pmx_sx protection at all, causing too many failure modes, esp. with the flush or closelog running in parallel. So I reverted r195005 and instead I pre-create the logging process, allowing it to run after the set up succeeded, otherwise the process terminates itself.
Second, hwpmc(4) must not voluntarily call fo_close(), this causes double-close of the file. It seems to almost avoid bad consequences for pipes, but other types of files demonstrate random memory access. So remove fo_close() calls, which also do not provide the declared wake-up of waiters consistently. Instead, send a signal to the logger and configure the logger process to not block it. Since logger never returns to userspace, the signal only causes termination of the interruptible sleeps in fo_write().
Remove unneeded Giant drop inside hwpmc syscall handler.
Use designated initializers for sysent.
Do some style adjustments in the nearby code.
Reported and tested by: pho