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 final component of the path parameter refers to an existing entity, the call
fails and errno is set to [EEXIST].
mode Specifies the mask for the read, write, and search/execute (RWX) flags for
owner, group, and others. Also specifies the file type flags for the directory.
The permission bits are set according to the value of this parameter modified by
the process’s file creation mask (see the umask(2) reference page). The value of
this parameter is constructed by logically ORing flags that are defined in the
sys/stat.h header file.
The file type flags 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 file 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 flag 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 file 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 modified by the
process’s file creation mask (see the umask(2) reference page). The value of this param-
eter is constructed by logically ORing flags that are defined in the sys/stat.h header file.
Directories within /G (the Guardian file 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.
4−22 Hewlett-Packard Company 527186-003