csh pgrp problem

Richard Tobin richard at aiai.ed.ac.uk
Thu Aug 10 04:34:13 AEST 1989


For historical reasons, we use a modified csh, which we call tcsh, but
which isn't the "standard" one used elsewhere.

Running under SunOS 4, we occasionally encounter an annoying problem:
a pipeline (eg cat /etc/passwd | more) will stop, with the message

   Stopped (tty output)

I believe I've found the problem, what I want to know is whether there's
a simple fix, perhaps in more recent versions of csh than we have here.

I had some problems when I first compiled this shell for SunOS 4, and
the simplest solution seemed to be to #undef VFORK, since fork() in
SunOs 4 does copy-on-write.

What seems to be happening is that the shell forks twice (once for cat
and once for more).  Each child sets its process group to the jobid,
which is cat's process id.  The first child sets the terminal process
group to the same thing.  However, there's nothing to guarantee that
the first child sets the terminal process group before the second child
starts running, and perhaps once in 20 times it doesn't.  In these
cases the ioctls performed by more cause a SIGTTOU.

Presumably using vfork() forces things to happen in the right order.

Thanks in advance,
  Richard

-- 
Richard Tobin,                       JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.unix.wizards mailing list