pg problem under ksh

michael.rubin rubin at cbnewsl.ATT.COM
Sat Oct 21 04:02:25 AEST 1989


In article <1156 at msa3b.UUCP> kevin at msa3b.UUCP (Kevin P. Kleinfelter) writes:
>I am porting ksh to AIX. [...] After I get a clean compile and link, I fire-up
>ksh and get a prompt. Then I type
>	pg foo
>and I get
>	pg: cannot reopen stdout
>
>I have seen this message before, in particular on a 3B2 at an AT&T System
>Administration class.  What does it mean (aside from the obvious)?  What do
>I do about it?
>-- 
>Kevin Kleinfelter @ Management Science America, Inc (404) 239-2347
>gatech!nanovx!msa3b!kevin

Pg tries to open /dev/tty and produces that message when it cannot.
/dev/tty doesn't work when your login shell is not the controlling
process of your terminal.
If you do a ps -ef, your shell will probably have a terminal of "?".

This is normally caused by some process having the terminal open
before you logged in - e.g. something the last user ran that is hung
or ignoring signals.
That process then becomes the controlling process for the terminal.
To fix this, find the offending process (it'll be the only one in a
ps -ef listing that IS connected to your terminal) and kill -9 it,
then log out and log in again.  Do you have any zombie ksh's?

However, you might also have something wrong in your ksh that causes
it to relinquish control of the tty; maybe it's doing a setpgrp()
incorrectly.

--Mike Rubin <mike at sfbat.att.com>



More information about the Comp.unix.questions mailing list