代码之家  ›  专栏  ›  技术社区  ›  zomega

如果有关libc的手册页不是来自glibc,它们从哪里来?

  •  0
  • zomega  · 技术社区  · 2 年前

    关于libc的手册页是从哪里来的?

    它们不能来自glibc,因为它们与glibc的API略有不同。

    一个例子是的手册页 mmap 。它描述了一个标志 MAP_UNINITIALIZED .

    但这个标志在glibc中并不存在。Glibc不想支持这个标志,因为他们说它是 kernel only .如果你输了 glibc source 你也可以看到他们从来没有在任何地方定义这个宏。

    那么,如果关于libc的手册页不是来自glibc,它们从哪里来呢?

    1 回复  |  直到 2 年前
        1
  •  1
  •   Caulder    2 年前

    至少在我的mmap(2)手册页的顶部写着:“Linux程序员手册”。

    如果您不想知道手册页(或程序等)所在的位置,请致电 whereis :

    $ whereis mmap
    mmap: /usr/share/man/man2/mmap.2.gz /usr/share/man/man3/mmap.3posix.gz
    

    如果您需要知道这个文件的来源,假设您已经使用 apt 尝试 apt-file :

    $ apt-file search mmap.2.gz
    manpages-de-dev: /usr/share/man/de/man2/mmap.2.gz
    manpages-dev: /usr/share/man/man2/mmap.2.gz
    manpages-fr-dev: /usr/share/man/fr/man2/mmap.2.gz
    manpages-ja-dev: /usr/share/man/ja/man2/mmap.2.gz
    manpages-nl-dev: /usr/share/man/nl/man2/mmap.2.gz
    manpages-ru-dev: /usr/share/man/ru/man2/mmap.2.gz
    

    然后,您可以使用向您显示包的元数据 apt status :

    $ apt show manpages-dev
    Package: manpages-dev
    Version: 5.10-1
    Priority: optional
    Section: doc
    Source: manpages
    Maintainer: Dr. Tobias Quathamer <[email protected]>
    Installed-Size: 4,037 kB
    Depends: manpages
    Suggests: man-browser
    Breaks: libattr1-dev (<< 1:2.4.47-3), libbsd-dev (<< 0.8.4-1), manpages (<< 5.09-2)
    Replaces: libattr1-dev (<< 1:2.4.47-3), libbsd-dev (<< 0.8.4-1)
    Homepage: https://www.kernel.org/doc/man-pages/
    Tag: devel::doc, made-of::man, role::documentation
    Download-Size: 2,309 kB
    APT-Manual-Installed: no
    APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
    Description: Manual pages about using GNU/Linux for development
     These man pages describe the Linux programming interface, including
     these two sections:
      2 = Linux system calls.
      3 = Library calls (note that a more comprehensive source of information
          may be found in the glibc-doc and glibc-doc-reference packages).
    

    这将引导您进入URL: https://www.kernel.org/doc/man-pages/ .
    实际的存储库是: https://git.kernel.org/pub/scm/docs/man-pages/