EDIT:
Got it
here is what i did:
in syscall.c:
extern int numSysCalls;
in sysproc.c:
int numSysCalls = -1;
Okay, so I'm working on introducing a simple system call that returns the number of system call attempts. Seems easy, but I get an error that I don't understand ...
Basically, here's what I did: in syscall.c there is a syscall () function that checks if it is syscall or not. I basically declared a variable and increment it every time this function is called.
Var declaration in syscall.c:
18: int16_t numSysCalls = -1;
Syscall () function:
115: void syscall(void){
116: numSysCalls++;
...
The error I get is:
kernel/syscall.c:116: error: ‘numSysCalls’ undeclared (first use in this function)
kernel/syscall.c:116: error: (Each undeclared identifier is reported only once
kernel/syscall.c:116: error: for each function it appears in.)
Then in sysproc.c I have the same extern int and just return int when I call my numCalls function, as follows:
External variable in sysproc.c:
extern int numSysCalls;
Method used:
int sys_numSys(void){
if (numSysCalls == -1) return numSysCalls;
else return numSysCalls + 1;
}
: numSysCalls syscall ( ) - .
numSys -1, .