Adding a System call

Hello, I am completely new to FREEBSD FreeBSD and kernel programming.

As part of my O/S course, I need to add a system call to a kernel which takes UID and signum as its arguments and sends it to all processes under that UID.

I have no clue on how to proceed, can someone please help? I tried looking at the existing kernel code but I have no clue on what's happening!
 
Hello,
Your starting point may be the following two kernel-files:
Code:
sys/kern/syscalls.master
sys/kern/syscalls.c
sys/kern/kern_prot.c
sys/kern/init_sysent.c
Maybe start with looking how a particular other syscall is implemented in there and do analogue things.

Regards,
Doena
 
Show your work, we are not here to solve your homework. Let us see what you have so far.
 
julai said:
As part of my O/S course, I need to add a system call to a kernel which takes UID and signum as its arguments and sends it to all processes under that UID.

I have no clue on how to proceed, can someone please help? I tried looking at the existing kernel code but I have no clue on what's happening!

Try reading this.
 
killpg1 system call is showing error when im building using make...its asking to define prototype..am I missing any header files? I included signal.h sys/types.h
 
caesius said:
Posting the exact error will get more replies.

Code:
#include <sys/systm.h>

Do you have this?

I included it...but still the error persists

Here is the exact error

cc1: warnings being treated as errors
../../../local/uidkill.c: In function 'sys_uidkill':
../../../local/uidkill.c:96: warning: implicit declaration of function 'kill'
../../../local/uidkill.c:96: warning: nested extern declaration of 'kill' [-Wnested-externs]
 
I assume that uidkill.c is a file that you coded yourself.

My guess is that you are experiencing a C function prototype error. This is not a BSD error, but a programmer error for violating C's language rules. In C, you have to declare functions before they are called. This is done one of two ways:

1) You list all function prototypes at the top of the file; or
2) You code your functions in full before they are called by subsequent functions in the file.

Based on your very limited information, this is my guess. We are not mind readers, so they more information you give us, the better anyone can help.
 
Back
Top