move mainpid into the shm

Watchdog needs to read it, and we forked off the watchdog before we
set mainpid.  This meant we were doing kill(0, 0) in check_main_alive()