Skip to content

Commit 99ca58a

Browse files
uucore: add safe wrapper for getpgrp() (#7676)
* uucore: add safe wrapper for getpgrp() * add getpgrp to the spell ignore --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
1 parent 6d29b7b commit 99ca58a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/uucore/src/lib/features/process.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// spell-checker:ignore (vars) cvar exitstatus cmdline kworker getsid getpid
77
// spell-checker:ignore (sys/unix) WIFSIGNALED ESRCH
8-
// spell-checker:ignore pgrep pwait snice
8+
// spell-checker:ignore pgrep pwait snice getpgrp
99

1010
use libc::{gid_t, pid_t, uid_t};
1111
#[cfg(not(target_os = "redox"))]
@@ -23,6 +23,12 @@ pub fn geteuid() -> uid_t {
2323
unsafe { libc::geteuid() }
2424
}
2525

26+
/// `getpgrp()` returns the process group ID of the calling process.
27+
/// It is a trivial wrapper over libc::getpgrp to "hide" the unsafe
28+
pub fn getpgrp() -> pid_t {
29+
unsafe { libc::getpgrp() }
30+
}
31+
2632
/// `getegid()` returns the effective group ID of the calling process.
2733
pub fn getegid() -> gid_t {
2834
unsafe { libc::getegid() }

0 commit comments

Comments
 (0)