alarm(seconds)
), which sends SIGALRM to the calling process after the specified time interval.
The program alarmtest.c
calls alarm(), then enters an infinite loop. A correct implementation of alarm()
kills the process after the specified number of seconds.
signal()
system call can be used to change the "disposition" of a signal, i.e. how the signal is handled when received. In this step, you need to support only SIG_DFL (default), and SIG_IGN (ignore). The template already has built-in handling for SIG_DFL (kill the process), so you need only support the configuration, and "handle" signals with a SIG_IGN disposition.
Test your implementation using alarmtest2.c
.
alarmtest3.c
.
kill
uses this system call, and takes a pid
and signal number= as arguments.
Test your program by running helloloop
, then using the program kill
to send SIGINT and SIGKILL to the helloloop
process.
setforeground()
to set a given pid as the foreground process.
(to be continued) Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |