diff options
| author | The 8472 <git@infinite-source.de> | 2024-06-24 23:10:17 +0200 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2024-06-25 01:00:28 +0200 |
| commit | 0ce361938eddf08da88e4c35e0ed63dbb204b2f2 (patch) | |
| tree | 52807c1b941fdb9dcba4192330a084b063a98aa9 /library/std/src/sys | |
| parent | 6687a3f7da60a4d0f06fd84fea75bec1dd0fce2a (diff) | |
| download | rust-0ce361938eddf08da88e4c35e0ed63dbb204b2f2.tar.gz rust-0ce361938eddf08da88e4c35e0ed63dbb204b2f2.zip | |
document safety properties of the internal Process::new constructor
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/pal/unix/process/process_unix.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs index 3de66d9789f..23dce4ea5fb 100644 --- a/library/std/src/sys/pal/unix/process/process_unix.rs +++ b/library/std/src/sys/pal/unix/process/process_unix.rs @@ -877,6 +877,12 @@ pub struct Process { impl Process { #[cfg(target_os = "linux")] + /// # Safety + /// + /// `pidfd` must either be -1 (representing no file descriptor) or a valid, exclusively owned file + /// descriptor (See [I/O Safety]). + /// + /// [I/O Safety]: crate::io#io-safety unsafe fn new(pid: pid_t, pidfd: pid_t) -> Self { use crate::os::unix::io::FromRawFd; use crate::sys_common::FromInner; |
