We need to develop a system call that will gather use statistics regarding all processes currently running. This system call will receive a custom struct as an argument, and this struct will be populated by the kernel, where it can then be accessed from user space. The system call has the prototype:
int getpinfo(struct pstat *)
And the custom structure will have the definition of:
#ifndef _PSTAT_H_
#define _PSTAT_H_
#include "param.h"
struct pstat {
int inuse[NPROC]; // whether this slot of the process table is in use (1 or 0)
int tickets[NPROC]; // the number of tickets this process has
int pid[NPROC]; // the PID of each process
int ticks[NPROC]; // the number of ticks each process has accumulated
};
#endif // _PSTAT_H_
As part of the professors requirement, we must mimic how this pointer is security checked when it is given, like other system calls. The routine should return 0 if successful, or -1 otherwise.
We need to develop a system call that will gather use statistics regarding all processes currently running. This system call will receive a custom struct as an argument, and this struct will be populated by the kernel, where it can then be accessed from user space. The system call has the prototype:
int getpinfo(struct pstat *)
And the custom structure will have the definition of:
As part of the professors requirement, we must mimic how this pointer is security checked when it is given, like other system calls. The routine should return 0 if successful, or -1 otherwise.