Okay, ignoring getpid, does this work?