Ignore SIGPIPE process-wide with signal(SIGPIPE, SIG_IGN)
Writing to a closed pipe or socket kills the process with SIGPIPE. Ignore the signal and write(2) returns -1 with EPIPE, which you can handle in the code.
Short posts that solve one thing: the code, the output we got, and why it works.
Writing to a closed pipe or socket kills the process with SIGPIPE. Ignore the signal and write(2) returns -1 with EPIPE, which you can handle in the code.
Turn on runtime subscript checks with the SSRANGE compiler option, so a bad index stops the run with a message.
Centre-align STM32 PWM with the CMS bits in TIMx_CR1, which counts up and down and halves the PWM frequency for the same reload value.
malloc(3) returns NULL and sets ENOMEM when it cannot allocate. Test it before use, and know that Linux overcommit often kills the process instead of failing.
Copy one sequential data set to another with IEBGENER, using SYSUT1 as input, SYSUT2 as output and a dummy SYSIN, on z/OS 3.1.
Read one STM32 ADC channel in polling mode with HAL_ADC_Start, HAL_ADC_PollForConversion and HAL_ADC_GetValue, and convert the result to millivolts.
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.
Turn one show function into a complete read-only debugfs file with DEFINE_SHOW_ATTRIBUTE() in Linux 6.12, with no hand-written file_operations.
Write a minimal JOB card with an accounting field, CLASS, MSGCLASS and NOTIFY=&SYSUID, so JES2 on z/OS 3.1 messages you when the job ends.
Return a TinyUSB device descriptor from tud_descriptor_device_cb with a static tusb_desc_device_t, using the IAD class codes a composite CDC device needs.
Detach a daemon from its terminal by forking, exiting the parent and calling setsid in the child on Linux 6.12, so closing the terminal cannot hang it up.
Zero a 256-bit register with vpxor ymm0, ymm0, ymm0, which needs AVX2; NASM 2.16.03 example that proves the lanes are cleared.
We send one email when a new post is published. No spam.