Question

We know that unistd.h is an important header, however I am not sure if it comes from kernel source or it is installed until we install libc?

Was it helpful?

Solution

in fedora

# rpm -qf /usr/include/unistd.h
eglibc-headers-2.13-2.21.i686

we can see this part in header file

this file is part of the GNU C Library.

and in the kernel version 2.6.32.21 we can see

/* kernel/include/linux/unistd.h */
#include <asm/unistd.h>

we suppose X86

/* kernel/arch/x86/include/asm/unistd.h */
# ifdef CONFIG_X86_32
#  include "unistd_32.h"
# else
#  include "unistd_64.h"
# endif

and in the file there is system call. not we normally use unistd.h

/*
 * This file contains the system call numbers.
 */

#define __NR_restart_syscall      0
#define __NR_exit         1
#define __NR_fork         2
#define __NR_read         3
#define __NR_write        4
#define __NR_open         5
#define __NR_close        6
#define __NR_waitpid          7
#define __NR_creat        8
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top