Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (k - m) mkdir(2)
permission 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.
The mkdir( ) function cannot create a directory named /dev, /dev/tty,or/dev/null in the root
directory of the OSS file system. The mkdir( ) function cannot create a directory named
lost+found in the root directory of an OSS fileset. If these directories are missing from the sys-
tem, such a function call fails and sets errno to the value [EPERM]. When these directories
already exist (the normal case), errno is set to [EEXIST].
If bits in the mode parameter other than the file permission bits, S_ISVTX,orS_IFDIR are set,
mkdir( ) fails and sets errno to [EINVAL].
Upon successful completion, the mkdir() function marks the st_atime, st_ctime, and st_mtime
fields of the directory for update and marks the st_ctime and st_mtime fields of the new
directory’s parent directory for update.
Use on Guardian Objects
The mkdir( ) function succeeds within /G (the Guardian file system) only when creating a Guar-
dian subvolume that is exactly three directories under the root (for example, /G/vol/subvol). This
Guardian subvolume must be empty. If the subvolume is not empty, errno is set to [EEXIST].
When the call succeeds, the resulting directory (subvolume) is owned by the super ID.
File Type Flags
The file type flags that can be logically ORed into the value specified in the mode parameter are
as follows:
S_IFDIR Directory in the OSS file system or empty subvolume in /G, the Guardian file
system.
S_ISVTX Sticky bit; used only for directories (cannot be used for files in /G, the Guardian
file system).
When set, a user can remove files from the directory only if the user either:
• Has write permission for the directory and is the owner of either the
directory or the file being removed
• Has appropriate privileges
Use From the Guardian Environment
The mkdir( ) function is one of a set of functions that have the following effects when the first of
them is called from the Guardian environment:
• T
wo Guardian file system file numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These file numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
• The current working directory is assigned from the VOLUME attribute of the Guardian
environment =_DEFAULTS DEFINE.
• The use of static memory by the process increases slightly.
These effects occur only when the first of the set of functions is called. The effects are not cumu-
lative.
527186-023 Hewlett-Packard Company 4−49