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
 
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