This assignment relies on both Assignment 1 and Assignment 2. It will be checked off in the laboratory on the due date. Checkoff times will be announced. You must hand in complete source code, lint and sample output on the due date.
proc(4)
ptree
(and related functions)
wstat
waitpid
ptree
man page to
see how Sun presents proc
information.
get_prstatus
and the output_prstatus
functions
that you wrote for Assignment 2:
get_prusage
gets the usage information for
specified process. The prototype is:
int get_prusage(int pid, prusage_t *up);(Use
ioctl
with PIOCUSAGE
.)
The output_prusage
functions outputs the
prusage_t
in a readable format. The prototype is:
int output_prusage(FILE *fp, prusage_t s);
trace_stopped
which
will output status information and usage information for
a child process that has been stopped.
If the child's state indicates that it has been
terminated rather than stopped
output a message to that effect. The
waitpid must include WUNTRACED in the options
in order to receive notification of a stopped process.
int trace_stopped(FILE *fp, int pid, int stat_loc);
runsim
so that it calls trace_stopped
for each successful waitpid
.
SIGSTOP
and SIGCONT
signals from another window to children of runsim
to cause status information
to be output.