mkdir(2) — 4 BSD
NAME
mkdir − make a directory file
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int mkdir (path, mode)
char ∗path;
mode_t mode;
DESCRIPTION
mkdir creates a new directory file with name path. The mode of the new file is initialized from mode. (The protection part of the mode is modified by the process’s mode mask; see umask(2)).
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 low-order 9 bits of mode are modified by the process’s file mode creation mask: all bits set in the process’s file mode creation mask are cleared. See umask(2).
RETURN VALUE
A 0 return value indicates success. A −1 return value indicates an error, and an error code is stored in errno.
ERRORS
mkdir will fail and no directory will be created if:
[EACCES] Search permission is denied on a component of the path prefix, or write permission is denied on the parent directory of the directory to be created.
[EEXIST] The named file exists.
[EFAULT] Path points outside the process’s allocated address space.
[EIO] An I/O error occurred while writing to the file system.
[EMLINK] The link count of the parent directory would exceed {LINK_MAX}.
[ENAMETOOLONG]
The path argument exceeds {PATH_MAX} in length, or a pathname component is longer than {NAME_MAX} (see pathconf(2)).
[ENOENT] A component of the path prefix does not exist, or the path argument points to an empty string.
[ENOSPC] The file system does not contain enough space to hold the contents of the new directory or to extend the parent directory of the new directory.
[ENOTDIR] A component of the path prefix is not a directory.
[EROFS] The parent directory of the directory being created resides on a read-only file system.
SEE ALSO
CX/UX Programmer’s Reference Manual