document safety properties of the internal Process::new constructor

This commit is contained in:
The 8472 2024-06-24 23:10:17 +02:00
parent 6687a3f7da
commit 0ce361938e

View File

@ -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;