Lines Matching +full:signal +full:- +full:exit
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
36 OS Test - Silicon Graphics, Inc.
38 TEST IDENTIFIER : kill02 Sending a signal to processes with the same process group ID.
44 CO-PILOT : Barrie Kletscher
50 1. Sending a signal to pid of zero sends to all processes whose process
53 2. Sending a signal to pid of zero does not send to processes in another process group.
58 kiltcs02 1 PASS The signal was sent to all processes in the process group.
59 kiltcs02 2 PASS The signal was not sent to selective processes that were not in the process group.
62 kiltcs02 1 FAIL The signal was not sent to all processes in the process group.
63 kiltcs02 2 FAIL The signal was sent to a process that was not in the process group.
67 kiltcs02 # BROK Setting to catch unexpected signal %d failed. Errno: %d, Error message %s.
68 kiltcs02 # BROK Setting to ignore signal %d failed. Errno: %d, Error message %s.
71 kiltcs02 0 WARN Unexpected signal X was caught.
80 Set up unexpected signal handling.
84 If setup fails exit.
87 Send the signal SIGUSR1 with pid equal to zero.
89 to process the signal.
91 out if the child was interrupted by the signal and wrote to it.
94 Exit.
102 Pause until the signal SIGUSR1 comes in from the parent.
104 Exit.
110 Pause until killed by parent because this child shouldn't receive signal SIGUSR1.
115 Pause until the signal SIGUSR1 comes in from the parent.
116 Exit.
122 Pause until killed by parent because this child shouldn't receive signal SIGUSR1.
124 **usr1_rout-Used by all children**
125 Write to the appropriate pipe that the signal SIGUSR1 was caught.
135 #include <signal.h>
142 #define SIG_CAUGHT "2" /*Indicates that the signal SIGUSR1 was caught. */
143 #define SIG_RECEIVED 1 /*Integer value that indicates that the signal SIGUSR1 */
145 #define SIG_NOT_RECD 0 /*Integer value that indicates that the signal SIGUSR1 */
149 #define SLEEP_TIME 10 /*Amount of time the children get to catch the signal */
153 /*parents signal. */
155 #define CHILD_EXIT(VAR) ((VAR >> 8) & 0377) /*Exit value from the child. */
156 #define CHILD_SIG(VAR) (VAR & 0377) /*Signal value from the termination of child. */
185 void notify_timeout(); /*Signal handler that the parent enters if it times out */
193 /*they have caught signal SIGUSR1. */
240 if (kill(pid1, SIGKILL) == -1 in main()
255 if (kill(pid1, SIGKILL) == -1 && errno != ESRCH) { in main()
292 * get set up. Then sends the signal and checks the outcome.
297 * Set to catch the alarm signal SIGALRM. in parent_rout()
299 if (signal(SIGALRM, notify_timeout) == SIG_ERR) { in parent_rout()
351 if (TEST_RETURN == -1) { in parent_rout()
359 * catch the signal. in parent_rout()
364 * The signal was sent above and time has run out for child response, in parent_rout()
368 if (read1_stat == -1 && errno == EAGAIN) in parent_rout()
371 if (read2_stat == -1 && errno == EAGAIN) in parent_rout()
374 if (readA_stat == -1 && errno == EAGAIN) in parent_rout()
377 if (readB_stat == -1 && errno == EAGAIN) in parent_rout()
380 if (read1_stat == -1 || read2_stat == -1 || in parent_rout()
381 readA_stat == -1 || readB_stat == -1) { in parent_rout()
391 * Check the processes that were supposed to get the signal. in parent_rout()
397 * the signal did receive the signal. in parent_rout()
400 "The signal was sent to all processes in the process group."); in parent_rout()
401 } else { /*Process A didn't receive the signal. */ in parent_rout()
403 "Process A did not receive the signal."); in parent_rout()
406 } else { /*Process 1 didn't receive the signal. */ in parent_rout()
407 tst_resm(TFAIL, "Process 1 did not receive the signal."); in parent_rout()
411 * Check the processes that were not supposed to get the signal. in parent_rout()
416 * Both processes, 2 and B did not receive the signal. in parent_rout()
419 "The signal was not sent to selective processes that were not in the process group."); in parent_rout()
420 } else { /*Process B received the signal. */ in parent_rout()
421 tst_resm(TFAIL, "Process B received the signal."); in parent_rout()
426 else { /*Process 2 received the signal. */ in parent_rout()
428 tst_resm(TFAIL, "Process 2 received the signal."); in parent_rout()
446 if (signal(SIGUSR1, usr1_rout) == SIG_ERR) { in child1_rout()
448 "Could not set to catch the childrens signal."); in child1_rout()
450 exit(0); in child1_rout()
466 exit(0); in child1_rout()
473 else if (pidB == -1) { in child1_rout()
477 if (kill(pidA, SIGKILL) == -1) in child1_rout()
482 exit(0); in child1_rout()
492 exit(0); in child1_rout()
500 else if (pidA == -1) { in child1_rout()
506 exit(0); in child1_rout()
512 if (signal(SIGUSR2, chld1_kill) == SIG_ERR) { in child1_rout()
514 "Could not set to catch the parents signal."); in child1_rout()
517 exit(0); in child1_rout()
521 * Set to catch the alarm signal SIGALRM. in child1_rout()
523 if (signal(SIGALRM, notify_timeout) == SIG_ERR) { in child1_rout()
528 exit(0); in child1_rout()
537 (void)alarm(TIMEOUT - 40); in child1_rout()
541 (void)alarm(TIMEOUT - 40); in child1_rout()
555 exit(0); in child1_rout()
564 * Pause until the signal SIGUSR1 or SIGUSR2 is sent from the parent. in child1_rout()
569 * Pause until signal SIGUSR2 is sent from the parent. in child1_rout()
579 * This is the routine for child 2, which should not receive the parents signal.
594 if (signal(SIGUSR1, usr1_rout) == SIG_ERR) { in child2_rout()
596 "Could not set to catch the parents signal."); in child2_rout()
598 exit(0); in child2_rout()
611 * This is the routine for child A, which should receive the parents signal.
625 exit(0); in childA_rout()
634 /* Setup the signal handler again */ in childA_rout_uclinux()
635 if (signal(SIGUSR1, usr1_rout) == SIG_ERR) { in childA_rout_uclinux()
637 "Could not set to catch the childrens signal."); in childA_rout_uclinux()
639 exit(0); in childA_rout_uclinux()
647 * This is the routine for child B, which should not receive the parents signal.
667 exit(0); in childB_rout()
676 /* Setup the signal handler again */ in childB_rout_uclinux()
677 if (signal(SIGUSR1, usr1_rout) == SIG_ERR) { in childB_rout_uclinux()
679 "Could not set to catch the childrens signal."); in childB_rout_uclinux()
681 exit(0); in childB_rout_uclinux()
689 * This routine sets up the interprocess communication pipes, signal handling,
705 * SIGUSR1 is set to be ignored because this is the signal we are using for in setup()
711 if (signal(SIGUSR1, SIG_IGN) == SIG_ERR) { in setup()
713 "signal(SIGUSR1, SIG_IGN) failed"); in setup()
716 if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { in setup()
718 "signal(SIGCHLD, SIG_IGN) failed"); in setup()
726 if ((pipe(pipe1_fd) == -1) in setup()
727 || (fcntl(pipe1_fd[0], F_SETFL, O_NDELAY) == -1)) { in setup()
732 if ((pipe(pipe2_fd) == -1) in setup()
733 || (fcntl(pipe2_fd[0], F_SETFL, O_NDELAY) == -1)) { in setup()
738 if ((pipe(pipeA_fd) == -1) in setup()
739 || (fcntl(pipeA_fd[0], F_SETFL, O_NDELAY) == -1)) { in setup()
744 if ((pipe(pipeB_fd) == -1) in setup()
745 || (fcntl(pipeB_fd[0], F_SETFL, O_NDELAY) == -1)) { in setup()
767 if (write(pipe1_fd[1], SIG_CAUGHT, 1) == -1) in usr1_rout()
769 "Writing signal catching status failed in child 1."); in usr1_rout()
772 if (write(pipe2_fd[1], SIG_CAUGHT, 1) == -1) in usr1_rout()
774 "Writing signal catching status failed in child 2."); in usr1_rout()
777 if (write(pipeA_fd[1], SIG_CAUGHT, 1) == -1) in usr1_rout()
779 "Writing signal catching status failed in child A."); in usr1_rout()
782 if (write(pipeB_fd[1], SIG_CAUGHT, 1) == -1) in usr1_rout()
784 "Writing signal catching status failed in child B."); in usr1_rout()
817 if (kill(pid1, SIGUSR2) == -1 && errno != ESRCH) { in par_kill()
826 if (kill(pid2, SIGKILL) == -1 && errno != ESRCH) in par_kill()
843 if (kill(pidA, SIGKILL) == -1 && errno != ESRCH) in chld1_kill()
850 if (kill(pidB, SIGKILL) == -1 && errno != ESRCH) in chld1_kill()
855 exit(0); in chld1_kill()
860 * cleanup() - performs all ONE TIME cleanup for this test at
861 * completion or premature exit.