我们知道unistd.h是一个重要的标题,但我不确定它是来自内核源代码还是在我们安装libc之前安装它?
答案 0 :(得分:2)
# rpm -qf /usr/include/unistd.h
eglibc-headers-2.13-2.21.i686
我们可以在头文件中看到这部分
this file is part of the GNU C Library.
在内核版本2.6.32.21中我们可以看到
/* kernel/include/linux/unistd.h */
#include <asm/unistd.h>
我们假设X86
/* kernel/arch/x86/include/asm/unistd.h */
# ifdef CONFIG_X86_32
# include "unistd_32.h"
# else
# include "unistd_64.h"
# endif
并且在文件中有系统调用。我们通常不使用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