1) This is pager or swapper: Which process has PID 0?
2) Never used Minix but manual says negative pid in Minix means kernel process. As this is actually part of the kernel implementation, I can't say if that comply or not to POSIX =)
3) You should use pid_t
If your aim is maximum portability you should read POSIX and it says:
First, getpid() function returns pid_t
. pid_t
is defined in types.h.
Second:
... blksize_t, pid_t, and ssize_t shall be signed integer types. ...
The implementation shall support one or more programming environments
in which the widths of ..., pid_t, ... are no greater than the width
of type long. The names of these programming environments can be
obtained using the confstr() function or the getconf utility.
So you can save pid_t
value in long
.
Also notice that by POSIX, pid_t
is an integer.