the examples in /usr/share/lkm are just a bit out of date (this is on 4.6-RELEASE)
$ pwd /usr/share/lkm/syscall $ sudo make ===> module cc -O2 -pipe -D_KERNEL -I/sys -c newsyscall.c newsyscall.c: In function `newsyscall': newsyscall.c:109: error: syntax error before '}' token *** Error code 1 Stop in /usr/share/lkm/syscall/module (line 92 of /usr/share/mk/sys.mk). *** Error code 1 Stop in /usr/share/lkm/syscall (line 48 of /usr/share/mk/bsd.subdir.mk). But after applying the following change: $ sudo make ===> module cc -O2 -pipe -D_KERNEL -I/sys -c newsyscall.c cc -O2 -pipe -D_KERNEL -I/sys -c mycall.c ld -r -o combined.o newsyscall.o mycall.o ===> test cc -O2 -pipe -c testsyscall.c cc -o testsyscall testsyscall.o here's the patch: --- misc/module/miscmod.c.old Fri Nov 13 05:05:37 2009 +++ misc/module/miscmod.c Fri Nov 13 05:07:06 2009 @@ -179,7 +179,7 @@ int cmd; int ver; { - DISPATCH(lkmtp,cmd,ver,miscmod_handle,miscmod_handle,lkm_nofunc) + DISPATCH(lkmtp,cmd,ver,miscmod_handle,miscmod_handle,lkm_nofunc); } --- syscall/module/newsyscall.c.old Fri Nov 13 05:05:15 2009 +++ syscall/module/newsyscall.c Fri Nov 13 04:28:49 2009 @@ -105,7 +105,7 @@ int cmd; int ver; { - DISPATCH(lkmtp,cmd,ver,newsyscall_load,lkm_nofunc,lkm_nofunc) + DISPATCH(lkmtp,cmd,ver,newsyscall_load,lkm_nofunc,lkm_nofunc); }