% limb manual
% djbunix.h(0)
% limb 0.2.0
% 2024-01-09
# NAME
djbunix.h - standard I/O and other Unix system calls interfaces
# SYNOPSIS
#include <limb/djbunix.h>
# DESCRIPTION
`djbunix` offers alternative API to basic Unix concepts, dealing with I/O
operations, file descriptors, environment, child processes, and so on.
<inc skalibs.md>
## Functions
The following functions/macros are defined :
: [open_read](3)
:: Open a file for reading with *O_NONBLOCK* set.
: [open_readat](3)
:: Similar to [open_read](3) but relative path are based on given file
:: descriptor.
: [open_readb](3)
:: Similar to [open_read](3) but clears *O_NONBLOCK* after opening.
: [open_readatb](3)
:: Similar to [open_readb](3) but relative path are based on given file
:: descriptor.
: [openb_read](3)
:: Similar to [open_read](3) but without *O_NONBLOCK*.
: [openb_readat](3)
:: Similar to [openb_read](3) but relative path are based on given file
:: descriptor.
: [openbc_read](3)
:: Similar to [openb_read](3) but with *O_CLOEXEC* set.
: [openbc_readat](3)
:: Similar to [openbc_read](3) but relative path are based on given file
:: descriptor.
: [openc_read](3)
:: Similar to [open_read](3) but with *O_CLOEXEC* set.
: [openc_readat](3)
:: Similar to [openc_read](3) but relative path on based on given file
:: descriptor.
: [openc_readb](3)
:: Similar to [openc_read](3) but clears *O_NONBLOCK* after opening.
: [openc_readatb](3)
:: Similar to [openc_readb](3) but relative path on based on given file
:: descriptor.
: [open_write](3)
:: Open a file for writing with *O_NONBLOCK* set.
: [open_writeat](3)
:: Similar to [open_write](3) but relative path are based on given file
:: descriptor.
: [open_writeb](3)
:: Similar to [open_write](3) but clears *O_NONBLOCK* after opening.
: [open_writeatb](3)
:: Similar to [open_writeb](3) but relative path are based on given file
:: descriptor.
: [openb_write](3)
:: Similar to [open_write](3) but without *O_NONBLOCK*.
: [openb_writeat](3)
:: Similar to [openb_write](3) but relative path are based on given file
:: descriptor.
: [openbc_write](3)
:: Similar to [openb_write](3) but with *O_CLOEXEC* set.
: [openbc_writeat](3)
:: Similar to [openbc_write](3) but relative path are based on given file
:: descriptor.
: [openc_write](3)
:: Similar to [open_write](3) but with *O_CLOEXEC* set.
: [openc_writeat](3)
:: Similar to [openc_write](3) but relative path on based on given file
:: descriptor.
: [openc_writeb](3)
:: Similar to [openc_write](3) but clears *O_NONBLOCK* after opening.
: [openc_writeatb](3)
:: Similar to [openc_writeb](3) but relative path on based on given file
:: descriptor.
: [open_create](3)
:: Similar to [open_write](3) but create the file if it doesn't exist.
: [open_createat](3)
:: Similar to [open_create](3) but relative path are based of given file
:: descriptor.
: [openc_create](3)
:: Similar to [open_create](3) but with *O_CLOEXEC* set.
: [openc_createat](3)
:: Similar to [openc_create](3) but relative path are based of given file
:: descriptor.
: [open_excl](3)
:: Similar to [open_create](3) but fails if the file exists.
: [open_exclat](3)
:: Similar to [open_excl](3) but relative path are based of given file
:: descriptor.
: [openc_excl](3)
:: Similar to [open_excl](3) but with *O_CLOEXEC* set.
: [openc_exclat](3)
:: Similar to [openc_excl](3) but relative path are based of given file
:: descriptor.
: [open_append](3)
:: Similar to [open_create](3) but the file is opened in append-mode.
: [open_appendat](3)
:: Similar to [open_append](3) but relative path are based of given file
:: descriptor.
: [openc_append](3)
:: Similar to [open_append](3) but with *O_CLOEXEC* set.
: [openc_appendat](3)
:: Similar to [openc_append](3) but relative path are based of given file
:: descriptor.
: [open_trunc](3)
:: Similar to [open_create](3) but truncate the file if it exists.
: [open_truncat](3)
:: Similar to [open_trunc](3) but relative path are based of given file
:: descriptor.
: [openc_trunc](3)
:: Similar to [open_trunc](3) but with *O_CLOEXEC* set.
: [openc_truncat](3)
:: Similar to [openc_trunc](3) but relative path are based of given file
:: descriptor.
: [open_tmp](3)
:: Open a new temporary file for writing.
: [open_tmpat](3)
:: Similar to [open_tmp](3) but relative path are based of given file
:: descriptor.
: [open2](3)
:: Wrapper for [open](3) that takes 2 arguments, and can't be interrupted by
:: signals.
: [open2_at](3)
:: Wrapper for [openat](3) that takes 2 arguments, and can't be interrupted by
:: signals.
: [open3](3)
:: Wrapper for [open](3) that takes 3 arguments, and can't be interrupted by
:: signals.
: [open3_at](3)
:: Wrapper for [openat](3) that takes 3 arguments, and can't be interrupted by
:: signals.
: [open_b](3)
:: Open a file using given *open_fn* then clears *O_NONBLOCK*.
: [open_atb](3)
:: Similar to [open_b](3) but relative path are based on given file descriptor.
: [open_parsed_name](3)
:: Return the specified file descriptor, or that of the given file name.
: [coe](3)
:: Ensure a file descriptor has *O_CLOEXEC* set.
: [uncoe](3)
:: Ensure a file descriptor has *O_CLOEXEC* unset.
: [ndelay_on](3)
:: Ensure a file descriptor has *O_NONBLOCK* set.
: [ndelay_off](3)
:: Ensure a file descriptor has *O_NONBLOCK* unset.
: [open_read_closeat](3)
:: Open, read & close a file into memory.
: [open_read_close](3)
:: Same as [open_read_closeat](3) but relative path are based on current working
:: directory.
: [open_saread_closeat](3)
:: Open, read & close a file into a *stralloc*.
: [open_saread_close](3)
:: Same as [open_saread_closeat](3) but relative path are based on current
:: working directory.
: [open_write_closeat](3)
:: Open, write & close a file with data from pointed memory.
: [open_write_close](3)
:: Same as [open_write_closeat](3) but relative path are based on current
:: working directory.
: [open_writev_closeat](3)
:: Open, write & close a file with data from array of vectors.
: [open_writev_close](3)
:: Same as [open_writev_closeat](3) but relative path are based on current
:: working directory.
: [read_close](3)
:: Read & close a file into memory.
: [sa_read](3)
:: Read a file appending its content to a *stralloc*.
: [sa_readmax](3)
:: Similar to [sa_read](3) but with a limit.
: [fd_copy](3)
:: Wrapper for [dup2](3) that can't be interrupted by signals.
: [fd_copy2](3)
:: Same as [fd_copy](3) but copies two file descriptors.
: [fd_move](3)
:: Same as [fd_copy ](3) but closing the original file descriptor.
: [fd_move2](3)
:: Same as [fd_move](3) but moves two file descriptors.
: [fd_close](3)
:: Close a file descriptor without affecting `errno`.
: [fd_same](3)
:: Return whether or not two file descriptors reference the same file.
: [pipenb](3)
:: Create a pipe in non-blocking mode.
: [pipecoe](3)
:: Create a pipe in close-on-exec mode.
: [pipenbcoe](3)
:: Create a pipe in non-blocking & close-on-exec modes.
: [pipe_internal](3)
:: Create a pipe according to specified flags.
: [fd_chdir](3)
:: Similar to [fchdir](3) but without signal interruption.
: [fd_mkdirpat](3)
:: Create a path of directories and returns the file descriptor.
: [fd_mkdirp](3)
:: Same as [fd_mkdirpat](3) but relative path are based on current working
:: directory.
: [mkdirpat](3)
:: Create a path of directories.
: [mkdirp](3)
:: Same as [mkdirpat](3) but relative path are based on current working
:: directory.
: [rm_rfat](3)
:: Remove an entire directory entry, with relative path based on given file
:: descriptor
: [rm_rf_tmpat](3)
:: Different interface, using the given *stralloc* as head-allocated temporary
:: space.
: [rm_rf_in_tmpat](3)
:: Different interface, expecting the name to be found as NUL-terminated string
:: inside the given *stralloc*
: [rmstarat](3)
:: Remove the full content of a directory, with relative path based on given
:: file descriptor.
: [rmstar_tmpat](3)
:: Different interface, using the given *stralloc* as head-allocated temporary
:: space.
: [rmstar_in_tmpat](3)
:: Different interface, expecting the name to be found as NUL-terminated string
:: inside the given *stralloc*.
: [sa_readlink](3)
:: Places the content of a symbolic link into a *stralloc*.
: [sa_readlink0](3)
:: Similar to [sa_readlink](3) but ensures the content is NUL-terminated.
: [sa_readlinkat](3)
:: Similar to [sa_readlink](3) but relative path are based on given file
:: descriptor.
: [sa_readlinkat0](3)
:: Similar to [sa_readlinkat](3) but ensures the content is NUL-terminated.
: [sa_realpath](3)
:: Place the canonicalized absolute pathname into the given *stralloc*.
: [sa_realpathat](3)
:: Similar to [sa_realpath](3) but relative path are base on given file
:: descriptor.
: [sa_ls](3)
:: Appends the names of all files in a directory into the given *stralloc*.
: [sa_lsat](3)
:: Similar to [sa_ls](3) but relative path are based on given file descriptor.