CS 474: Operating Systems

Programming Assignment #1
 

Project 1: Simple signal handler routine to demonstrate how to set
           signal handlers

Relevant material:  UNIX man pages.  On Linux, you may need to read the following man pages:

         man signal
         man 7 signal
         man kill
         man ps
         man exit
         man sleep

         (HINT: You will probably only need signal()).

Programming Language:  C -- NO EXCEPTIONS.  A properly commented/documented
       program is expected.  Note, your name, date, and purpose of
       program must be part of the comments.
 

Requirements:  Write a program which creates signal handlers for the
        SIGUSR1 and SIGUSR2 signals.  The main routine may be an infinite "sleep" loop.
        On receipt of SIGUSR1 the output should be the day and time
        of the final exam.  On receipt of SIGUSR2, the output should
        be whether the author has a conflict with that date with
        respect to other NMSU final exams.

       You will also need to reset the signal inside the signal handler to enable it again (this is a requirement).

        Error handling for SIG_ERR should be performed.  If SIG_ERR
        is raised, the program should indicate an error and exit with
        a return code of 1.
 

Testing:  After successful compilation of your program, you may invoke it with the background option ('&').  You can then use signals on the back grounded process.

I will (at least) test your program in the following manner:

       project1 &
       kill -USR1 %1
       kill -USR2 %1
       kill %1