c - 如何获取 x86 Linux 内核定义



假设我想找到O_APPEND的真正定义,这是open()系统调用的标志之一。根据实际定义,我的意思是像0x2这样的数字.

我去LXR做一个搜索:

Defined in 5 files:
arch/alpha/include/uapi/asm/fcntl.h, line 10 (as a macro)
arch/mips/include/uapi/asm/fcntl.h, line 13 (as a macro)
arch/parisc/include/uapi/asm/fcntl.h, line 4 (as a macro)
arch/sparc/include/uapi/asm/fcntl.h, line 4 (as a macro)
include/uapi/asm-generic/fcntl.h, line 35 (as a macro)

但是,这里没有x86。为什么?

当我需要查找系统呼叫的号码时,我遇到了同样的问题,我最终使用了包含生成表的第三方网站。

如果我理解正确,syscall 以某种方式是即时生成的,因此在内核针对特定架构进行预处理之前,不可能查找它们。

对于x86x86_64的所有定义,它都是相同的故事吗?当我需要某人生成的互联网上尚未存在的内容时,如何继续?我本可以在桌面上的标题中查找它,但我使用 x86_64 ,而不是x86.

那么,如何找到 x86 架构的确切数字标志和模式#define d

在用户空间 API (uapi( 的情况下,它将在 include/uapi/asm-generic/fcntl.h 中定义。

路径的generic部分意味着这是独立于体系结构的代码。

最新更新