【问题标题】:How to get x86 Linux kernel definitions如何获取 x86 Linux 内核定义
【发布时间】:2017-05-20 09:01:31
【问题描述】:

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

I go to LXR and do a search:

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。为什么?

当我需要查找系统调用的编号时,我遇到了同样的问题,我最终使用了包含生成表的 3rd-party website

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

x86x86_64 的所有定义是否相同? 当我需要某些尚未在 Internet 上由某人生成的内容时,我该如何继续? 我本可以在桌面上的标题中查找它,但我使用的是 x86_64,而不是 x86 .

那么,对于 x86 架构,我如何找到确切的数字标志和模式是 #defined

【问题讨论】:

标签: c linux linux-kernel x86


【解决方案1】:

如果是用户空间 API (uapi),它将在 include/uapi/asm-generic/fcntl.h 中定义。

路径中的generic 部分表示这是独立于架构的代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    • 2016-05-09
    • 2014-11-27
    • 2014-05-24
    • 2020-08-09
    • 2012-07-21
    相关资源
    最近更新 更多