Search notes:

The Standard C Library

«Enhances» C with

Some functions and function families

arg_parse
alarm
Error related functions such as perror()
exit
getc
getopt
ioctl
Memory allocation such as malloc.
String and array functions (such as strcmp to compare strings).
Date and time
open and fopen
fseek and lseek
signal handling
sleep / nanosleep
tsearch and tfind to implement an associative array.
stat
wait
setjmp and longjmp
With the <stdarg.h> include file, it is possible to access variadic arguments in functions.

gets / fgets

gets() reads a line, terminated by a new line or EOF. For this reason, gets should almost never be used because in normal circustances, it's impossible to know in advance how long the line will be.
fgets() reads from a file rather than from stdin and allows to specify the maximum amount to be read.

printf family

Gone here.

scanf family

Gone here

syscall

Call a Linux kernel syscall directly, »without« libc (that is except using libc's syscall):
// #define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>

int main() {
 //
 // Write some text to STDOUT (1). The lenght of the
 // text is 12 (last paramter).
 //
    syscall(SYS_write, 1, "Hello World\n", 12);
}
Github repository about-libc, path: /syscall.c

include files

string.h

Reserved names: Names that begin with str, mem or wcs and are followed by a lowercase letter are reserved because they might be added in the declarations in the <string.h> header file.

glibc

As per this stackoverflow answer, GNU's libc (glibc) is Linux specific and won't work on Windows.

musl

musl libc claims to be a lightweight, fast, simple, free standard library.
It's official git (not github!) repository is here.
musl is pronounced as mussel.

TODO

sysdeps/x86_64/elf/start.S
The relation of dirent struct (<dirent.h>) to the dentry struct in Linux.

See also

libc: building a test version
/usr/lib/libc.a
The gcc options -nostartfiles, -nodefaultlibs, -nolibc and -nostdlib.
Input/output
The FILE struct.
C++ Standard Library
The Linux kernel source directory tools/include/nolibc

Links

The GNU C Library
dietlibc is a libc that is optimized for small size.
uClibc-ng is a small C library for developing embedded Linux systems. Although (much) smaller than the GNU C Library, nearly all applications supported by glibc also work perfectly with uClibc-ng.
It appears to me that uClibc-ng is somewhat related to µClibc.
klibc is developed and maintained by Linux kernel developers.
picolibc is a set of standard C libraries, both libc and libm, designed for smaller embedded systems with limited ROM and RAM.
Cosmopolitan Libc creates executables from C sources that can be run natively on Linux, Mac, Windows and other platforms without a virtual machine or interpreter.
(… but with Apple moving to arm64, it might not be running here anymore?)

Index