MKDIR(2-POSIX) RISC/os Reference Manual MKDIR(2-POSIX)
NAME
mkdir - make a directory
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
int mkdir (path, mode)
char *path;
modet mode;
DESCRIPTION
The routine mkdir creates a new directory with the name
path. The file permission bits of the new directory are ini-
tialized from the mode. The protection part of the mode
argument is modified by the process's creation mask [see
umask(2)]. Only the file permission bits of mode are used;
the rest are discarded.
The directory's owner ID is set to the process's effective
user ID. The directory's group ID is set depending on
_riscos_group_parent (see kopt(8)), and will be set to
either the process's effective group ID or the group ID of
the directory in which it is being created. The newly
created directory is empty except for the entries "." and
"..".
Upon successful completion, the st_atime, st_ctime, and
st_mtime fields of the directory are marked for update.
Also, the st_ctime and st_mtime fields of the directory that
contains the new entry are marked for update.
ERRORS
mkdir will fail and no directory will be created if one or
more of the following are true:
[ENOTDIR] A component of the path prefix is not a
directory.
[ENOENT] A component of the path prefix does not
exist, or path points to an empty
string.
[EACCES] Either a component of the path prefix
denies search permission or write per-
mission is denied on the parent direc-
tory of the directory to be created.
[ENAMETOOLONG] The path is longer than {PATH_MAX} or a
pathname component is longer than
{NAME_MAX}.
Printed 1/15/91 Page 1
MKDIR(2-POSIX) RISC/os Reference Manual MKDIR(2-POSIX)
[EEXIST] The named file already exists.
[EROFS] The path prefix resides on a read-only
file system.
[EFAULT] path points outside the allocated
address space of the process.
[EMLINK] The maximum number of links, {LINK_MAX},
to the parent directory would be
exceeded.
[EIO] An I/O error has occurred while access-
ing the file system.
[ENOSPC] The file system does not contain enough
space to hold the contents of the new
directory or to extend the parent direc-
tory of the new directory.
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned, and errno is set to indi-
cate the error.
SEE ALSO
chmod(2), stat(2), umask(2).
Page 2 Printed 1/15/91