
Make a Socket Non-Blocking with fcntl and O_NONBLOCK
Switch a socket to non-blocking mode with fcntl and O_NONBLOCK, or set it atomically with SOCK_NONBLOCK and accept4, and learn the flag mistakes that bite.
Tag
362 posts

Switch a socket to non-blocking mode with fcntl and O_NONBLOCK, or set it atomically with SOCK_NONBLOCK and accept4, and learn the flag mistakes that bite.

Start threads with pthread_create, wait for them with pthread_join and check the error codes correctly. Includes a complete C program and the mistakes to avoid.

Learn what SIMD means, how a vector register splits into lanes, and how C intrinsics map to instructions, with a first program that adds four floats at once.

Use K_THREAD_DEFINE to create a Zephyr thread at build time, with stack size, priority and start delay, plus the thread entry signature and how to stop it.

Turn errno into a readable message with perror and strerror in C on Linux with glibc 2.41, and learn when each one fits.

Learn fixed-point arithmetic for firmware in C: Q formats, conversion, multiply and divide, saturation, filters, printing and testing, with verified outputs.

A complete x86-64 kernel core: GDT, IDT, exceptions, PIC and APIC interrupts, timers, a frame allocator, four-level paging, page faults, a heap and PCI.

Open a window with GLFW 3.4 in C, run an event loop, and read the keyboard through a key callback and through polling with glfwGetKey.

A stack buffer overflow writes past a local array into the data next to it. See how it happens in C, what a canary does, and which habits prevent it.

Copy a float into a uint32_t with memcpy, then mask out the sign, exponent and fraction fields to see exactly how IEEE 754 stores it.

Learn what blocking and non-blocking I/O mean for sockets on POSIX, what EAGAIN tells you, and why servers with many clients switch to non-blocking mode.

Write a working Makefile for a small C program with a compiler variable, flags, object files and a clean target, and see how make decides what to rebuild.