简体   繁体   中英

How to get x86 Linux kernel definitions

Let's say I want to find the real definition of O_APPEND , which is one of the flags for open() syscall. By real definition, I mean a number like 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)

However, there's no x86 here. Why?

I faced the same problem when I needed to look up the numbers for syscalls and I ended up using a 3rd-party website that contains a generated table.

If I understood correctly, syscalls are somehow generated on-the-fly, so there's no possibility to look them up until the kernel is preprocessed for a specific architecture.

Is it the same story for all the defines for x86 and x86_64 ? How do I continue when I need something that is not already on the Internet generated by someone? I could've looked it up on my desktop in headers, but I use x86_64 , not x86 .

So, how do I find the exact numbers flags and modes are #define d to for x86 architechture ?

In the case of the user space API (uapi), it will be defined in include/uapi/asm-generic/fcntl.h .

The generic part of the path means this is architecture independent code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM