Search PIDs manually instead of calling pidof

pid_t change may not compile on windows.