Linux kernel headers’ organization

kernellinuxlinux-kernel

While I was doing some reading on system calls, I did a search for "syscalls.h" to find the header file in LXR. The search results puzzled me. There is a dozen of "syscalls.h" files coming from directories under "arch/_arch_name_/include/asm". These are ok, they are architecture specific definitions or something else needed. The question is why do we have two different "syscalls.h" headers under both /include/linux and /include/asm-generic?

Also, I want to find out that what /include/linux headers are for and what /include/asm-generic headers are for. How do they differentiate between each other? What is the logic behind having two separate header folders? How do they relate to each other?

Thanks

Best Answer

The software has to be portable. If you compile your C/C++ sources, then you don't need to know if you running i386/x86_64/arm/mips or what ever. The headers are linked in such way the software compiles.

All other header files exist because they were implemented a lot of different standards, there are ports from BSD and so on. So many of them are historically based. Where each one comes from and why they are there has many different reasons and will surely blow answers.

And an answer for asm-generic: stackoverflow

Related Question