CS 3733 Operating Systems, Spring 2002 Assignment 4 Comments
The assignment was graded on a basis of 30 points.
- Watch out for lint warning about implicit declarations.
You should get rid of these.
- You should also get rid of warnings about declared global, could be static.
- The argument not used in the signal handler is OK.
You can get rid of this by putting
/* ARGSUSED */
before the function definition.
- The read system call returns 0 on end-of-file.
- Please, no line longer than 80 in the source.
- sigaction should not be done in the loop that calls readline.
It only needs to be executed once.
- It is not necessary to add SIGUSR1 to the sa_mask since it is
automatically blocked while the signal handler is executing.
- It is possible to do this without global variables, but not necessary.
There may be many ways to do this but the simplest is to think of the
variables as part of an object. The problem is that both the setting and
the getting must be done with a single function.
Only one student explained how to do this in any detail.
The variables are declared static inside the function.
The functions returns and int and takes at least two parameters,
one specifying what to do (which variable and whether to read or write)
and the value to write (which is not be used if reading is specified).
Note: A variable declared static outside of any block is still global,
in that it can be accessed by any function in that file.