From:
王哲 [mailto:wangzhe5004@xxxxxxxxx]
2012/6/20 Jeff Haran <jharan@xxxxxxxxxxxxxx> From:
王哲 [mailto:wangzhe5004@xxxxxxxxx]
2012/6/19 Jeff Haran <jharan@xxxxxxxxxxxxxx> From:
kernelnewbies-bounces@xxxxxxxxxxxxxxxxx [mailto:kernelnewbies-bounces@xxxxxxxxxxxxxxxxx]
On Behalf Of ?? Hello everyone: Because it appears you never defined the symbol SYS_mysyscall. I think so,but where shoud i defne the symbol SYS_mysyscall ?
83 #define SYS_getpid __NR_getpid
,so SYS_getpid is replaced by __NR_getpid. and __NR_getpid was defined in the kernel(arch/x86/include/asm/unistd_32.h). and my syscall was also defined there.#define SYS_mysyscall __NR_mysyscall, i don't kown why it doesn't works. My sources contain no reference to SYS_mysyscall nor __NR_mysyscall, so I assume you’ve added them to the Linux include files that you built your module from. User space programs like your main() program above generally aren’t going to include Linux source tree include files. When you include <syscall.h> from a user
space program in a typical development environment, the compiler is by default going to look for syscall.h in /usr/include, not in the Linux source tree where presumably you’ve made your modifications. Of course you can always tell the compiler to look there
using the –I command line option to gcc, if you want to. The usual practice however is to keep kernel code and user code include files completely separate. That means some duplication of effort, like having to define SYS_mysyscall in two different places,
but that’s the usual practice because most people aren’t building kernels and thus haven’t installed the kernel source include files. Jeff Haran |
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies