I had a project that I just completed where our assignment was to take a OpenBSD image that our professor gave us and add a syscall to the kernel, recompile, and test it. I completed the assignment and now have some questions which might be more appropriate for the professor but I thought I'd give them a shot here.
I don't know about syscalls in other OSes so any information about how they are implemented would be great but my specific question lies in why the code for them is implemented the way it is.
The function in my .c file is:
int countOccurances( struct proc *p, void *v, register_t *retval )
In the syscalls.master file, I put what I normally would have put in the .c:
countOccurances(const char *str, char c )
To return a value, I didn't type:
return count;
I used:
*retval = count;
I am curious about why the syscalls have to be implemented in this way.
I don't know about syscalls in other OSes so any information about how they are implemented would be great but my specific question lies in why the code for them is implemented the way it is.
The function in my .c file is:
int countOccurances( struct proc *p, void *v, register_t *retval )
In the syscalls.master file, I put what I normally would have put in the .c:
countOccurances(const char *str, char c )
To return a value, I didn't type:
return count;
I used:
*retval = count;
I am curious about why the syscalls have to be implemented in this way.