mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 02:43:45 +00:00
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.
This commit is contained in:
parent
1f8a450cdd
commit
6b4dbdbf47
@ -32,9 +32,9 @@
|
|||||||
//! other code using that file descriptor.
|
//! other code using that file descriptor.
|
||||||
//! This list doesn't include `mmap`, since `mmap` does do a proper borrow of
|
//! 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
|
//! its file descriptor argument. That said, `mmap` is unsafe for other
|
||||||
//! reasons: it operates on raw pointers, and it has undefined behavior if the
|
//! reasons: it operates on raw pointers, and it can have undefined behavior if
|
||||||
//! underlying storage is mutated. Mutations may come from other processes, or
|
//! the underlying storage is mutated. Mutations may come from other processes,
|
||||||
//! from the same process if the API provides `BorrowedFd` access, since as
|
//! or from the same process if the API provides `BorrowedFd` access, since as
|
||||||
//! mentioned earlier, `BorrowedFd` values may be used in APIs which provide
|
//! mentioned earlier, `BorrowedFd` values may be used in APIs which provide
|
||||||
//! safe access to any system call. Consequently, code using `mmap` and
|
//! safe access to any system call. Consequently, code using `mmap` and
|
||||||
//! presenting a safe API must take full responsibility for ensuring that safe
|
//! presenting a safe API must take full responsibility for ensuring that safe
|
||||||
|
Loading…
Reference in New Issue
Block a user