Skip to content
systemcoding.dev

Tag

glibc

6 posts

Flat illustration of a hardware register drawn as bit fields with one field highlighted, with the C, GNU and STMicroelectronics logos.
Systems Programming

Register Exit Handlers with atexit and on_exit

atexit registers cleanup functions that run in reverse order when a program ends normally. on_exit also passes the status. Neither runs after _exit or abort.

7 min read
Flat illustration of a database beside the table it holds, with the C, GNU and Rust logos.
Systems Programming

Parse Long Options with getopt_long

Use getopt_long in C to accept --name and --name=value options, fill in the option table, handle flags and abbreviations, and keep short options working.

7 min read
Flat illustration of two options weighed side by side, with the GNU, C and C++ logos.
Systems Programming

Use strerror_r Correctly: XSI vs GNU Versions

strerror_r has two incompatible signatures in glibc. Learn which one you get, how to write code that works with both, and how strerror_l avoids the problem.

6 min read