1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

uucore::process: Add a few notes

This commit is contained in:
Jan Verbeek 2021-08-27 16:16:59 +02:00
parent cc652c7fe9
commit 601ea3ef19

View file

@ -19,6 +19,8 @@ use std::process::ExitStatus as StdExitStatus;
use std::thread; use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
// SAFETY: These functions always succeed and return simple integers.
/// `geteuid()` returns the effective user ID of the calling process. /// `geteuid()` returns the effective user ID of the calling process.
pub fn geteuid() -> uid_t { pub fn geteuid() -> uid_t {
unsafe { libc::geteuid() } unsafe { libc::geteuid() }
@ -96,6 +98,9 @@ impl fmt::Display for ExitStatus {
/// Missing methods for Child objects /// Missing methods for Child objects
pub trait ChildExt { pub trait ChildExt {
/// Send a signal to a Child process. /// Send a signal to a Child process.
///
/// Caller beware: if the process already exited then you may accidentally
/// send the signal to an unrelated process that recycled the PID.
fn send_signal(&mut self, signal: usize) -> io::Result<()>; fn send_signal(&mut self, signal: usize) -> io::Result<()>;
/// Wait for a process to finish or return after the specified duration. /// Wait for a process to finish or return after the specified duration.