I was searching for the source code of the C standard libraries. What I mean with it is, for example, how are cos, abs, printf, scanf, fopen, and all the other standard C functions written, I mean to see their source code.
So while searching for this, I came across with GLIBC, but I don't know what it actually is. It is GNU C Library, and it contains some source codes, but what are they actually, are they the source code of the standard functions or are they something else? And what is it used for?
It's the implementation of Standard C library described in C standards, plus some extras which are not strictly standard but used frequently.
Its main contents are:
C library described in ANSI, C99, C11, C23 standards. It includes macros, symbols, function implementations, etc., such as printf()
, malloc()
, etc.)
POSIX standard library. The "userland" glue of system calls. (open()
, read()
, etc.) Actually glibc does not "implement" system calls; the kernel does it. But glibc provides the user land interface to the services provided by kernel so that user application can use a system call just like a ordinary function.
Also some nonstandard but useful stuff.
"use the force, read the source "
$ git clone git://sourceware.org/git/glibc.git
(I was recently pretty enlightened when I looked through malloc.c
in glibc)