subject

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();
}
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 15:40, lmirandanvmi
Establish which of the following statements are true. (a) a sequence is convergent if and only if all of its subsequences are convergent. (b) a sequence is bounded if and only if all of its subsequences are bounded. (c) a sequence is monotonic if and only if all of its subsequences are monotonic.
Answers: 2
image
Computers and Technology, 23.06.2019 23:30, jamalchris9353
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
image
Computers and Technology, 25.06.2019 05:00, quintinlarrieu
Brad wants to buy flowers for his friend with 33 dollars. the daisies are 1 dollar each and the roses are 2 dollars each he buy 3 more daisies than roses how much did the roses cost
Answers: 2
image
Computers and Technology, 26.06.2019 11:00, yasarhan2
Imagine that you live in a country in northern europe and have just been appointed ambassador to the abbasid dynasty during the golden age of islam. your first task is to write a summary report to inform your government about the conditions in the empire. in your summary report, explain the important events occurring under muslim rule, including the division among sunni and shi’a muslims, a description of the growth and development of islam, a description of muslim achievements in the arts and sciences, and the impact of all of these factors on your government.
Answers: 1
You know the right 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:

Konu
Business, 18.03.2021 01:10
Konu
Mathematics, 18.03.2021 01:10
Konu
Computers and Technology, 18.03.2021 01:10
Konu
English, 18.03.2021 01:10
Konu
Mathematics, 18.03.2021 01:10