bsd - freebsd compile is so complicated? -
i want add custom syscall freebsd(school work). google hundreds of time. there no right solution it. homework is: "add custom syscall freebsd kernel , recompile kernel , use it". find should follow instructions in these 2 pages:
1 : http://www.onlamp.com/pub/a/bsd/2003/10/09/adding_system_calls.html
then
2: https://www.freebsd.org/doc/en/books/handbook/kernelconfig-building.html
will shows errors in compile time:
<sys/parma.h> no such file or directory <sys/kern.h> no such file or directory <sys/syscallargs.h> no such file or directory
i removed these 3 header include form file recompile it. shows other errors like: maxcpu undeclered in pcpu.h file.
what missed? how can school work?
note: use freebsd8 in vbox
look @ error messages say; files don't exist.
- the first include file typo; it's
param.h
, notparma.h
! - there no
kern.h
. maybe meansys/kernel.h
? - idem
syscallargs.h
. perhaps meansyscall.h
?
you can find header files e.g:
find /usr/src/sys/ -type f -name '*.h'|grep 'sys/.*kern.*\.h' /usr/src/sys/ofed/include/linux/kernel.h /usr/src/sys/dev/netmap/netmap_kern.h ...
update: more important determining includes actually need.
freebsd has pretty documentation. if want use kernel function or data-structure, covered in section 9 of manual pages.
you can list manual pages in section ls /usr/share/man/man9/ | less
. or can use apropos
command. since want implement syscall, start e.g.
apropos syscall
it return:
syscall_module(9) - syscall kernel module declaration macro syscall(2), __syscall(2) - indirect system call
it seems me first 1 relevant assignment. (the second 1 how call system call user space.) read man syscall_module
. or read online.
note that:
minimal example syscall module can found in /usr/share/examples/kld/syscall/module/syscall.c.
that example should enough started on writing own system call module...
Comments
Post a Comment