How kraj/glibc works
GNU C Library (glibc) implements the standard C and POSIX-facing runtime used by C and compatible-language programs to access operating-system services. The principal workflow is an application calling a libc API, which provides a result directly or mediates access to the kernel; name-service lookups can additionally be configured to consult provider modules, including files and DNS. The tree and README establish the product’s broad runtime scope, while sampled source supports detail mainly for DNS queries, NSS configuration and service lookup, and NSCD caching; other branches are shown at subsystem level.
Main entry points: assert.c C runtime APIs · nss_database.c NSS configuration · res_query.c DNS resolver · start.c Program startup
Components 18
Process startup
- Program startup
csu/start.c - Libc initialization
csu/libc-start.c
Core runtime
- C runtime APIs
assert/assert.c - Buffered I/O
libio - String routines
debug/memcpy_chk.c - Character handling
ctype/ctype.c - Thread runtime
sysdeps/nptl/proc_service.h
Name services
- NSS configuration
nss/nss_database.c - Files provider
nss/nss_files/files-service.c - Hesiod provider
hesiod/nss_hesiod/hesiod-service.c - DNS resolver
resolv/res_query.c - Query construction
resolv/res_mkquery.c - Lookup cache
nscd/servicescache.c - Cache protocol
nscd/nscd-client.h
Dynamic linking
- Dynamic loader
elf/rtld.c
Other components
- Application
- Operating system
- DNS servers
Connections 20
- Application → Program startup: starts process
- Program startup → Libc initialization: transfers control
- Libc initialization → C runtime APIs: initializes runtime
- Application → C runtime APIs: calls APIs
- C runtime APIs → Operating system: requests OS services
- C runtime APIs → Buffered I/O: uses I/O
- C runtime APIs → String routines: uses routines
- C runtime APIs → Character handling: uses classification
- C runtime APIs → Thread runtime: uses threading
- Application → Dynamic loader: loads objects
- C runtime APIs → NSS configuration: gets provider actions
- NSS configuration → Files provider: selects provider
- NSS configuration → DNS resolver: selects provider
- NSS configuration → Hesiod provider: selects provider
- DNS resolver → Query construction: constructs queries
- DNS resolver → DNS servers: sends DNS queries
- C runtime APIs → Lookup cache: requests cached lookup
- Lookup cache → Cache protocol: uses request types
- Files provider → Operating system: reads service files
- Hesiod provider → DNS resolver: resolves Hesiod records