NAME
open_b, open_atb - open a file using given function then clears O_NONBLOCK
SYNOPSIS
#include <limb/djbunix.h>
int open_b(open_fn fn, const char *file) int open_atb(openat_fn fnat, int fd, const char *file)
DESCRIPTION
The open_b
() function calls the function fn
with file
as its only
argument. This function should open the file whose name is pointed by file
and
return the corresponding file descriptor on success, otherwise it should return
-1 and set errno
to indicate the error.
After the file has been successfully opened, the open_b
() function will ensure
that it is in blocking mode, i.e. that it has O_NONBLOCK clear.
The open_atb
() function is similar except that it takes an additional argument
fd
being used along side file
as arguments to the function fnat
, which
must be similar to fn
except when file
is a relative path, in which case it
must be treated as relative to the directory associated with the file
descriptor fd
, which may be AT_FDCWD to user the current working directory.
RETURN VALUE
On success, these functions return the opened file descriptor, which always has
the O_NONBLOCK flag clear. Otherwise they return -1 and set errno
to
indicate the error.
ERRORS
The open_b
() and open_atb
() functions may fail and set errno
for any of
the errors specified for the given fn
or fnat
function, respectively.
They may also fail and set errno
for the errors described for ndelay_off(3).