| MKDIR(2) | System Calls Manual | MKDIR(2) | 
mkdir, mkdirat —
#include <sys/stat.h>
int
  
  mkdir(const
    char *path, mode_t
    mode);
#include
    <sys/stat.h>
  
  #include <fcntl.h>
int
  
  mkdirat(int
    fd, const char
    *path, mode_t
    mode);
mkdirat() works the same way as
    mkdir() except if path is
    relative. In that case, it is looked up from a directory whose file
    descriptor was passed as fd. Search permission is
    required this directory. fd can be set to
    AT_FDCWD in order to specify the current
  directory.
The directory's owner ID is set to the process's effective user ID. The directory's group ID is set to that of the parent directory in which it is created.
mkdir() and mkdirat()
  functions return the value 0 if successful; otherwise the
  value -1 is returned and the global variable
  errno is set to indicate the error.
mkdir() and mkdirat() will
  fail and no directory will be created if:
EACCES]EDQUOT]EEXIST]EFAULT]EIO]ELOOP]ENAMETOOLONG]NAME_MAX}
      characters, or an entire path name exceeded
      {PATH_MAX} characters.ENOENT]ENOSPC]ENOTDIR]EROFS]In addition, mkdirat() will fail if:
mkdir() function conforms to IEEE
  Std 1003.1-1990 (“POSIX.1”).
  mkdirat() conforms to IEEE Std
  1003.1-2008 (“POSIX.1”).
mkdir() function appeared in
  Version 1 AT&T UNIX.
| September 1, 2019 | NetBSD 9.4 |