| MKDIR(2) | System Calls Manual | MKDIR(2) | 
mkdir, mkdirat
    — make a directory file
Standard C Library (libc, -lc)
#include
    <sys/stat.h>
int
  
  mkdir(const
    char *path, mode_t
    mode);
int
  
  mkdirat(int
    fd, const char
    *path, mode_t
    mode);
The directory path is created with the access permissions specified by mode and restricted by the umask(2) of the calling process.
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.
The
    mkdirat()
    system call is equivalent to
    mkdir()
    except in the case where path specifies a relative
    path. In this case the newly created directory is created relative to the
    directory associated with the file descriptor fd
    instead of the current working directory. If
    mkdirat() is passed the special value
    AT_FDCWD in the fd parameter,
    the current working directory is used and the behavior is identical to a
    call to mkdir().
The mkdir() function returns the
    value 0 if successful; otherwise the value -1 is returned and
    the global variable errno is set to indicate the
    error.
The mkdir() system call will fail and no
    directory will be created if:
ENOTDIR]ENAMETOOLONG]ENOENT]EACCES]ELOOP]EPERM]EROFS]EMLINK]EEXIST]ENOSPC]ENOSPC]EDQUOT]EDQUOT]EIO]EIO]EFAULT]In addition to the errors returned by the
    mkdir(), the mkdirat() may
    fail if:
The mkdir() system call is expected to
    conform to IEEE Std 1003.1-1990
    (“POSIX.1”). The mkdirat()
    system call follows The Open Group Extended API Set 2 specification.
The mkdirat() system call appeared in
    FreeBSD 8.0. The mkdir()
    system call appeared in Version 1 AT&T
    UNIX.
| June 26, 2008 | Debian |