Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program, signals.c that will utilize signal handlers to intercept keyboard interrupts to manage control of a child process. Your main program should fork

image text in transcribed
Write a program, signals.c that will utilize signal handlers to intercept keyboard interrupts to manage control of a child process. Your main program should fork and exec a new child process to run the "yes" command (use man yes to learn more). You should then register signal handlers for both ctrl-c and ctrl-z in your main program. The ctrl-z signal handler should toggle the child yes stop the child process if it is running, or resume the child process if it is stopped, all while keeping the main program running. The ctrl-c signal should kill the child process, and then exit the main process. In both signal handlers, add print statements indicating what the program is doing- i.e. "ctrl-z caught, stopping child process". Your main program should sit in an infinite loop once the setup has been completed. It should only exit when the user hits ctrl-c, after cleaning up the child process

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_2

Step: 3

blur-text-image_3

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 Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions