问题描述
对于学校作业,我必须向freebsd添加自定义helloworld syscall.我使用以下链接作为指南: http://members.tripod.com/s_mathur/bsdhowto.html 好的!在第二步中,我遇到了问题:root没有运行它的权限,所以我使用了:"make sysent".看起来还可以.步骤4说:4.修改Makefile使其包含sys_hello.c等,然后重新编译内核.哪个makefile?以及如何编译它以及如何调用syscall你好?提前tnx
for school work I have to add custom helloworld syscall to freebsd. I used following link as my guide: http://members.tripod.com/s_mathur/bsdhowto.htmlOK!In step two I got problem: root has not permission to run it so I used: "make sysent" instead. seems ok.Step 4 says: 4. Modify the Makefile to include sys_hello.c,etc and recompile the kernel.!!!Which makefile? and how to compile it and how call syscall hello?tnx in advance
推荐答案
如果sys_hello.c包含您的syscall实现-并且位于sys/kern/sys_hello.c中,则将该文件添加到conf/files中.搜索例如.在此处"kern_fork.c"并以类似方式添加sys_hello.c.然后,重建并重新安装内核和世界(使buildkernel buildworld installkernel installworld);要使userspace部分进入libc.so,必须进行world rebuild.至于调用-好吧,就像调用另一个syscall一样调用它.您将需要在某处添加syscall声明.
If sys_hello.c contains your syscall implementation - and it's in sys/kern/sys_hello.c - then add this file to conf/files. Search for eg. "kern_fork.c" there and add sys_hello.c in a similar way. Afterwards, rebuild and reinstall kernel and world (make buildkernel buildworld installkernel installworld); world rebuild is neccessary to get the userspace part into libc.so. As for calling - well, call it like you would call another syscall. You will need to add the syscall declaration somewhere.
这篇关于freebsd通过编译内核添加自定义syscall?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!