FAT | RFS | XFS
mkdir()
PROTOTYPE
#include <posix.h>
int mkdir(const char *path, mode_t mode);
DESCRIPTION
mkdir() creates a directory with the name and location specified by path. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD. As modified by the file mode creation mask, mode sets the directory’s access permission bits.
The caller needs search access to the path prefix and write access to the parent directory. The status change and data modification timestamps of the parent directory and all timestamps of the new directory are updated. The new directory’s user and group IDs are set to those of the calling task (as determined by FsGetId()).
If successful, mkdir() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EACCES | No execute access to a directory in the path prefix or no write access to the new parent directory. |
| EEXIST | The named directory already exists. |
| EFAULT | path equals NULL. |
| EINVAL | The leaf name in path is invalid. |
| ENAMETOOLONG | A name in path exceeds the effective maximum file name length. |
| ENOENT | path is the empty string or includes a directory that was not found. |
| ENOSPC | No space is left on volume to create directory. |
| ENOTDIR | One of the path components is not a directory. |
| EROFS | The volume is read-only. |
EXAMPLE
rc = mkdir("obj", S_IRUSR | S_IWUSR | S_IXUSR);