Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am on Linux 2.6.32-26-generic

When I look in to the linux source code for "ioctl.h" hearer file, I could see many variants. (for different platforms, I guess). i.e.


But I see that file being included as #include <sys/ioctl.h>

How does this mapping work?

share|improve this question
Is this more appropriate for stackoverflow? – hari Sep 21 '11 at 18:10
up vote 4 down vote accepted

I believe file is being included is /usr/include/sys/ioctl.h (not from /usr/src/linux or some). And on my system it belongs to glibc, not kernel or kernel-headers.

Actually, nothing gets included from kernel source - headers inside /usr/src/linux (or so) are being used only for kernel compilation. If some software needs some kernel headers to compile it uses ones in /usr/include/linux (and some others), which are usually part of package like kernel-headers or linux-headers.

share|improve this answer

The default search path for include files is /usr/include. This is a property of the C compiler, and in theory different compilers could use different paths, but in practice they all look in /usr/include (and a few other compiler-dependent places).

#include <sys/ioctl.h> means to look for a file called sys/ioctl.h relatively to an entry in the include path, thus /usr/include/sys/ioctl.h.

The headers in the kernel source are not relevant unless you are compiling a kernel module (or the kernel itself). Headers for userland programs come with the C library or with the C compiler.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.