Files
cppdraft_translate/cppdraft/fs/conformance.md
2025-10-25 03:02:53 +03:00

126 lines
5.1 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.conformance]
# 31 Input/output library [[input.output]](./#input.output)
## 31.12 File systems [[filesystems]](filesystems#fs.conformance)
### 31.12.2 Conformance [fs.conformance]
#### [31.12.2.1](#general) General [[fs.conformance.general]](fs.conformance.general)
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13168)
Conformance is specified in terms of behavior[.](#general-1.sentence-1)
Ideal behavior is not always
implementable, so the conformance subclauses take that into account[.](#general-1.sentence-2)
#### [31.12.2.2](#fs.conform.9945) POSIX conformance [[fs.conform.9945]](fs.conform.9945)
[1](#fs.conform.9945-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13173)
Some behavior is specified by reference to POSIX[.](#fs.conform.9945-1.sentence-1)
How such behavior is actually implemented is unspecified[.](#fs.conform.9945-1.sentence-2)
[*Note [1](#fs.conform.9945-note-1)*:
This constitutes an “as if” rule allowing implementations
to call native
operating system or other APIs[.](#fs.conform.9945-1.sentence-3)
— *end note*]
[2](#fs.conform.9945-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13181)
Implementations should provide such behavior as it is defined by
POSIX[.](#fs.conform.9945-2.sentence-1)
Implementations shall document any behavior that differs from the
behavior defined by POSIX[.](#fs.conform.9945-2.sentence-2)
Implementations that do not support exact POSIX
behavior should provide behavior as close to POSIX behavior as is reasonable given the
limitations of actual operating systems and file systems[.](#fs.conform.9945-2.sentence-3)
If an implementation cannot provide any
reasonable behavior, the implementation shall report an error as specified in [[fs.err.report]](fs.err.report "31.12.5Error reporting")[.](#fs.conform.9945-2.sentence-4)
[*Note [2](#fs.conform.9945-note-2)*:
This allows users to rely on an exception being thrown or
an error code being set when an implementation cannot provide any reasonable
behavior[.](#fs.conform.9945-2.sentence-5)
— *end note*]
[3](#fs.conform.9945-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13194)
Implementations are not required to provide behavior that is not supported by
a particular file system[.](#fs.conform.9945-3.sentence-1)
[*Example [1](#fs.conform.9945-example-1)*:
The FAT file system used by some memory cards, camera memory, and
floppy disks does not support hard links, symlinks, and many other features of
more capable file systems, so implementations are not required to support those
features on the FAT file system
but instead are required to report an error as described above[.](#fs.conform.9945-3.sentence-2)
— *end example*]
#### [31.12.2.3](#fs.conform.os) Operating system dependent behavior conformance [[fs.conform.os]](fs.conform.os)
[1](#fs.conform.os-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13206)
Behavior that is specified as being[*operating system dependent*](#def:operating_system_dependent "31.12.2.3Operating system dependent behavior conformance[fs.conform.os]") is dependent upon the behavior
and characteristics of an operating system[.](#fs.conform.os-1.sentence-1)
The operating system an
implementation is dependent upon isimplementation-defined[.](#fs.conform.os-1.sentence-2)
[2](#fs.conform.os-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13215)
It is permissible for an implementation to be dependent upon an operating
system emulator rather than the actual underlying operating system[.](#fs.conform.os-2.sentence-1)
#### [31.12.2.4](#fs.race.behavior) File system race behavior [[fs.race.behavior]](fs.race.behavior)
[1](#fs.race.behavior-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13221)
A [*file system race*](#def:file_system_race "31.12.2.4File system race behavior[fs.race.behavior]") is
the condition that occurs
when multiple threads, processes, or computers interleave access and
modification of
the same object within a file system[.](#fs.race.behavior-1.sentence-1)
Behavior is undefined if calls to functions provided by subclause [[filesystems]](filesystems "31.12File systems") introduce a file system race[.](#fs.race.behavior-1.sentence-2)
[2](#fs.race.behavior-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13229)
If the possibility of a file system race would make it unreliable for a
program to test for a precondition before calling a function described herein,*Preconditions*: is not specified for the function[.](#fs.race.behavior-2.sentence-1)
[*Note [1](#fs.race.behavior-note-1)*:
As a design practice, preconditions are not specified when it
is unreasonable for a program to detect them prior to calling the function[.](#fs.race.behavior-2.sentence-2)
— *end note*]