Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Ultrix 3.0 signals confuse wait() system call
@ 1989-03-21 15:44 Ian! D. Allen [CGL]
  0 siblings, 0 replies; only message in thread
From: Ian! D. Allen [CGL] @ 1989-03-21 15:44 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1989-03-21 15:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1989-03-21 15:44 Ultrix 3.0 signals confuse wait() system call Ian! D. Allen [CGL]

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