Subject: Re: standards/28493: tcgetpgrp/TIOCGPGRP shouldn't use -1 for "an invalid process ID"
To: None <jld@panix.com>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 12/02/2004 22:00:40
> >Synopsis:       tcgetpgrp/TIOCGPGRP shouldn't use -1 for "an invalid process ID"
...
> says that "[i]f there is no foreground process group, tcgetpgrp() shall
> return a value greater than 1 that does not match the process group ID
> of any existing process group."  And there exists at least one piece of
> software (zsh; see below) that misbehaves when the "greater than 1" part
> of that is violated.
...
> Change NO_PGID to something positive, and ensure that it can't be used
> for an actual pid/pgid.  INT32_MAX?

I've changed tcgetpgrp() to convert (pid_t)-1 to (uint)(pid_t)~0u >> 1
which should be a large positive value that the system is unlikely to
use as a pid/pgid.

I did think of using 2 - and ensuring the kernel didn't alloacate pid 2.

	David

-- 
David Laight: david@l8s.co.uk