Files
2025-10-25 03:02:53 +03:00

172 lines
18 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[fs.enum]
# 31 Input/output library [[input.output]](./#input.output)
## 31.12 File systems [[filesystems]](filesystems#fs.enum)
### 31.12.8 Enumerations [fs.enum]
#### [31.12.8.1](#path.format) Enum path::format [[fs.enum.path.format]](fs.enum.path.format)
[1](#path.format-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15695)
This enum specifies constants used to identify the format of the character
sequence, with the meanings listed in Table [148](#tab:fs.enum.path.format "Table 148: Enum path::format")[.](#path.format-1.sentence-1)
Table [148](#tab:fs.enum.path.format) — Enum path::format [[tab:fs.enum.path.format]](./tab:fs.enum.path.format)
| [🔗](#tab:fs.enum.path.format-row-1)<br>**Name** | **Meaning** |
| --- | --- |
| [🔗](#tab:fs.enum.path.format-row-2)<br>native_format | The native pathname format[.](#tab:fs.enum.path.format-row-2-column-2-sentence-1) |
| [🔗](#tab:fs.enum.path.format-row-3)<br>generic_format | The generic pathname format[.](#tab:fs.enum.path.format-row-3-column-2-sentence-1) |
| [🔗](#tab:fs.enum.path.format-row-4)<br>auto_format | The interpretation of the format of the character sequence is implementation-defined[.](#tab:fs.enum.path.format-row-4-column-2-sentence-1)<br>The implementation may inspect the content of the character sequence to determine the format[.](#tab:fs.enum.path.format-row-4-column-2-sentence-2)<br>*Recommended practice*: For POSIX-based systems, native and generic formats are equivalent and the character sequence should always be interpreted in the same way[.](#tab:fs.enum.path.format-row-4-column-2-sentence-3) |
#### [31.12.8.2](#file.type) Enum class file_type [[fs.enum.file.type]](fs.enum.file.type)
[1](#file.type-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15720)
This enum class specifies constants used to identify file types,
with the meanings listed in Table [149](#tab:fs.enum.file.type "Table 149: Enum class file_­type")[.](#file.type-1.sentence-1)
The values of the constants are distinct[.](#file.type-1.sentence-2)
Table [149](#tab:fs.enum.file.type) — Enum class file_type [[tab:fs.enum.file.type]](./tab:fs.enum.file.type)
| [🔗](#tab:fs.enum.file.type-row-1)<br>**Constant** | **Meaning** |
| --- | --- |
| [🔗](#tab:fs.enum.file.type-row-2)<br>[none](#lib:file_type,none "31.12.8.2Enum class file_­type[fs.enum.file.type]") | The type of the file has not been determined or an error occurred while trying to determine the type[.](#tab:fs.enum.file.type-row-2-column-2-sentence-1) |
| [🔗](#tab:fs.enum.file.type-row-3)<br>[not_found](#lib:file_type,not_found "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Pseudo-type indicating the file was not found[.](#tab:fs.enum.file.type-row-3-column-2-sentence-1)<br>[*Note [1](#tab:fs.enum.file.type-row-3-column-2-note-1)*:<br>The file not being found is not considered an error while determining the type of a file[.](#tab:fs.enum.file.type-row-3-column-2-sentence-2) — *end note*] |
| [🔗](#tab:fs.enum.file.type-row-4)<br>[regular](#lib:file_type,regular "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Regular file |
| [🔗](#tab:fs.enum.file.type-row-5)<br>[directory](#lib:file_type,directory "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Directory file |
| [🔗](#tab:fs.enum.file.type-row-6)<br>[symlink](#lib:file_type,symlink "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Symbolic link file |
| [🔗](#tab:fs.enum.file.type-row-7)<br>[block](#lib:file_type,block "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Block special file |
| [🔗](#tab:fs.enum.file.type-row-8)<br>[character](#lib:file_type,character "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Character special file |
| [🔗](#tab:fs.enum.file.type-row-9)<br>[fifo](#lib:file_type,fifo "31.12.8.2Enum class file_­type[fs.enum.file.type]") | FIFO or pipe file |
| [🔗](#tab:fs.enum.file.type-row-10)<br>[socket](#lib:file_type,socket "31.12.8.2Enum class file_­type[fs.enum.file.type]") | Socket file |
| [🔗](#tab:fs.enum.file.type-row-11)<br>*implementation-defined* | Implementations that support file systems having file types in addition to the above file_type types shall supply implementation-defined file_type constants to separately identify each of those additional file types |
| [🔗](#tab:fs.enum.file.type-row-12)<br>[unknown](#lib:file_type,unknown "31.12.8.2Enum class file_­type[fs.enum.file.type]") | The file exists but the type cannot be determined |
#### [31.12.8.3](#copy.opts) Enum class copy_options [[fs.enum.copy.opts]](fs.enum.copy.opts)
[1](#copy.opts-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15766)
The enum class type copy_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types")) that specifies bitmask constants used to control the semantics of
copy operations[.](#copy.opts-1.sentence-1)
The constants are specified in option groups with the meanings listed in Table [150](#tab:fs.enum.copy.opts "Table 150: Enum class copy_­options")[.](#copy.opts-1.sentence-2)
The constant none represents the empty bitmask, and
is shown in each option group for purposes of exposition;
implementations shall provide only a single definition[.](#copy.opts-1.sentence-3)
Every other constant in the table represents a distinct bitmask element[.](#copy.opts-1.sentence-4)
Table [150](#tab:fs.enum.copy.opts) — Enum class copy_options [[tab:fs.enum.copy.opts]](./tab:fs.enum.copy.opts)
| [🔗](#tab:fs.enum.copy.opts-row-1)<br>**Option group controlling copy_file function effects for existing target files** | |
| --- | --- |
| [🔗](#tab:fs.enum.copy.opts-row-2)<br>**Constant** | **Meaning** |
| [🔗](#tab:fs.enum.copy.opts-row-3)<br>[none](#lib:copy_options,none "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | (Default) Error; file already exists[.](#tab:fs.enum.copy.opts-row-3-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-4)<br>[skip_existing](#lib:copy_options,skip_existing "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Do not overwrite existing file, do not report an error[.](#tab:fs.enum.copy.opts-row-4-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-5)<br>[overwrite_existing](#lib:copy_options,overwrite_existing "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Overwrite the existing file[.](#tab:fs.enum.copy.opts-row-5-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-6)<br>[update_existing](#lib:copy_options,update_existing "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Overwrite the existing file if it is older than the replacement file[.](#tab:fs.enum.copy.opts-row-6-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-7)<br>**Option group controlling copy function effects for subdirectories** | |
| [🔗](#tab:fs.enum.copy.opts-row-8)<br>**Constant** | **Meaning** |
| [🔗](#tab:fs.enum.copy.opts-row-9)<br>[none](#lib:copy_options,none "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | (Default) Do not copy subdirectories[.](#tab:fs.enum.copy.opts-row-9-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-10)<br>[recursive](#lib:copy_options,recursive "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Recursively copy subdirectories and their contents[.](#tab:fs.enum.copy.opts-row-10-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-11)<br>**Option group controlling copy function effects for symbolic links** | |
| [🔗](#tab:fs.enum.copy.opts-row-12)<br>**Constant** | **Meaning** |
| [🔗](#tab:fs.enum.copy.opts-row-13)<br>[none](#lib:copy_options,none "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | (Default) Follow symbolic links[.](#tab:fs.enum.copy.opts-row-13-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-14)<br>[copy_symlinks](#lib:copy_options,copy_symlinks "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Copy symbolic links as symbolic links rather than copying the files that they point to[.](#tab:fs.enum.copy.opts-row-14-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-15)<br>[skip_symlinks](#lib:copy_options,skip_symlinks "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Ignore symbolic links[.](#tab:fs.enum.copy.opts-row-15-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-16)<br>**Option group controlling copy function effects for choosing the form of copying** | |
| [🔗](#tab:fs.enum.copy.opts-row-17)<br>**Constant** | **Meaning** |
| [🔗](#tab:fs.enum.copy.opts-row-18)<br>[none](#lib:copy_options,none "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | (Default) Copy content[.](#tab:fs.enum.copy.opts-row-18-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-19)<br>[directories_only](#lib:copy_options,directories_only "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Copy directory structure only, do not copy non-directory files[.](#tab:fs.enum.copy.opts-row-19-column-2-sentence-1) |
| [🔗](#tab:fs.enum.copy.opts-row-20)<br>[create_symlinks](#lib:copy_options,create_symlinks "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Make symbolic links instead of copies of files[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-1)<br>The source path shall be an absolute path unless the destination path is in the current directory[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-2) |
| [🔗](#tab:fs.enum.copy.opts-row-21)<br>[create_hard_links](#lib:copy_options,create_hard_links "31.12.8.3Enum class copy_­options[fs.enum.copy.opts]") | Make hard links instead of copies of files[.](#tab:fs.enum.copy.opts-row-21-column-2-sentence-1) |
#### [31.12.8.4](#perms) Enum class perms [[fs.enum.perms]](fs.enum.perms)
[1](#perms-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15823)
The enum class type perms is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types")) that specifies bitmask constants used to identify file
permissions, with the meanings listed in Table [151](#tab:fs.enum.perms "Table 151: Enum class perms")[.](#perms-1.sentence-1)
Table [151](#tab:fs.enum.perms) — Enum class perms [[tab:fs.enum.perms]](./tab:fs.enum.perms)
| [🔗](#tab:fs.enum.perms-row-1)<br>**Name** | **Value** | **POSIX** | **Definition or notes** |
| --- | --- | --- | --- |
| [🔗](#tab:fs.enum.perms-row-2) | **(octal)** | **macro** | |
| [🔗](#tab:fs.enum.perms-row-3)<br>[none](#lib:perms,none "31.12.8.4Enum class perms[fs.enum.perms]") | 0 | | There are no permissions set for the file[.](#tab:fs.enum.perms-row-3-column-4-sentence-1) |
| [🔗](#tab:fs.enum.perms-row-4)<br>[owner_read](#lib:perms,owner_read "31.12.8.4Enum class perms[fs.enum.perms]") | 0400 | S_IRUSR | Read permission, owner |
| [🔗](#tab:fs.enum.perms-row-5)<br>[owner_write](#lib:perms,owner_write "31.12.8.4Enum class perms[fs.enum.perms]") | 0200 | S_IWUSR | Write permission, owner |
| [🔗](#tab:fs.enum.perms-row-6)<br>[owner_exec](#lib:perms,owner_exec "31.12.8.4Enum class perms[fs.enum.perms]") | 0100 | S_IXUSR | Execute/search permission, owner |
| [🔗](#tab:fs.enum.perms-row-7)<br>[owner_all](#lib:perms,owner_all "31.12.8.4Enum class perms[fs.enum.perms]") | 0700 | S_IRWXU | Read, write, execute/search by owner; owner_read | owner_write | owner_exec |
| [🔗](#tab:fs.enum.perms-row-8)<br>[group_read](#lib:perms,group_read "31.12.8.4Enum class perms[fs.enum.perms]") | 040 | S_IRGRP | Read permission, group |
| [🔗](#tab:fs.enum.perms-row-9)<br>[group_write](#lib:perms,group_write "31.12.8.4Enum class perms[fs.enum.perms]") | 020 | S_IWGRP | Write permission, group |
| [🔗](#tab:fs.enum.perms-row-10)<br>[group_exec](#lib:perms,group_exec "31.12.8.4Enum class perms[fs.enum.perms]") | 010 | S_IXGRP | Execute/search permission, group |
| [🔗](#tab:fs.enum.perms-row-11)<br>[group_all](#lib:perms,group_all "31.12.8.4Enum class perms[fs.enum.perms]") | 070 | S_IRWXG | Read, write, execute/search by group; group_read | group_write | group_exec |
| [🔗](#tab:fs.enum.perms-row-12)<br>[others_read](#lib:perms,others_read "31.12.8.4Enum class perms[fs.enum.perms]") | 04 | S_IROTH | Read permission, others |
| [🔗](#tab:fs.enum.perms-row-13)<br>[others_write](#lib:perms,others_write "31.12.8.4Enum class perms[fs.enum.perms]") | 02 | S_IWOTH | Write permission, others |
| [🔗](#tab:fs.enum.perms-row-14)<br>[others_exec](#lib:perms,others_exec "31.12.8.4Enum class perms[fs.enum.perms]") | 01 | S_IXOTH | Execute/search permission, others |
| [🔗](#tab:fs.enum.perms-row-15)<br>[others_all](#lib:perms,others_all "31.12.8.4Enum class perms[fs.enum.perms]") | 07 | S_IRWXO | Read, write, execute/search by others; others_read | others_write | others_exec |
| [🔗](#tab:fs.enum.perms-row-16)<br>[all](#lib:perms,all "31.12.8.4Enum class perms[fs.enum.perms]") | 0777 | | owner_all | group_all | others_all |
| [🔗](#tab:fs.enum.perms-row-17)<br>[set_uid](#lib:perms,set_uid "31.12.8.4Enum class perms[fs.enum.perms]") | 04000 | S_ISUID | Set-user-ID on execution |
| [🔗](#tab:fs.enum.perms-row-18)<br>[set_gid](#lib:perms,set_gid "31.12.8.4Enum class perms[fs.enum.perms]") | 02000 | S_ISGID | Set-group-ID on execution |
| [🔗](#tab:fs.enum.perms-row-19)<br>[sticky_bit](#lib:perms,sticky_bit "31.12.8.4Enum class perms[fs.enum.perms]") | 01000 | S_ISVTX | Operating system dependent[.](#tab:fs.enum.perms-row-19-column-4-sentence-1) |
| [🔗](#tab:fs.enum.perms-row-20)<br>[mask](#lib:perms,mask "31.12.8.4Enum class perms[fs.enum.perms]") | 07777 | | all | set_uid | set_gid | sticky_bit |
| [🔗](#tab:fs.enum.perms-row-21)<br>[unknown](#lib:perms,unknown "31.12.8.4Enum class perms[fs.enum.perms]") | 0xFFFF | | The permissions are not known, such as when a file_status object is created without specifying the permissions |
#### [31.12.8.5](#perm.opts) Enum class perm_options [[fs.enum.perm.opts]](fs.enum.perm.opts)
[1](#perm.opts-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15882)
The enum class type perm_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types")) that specifies bitmask constants used to
control the semantics of permissions operations,
with the meanings listed in Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_­options")[.](#perm.opts-1.sentence-1)
The bitmask constants are bitmask elements[.](#perm.opts-1.sentence-2)
In Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_­options") perm denotes a value of type perms passed to permissions[.](#perm.opts-1.sentence-3)
Table [152](#tab:fs.enum.perm.opts) — Enum class perm_options [[tab:fs.enum.perm.opts]](./tab:fs.enum.perm.opts)
| [🔗](#tab:fs.enum.perm.opts-row-1)<br>**Name** | **Meaning** |
| --- | --- |
| [🔗](#tab:fs.enum.perm.opts-row-2)<br>[replace](#lib:perm_options,replace "31.12.8.5Enum class perm_­options[fs.enum.perm.opts]") | permissions shall replace the file's permission bits with perm |
| [🔗](#tab:fs.enum.perm.opts-row-3)<br>[add](#lib:perm_options,add "31.12.8.5Enum class perm_­options[fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise or of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-3-column-2-sentence-1) |
| [🔗](#tab:fs.enum.perm.opts-row-4)<br>[remove](#lib:perm_options,remove "31.12.8.5Enum class perm_­options[fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise and of the complement of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-4-column-2-sentence-1) |
| [🔗](#tab:fs.enum.perm.opts-row-5)<br>[nofollow](#lib:perm_options,nofollow "31.12.8.5Enum class perm_­options[fs.enum.perm.opts]") | permissions shall change the permissions of a symbolic link itself rather than the permissions of the file the link resolves to[.](#tab:fs.enum.perm.opts-row-5-column-2-sentence-1) |
#### [31.12.8.6](#dir.opts) Enum class directory_options [[fs.enum.dir.opts]](fs.enum.dir.opts)
[1](#dir.opts-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15913)
The enum class type directory_options is a bitmask
type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types")) that specifies bitmask constants used to identify
directory traversal options, with the meanings listed in Table [153](#tab:fs.enum.dir.opts "Table 153: Enum class directory_­options")[.](#dir.opts-1.sentence-1)
The constant none represents the empty bitmask;
every other constant in the table represents a distinct bitmask element[.](#dir.opts-1.sentence-2)
Table [153](#tab:fs.enum.dir.opts) — Enum class directory_options [[tab:fs.enum.dir.opts]](./tab:fs.enum.dir.opts)
| [🔗](#tab:fs.enum.dir.opts-row-1)<br>**Name** | **Meaning** |
| --- | --- |
| [🔗](#tab:fs.enum.dir.opts-row-2)<br>[none](#lib:directory_options,none "31.12.8.6Enum class directory_­options[fs.enum.dir.opts]") | (Default) Skip directory symlinks, permission denied is an error[.](#tab:fs.enum.dir.opts-row-2-column-2-sentence-1) |
| [🔗](#tab:fs.enum.dir.opts-row-3)<br>[follow_directory_symlink](#lib:directory_options,follow_directory_symlink "31.12.8.6Enum class directory_­options[fs.enum.dir.opts]") | Follow rather than skip directory symlinks[.](#tab:fs.enum.dir.opts-row-3-column-2-sentence-1) |
| [🔗](#tab:fs.enum.dir.opts-row-4)<br>[skip_permission_denied](#lib:directory_options,skip_permission_denied "31.12.8.6Enum class directory_­options[fs.enum.dir.opts]") | Skip directories that would otherwise result in permission denied[.](#tab:fs.enum.dir.opts-row-4-column-2-sentence-1) |