Skip to content
systemcoding.dev

Snippets

Short posts that solve one thing: the code, the output we got, and why it works.

Systems Programming

Get the page size with sysconf(_SC_PAGESIZE)

Read the memory page size at run time with sysconf(_SC_PAGESIZE) instead of hard-coding 4096, which is wrong on arm64 kernels built with 16K or 64K pages.

1 min read
Systems Programming

Get Unix epoch seconds with time and time_t

Read the current Unix epoch seconds with time(NULL) on glibc 2.41, and build 32-bit targets with _TIME_BITS=64 so time_t survives the year 2038.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.