about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorThe 8472 <git@infinite-source.de>2024-06-24 23:10:17 +0200
committerThe 8472 <git@infinite-source.de>2024-06-25 01:00:28 +0200
commit0ce361938eddf08da88e4c35e0ed63dbb204b2f2 (patch)
tree52807c1b941fdb9dcba4192330a084b063a98aa9 /library/std/src/sys
parent6687a3f7da60a4d0f06fd84fea75bec1dd0fce2a (diff)
downloadrust-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.rs6
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;