Requirements Catalog of LSB Core 3.1
Requirements for the function 'mkdir'
| Standard | ID | Description |
| SUSv3 | mkdir.01 | The mkdir() function shall create a new directory with name path. |
| SUSv3 | mkdir.02 | The file permission bits of the new directory shall be initialized from mode. |
| SUSv3 | mkdir.03 | These file permission bits of the mode argument shall be modified by the process' file creation mask |
| SUSv3 | mkdir.04 | The directory's user ID shall be set to the process' effective user ID |
| SUSv3 | mkdir.05 | The directory's group ID shall be set to the group ID of the parent directory or to the effective group ID of the process. Implementations shall provide a way to initialize the directory's group ID to the group ID of the parent directory. Implementations may, but need not, provide an implementation-defined way to initialize the directory's group ID to the effective group ID of the calling process. |
| SUSv3 | mkdir.06 | The newly created directory shall be an empty directory. |
| SUSv3 | mkdir.07 | If path names a symbolic link, mkdir() shall fail and set errno to [EEXIST]. |
| SUSv3 | mkdir.08 | Upon successful completion, mkdir() shall mark for update the st_atime, st_ctime, and st_mtime fields of the directory. |
| SUSv3 | mkdir.09 | Also, the st_ctime and st_mtime fields of the directory that contains the new entry shall be marked for update. |
| SUSv3 | mkdir.10 | Upon successful completion, mkdir() shall return 0. |
| SUSv3 | mkdir.11 | Otherwise, -1 shall be returned, no directory shall be created, and errno shall be set to indicate the error |
| SUSv3 | mkdir.12 | The mkdir() function shall fail if: |
| SUSv3 | mkdir.12.01 | [EACCES] Search permission is denied on a component of the path prefix, or write permission is denied on the parent directory of the directory to be created. |
| SUSv3 | mkdir.12.02 | [EEXIST] The named file exists. |
| SUSv3 | mkdir.12.03 | [ELOOP] A loop exists in symbolic links encountered during resolution of the path argument. |
| SUSv3 | mkdir.12.04 | [EMLINK] The link count of the parent directory would exceed {LINK_MAX}. |
| SUSv3 | mkdir.12.05 | [ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. |
| SUSv3 | mkdir.12.06 | [ENOENT] A component of the path prefix specified by path does not name an existing directory or path is an empty string. |
| SUSv3 | mkdir.12.07 | [ENOSPC] The file system does not contain enough space to hold the contents of the new directory or to extend the parent directory of the new directory. |
| SUSv3 | mkdir.12.08 | [ENOTDIR] A component of the path prefix is not a directory. |
| SUSv3 | mkdir.12.09 | [EROFS] The parent directory resides on a read-only file system. |
| SUSv3 | mkdir.13 | The mkdir() function may fail if: |
| SUSv3 | mkdir.13.01 | [ELOOP] More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument. |
| SUSv3 | mkdir.13.02 | [ENAMETOOLONG] As a result of encountering a symbolic link in resolution of the path argument, the length of the substituted pathname string exceeded {PATH_MAX}. |