Linux 中 man手册中函数后面括号数字释义

文章目录

简介

Linux手册页项目记录了用户空间程序使用的Linux内核和C库接口。
用man手册查看系统命令,系统调用,glibc函数时,会发现其后面会有个括号,括号里面是一个数字,比如:

access(2),  awk(1),  crash(1),  fattach(3C),  ff(1),  fstat(8), fuser(1), gethostname(2), isprint(3), kill(1), localtime(3), lstat(2), modload(8), mount(8), netstat(1), ofiles(8L), perl(1),
ps(1), readlink(2), setlocale(3), stat(2), strftime(3), time(2), uname(1).

Linux手册页记录了用户空间程序使用的Linux内核和C库接口(主要是GNU C库(glibc)):

1: User commands; man-pages includes a small number of Section 1 pages that document programs supplied by the GNU C library.
2: System calls documents the system calls provided by the Linux kernel.
3: Library functions documents the functions provided by the standard C library.
4: Devices documents details of various devices, most of which reside in /dev.
5: Files describes various file formats and filesystems, and includes proc(5), which documents the /proc file system.
7: Overviews, conventions, and miscellaneous.
8: Superuser and system administration commands; man-pages includes a small number of Section 8 pages that document programs supplied by the GNU C library.

下图表示进程的地址空间。图的左侧是说进程可以通过什么方式来更改进程虚拟地址空间,而中间就是进程虚拟地址空间是如何划分的,右侧则是进程的虚拟地址空间所对应的物理内存或者说物理地址空间。
其中函数括号中的数字2代表该函数是系统调用,3代表该函数是库函数。
在这里插入图片描述
图片来自于 极客时间:Linux内核技术实战

很多系统调用都有两个手册页:用户命令和系统调用。
比如 readlink :

[root@localhost ~]# man 1 readlink
READLINK(1)                                                                                User Commands                                                                                READLINK(1)

NAME
       readlink - print resolved symbolic links or canonical file names

SYNOPSIS
       readlink [OPTION]... FILE...

[root@localhost ~]# man 2 readlink
READLINK(2)                                                                          Linux Programmer's Manual                                                                          READLINK(2)

NAME
       readlink - read value of a symbolic link

SYNOPSIS
       #include <unistd.h>

       ssize_t readlink(const char *path, char *buf, size_t bufsiz);

还有些库函数也有多个手册页,比如 netlink :

netlink(3)  //用 man 3 netlink 查看
netlink(7)	//用 man 7 netlink 查看

参考资料

极客时间:Linux内核技术实战

https://www.kernel.org/doc/man-pages/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值