Article View: comp.sys.dec
Article #5258Ultrix 3.0 signals confuse wait() system call
From: Ian! D. Allen [CGL]
Date: Tue, 21 Mar 1989 15:44
Date: Tue, 21 Mar 1989 15:44
38 lines
1305 bytes
1305 bytes
/*
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
Technical Details
Message-ID:
<8748@watcgl.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watcgl!idallenShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!watcgl!idallen From: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL]) Newsgroups: comp.sys.dec Subject: Ultrix 3.0 signals confuse wait() system call Message-ID: <8748@watcgl.waterloo.edu> Date: 21 Mar 89 15:44:19 GMT Distribution: comp Organization: U of Waterloo, Ontario Lines: 38