debug: only do getpid() if we have to