Tag: #file-descriptors
How does swapping stdin and stderr work?
The magic shell string
3>&2 2>&1 1>&3- swaps stdout and stderr. It does with the dup2 system call to swap file descriptors. 2018-02-22What is
mode_t in C? mode_t is a bitfield type in C that represents file permissions, including read, write, and execute permissions for the owner, group, and other classes. It provides symbolic constants to set and check these permissions. 2017-02-24What is
lsof? lsof lists open system resources, including pipes, sockets, and yes, files. It shows their type, owner, and location. 2017-02-20How do I close a file descriptor in C?
To close a file descriptor in C, use the
close system call. Multiple descriptors can reference the same underlying file or pipe. The pipe is only closed when all references are closed. 2017-02-16How do I duplicate a file descriptor in C?
Use the
dup system call to duplicate a file descriptor in C, allowing two references to the same underlying pipe. 2017-02-15All content copyright James Fisher.
Granola