Open System Services System Calls Reference Manual (G06.25+, H06.03+)

mkdir(2) OSS System Calls Reference Manual
NAME
mkdir - Creates a directory
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <sys/stat.h>
int mkdir(
const char *path,
mode_t mode);
PARAMETERS
path Points to the pathname for the new directory.
If any component of the path parameter refers to a symbolic link, the link is
traversed and pathname resolution continues.
If the nal component of the path parameter refers to an existing entity, the call
fails and errno is set to [EEXIST].
mode Species the mask for the read, write, and search/execute (RWX) ags for
owner, group, and others. Also species the le type ags for the directory.
The permission bits are set according to the value of this parameter modied by
the processs le creation mask (see the umask(2) reference page). The value of
this parameter is constructed by logically ORing ags that are dened in the
sys/stat.h header le.
The le type ags are described in DESCRIPTION.
DESCRIPTION
The mkdir() function creates a new directory with the following attributes:
The owner ID is set to the effective user ID of the calling process. Directories within /G
(the Guardian le system) are the exception; for them, the owner ID is set to 65535 (the
super ID).
The group ID is set to the group ID of the parent directory if the S_ISGID ag is set in
the parent directory; otherwise, the group ID is set to the effective group ID of the calling
process. Directories within /G (the Guardian le system) are the exception; for them, the
group ID is set to 255.
The permission bits are set according to the value of the mode parameter modied by the
processs le creation mask (see the umask(2) reference page). The value of this param-
eter is constructed by logically ORing ags that are dened in the sys/stat.h header le.
Directories within /G (the Guardian le system) are the exception; for them, all the per-
mission bits ("rwxrwxrwx") are automatically set.
The new directory is empty except for . (dot) and ..(dot-dot).
To execute the mkdir() function, a process must have search permission for the parent directory
of the directory pointed to by the path parameter and write permission in the parent directory of
the path directory.
422 Hewlett-Packard Company 527186-003