getpid() return value

Guy Harris guy at sun.uucp
Thu Apr 11 16:42:15 AEST 1985


> In the manual page for getpid() it states that a long is returned.
> In the readable lint file it says that an int is returned.
> 
> What does getpid() return under 4.2BSD?

The smartass answer is that "int"s and "long"s are one and the same under
4.2BSD (for instance, Internet addresses, which are 32-bit quantities,
are declared as "int" all throughout 4.2) so it doesn't make a difference.
Process IDs are declared as "long" some places in the kernel and as
"int" in others.  Since 4.2, like most other V7-family systems, limits
process IDs to the range 0 <= PID < 30000, PIDs will fit in a 16-bit "int".
I'm not sure why they declared them as longs where they did.  In all other
UNIX systems, "getpid" returns an "int".  I'd say the manual page is
wedged.

	Guy Harris
	sun!guy



More information about the Comp.bugs.4bsd.ucb-fixes mailing list