Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE THE CODE IN C AND ALSO ADD COMMENTS ON THE CODE AND SHOW THAT IT WORKS BASED ON WHATS GIVEN BELOW Write a

PLEASE WRITE THE CODE IN C AND ALSO ADD COMMENTS ON THE CODE AND SHOW THAT IT WORKS BASED ON WHATS GIVEN BELOW

image text in transcribed

Write a program that blocks and then unblocks the signals, SIGINT (ctrl + c and SIGQUIT (ctrl+ \) in followin g steps 1) Set up the handler for the signal SIGINT and SIGQUIT Use signal() to set up a handler The handler function should print out signal number and description about . the signal: use the argument for the signal number and strsignal) for description 2) Block SIGINT and SIGQUIT for 10 seconds Use sigprocmask() to block . Use sleep() for 10 second:s . Try 'ctrk' and 'ctrl-1, to see that the pending signals include SIGINT and SIGQUIT at the next step (the handler should not be called) .Signals other than SIGINT and SIGQUIT should not be blocked 3) Show pending signals Use sigpending() and printsigset() . Pending signals will be shown If there is not pending signals, print "empty signal set" 4) Unblock SIGINT and SIGQUIT Use sigprocmask) The handler function should print out "I caught signal 2 (Interrupt)" when you type in "ctrl-c", for example 5) The program should loop until SIGINT (not SIGQUIT) is caught, when the SIGINIT is caught the program is finished

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago