[bind10-dev] -1 is a legal PID

Mark Andrews marka at isc.org
Tue Aug 28 01:04:01 UTC 2012


In message <20120827161730.87833216C70 at bikeshed.isc.org>, Francis Dupont writes
:
> > Well, I kind of think that where fork is not available, we won't be
> > using that, but something else. As the name of file suggests, it's
> > probably unix-specific and needs fork to work. It was used in
> > unittests because it was the easiest way to go then.
> 
> => yes, this defect (*) is Unix specific. On Windows for instance
> the corresponding call returns a handle (or NULL) even there are
> PIDs too (and _getpid() which can't fail too). My concern is to
> not propagate the defect to bind10.


http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
pid_t Used for process IDs and process group IDs.

Positive values of pid_t are process id's and negative are process group id's
see kill().
http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html

-1 is not in the range of valid process id's but is part of the type space.

> Regards
> 
> Francis Dupont <fdupont at isc.org>
> 
> PS: IMHO to put the error value in a type where it is a priori a
> legal value is a defect in the design and introduces portability
> problems. BTW Unix is not consistent because getpid() can't fail
> but nowhere it is explained it can't return (pid_t) -1...
> _______________________________________________
> bind10-dev mailing list
> bind10-dev at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind10-dev
-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org


More information about the bind10-dev mailing list