kernel headers

The C library and compiled programs needs to interact with the kernel

  • Available system calls and their numbers
  • Constant definitions
  • Data structures, etc. Therefore, compiling the C library requires kernel headers, and many applications also require them. Available in and and a few other directories corresponding to the ones visible in include/ in the kernel sources

System call numbers, in

define __NR_exit 1

define __NR_fork 2

define __NR_read 3

▶ Constant definitions, here in ,included from , included from

define O_RDWR 00000002

▶ Data structures, here in struct stat { unsigned long st_dev; unsigned long st_ino; [...] };

▶ The kernel to user space ABI is backward compatible ▶ Binaries generated with a toolchain using kernel headers older than the running kernel will work without problem, but won't be able to use the new system calls, data structures, etc. ▶ Binaries generated with a toolchain using kernel headers newer than the running kernel might work on if they don't use the recent features, otherwise they will break ▶ Using the latest kernel headers is not necessary, unless access to the new kernel features is needed ▶ The kernel headers are extracted from the kernel sources using the headers_install kernel Makefile target.

results matching ""

    No results matching ""