Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a program that uses system call int kill(pid_t pid, int sig) to deliver signal SIGINT and signal SIGHQUIT. Provide pid_t pid from command line

  1. Develop a program that uses system call int kill(pid_t pid, int sig) to deliver signal SIGINT and signal SIGHQUIT. Provide pid_t pid from command line to the program. Let the process sleep 3 seconds between delivering signal SIGINT and signal SIGHQUIT. Then run Program Example 4.4 at the end of Lecture 4 as a background job. Use your program to deliver signal SIGINT and signal SIGHQUIT to the process of Program Example 4.4.

Example 4.4 given ..

#include #include #include #include int main() { int i; void signal_catcher(int); if (signal(SIGINT, signal_catcher) ==SIG_ERR) { perror("SIGINT"); exit(1); } if (signal(SIGQUIT, signal_catcher) ==SIG_ERR) { perror("SIGQUIT"); exit(2); } for (i=0; ; ++i) { printf("%i ", i); sleep(1); } } void signal_catcher(int the_sig) { signal(the_sig, signal_catcher); /*reset*/ printf(" Signal %d received. ", the_sig); if (the_sig == SIGQUIT) exit(3); }

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

=+(0

Answered: 1 week ago

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago