ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If i change the code the problem it's the same . The system do not recognize the variable i define in the kernel header. If i write for example : fd2=open("local",O_SESSION) the compiler say me that O_SESSION is undeclared. I did some mistake modifing the kernel headers, but i do not understand what mistake!
When you compile programs, they refer to the kernel-headers or libc-headers which are packaged separately from the kernel sources.
You could explicitly point the sources at your modified headers in the kernel sources using -I/path/to/modified/files. But that is not really correct because the headers in the kernel sources are not sanitized for external use.
The libc-headers are sanitized headers which are used to compile your glibc version and it is these headers which are referred to by (nearly) all sources at compile time. You'll find these headers under /usr/include/asm, /usr/include/asm-generic and /usr/inlcude/linux.
When you compile programs, they refer to the kernel-headers or libc-headers which are packaged separately from the kernel sources.
You could explicitly point the sources at your modified headers in the kernel sources using -I/path/to/modified/files. But that is not really correct because the headers in the kernel sources are not sanitized for external use.
The libc-headers are sanitized headers which are used to compile your glibc version and it is these headers which are referred to by (nearly) all sources at compile time. You'll find these headers under /usr/include/asm, /usr/include/asm-generic and /usr/inlcude/linux.
So you are saying that when i compile file with gcc the headers it search are in "/usr/include/asm, /usr/include/asm-generic and /usr/inlcud/linux".
i see that in usr/include/asm there is the same header i need "fcntl.h" .
But that header is different from the header i modified and recompiled in my new kernel.
Do you suggest to overwrite that header with the one i modified in the kernel ?
It would be better to modify that one -but keep a backup of the roiginal. These installed ehaders are the ones that define the functions for nearly all the software compiled on your system. That is why you should not upgrade them to match the kernel version you are running. Kernel-headers should only be upgraded when the glibc version is updated and the version of headers should, again, match those used to compile glibc with -not necessarily the version of the kernel you are running.
If the software you are compiling is a kernel module, then you should use the header from the kernel sources, but otherwsie use the installed one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.