freebsd add custom syscall by compiling the kernel?

蓝咒 提交于 2019-12-13 18:43:13

问题


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.html OK! 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


回答1:


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.



来源:https://stackoverflow.com/questions/29755770/freebsd-add-custom-syscall-by-compiling-the-kernel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!