A simple new system call

Hello, I am a newbie in FreeBSD. I installed FreeBSD-11.0-RELEASE-amd64 on VMware. I want to add first new system call. I find this link: http://beefchunk.com/documentation/sys-programming/os-freebsd/addsystemcall.html
and: http://crypto.ee.ntu.edu.tw/~thyeh/html/syscall.html
They are a little different! which one is correct and simple?
I want to write a simple function, like a+b=c.
In /usr/src/sys/kern , in mykern.c:
Code:
#include <stdio.h>
int func()
{
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
c=a+b;
prinft("%d",c);
return 0;
}
And in syscalls.master I should to add my syscall, But what should I write now in syscalls.master file?

Thanks
 
Considering that one of those sites mentions FreeBSD 3.1 and we're now at 11.0 I think it's safe to conclude that those sites are pretty much obsolete now.

I think you should check the official developers handbook, (edit): as well as the architecture handbook which goes more in-depth on how the kernel actually functions.
 
scanf() and printf() are libc functions, i.e. userspace functions. You can't expect kernel module to wait for input like that (or call libc functions in general).
 
Back
Top