Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL])
Subject: Ultrix 3.0 signals confuse wait() system call
Date: 21 Mar 89 15:44:19 GMT	[thread overview]
Message-ID: <8748@watcgl.waterloo.edu> (raw)

/*

Compile and execute this file under a C shell on Ultrix 3.0.  When the
child shell prompt appears, type ^Z to stop the job, then type fg to
start it again.  Then type ^D to exit the shell.  The parent process
will *die* with a SIGTSTP exit signal.  If you don't stop/start the job
before you exit the child shell, or if you unmask either SIGCONT or
SIGCHLD, the parent process will correctly return its child status.

*/

#include <sys/wait.h>
#include <sys/signal.h>

static union wait status;
static int ret;
static int pid;

main()
{
	sigblock( sigmask(SIGCONT) | sigmask(SIGCHLD) );

	switch( (pid=fork()) ){
	case -1:
		perror("vfork");
		exit(1);
	case  0:
		execvp("/bin/sh", 0);
		perror("shell");
		exit(1);
	default:
		ret = wait(&status);
		printf("wait returns %d\n", ret);
	}
}
-- 
-IAN! (Ian! D. Allen) IDAllen@watcgl.UWaterloo.CA IDAllen@watcgl.Waterloo.edu
 Computer Graphics Lab    University of Waterloo    Ontario, Canada


                 reply	other threads:[~1989-03-21 15:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox