From c3d334499ada28336a8c30bd5dd29ba4478e6736 Mon Sep 17 00:00:00 2001 From: eduardorittner Date: Sun, 6 Apr 2025 11:22:52 -0300 Subject: [PATCH 1/2] uucore: add safe wrapper for getpgrp() --- src/uucore/src/lib/features/process.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 007e712fa5d..1966069b26b 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -23,6 +23,12 @@ pub fn geteuid() -> uid_t { unsafe { libc::geteuid() } } +/// `getpgrp()` returns the process group ID of the calling process. +/// It is a trivial wrapper over libc::getpgrp to "hide" the unsafe +pub fn getpgrp() -> pid_t { + unsafe { libc::getpgrp() } +} + /// `getegid()` returns the effective group ID of the calling process. pub fn getegid() -> gid_t { unsafe { libc::getegid() } From 308044fce223f8100961e37fe81b7d4030d73120 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 May 2025 10:00:26 +0200 Subject: [PATCH 2/2] add getpgrp to the spell ignore --- src/uucore/src/lib/features/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 1966069b26b..4656e7c13ea 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -5,7 +5,7 @@ // spell-checker:ignore (vars) cvar exitstatus cmdline kworker getsid getpid // spell-checker:ignore (sys/unix) WIFSIGNALED ESRCH -// spell-checker:ignore pgrep pwait snice +// spell-checker:ignore pgrep pwait snice getpgrp use libc::{gid_t, pid_t, uid_t}; #[cfg(not(target_os = "redox"))]