0

すべてのシステムコールの定数を取得しようとしていますが、 と の間でカーネルのソースに大きな混乱があるinclude/asm/unistd.hようinclude/asm/unistd_XX.hですinclude/asm-generic/unistd.h

それらのそれぞれの違いは何ですか?

取得したい場合は、どちらを使用する必要がありますか:

a) x86 syscalls
b) x64 syscalls
c) IA32 emulation syscalls
4

1 に答える 1

0

したがって、正しい方法はunistd.hfor x64and/or unistd_32.hfor x86andを使用することia32です。これらのファイルは、Linux ディストリビューションのヘッダーにあります。ただし、パスはディストリビューション間で (さらにはカーネル間でも) 変わることに注意してください。そのため、これらのファイルが正確にどこにあるかを確認する最良の方法は次のとおりです。

uni_hack.h

#if defined(CONFIG_X86)  <---- replace with whatever you want, #ifdef CONFIG_IA32_EMULATION for example
#   include <asm/unistd_32.h>
#endif

-

Kbuild file

obj-m += kernel_module_example.o

$(obj)/kernel_module_example.o: $(obj)/real_unistd.h

$(obj)/real_unistd.h: $(src)/uni_hack.h FORCE
    cpp $(c_flags) -E -dM <$< >$@  <---- this will generate "real_unistd.h" in the directory of your kernel module, and it will contain the content of unistd_32.h

unistd.hforの使用は、ソース コードで -ing するx64だけの問題です。#include

于 2013-07-09T22:59:46.223 に答える