Question: List ALL possible outputs of this program, assuming that all function and system calls succeed and return without error. You may also assume that no

List ALL possible outputs of this program, assuming that all function and system calls succeed and return without error. You may also assume that no externally issued signals are sent to either process. int counter = 0; void handler (int sig) { counter++; } int main() { signal (SIGUSR1, handler); signal (SIGUSR2, handler); int parent = getpid(); int child = fork(); if (child == 0) { kill (parent, SIGUSR1); kill (parent, SIGUSR2); kill (parent, SIGUSR1); kill (parent, SIGUSR2); exit(0); } sleep (1); waitpid (child, NULL, 0); printf ("Rec %d USR 1,2 sigs ", counter); return 0; }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
