其中是/usr/include/unistd.h和limit.h from、glibc或kernel
我们知道unistd.h是一个重要的头文件,但是我不确定它是来自内核源文件还是在我们在fedora中安装libc之前安装的其中是/usr/include/unistd.h和limit.h from、glibc或kernel,c,linux,kernel,libc,C,Linux,Kernel,Libc,我们知道unistd.h是一个重要的头文件,但是我不确定它是来自内核源文件还是在我们在fedora中安装libc之前安装的 # 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
# 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>
文件中有系统调用。我们通常不使用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
非常有用的提示。glibc Headers说,我在我的电脑上试用过,但还有一个问题,这些文件中的内容是由内核定义的还是由glibc定义的。我认为这些文件是特定于平台和发行版的,因此,我认为内核必须有一个地方来存储这些类似的信息。在glibc中,我认为它可以获得系统环境,就像平台和发行版一样。内核不需要存储用户空间的信息,它来自libc源代码;h是POSIX标准头文件;如果需要的话,内核中的任何内容都将包含在本文档中。除了内核编程之外,您不应该将内核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