NAME
fd_mkdirpat, fd_mkdirp, mkdirpat, mkdirp - create a path of directories
SYNOPSIS
#include <limb/djbunix.h>
int fd_mkdirpat(int fd, const char *name, mode_t mode) int fd_mkdirp(const char *name, mode_t mode) int mkdirpat(int fd, const char *name, mode_t mode) int mkdirp(const char *name, mode_t mode)
DESCRIPTION
The fd_mkdirpat() function creates the path of directories name, i.e. it
attempts not only to create the last element of name but every single one.
This can be thinking thought of as equivalent to mkdir --parent.
The file permission bits of the new directory will be initialized from mode
for newly created directories (already existing ones aren't changed).
If name specifies a relative path, it is relative to the directory associated
with the file descriptor fd which may be AT_FDCWD to use the current working
directory.
A file descriptior to the last directory of the path in name is returned.
The fd_mkdirp() function is similar to fd_mkdirpat() except when name
specifies a relative path, in which case it is relative to the current working
directory.
The mkdirpat() function is similar to fd_mkdirpat() except that, on success,
it returns zero.
The mkdirp() function is similar to fd_mkdirp() except that, on success, it
returns zero.
RETURN VALUE
The fd_mkdirpat() and fd_mkdirp() functions return a file descriptor to the
full directory specified in name on success. Otherwise, they return -1 and set
errno to indicate the error.
The mkdirpat() and mkdirp() functions return 0 on success. Otherwise, they
return -1 and set errno to indicate the error.
ERRORS
These functions may fail and set errno for any of the errors specified for mkdirat(3) and openat(3), save for EEXIST.