Read the file status flags with fcntl F_GETFL
Read an open descriptor's access mode and status flags such as O_APPEND and O_NONBLOCK with fcntl F_GETFL on Linux 6.12, masking with O_ACCMODE.
Short posts that solve one thing: the code, the output we got, and why it works.
Read an open descriptor's access mode and status flags such as O_APPEND and O_NONBLOCK with fcntl F_GETFL on Linux 6.12, masking with O_ACCMODE.
Attach commands to an LLDB breakpoint with breakpoint command add, ending the list with DONE, to log or continue without stopping.
List the object files inside a .a archive with ar t, add v for sizes and dates, and see duplicate member names that ar extracts only one at a time.
Open a file for writing with O_WRONLY, O_CREAT, O_TRUNC and mode 0644 on Linux 6.12. The mode is masked by umask, so the file may end up less open.
Break on every function whose name matches a regular expression in LLDB with breakpoint set -r, abbreviated br s -r.
Read the program header table with readelf -l from GNU binutils 2.43 to see what the loader maps, which sections share a segment, and the interpreter path.
Create a tiny in-kernel filesystem for internal files with init_pseudo and kern_mount on Linux 6.12, the way sockfs and pipefs are built.
Read your own process ID and your parent's with getpid and getppid on Linux 6.12 and glibc 2.40. Neither call can fail, so there is nothing to check.
Keep temporary values in GDB convenience variables with set $var, so later commands can reuse a pointer or a computed number.
Create a block device the modern way with blk_mq_alloc_tag_set and blk_mq_alloc_disk on Linux 6.12, which takes a queue_limits pointer since 6.9.
Save errno into a local variable right after a failing call, before any printf or free can overwrite it, in C on POSIX systems.
Use __builtin_mul_overflow in GCC 14 or Clang to multiply two sizes and learn whether the product wrapped, before it reaches malloc.
We send one email when a new post is published. No spam.