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.
Is there an online (hypertexted cross-referenced) version somewhere?
libc is a single library file (both . so and . a versions are available) and in most cases resides in /usr/lib . However, the glibc (GNU libc) project provides more than just libc - it also provides the libm mentioned earlier, and other core libraries like libpthread .
They mostly are in /lib (32-bit systems) cq /lib64 (64, of course), but they are named libc-<version>.
The term "libc" is commonly used as a shorthand for the "standard C library", a library of standard functions that can be used by all C programs (and sometimes by programs in other languages).
Ubuntu also has packages for alternative libc implementations such as musl, but the distribution itself does not use them because it is glibc-based. Save this answer.
Most linuxes use a libc version named 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.
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)
Update: After closing of koala's lxr, there are:
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/codesearch and try to search something glibc-specific
UPD (march 2013) They killed codesearch again:
404. That’s an error.
The requested URL /codesearch was not found on this server. That’s all we know.
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/glibc Buildroot 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/
Info on the glibc repository: 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.
Browse the source online http://sourceware.org/git/?p=glibc.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With