Initial revision
This commit is contained in:
1
lang/cem/ctest/ctsys/run
Normal file
1
lang/cem/ctest/ctsys/run
Normal file
@@ -0,0 +1 @@
|
||||
make "P=tfork" -fsk ../makefile ${1-gen}
|
||||
11
lang/cem/ctest/ctsys/signal.c
Normal file
11
lang/cem/ctest/ctsys/signal.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <signal.h>
|
||||
foo()
|
||||
{
|
||||
printf("signal received\n");
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
signal(SIGINT,foo);
|
||||
while(1);
|
||||
}
|
||||
31
lang/cem/ctest/ctsys/tfork.c
Normal file
31
lang/cem/ctest/ctsys/tfork.c
Normal file
@@ -0,0 +1,31 @@
|
||||
main(argc,argv) char **argv ; {
|
||||
int child, waitchild ;
|
||||
int status ;
|
||||
child=fork() ;
|
||||
if ( child== -1 ) {
|
||||
printf("fork returned -1\n") ;
|
||||
return 1 ;
|
||||
}
|
||||
if ( child ) {
|
||||
/* The parent */
|
||||
printf("childno %d\n",child ) ;
|
||||
do {
|
||||
waitchild= wait(&status ) ;
|
||||
printf("Child %d, status 0x%x\n",waitchild,status) ;
|
||||
if ( waitchild== -1 ) {
|
||||
printf("No children\n") ;
|
||||
return 1 ;
|
||||
}
|
||||
} while ( waitchild!=child ) ;
|
||||
if ( argc<=1 && status != (8<<8) ) {
|
||||
printf("incorrect status return\n") ;
|
||||
return 2 ;
|
||||
}
|
||||
} else {
|
||||
/* The child */
|
||||
if ( argc>1 ) pause() ;
|
||||
return 8 ;
|
||||
}
|
||||
printf("fork/wait ok\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
3
lang/cem/ctest/ctsys/tfork.cem.g
Normal file
3
lang/cem/ctest/ctsys/tfork.cem.g
Normal file
@@ -0,0 +1,3 @@
|
||||
childno N
|
||||
Child N, status 0x800
|
||||
fork/wait ok
|
||||
Reference in New Issue
Block a user