Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: mdb@silvlis.com (Mark D. Baushke) Newsgroups: comp.sys.sun Subject: problem using sunview window + reading tty from a child process Message-ID: <8901262238.AA22249@amadeus.silvlis.com> Date: 14 Feb 89 09:26:13 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 72 Approved: Sun-Spots@rice.edu Original-Date: Thu, 26 Jan 89 14:38:47 PST X-Sun-Spots-Digest: Volume 7, Issue 153, message 2 of 16 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 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@sun.com Silvar-Lisco, Inc. Nameservers: mdb@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@rice.edu". --wnl ]]