Question: Create two c programs that handles the sending and receiving of signals. 1) The sigaction should contain a structure act, whose handler is the function
Create two c programs that handles the sending and receiving of signals.
1) The sigaction should contain a structure act, whose handler is the function question, where it asks user willing to continue or not, and waits 5 seconds for users answer. Type Ctrl-C to Quit this program. If not quitted display your name and date.
2) Create a child process to send alarm to parent process (via kill) , parent process catch the alarm signal and produce out the current time.The child process gets the parent ID by function getppid(), and it sends the SIGALRM to parent process to this PPID.
Hint:
The structure sigaction is used to dene the actions to be taken on receipt of the signal specied by int sig. This structure include three elds:
Use the below code to start with
struct sigaction act;
act.sa_handler = question;
sigemptyset(&act.sa_mask); act.sa_flags=0;
sigaction(SIGINT, &act,0);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
