Computers and Technology

Suppose we have a program that calls two functions do_f1() and do_f2() in that order. a. After calling do_f1(), it sends SIGSUR1 signal to its parent.
b. Before calling do_f2 (), it waits for SIGUSR2 signal, which will be sent from another process, so don't worry about who sends the signal SIGUSR2.
You are asked to implement this program and use sigsuspend() to wait for a signal.
// all the necessary libraries are included
do f1() { /* ... */ } /* Suppose these functions are already */
do_f2() { /* ... */} /* implemented for you. So, just use them */
static int sigreceived = 0;
void my_sig_handler (int signo) {
sigreceived = 1;
}
void main() {
struct sigaction act;
sigset_t blockmask, sigmask;
do f1() ;
/* (a) show how to send SIGUSR1 to the parent process */
/* (b) show how to set up the necessary structures and masks and then wait for SIGUSR2 using sigsuspent() */
do_f2();
}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, abbygriffin2009
Martha is a healer, a healthcare provider, and an experienced nurse. she wants to share her daily experiences, as well as her 12 years of work knowledge, with people who may be interested in health and healing. which mode of internet communication can martha use?
Answers: 3
image
Computers and Technology, 22.06.2019 18:30, Akkenson17871
The "instance" relationship shows that something is an object of a
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, victordhernandez01
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
image
Computers and Technology, 24.06.2019 07:00, jared2461
Jean has kept the content of her website limited to what is important; she has also ensured that the text follows a particular style and color all throughout her website. which website features has jean kept in mind? jean has limited the content of her website to what is important; this ensures (clarity, simplicity, harmony and unity) of the content. she has also formatted the text in a particular style and color throughout her website, ensuring (balance, simplicity, consistency)
Answers: 2
Do you know the correct answer?
Suppose we have a program that calls two functions do_f1() and do_f2() in that order. a. After call...

Questions in other subjects: