problem using sunview window + reading tty from a child process

Mark D. Baushke mdb at silvlis.com
Tue Feb 14 19:26:13 AEST 1989


Problem summary: Reading from a stdin (attached to a tty) in a child
		 process after opening and closing a sunview window
		 fails.

System Info:	 Sun 3/60 SunOS 3.x, Sun 4/260 SunOS 4.0.1

The shar file below contains the sources which demonstrate a problem I am
having with the interaction of a simple sunview program with standard
input.

The files slave.c and master.c in this directory demonstrate a problem
with mixing certain sunview programs with terminal I/O. 

The problem shows up when a graphic program wants to STOP doing graphics,
and revert back to a 'stdin' / command-driven program. The program runs OK
when invoked directly from the shell. When invoked through a parent
process, it cannot read from stdin after the sunview window(s) have been
closed.

If run standalone, the "slave" program works correctly. It is able to read
from stdin (connected to a tty) both before and after having created a
sunview frame with the window_create() call.

However, if the same program is run as a child process from "master", then
it is still able to read from stdin before creating the sunview frame, but
is no longer able to read from stdin afterwards. It "hangs" on the read
and must be interrupted.

to build,    make now

to run,  type     "slave" 		to see it run OK
                  "master slave"	to see it fail

slave requires that you type a single char, followed by <cr> it then
confirms that character, and opens a suntools window. You should 'QUIT'
that window with the mouse. It then prompts again for another character.

Two questions:

1. What is sunview doing ?

2. What is the minimum I need to do in 'master' so that slave will run
   OK ?  Do I need to play with process groups ?  with utmp ?? with
   something I have not yet heard of ??? ....

I have an application which needs to wait for the child to finish and
capture its status upon the completion of the child's task. It also needs
to read input from stdin both before and after activity in the sunview
frame.

Does anyone have a suggested work around to this problem?

(I suspect that either the window_create() or window_main_loop()
procedures are using an ioctl TIOCNOTTY, but I do not know how to prevent
this from happening or undo the behavior.)

I will post a summary if there is sufficient interest.

Thanks in advance,

Mark D. Baushke                 Internet:    mdb%silvlis.com at sun.com
Silvar-Lisco, Inc.              Nameservers: mdb at silvlis.com
1080 Marsh Road                 Usenet:      {pyramid,sgi,sun}!silvlis!mdb
Menlo Park, CA 94025-1053       Telephone:   +1 415 853-6411 / +1 415 969-8328

[[ If you want to help Mr. Baushke, please retrieve the shar file he
included.  It is stored in the archives under "sun-spots" as
"sunviewhelp.shar".  It is 5785 bytes long -- a little long to include in
a message given what it is.  It can be retrieved via anonymous FTP from
the host "titan.rice.edu" or via the archive server.  For more information
about the archive server, send a mail message containing the word "help"
to the address "archive-server at rice.edu".  --wnl ]]



More information about the Comp.sys.sun mailing list