[net.bugs.4bsd] getpid

kiely@lownlab.UUCP (James P. Kiely) (04/09/85)

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?


NAME:	James P. Kiely
USENET:	...!harvard!hscfvax!lownlab!kiely
USPS:	Lown Cardiovascular Laboratory
	Harvard School of Public Health
	665 Huntington Avenue
	Boston, Mass. 02115-9915
PHONE:	617/732-1307

guy@sun.uucp (Guy Harris) (04/11/85)

> 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