On my system the lowest ID running right now is 1 (init). I’m making a small wrapper function around pidof and I was wondering, what is the lowest possible process ID a process can have?
The reason I ask is because I would like to return an integer from my function indicating “process was not running” (pidof itself returns an empty string in this case). I was thinking of using either 0 or -1, and I just want to make sure a real process could never have such IDs.
PIDs are always positive, so both 0 and -1 are OK as non-PID sentinels. Several PID-related system calls, like
wait()andkill(), assign special meaning to these values.