freebsd 通过编译内核添加自定义系统调用?

freebsd add custom syscall by compiling the kernel?

为了完成学业,我必须将自定义的 helloworld 系统调用添加到 freebsd。我使用以下 link 作为指导:http://members.tripod.com/s_mathur/bsdhowto.html 好的! 在第二步中,我遇到了问题:root 没有 运行 的权限,所以我使用了:"make sysent"。似乎还可以。 第 4 步说: 4. 修改 Makefile 以包含 sys_hello.c 等并重新编译内核。!!! 哪个生成文件?以及如何编译它以及如何调用 syscall hello? 提前tnx

如果 sys_hello.c 包含您的系统调用实现 - 并且它在 sys/kern/sys_hello.c 中 - 然后将此文件添加到 conf/files。搜索例如。 "kern_fork.c" 并以类似的方式添加 sys_hello.c。之后,重建并重新安装内核和世界(make buildkernel buildworld installkernel installworld);需要重建世界才能将用户空间部分放入 libc.so。至于调用 - 好吧,就像调用另一个系统调用一样调用它。您需要在某处添加系统调用声明。