document safety properties of the internal Process::new constructor · model-checking/verify-rust-std@bf06e43 (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -877,6 +877,12 @@ pub struct Process {
877 877
878 878 impl Process {
879 879 #[cfg(target_os = "linux")]
880 +/// # Safety
881 + ///
882 + /// `pidfd` must either be -1 (representing no file descriptor) or a valid, exclusively owned file
883 + /// descriptor (See [I/O Safety]).
884 + ///
885 + /// [I/O Safety]: crate::io#io-safety
880 886 unsafe fn new(pid: pid_t, pidfd: pid_t) -> Self {
881 887 use crate::os::unix::io::FromRawFd;
882 888 use crate::sys_common::FromInner;