[comp.unix.wizards] bizarre output from getpgrp

sean@avec.UUCP (03/26/87)

My job involves porting a lot of source onto many different boxes.  However
This problem is new..

This is to a Xenix (with V7 tty drivers) and a 68020 chip.  The manufacturer
will remain anonymous.  Their call to getpgrp() returns the pid.  My 
understanding is that the default process group is the pid of your login
shell unless you set it otherwise (via setprgp()).

Is there a better definition for what this function does than the SVID
"Returns the current process group?".  Their source for the command is
behaving correctly, I think it's just written wrong.

Please advise.

Sean MacGuire - Technical Support
Quadratron Canada Inc.

ihnp4!philabs!micomvax!avec!sean  -   "It's not a bug, it's a feature."

mouse@mcgill-vision.UUCP (04/07/87)

In article <704@avec.UUCP>, sean@avec.UUCP (Sean McGuire) writes:
> This is to a Xenix (with V7 tty drivers) and a 68020 chip.  The
> manufacturer will remain anonymous.  Their call to getpgrp() returns
> the pid.  My understanding is that the default process group is the
> pid of your login shell unless you set it otherwise (via setprgp()).

Depends on the shell.  Any shell that does job control (such as most
(all?) implementations of the csh) must place jobs in process groups of
their own.  Normally, the process group is the PID of the group leader;
if there is only one process in the job (the usual case), this means
that the group ID is the process ID.

If, on the other hand, the following prints "broken", then they have
changed the semantics significantly:

	int old,new;
	old=getpgrp(getpid());
	if (fork())
	 { new=getpgrp(getpid());
	   if (new != old) printf("broken\n");
	 }

					der Mouse

Smart mailers: mouse@mcgill-vision.uucp
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu