From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Peter C. Chapin" Newsgroups: gmane.os.tru64.managers Subject: SIGCHLD confuses popen()? Date: Tue, 28 Jan 2003 10:26:49 -0500 (EST) Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1043767533 25668 80.91.224.249 (28 Jan 2003 15:25:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 28 Jan 2003 15:25:33 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18dXc9-0006fT-00 for ; Tue, 28 Jan 2003 16:25:29 +0100 Original-Received: (qmail 4234 invoked by uid 5); 28 Jan 2003 15:27:05 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 4225 invoked by uid 49493); 28 Jan 2003 15:27:05 -0000 Original-Received: from pchapin@ecet.vtc.edu by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(-1.2/5.0):. Processed in 0.37264 secs); 28 Jan 2003 15:27:05 -0000 Original-Received: from unknown (HELO emroute2.cind.ornl.gov) (128.219.159.41) by 0 with SMTP; 28 Jan 2003 15:27:04 -0000 Original-Received: from emroute2.cind.ornl.gov (LOCALHOST [127.0.0.1]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #30669) with ESMTP id <0H9F00L6BK93B7@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 28 Jan 2003 10:27:04 -0500 (EST) Original-Received: from midnight.ecet.vtc.edu (midnight.ecet.vtc.edu [155.42.13.3]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #30669) with SMTP id <0H9F00ALRK900B@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 28 Jan 2003 10:27:02 -0500 (EST) Original-Received: (qmail 199376 invoked by uid 201); Tue, 28 Jan 2003 15:26:49 +0000 Original-Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; Tue, 28 Jan 2003 15:26:49 +0000 Original-To: Tru64 Unix Managers Xref: main.gmane.org gmane.os.tru64.managers:3101 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:3101 This may be the wrong place to ask this; if so, feel free to ignore me. One of my students is building a server program that installs a signal handler for the SIGCHLD signal. The program creates a child for every connection and then reaps the children in the signal handler (most likely while the main loop is blocked in accept()). There are no problems with this part. However, the student is also using popen() during the initialization of the program to spawn a helper process. It happens that he is doing this after setting up signal handling. Thus when the helper process terminates, the SIGCHLD handler is run. This apparently confuses popen() because subsequent attempts to read the helper process's output return nothing. (I'm assuming the helper process terminates before popen() returns... it produces only a single line of output and does not need to wait for anything). However, if the signal handling is temporarly removed, the output of the helper process can be read fine. The program works normally as written on our Linux system but displays the behavior I describe here on Tru64 v5.1A. Is there some Tru64 specific interaction between signals and popen() that we need to know about? Or were we just lucky that it worked on Linux? Peter