Do this assignment only on the Solaris 2.5 machines. All of the Sparc 4's and Sparc 5's are running Solaris 2.5. The server, pandora, is also running Solaris 2.5.
Read Exercise 3.12 which starts on page 130 of PUP.
To find out about the proc file system under Solaris 2.5, do a
man -s4 proc.
Write the function get_prstatus described on page 133. Put this in a file called procutil.c.
Write a similar function get_pspinfo(int pid, prpsinfo_t *psp) which does a PIOCPSINFO ioctl to fill the structure pointed to by psp.
Write the function output_prstatus described on page 133. Write a similar function output_psinfo.
Each of these will only output a small subset of the available information, but each piece of information should be in a form that is nicely formatted and easily understood, that is, in plain English. Output the fields exactly in the order given below.
The fields that must be handled by output_prstatus are
The fields that must be handled by output_psinfo are
Write a main program which takes two command line arguments, a process ID, and a file name. All output from the main program should go to either standard output or the given file. The main program will do the following:
Test your program by running my program:
/usr/local/courses/cs3733/pup/proctest/proctest1 abc def gh
This program will run for a long time or until you hit Ctrl-C.
It will start by printing out its process ID.
After starting testproc1 running,
test your program using the process ID of proctest1.
Only exit proctest1 after your program has finished.
The following should be handed in in one packet staped together in the order given. All pages should be numbered with the cover page page 1.