Fixes up ping

The main thing is using threads instead of processes.  I don't plan on
every supporting fork with shared memory - that usually calls for
threading.

The main thing missing is the ability to interrupt a read call (search
for alarm).

Other stuff includes the printf formatters (untested here), locking, and
some other cosmetic changes.