【发布时间】:2017-05-20 09:01:31
【问题描述】:
假设我想找到O_APPEND 的真正定义,它是open() 系统调用的标志之一。按照真正的定义,我的意思是像0x2 这样的数字。
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。
如果我理解正确的话,系统调用是以某种方式即时生成的,因此在针对特定架构对内核进行预处理之前,不可能查找它们。
x86 和 x86_64 的所有定义是否相同? 当我需要某些尚未在 Internet 上由某人生成的内容时,我该如何继续? 我本可以在桌面上的标题中查找它,但我使用的是 x86_64,而不是 x86 .
那么,对于 x86 架构,我如何找到确切的数字标志和模式是 #defined ?
【问题讨论】:
-
查看
strace使用的脚本可能会有所帮助。例如,sourceforge.net/p/strace/code/ci/master/tree/maint/….
标签: c linux linux-kernel x86