More progress on controller state machine

Converted integer-style states with switch statement into coderef-style states
using one function for each state.

Began complicated refactoring of command processing to try to maintain
  * input is always read as much as possible if we're waiting to write
  * long input (including comments) don't clog the pipes
  * overflows on comments don't cause error messages
  * there is an easy way to detect deadlocks and resolve them regardless of state
  * dumping state can be resumed in the middle of a service
  * service and fd modules don't have to know anything about controller
  * read_fd doesn't get select()ed if write_fd is what we're waiting on
Changed mind about making sure notify statements always complete

I decided there will be a function to explicitly declare an overflow instead
of having it happen automatically should a notify function be called on a
full buffer.  This way if you want to notify but can't, the caller gets to
decide whether that is a fatal error.