Where is the implementation of the GNU C library?

谁都会走 提交于 2021-01-28 08:34:13

问题


I'm looking through the glib header files that reside in /usr/include to get a feel for what is going on behind the scenes. All the files I'm looking at simply declare a bunch of macros and functions but I want to take a look at the implementation of these functions.


回答1:


The glibc source repository is here:

https://sourceware.org/git/?p=glibc.git;a=tree

Note that a lot of the interesting code is under the sysdeps directory, particularly sysdeps/unix/sysv/linux/*. Also worth noting is that stdio is split between stdio-common and libio, and all of the POSIX threads interfaces are implemented under nptl (which also has its own sysdeps tree.

Further, note that there are a lot of functions for which you will simply not find source code at all. Many of the standard functions are simply entry points for making calls to the kernel (syscalls), and these wrappers are automatically generated as part of the build process.




回答2:


The readable form of the implementation of the functions within the GLibC is contained within its source code, downloadable from its website.

Note that some of the functions are stubs that delegate to system calls, and the complete implementation will be found within the source code of your operating system.



来源:https://stackoverflow.com/questions/19498474/where-is-the-implementation-of-the-gnu-c-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!