libutil: Various updates from FreeBSD, esp. pid_* functions

It appears that libutil.so is another Frankenstein monster where half
of it came from FreeBSD and later it was updated with NetBSD functions.
Like libm, this causes problems with syncing later.

In order to update the daemon program, the set of pidfile_* functions
had to be brought in from FreeBSD.  While doing that, I synced with
FreeBSD as much as possible.  The expand number function was added
as well as a dedicated pw_util man page.

Specifically ignored were FreeBSD functionality involving kinfo and kld.
The login functions are essentially incompatible as the FreeBSD ones
require syscntls, so I left the NetBSD versions alone.  The various
humanize functions that only exist on DragonFly were also left untouched.

Collateral damage included:
  sbin/devd/devd.[ch][ch]       (partial sync)
  usr.sbin/authpf/authpf.c      (partial sync)
  usr.sbin/apmd/apmd.c
  usr.sbin/battd/battd.c
  usr.sbin/bthcid/bthcid.c
  usr.sbin/pflogd/pflogd.c
  usr.sbin/rwhod/rwhod.c
  usr.sbin/syslogd/             (full sync)
  usr.sbin/sysvipcd/sysvipcd.c
daemon(8): Add -P, -r, -u options from FreeBSD

This is a full sync with FreeBSD.  The DragonFly daemon hasn't been
significantly updated in years.  The sync brings in:

option -P supervisor pidfile
  This writes the pid of the daemon process in the specified file.
  It gets removed automatically similarly to the child pidfile

option -u user
  It executes the command using the credentials the the specified
  user, and it requires the superuser to invoke it.

option -r restart
  This acts like a watchdog and restarts a program that terminates

The update requires an update to libutil in order to use the same
pidfile handling that FreeBSD uses.