How does preprocessor resolve the path of linux kernel' head file?
I am new to C programming language, and currently trying to add new syscall
to Linux kernel by re-compiling the kernel.
When I read the source code, I found it very difficult to locate the path of head file.
For example:
#include <linux/kernel.h> /* for printk */
#include <linux/syscalls.h> /* for SYSCALL_DEFINE1 macro */
SYSCALL_DEFINE1(printmsg, int, i)
{
printk(KERN_DEBUG "Hello! This is a msg %d", i);
return 1;
}
This is one of my customized system calls. I edited the MakeFile in kernel/
folder and syscall_64.tbl
. After re-compiling, it worked. No compiling error.
However, my problem now is how the preprocessor resolves the path like <linux/syscalls.h>
. Based on my previous understanding, the preprocessor would go to the folder /usr/include
for searching. Certainly, there is no linux/syscalls.h
within /usr/include
.
I found linux/syscalls.h
is actually in linux's project include/linux/
.
I was wondering what makes the preprocessor search within the project just like include " "
when it is actually using <>
.
I was wondering if it is because of some part of MakeFile? If so, which command in MakeFile could make this happen?
Thank you for any help, and please let me know if I misunderstood something.
Comments
Post a Comment