Linux libc 源代码位置 - 用于下载还是在线查看?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6481291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
libc source location - for download or online viewing?
提问by ValenceElectron
Sorry I know this is stupid but where is linux libc source code available? What I downloaded from GNU didn't seem to be what I wanted, specifically I could find nothing in the pthreads function family.
抱歉,我知道这很愚蠢,但是 linux libc 源代码在哪里可用?我从 GNU 下载的似乎不是我想要的,特别是我在 pthreads 函数系列中找不到任何东西。
Is there an online (hypertexted cross-referenced) version somewhere?
某处是否有在线(超文本交叉引用)版本?
采纳答案by osgx
Most linuxes use a libc version named glibc
.
大多数 linux 使用名为glibc
.
The LXR (online cross-reference system) for glibc is e.g. here http://koala.cs.pub.ro/lxr/glibc/for 2.9 version(link is broken). I must say that something may be not lxr'ed because some sources are generated in the build process, for example - as i can remember - wrappers around a system calls.
glibc 的 LXR(在线交叉参考系统)例如在这里http://koala.cs.pub.ro/lxr/glibc/对于 2.9 版本(链接已损坏)。我必须说有些东西可能不是 lxr'ed,因为某些源是在构建过程中生成的,例如 - 我记得 - 系统调用的包装器。
Pthreads are in nptl/
folder. Right link to libc sources is http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.bz2(or change 2.14 to your version)
Pthreads 在nptl/
文件夹中。libc 源的正确链接是http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.bz2(或将 2.14 更改为您的版本)
Update: After closing of koala's lxr, there are:
更新:关闭考拉的 lxr 后,有:
Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/(Served with Sun's OpenGrok, which was originally used to generate online x-ref for Solaris/OpenSolaris)Google code search (I know that it was closed; but I also know it's other version which is up):
http://code.google.com/codesearchand try to search something glibc-specific
Metager with glibc:http://code.metager.de/source/xref/gnu/glibc/(与 Sun 的 OpenGrok 一起使用,最初用于为 Solaris/OpenSolaris 生成在线 x-ref)Google 代码搜索(我知道它已关闭;但我也知道它是另一个版本):
http://code.google.com/codesearch并尝试搜索特定于 glibc 的内容
UPD (march 2013) They killed codesearch again:
UPD(2013 年 3 月)他们再次杀死了 codesearch:
404. That's an error.
The requested URL /codesearch was not found on this server. That's all we know.
404. That's an error.
在此服务器上找不到请求的 URL /codesearch。我们知道的就这些。
UPD 2017
UPD 2017
Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/There is online git by glibc authors: https://sourceware.org/git/?p=glibc.git(tree is browserable at https://sourceware.org/git/?p=glibc.git;a=tree)
Glibc git is mirrored to github (which has some searching functions) https://github.com/bminor/glibcBuildroot 2018.05 notably uses this mirror.
There is search like google's codesearch in all debian packages: https://codesearch.debian.net/. It can search in glibc sources by "package:glibc request" request and also have file browser: http://sources.debian.net/src/glibc/
带 glibc 的 Metager:http://code.metager.de/source/xref/gnu/glibc/glibc 作者有在线 git:https: //sourceware.org/git/ ?p =glibc.git(树可在https://sourceware.org/git/?p=glibc.git;a=tree 浏览)
Glibc git 被镜像到 github(它有一些搜索功能)https://github.com/bminor/glibcBuildroot 2018.05特别使用了这个镜像。
在所有 debian 包中都有类似 google 的 codesearch 的搜索:https://codesearch.debian.net/ 。它可以通过“package:glibc request”请求在 glibc 源代码中搜索,也可以有文件浏览器:http: //sources.debian.net/src/glibc/
回答by sarnold
If you're on a Debian-derived system, you can use apt-get source libc6
. This will unpack a eglibc-2.12.1
directory (version number might differ, of course) in your current working directory, and the pthreads support are in the nptl/
directory below that. linuxthreads/
is for the older threading style, in case you're an archaeologist.
如果您使用的是 Debian 派生系统,则可以使用apt-get source libc6
. 这将eglibc-2.12.1
在您当前的工作目录中解压一个目录(当然,版本号可能不同),并且 pthreads 支持位于该nptl/
目录下。linuxthreads/
用于较旧的线程样式,以防您是考古学家。
回答by pmg
回答by Michael Burr
Info on the glibc repository: http://sourceware.org/glibc/wiki/GlibcGit
关于 glibc 存储库的信息:http: //sourceware.org/glibc/wiki/GlibcGit
Clone it to get your own copy and search it however you like:
克隆它以获得您自己的副本并根据您的喜好进行搜索:
git clone git://sourceware.org/git/glibc.git
I load it up in an IDE project (using whatever preferred IDE) and the code navigation works quite well to let me find what I'm interested in.
我将它加载到 IDE 项目中(使用任何首选的 IDE),代码导航运行良好,可以让我找到感兴趣的内容。
Browse the source online http://sourceware.org/git/?p=glibc.git