native: refactor getpid calls