
Probe for Optional Syscalls at Runtime and Fall Back Gracefully
Detect a missing system call by trying it once, treating ENOSYS and seccomp EPERM as absent, caching the answer and falling back, shown with close_range.
Tag
362 posts

Detect a missing system call by trying it once, treating ENOSYS and seccomp EPERM as absent, caching the answer and falling back, shown with close_range.

FreeRTOS queues copy items by value so senders can reuse variables, stack data stays safe and ownership is clear. See the trade-offs and when to pass pointers.

Send and receive messages between processes with POSIX message queues: mq_open, priorities, the mq_receive buffer rule, limits and cleanup on Linux 6.12.

Sleep, Stop and Standby are the three usual low-power modes on a Cortex-M microcontroller. Learn what each one turns off, what it keeps and how it wakes.

Pass messages between FreeRTOS tasks with a queue: create it, send with xQueueSend, receive with xQueueReceive, set timeouts and check the return values.

Share memory between unrelated processes with POSIX shm_open, ftruncate and mmap, add a writer and a reader, and learn the cleanup with shm_unlink. Linux 6.12.

Free an I2C slave holding SDA low after a reset by clocking SCL up to nine times and sending a stop, with a tested C routine and the reason for nine.

glibc wrappers are not thin pass-throughs. See how open becomes openat, exit becomes exit_group, fork becomes clone, and which calls never reach the kernel.

A spinlock burns a core while it waits and a mutex sleeps. Compare their costs, write a correct C11 spinlock, and see when user-space spinning beats a mutex.

Preemptive schedulers take the CPU away on their own, cooperative ones wait for a task to yield. Compare latency, safety and code cost with FreeRTOS examples.

Use HAL_I2C_Mem_Read and HAL_I2C_Mem_Write on STM32 for sensor and EEPROM registers: shifted address, memory address size, timeouts and errors.

The kernel returns -errno in the result register, and the C library turns values from -4095 to -1 into errno and a return of -1. See the raw path and the rules.