From Jason Turner

[fs.op.status]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvlpastv3/{from.md → to.md} +87 -0
tmp/tmpvlpastv3/{from.md → to.md} RENAMED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Status <a id="fs.op.status">[[fs.op.status]]</a>
2
+
3
+ ``` cpp
4
+ file_status status(const path& p);
5
+ ```
6
+
7
+ *Effects:* As if:
8
+
9
+ ``` cpp
10
+ error_code ec;
11
+ file_status result = status(p, ec);
12
+ if (result.type() == file_type::none)
13
+ throw filesystem_error(implementation-supplied-message, p, ec);
14
+ return result;
15
+ ```
16
+
17
+ *Returns:* See above.
18
+
19
+ *Throws:* `filesystem_error`.
20
+
21
+ [*Note 1*: `result` values of `file_status(file_type::not_found)` and
22
+ `file_status(file_type::unknown)` are not considered failures and do not
23
+ cause an exception to be thrown. — *end note*]
24
+
25
+ ``` cpp
26
+ file_status status(const path& p, error_code& ec) noexcept;
27
+ ```
28
+
29
+ *Effects:* If possible, determines the attributes of the file `p`
30
+ resolves to, as if by using POSIX `stat()` to obtain a POSIX
31
+ `struct stat`. If, during attribute determination, the underlying file
32
+ system API reports an error, sets `ec` to indicate the specific error
33
+ reported. Otherwise, `ec.clear()`.
34
+
35
+ [*Note 2*: This allows users to inspect the specifics of underlying API
36
+ errors even when the value returned by `status()` is not
37
+ `file_status(file_type::none)`. — *end note*]
38
+
39
+ Let `prms` denote the result of `(m & perms::mask)`, where `m` is
40
+ determined as if by converting the `st_mode` member of the obtained
41
+ `struct stat` to the type `perms`.
42
+
43
+ *Returns:*
44
+
45
+ - If `ec != error_code()`:
46
+ - If the specific error indicates that `p` cannot be resolved because
47
+ some element of the path does not exist, returns
48
+ `file_status(file_type::not_found)`.
49
+ - Otherwise, if the specific error indicates that `p` can be resolved
50
+ but the attributes cannot be determined, returns
51
+ `file_status(file_type::unknown)`.
52
+ - Otherwise, returns `file_status(file_type::none)`.
53
+
54
+ \[*Note 1*: These semantics distinguish between `p` being known not to
55
+ exist, `p` existing but not being able to determine its attributes,
56
+ and there being an error that prevents even knowing if `p` exists.
57
+ These distinctions are important to some use cases. — *end note*]
58
+ - Otherwise,
59
+ - If the attributes indicate a regular file, as if by POSIX `S_ISREG`,
60
+ returns `file_status(file_type::regular, prms)`.
61
+ \[*Note 2*: `file_type::regular` implies appropriate `<fstream>`
62
+ operations would succeed, assuming no hardware, permission, access,
63
+ or file system race errors. Lack of `file_type::regular` does not
64
+ necessarily imply `<fstream>` operations would fail on a
65
+ directory. — *end note*]
66
+ - Otherwise, if the attributes indicate a directory, as if by POSIX
67
+ `S_ISDIR`, returns `file_status(file_type::directory, prms)`.
68
+ \[*Note 3*: `file_type::directory` implies that calling
69
+ `directory_iterator(p)` would succeed. — *end note*]
70
+ - Otherwise, if the attributes indicate a block special file, as if by
71
+ POSIX `S_ISBLK`, returns `file_status(file_type::block, prms)`.
72
+ - Otherwise, if the attributes indicate a character special file, as
73
+ if by POSIX `S_ISCHR`, returns
74
+ `file_status(file_type::character, prms)`.
75
+ - Otherwise, if the attributes indicate a fifo or pipe file, as if by
76
+ POSIX `S_ISFIFO`, returns `file_status(file_type::fifo, prms)`.
77
+ - Otherwise, if the attributes indicate a socket, as if by POSIX
78
+ `S_ISSOCK`, returns `file_status(file_type::socket, prms)`.
79
+ - Otherwise, if the attributes indicate an implementation-defined file
80
+ type ([[fs.enum.file_type]]), returns
81
+ `file_status(file_type::`*`A`*`, prms)`, where *A* is the constant
82
+ for the *implementation-defined* file type.
83
+ - Otherwise, returns `file_status(file_type::unknown, prms)`.
84
+
85
+ *Remarks:* If a symbolic link is encountered during pathname resolution,
86
+ pathname resolution continues using the contents of the symbolic link.
87
+