30 Input/output library [input.output]

30.10 File systems [filesystems]

30.10.4 Terms and definitions [fs.definitions] absolute path [fs.def.absolute.path]

A path that unambiguously identifies the location of a file without reference to an additional starting location.
The elements of a path that determine if it is absolute are operating system dependent. directory [fs.def.directory]

A file within a file system that acts as a container of directory entries that contain information about other files, possibly including other directory files. file [fs.def.file]

An object within a file system that holds user or system data.
Files can be written to, or read from, or both.
A file has certain attributes, including type.
File types include regular files and directories.
Other types of files, such as symbolic links, may be supported by the implementation. file system [fs.def.filesystem]

A collection of files and their attributes. file system race [fs.def.race]

The condition that occurs when multiple threads, processes, or computers interleave access and modification of the same object within a file system. filename [fs.def.filename]

The name of a file.
Filenames dot and dot-dot, consisting solely of one and two period characters respectively, have special meaning.
The following characteristics of filenames are operating system dependent:
  • The permitted characters.
    Some operating systems prohibit the ASCII control characters (0x00 – 0x1F) in filenames.
    end example
  • The maximum permitted length.
  • Filenames that are not permitted.
  • Filenames that have special meaning.
  • Case awareness and sensitivity during path resolution.
  • Special rules that may apply to file types other than regular files, such as directories. native encoding [fs.def.native.encode]

For narrow character strings, the operating system dependent current encoding for pathnames ([fs.def.pathname]).
For wide character strings, the implementation-defined execution wide-character set encoding ([lex.charset]). native pathname format [fs.def.native]

The operating system dependent pathname format accepted by the host operating system. normal form [fs.def.normal.form]

A path in normal form is said to be normalized.
The process of obtaining a normalized path from a path that is not in normal form is called normalization.
Normalization of a generic format pathname means:
  1. If the path is empty, stop.
  2. Replace each slash character in the root-name with a preferred-separator.
  3. [Note
    The generic pathname grammar ([fs.path.generic]) defines directory-separator as one or more slashes and preferred-separators.
    end note
  4. Remove each dot filename and any immediately following directory-separator.
  5. As long as any appear, remove a non-dot-dot filename immediately followed by a directory-separator and a dot-dot filename, along with any immediately following directory-separator.
  6. If there is a root-directory, remove all dot-dot filenames and any directory-separators immediately following them.
    These dot-dot filenames attempt to refer to nonexistent parent directories.
    end note
  7. If the last filename is dot-dot, remove any trailing directory-separator.
  8. If the path is empty, add a dot. operating system dependent behavior [fs.def.osdep]

Behavior that is dependent upon the behavior and characteristics of an operating system. parent directory [fs.def.parent]

⟨of a directory⟩ the directory that both contains a directory entry for the given directory and is represented by the filename dot-dot in the given directory. parent directory [fs.def.parent.other]

⟨of other types of files⟩ a directory containing a directory entry for the file under discussion. path [fs.def.path]

A sequence of elements that identify the location of a file within a filesystem.
The elements are the root-name, root-directory, and an optional sequence of filenames.
The maximum number of elements in the sequence is operating system dependent. pathname [fs.def.pathname]

A character string that represents the name of a path.
Pathnames are formatted according to the generic pathname format grammar or an operating system dependent native pathname format. pathname resolution [fs.def.pathres]

Pathname resolution is the operating system dependent mechanism for resolving a pathname to a particular file in a file hierarchy.
There may be multiple pathnames that resolve to the same file.
POSIX specifies the mechanism in section 4.11, Pathname resolution.
end example
] relative path [fs.def.rel.path]

A path that is not absolute, and as such, only unambiguously identifies the location of a file when resolved ([fs.def.pathres]) relative to an implied starting location.
The elements of a path that determine if it is relative are operating system dependent.
Pathnames “.
” and “.
” are relative paths.
end note