MKDIR(2,L) AIX Technical Reference MKDIR(2,L)
-------------------------------------------------------------------------------
mkdir
PURPOSE
Creates a directory.
SYNTAX
int mkdir (path, mode)
char *path;
int mode;
DESCRIPTION
The mkdir system call creates a new directory. The path parameter names the
new directory.
To execute the mkdir system call, a process must have search permission to get
to the parent directory of path and write permission in the parent directory.
The new directory has:
o The owner ID set to the process's effective user ID.
o The group ID set to:
- The group ID of its parent directory, if the parent directory has the
set-file-group-ID attribute; otherwise,
- The process effective group ID
o Permission and attribute bits set according to the value of the mode
parameter, with the following modifications:
- All bits set in the process file mode creation mask are cleared. (For
information about the file mode creation mask, see "umask").
- The set-file-group-ID and sticky attributes are inherited from the
parent directory.
RETURN VALUE
Upon successful completion, the mkdir system call returns a value of 0. If the
mkdir system call fails, a value of -1 is returned, and errno is set to
indicate the error.
ERROR CONDITIONS
Processed November 7, 1990 MKDIR(2,L) 1
MKDIR(2,L) AIX Technical Reference MKDIR(2,L)
The mkdir system call fails and the directory is not created if one or more of
the following are true:
ENOTDIR A component of the path is not a directory.
ENOENT A component of the path does not exist.
EACCES Creating the requested directory requires writing in a directory with
a mode that denies write permission.
EACCES Search permission is denied for a component of the path.
EROFS The named file resides on a read-only file system.
EEXIST The named file already exists.
EFAULT The path parameter points outside of the process's allocated address
space.
EIO An I/O error occurred while writing to the file system.
ESTALE The process's root or current directory is located in a virtual file
system that has been unmounted.
ENAMETOOLONG
A component of the path parameter exceeded NAME_MAX characters or the
entire path parameter exceeded PATH_MAX characters.
EACCES The path parameter explicitly named a hidden directory component.
ENOENT A symbolic link was named, but the file to which it refers does not
exist.
ELOOP A loop of symbolic links was detected.
ENOSPC The file system is out of inodes, or there is not enough space to
increase the parent directory size.
EDQUOT The directory in which the entry for the new link is being placed
cannot be extended because the user's quota of disk blocks or inodes
on the file system containing the directory has been exhausted.
If the Transparent Computing Facility is installed on your system, mkdir can
also fail if one or more of the following are true:
ESITEDN1 path cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE path is a name relative to the working directory, but no site which
stores this directory is currently up.
Processed November 7, 1990 MKDIR(2,L) 2
MKDIR(2,L) AIX Technical Reference MKDIR(2,L)
ENOSTORE A component of path is replicated but is not stored on any site which
is currently up.
EROFS Write access is requested for a file on a replicated file system in
which the primary copy is unavailable.
EINTR A signal was caught during the system call.
RELATED INFORMATION
In this book: "chmod, fchmod," "mknod, mknodx, mkfifo," "rename," "rmdir,"
and "umask."
Processed November 7, 1990 MKDIR(2,L) 3