The reason to trust pid_t to fit in long would be that:

> 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 blksize_t, pid_t, size_t, ssize_t, suseconds_t, and useconds_t are no greater than the width of type long.

(http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html)