打开 C 函数的程序员联机帮助页在哪里?

j0h*_*j0h 17 man documentation

我正在使用 debian8 (jessie),我去找了 open 的联机帮助页。相反,我收到了警告:

$ man 3 open
No manual entry for open in section 3
See 'man 7 undocumented' for help when manual pages are not available.
Run Code Online (Sandbox Code Playgroud)

我已经安装了 manpage-dev 包,那么程序员手册页 (man 3) 在哪里打开?

Fah*_*tha 19

您想要man 2 open的是 C 库接口,而不是man 3 open. 它确实在manpages-dev(not manpage-dev) 中。man 3 open给出了一个 Perl 手册页。

# Show the corresponding source groff file
man -w 2 open   
/usr/share/man/man2/open.2.gz

# Show which package this file belongs to
dpkg -S /usr/share/man/man2/open.2.gz
manpages-dev: /usr/share/man/man2/open.2.gz

# Or use dlocate to show which package this file belongs to
dlocate /usr/share/man/man2/open.2.gz
manpages-dev: /usr/share/man/man2/open.2.gz
Run Code Online (Sandbox Code Playgroud)


JRF*_*son 15

联机帮助页部分在联机帮助页本身中进行了描述。进入man manshell 会话以查看各个部分和一般内容:

   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions eg /etc/passwd
   6   Games
   7   Miscellaneous  (including  macro  packages  and  conventions), e.g.
       man(7), groff(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]
Run Code Online (Sandbox Code Playgroud)

第 2 节介绍系统调用,第 3 节介绍库例程。第 2 节也描述了只是系统调用包装器的库例程。


Ran*_*832 10

只是为了进一步澄清原因,联机帮助页在第 2 节中,因为它是一个系统调用(或多或少直接作为内核的一部分实现,而不是 C 库)。

这种区别似乎有些武断,尤其是对于现在是库函数的旧系统调用(fork 仍然在第 2 节中,即使它现在是 clone 的包装器),除非您已经知道它。通常,请先查看第 3 部分,如果找不到或看起来可能不相关,请尝试第 2 部分。此外,第 2 节中的一些函数是内部或过时的特定于 linux 的函数,它们不应被正常程序(例如 getdents、gettid)调用。

您还可以安装 manpages-posix-dev 包以获取一组从可移植角度编写的联机帮助页,而不是包含特定于 linux 的信息。在这个包中,为 C 函数提供的所有联机帮助页都在第 3p 节中。