exit with correct status when terminated via signal

The main daemon now reflects the terminal signal in its own exit
  status via invoking raise() on itself (after cleanup and removal
  of signal handlers) instead of calling exit(0), which is better
  for any manager/init/shell process.  (cf. section "How to be a
  proper program" of http://www.cons.org/cracauer/sigint.html)

All atexit() handlers have become debug-only (most were before,
  at least that was the intent) and are taken care of locally on
  clean shutdown before the raise(), rather than via the libc's
  atexit(), since we're not calling exit() anymore.
libdmn: major refactoring, API changes, new functionality.

The libdmn code was refactored (in some areas, just plain rewritten)
  and its interfaces changed substantially.

Some of this was just for better clarity and analysis given the
  combination of complexity and criticality here, for example the
  "phase"-tracking so that strict ordering of the API invocations
  is enforced and documented in the code.

The rest provides support for a few critical new things in gdnsd:
1) The ability for foreground "daemons" to participate in pidfile
  locking and general daemon control with background ones (restart
  can move seamlessly between fg+bg now).
2) The ability to selectively configure which steps in the process
  (e.g. daemonization, chroot, privdrop, killing old daemon,
  pidfile acquisition) are to be skipped depending on the parameters
  of the current execution.
3) The ability to defer arbitrary privilege-requiring operations
  (such as binding sockets) until long after dropping privileges
  by using RPC-like calls to a helper process that exists until
  daemon finalization.  This functionlity is very limited at the
  moment in that it can't pass data, so you can only operate on
  shared data from before forking.  It does work in both foreground
  and background cases, and executes locally without the RPC magic
  in the case that no privileges are being lost in the first place.

The pidfile-management mechanisms remain mostly-unchanged (fcntl
  locks and using the reported locking pid as the reliable indicator)
  from before, so there shouldn't be any issues doing upgrade
  restarts from gdnsd 1.x -> 2.x.
One notable change, however, is that now the pidfile and the containing
  daemon-specific directory are expected to be owned by the privdrop
  user in privdrop cases rather than root.  This should be self-
  correcting in gdnsd 1.x cases where they're currently owned by root,
  as the new code handles the chown/chmod on startup.
gdnsd daemonization, restart, socket-binding updates

Updated to match new libdmn interfaces...
The "debug" option was removed from the configfile and replaced
  with the commandline option "-D".
The startfg commandline action has been replaced by the new
  commandline option "-f", which will foreground-mode any start-
  or restart-like action.
Foregrounded daemons will always privdrop/chroot as appropriate
  and participate in pidfile locking just like background ones.
  You can "gdnsd -f restart" to seamlessly restart a background
  service as a foreground one, and a regular restart from another
  terminal can then shut down the foreground instance and restart
  it seamlessly back as a daemon again.
Startup execution significantly re-ordered with the goal of moving
  the killing of a previous instance (for restart) and the binding
  of listening sockets as late as possible, after all other
  potentially-expensive and/or likely-to-fail operations (e.g.
  zonefile parsing and initial monitoring).
In cases where SO_REUSEPORT is available, we now actually bind
  the sockets just *before* killing the old daemon rather than
  just after, to eliminate the small remaining availability gap.
Merge branch '2.x' into dmn-rework
minor format-string fix for strerror failure
mark no_freebind unused (when not supported)
restructure detection of undead daemons a bit
Merge branch '2.x' into dmn-rework
fix kill-status bug from 2ae7c831
simplify pidfile writing via dprintf()
use proper mode constants in open/mkdir
trivial libdmn fixups
s/select/nanosleep/ for kill delay loop
cleanup/refactor on pipe-related code
set FD_CLOEXEC on dmn pipes just in case
use logf_errno() instead of strerror
get rid of threads_cleanup stuff

I don't think these do any useful debugging anyways
remove excess space from prefix strings
Merge branch '2.x' into dmn-rework
document -f option in help output