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, 22.06.2019 08:40, batman48000
1. the program must provide following functions to extract some statistics. note that the data_list parameter specified in these functions may be the same for all functions or different for different functions—that is your choice. a skeleton file is provided on mirmir. a) open_file()prompts the user to enter a year number for the data file. the program will check whether the year is between 1990 and 2015 (both inclusive). if year number is valid, the program will try to open data file with file name ‘year. txt’, where is the year. appropriate error message should be shown if the data file cannot be opened or if the year number is invalid. this function will loop until it receives proper input and successfully opens the file. it returns a file pointer and year. i. hint: use string concatenation to construct the file name b) read_file(fp)has one parameter, a file pointer read. this function returns a list of your choosing containing data you need for other parts of this project. c) find_average(data_list) takes a list of data (of some organization of your choosing) and returns the average salary. the function does not print anything. hints: i. this is not the average of the last column of data. it is not mathematically valid to find an average by finding the average of averages—for example, in this case there are many more in the lowest category than in the highest category. ii. how many wage earners are considered in finding the average (denominator)
Answers: 1
image
Computers and Technology, 22.06.2019 20:30, fickllyd000
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, Molly05
In my email i got a message it says a quick message and in message details on who its from its says nicole and under nicole is 50e0bf08e5b671@ualwgypg91wa5wl. uzo9kbud3qjwddygd5.vng -
Answers: 1
image
Computers and Technology, 24.06.2019 00:00, miguelturner
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
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
English, 02.06.2021 20:20
Konu
Mathematics, 02.06.2021 20:20
Konu
Mathematics, 02.06.2021 20:20
Konu
English, 02.06.2021 20:20