4.1 and ksh88d

chet at po.cwru.edu chet at po.cwru.edu
Tue Jul 17 08:44:08 AEST 1990


In article <9833 at brazos.Rice.edu> marg at cunixf.cc.columbia.edu (Margarita Suarez) writes:

[An explanation of why sometimes the last process in a pipeline would hang
ksh88d, and finally traced it down to a setpgid() race condition where a
process in the pipeline would try to set its pgrp before the process group
`leader' had established the process group.  This resulted in a pipeline
with pieces in different process groups.]

>To fix, check for the case where setpgid returns ENOPERM, and if so, sleep
>a bit and try again until the process group leader has been properly
>established.

A better fix is to do the setpgid() in both the parent and child, so the
setpgid() succeeds before anything else happens.  It doesn't matter which
succeeds, as long as the pgrp is set before anything else depends on it
being so.

Chet Ramey				"...but worst of all, young man,
Network Services Group			 you've got Industrial Disease!"
Case Western Reserve University	
chet at ins.CWRU.Edu		



More information about the Comp.sys.sun mailing list