I think you should use ```os_get_pid``` from ```os/env.c```