Search code examples
cc-standard-library

Where is the source code for the C library functions?


I would like to read how various libraries are implemented. I looked under /usr/src/include and all I found was .h files. For example, I was looking at malloc.h and all that it does is declare extern functions.

So I am trying to find the source for those functions. I downloaded GCC source RPM, but looking at the GCC source, it looks more like compiler code, rather than code for libraries such as stdlib. Can you please help me by pointing me to the right direction.


Solution

  • You need to get the source code of the associated C library, probably glibc or eglibc in your case.

    In the /usr/include/ folder, only the headers of the libc are present, along with some linux kernel headers in the linux/ subfolder.