diff options
| author | Dan Gohman <dev@sunfishcode.online> | 2021-07-27 16:58:38 -0700 | 
|---|---|---|
| committer | Dan Gohman <dev@sunfishcode.online> | 2021-08-19 12:02:39 -0700 | 
| commit | 6b4dbdbf47a73de688df06d50dada7ba80df9458 (patch) | |
| tree | f7551846a2b750755a6e5fea2845df63e4e9d16c /library/std/src/os/unix/io/mod.rs | |
| parent | 1f8a450cdd1b8324765f19c3edd8ca2242682fb8 (diff) | |
| download | rust-6b4dbdbf47a73de688df06d50dada7ba80df9458.tar.gz rust-6b4dbdbf47a73de688df06d50dada7ba80df9458.zip | |
Be more precise about `mmap` and undefined behavior.
`mmap` doesn't *always* cause undefined behavior; it depends on the details of how you use it.
Diffstat (limited to 'library/std/src/os/unix/io/mod.rs')
| -rw-r--r-- | library/std/src/os/unix/io/mod.rs | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/library/std/src/os/unix/io/mod.rs b/library/std/src/os/unix/io/mod.rs index 06f47cbb31f..fd1394a0520 100644 --- a/library/std/src/os/unix/io/mod.rs +++ b/library/std/src/os/unix/io/mod.rs @@ -32,9 +32,9 @@ //! other code using that file descriptor. //! This list doesn't include `mmap`, since `mmap` does do a proper borrow of //! its file descriptor argument. That said, `mmap` is unsafe for other -//! reasons: it operates on raw pointers, and it has undefined behavior if the -//! underlying storage is mutated. Mutations may come from other processes, or -//! from the same process if the API provides `BorrowedFd` access, since as +//! reasons: it operates on raw pointers, and it can have undefined behavior if +//! the underlying storage is mutated. Mutations may come from other processes, +//! or from the same process if the API provides `BorrowedFd` access, since as //! mentioned earlier, `BorrowedFd` values may be used in APIs which provide //! safe access to any system call. Consequently, code using `mmap` and //! presenting a safe API must take full responsibility for ensuring that safe | 
