|
80 | 80 | //! and then replacing the destination file with the temporary file once the new contents are fully |
81 | 81 | //! written to the filesystem. |
82 | 82 | //! |
83 | | -//! On Unix, the implementation is roughly equivalent to this pseudocode: |
| 83 | +//! On **Unix**, the implementation is roughly equivalent to this pseudocode: |
84 | 84 | //! |
85 | 85 | //! ```text |
86 | 86 | //! fd = open("/path/to/directory/.filename.XXXXXX", O_WRONLY | O_CLOEXEC); |
|
89 | 89 | //! rename("/path/to/directory/.filename.XXXXXX", "/path/to/directory/filename"); |
90 | 90 | //! ``` |
91 | 91 | //! |
92 | | -//! Where `XXXXXX` represents a random suffix. On other non-Unix platforms, the implementation is |
| 92 | +//! Where `XXXXXX` represents a random suffix. On **non-Unix** platforms, the implementation is |
93 | 93 | //! similar and uses the equivalent platform-specific system calls. |
94 | 94 | //! |
95 | | -//! On Unix, the actual implementation is more robust and makes use of directory file descriptors |
96 | | -//! (and the system calls `openat`, `linkat`, `renameat`) to make sure that, if the directory is |
97 | | -//! renamed or remounted during the operations, the file still ends up in the original destination |
98 | | -//! directory, and no cross-device writes happen. |
| 95 | +//! On **Unix**, the actual implementation is more robust and makes use of directory file |
| 96 | +//! descriptors (and the system calls `openat`, `linkat`, `renameat`) to make sure that, if the |
| 97 | +//! directory is renamed or remounted during the operations, the file still ends up in the original |
| 98 | +//! destination directory, and no cross-device writes happen. |
99 | 99 | //! |
100 | | -//! On Linux, the implementation makes use of anonymous temporary files (opened with `O_TMPFILE`), |
101 | | -//! and the implementation is roughly equivalent to this pseudocode: |
| 100 | +//! On **Linux**, the implementation makes use of anonymous temporary files (opened with |
| 101 | +//! [`O_TMPFILE`](https://www.man7.org/linux/man-pages/man2/open.2.html)) if supported, and the |
| 102 | +//! implementation is roughly equivalent to this pseudocode: |
102 | 103 | //! |
103 | 104 | //! ```text |
104 | 105 | //! fd = open("/path/to/directory", O_TMPFILE | O_WRONLY | O_CLOEXEC); |
|
108 | 109 | //! rename("/path/to/directory/.filename.XXXXXX", "/path/to/directory/filename"); |
109 | 110 | //! ``` |
110 | 111 | //! |
111 | | -//! This Linux-specific behavior is controlled by the `unnamed-tmpfile` feature of this Crate, |
| 112 | +//! This **Linux**-specific behavior is controlled by the `unnamed-tmpfile` feature of this Crate, |
112 | 113 | //! which is enabled by default. |
113 | 114 | //! |
114 | 115 | //! ## Notes and Limitations |
|
0 commit comments