Skip to content

Commit

Permalink
document safety properties of the internal Process::new constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Jun 24, 2024
1 parent 6687a3f commit 21fcbf8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/std/src/sys/pal/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]: std::io#io-safety
unsafe fn new(pid: pid_t, pidfd: pid_t) -> Self {
use crate::os::unix::io::FromRawFd;
use crate::sys_common::FromInner;
Expand Down

0 comments on commit 21fcbf8

Please sign in to comment.