Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a program that blocks and then ignores the signal, SIGINT in 7 steps as follows 1) Set up the handler for the signal

1. Write a program that blocks and then ignores the signal, SIGINT in 7 steps as

follows

1) Set up the handler for the signal SIGINT

Use signal( ) to set up a handler for SIGINT

The handler function should print out signal number and description about the signal : use the passed argument for the signal number and strsignal( ) for description

2) Block SIGINT for 10 seconds

Use sigprocmask( ) to block SIGINT and

Use sleep( ) to keep 10 seconds

Try Control-C (it generates a signal SIGINT) to see the pending signals

include SIGINT at the next step (the handler should not be called).

3) Show pending signals

Use sigpending( ) and printSigset( )

Pending signals will be shown

4) Ignore SIGINT

Use SIG_IGN option for signal( )

5) Show pending signals again

Use sigpending( ) and printSigset( )

Nothing will be shown

6) Set up the handler for SIGINT again

Use signal( )

7) Unblock SIGINT

Use sigprocmask( )

Use sleep( ) to keep for 10 seconds

The handler function should be working printing out I caught signal 2 (Interrupt) when you type in Control-C.

The functions introduced in each step are required to be used for this

homework.

You can also use other related functions covered in the lecture notes.

Your program should print out a statement indicating each step, for example,

$ ./homework4

Step 1) Setting up

Step 2) Blocking (10 seconds)

^CStep 3) Pending signals are 2 (Interrupt) Step 4) Ignoring

Step 5) Pending signals are

Step 6) Setting up again Step 7) Unblocking

^CI caught signal 2 (Interrupt)

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago

Question

How would you assess the value of an approach like this?

Answered: 1 week ago