diff --git a/proc.c b/proc.c index bcdbfea..a8759cc 100644 --- a/proc.c +++ b/proc.c @@ -36,6 +36,7 @@ allocproc(void) { struct proc *p; char *sp; + int i; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) @@ -70,6 +71,10 @@ found: memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; + // Initialise the syscall count array entries with 0 + for (i = 0; i < NO_OF_SYSCALLS; i++) + p->syscall_count[i] = 0; + return p; } diff --git a/proc.h b/proc.h index 6561ad3..ac325c9 100644 --- a/proc.h +++ b/proc.h @@ -1,5 +1,6 @@ // Segments in proc->gdt. #define NSEGS 7 +#define NO_OF_SYSCALLS 22 // Per-CPU state struct cpu { @@ -66,6 +67,7 @@ struct proc { struct file *ofile[NOFILE]; // Open files struct inode *cwd; // Current directory char name[16]; // Process name (debugging) + uint syscall_count[NO_OF_SYSCALLS]; // Number of particular syscalls }; // Process memory is laid out contiguously, low addresses first: