77// spell-checker:ignore (sys/unix) WIFSIGNALED ESRCH
88// spell-checker:ignore pgrep pwait snice getpgrp
99
10- use libc:: { gid_t, pid_t, uid_t} ;
1110#[ cfg( not( target_os = "redox" ) ) ]
1211use nix:: errno:: Errno ;
1312use nix:: sys:: signal:: { self as nix_signal, SigHandler , Signal } ;
1413use nix:: unistd:: Pid ;
14+ use rustix:: process:: { RawGid , RawPid , RawUid } ;
1515use std:: io;
1616use std:: process:: Child ;
1717use std:: process:: ExitStatus ;
@@ -20,35 +20,34 @@ use std::sync::atomic::AtomicBool;
2020use std:: thread;
2121use std:: time:: { Duration , Instant } ;
2222
23- /// `geteuid()` returns the effective user ID of the calling process.
24- pub fn geteuid ( ) -> uid_t {
25- nix :: unistd :: geteuid ( ) . as_raw ( )
23+ /// return the effective user ID of the calling process
24+ pub fn geteuid ( ) -> RawUid {
25+ rustix :: process :: geteuid ( ) . as_raw ( )
2626}
2727
28- /// `getpgrp()` returns the process group ID of the calling process.
29- /// It is a trivial wrapper over nix::unistd::getpgrp.
30- pub fn getpgrp ( ) -> pid_t {
31- nix:: unistd:: getpgrp ( ) . as_raw ( )
28+ /// return the process group ID of the calling process
29+ pub fn getpgrp ( ) -> RawPid {
30+ rustix:: process:: getpgrp ( ) . as_raw_pid ( )
3231}
3332
34- /// `getegid()` returns the effective group ID of the calling process.
35- pub fn getegid ( ) -> gid_t {
36- nix :: unistd :: getegid ( ) . as_raw ( )
33+ /// return the effective group ID of the calling process
34+ pub fn getegid ( ) -> RawGid {
35+ rustix :: process :: getegid ( ) . as_raw ( )
3736}
3837
39- /// `getgid()` returns the real group ID of the calling process.
40- pub fn getgid ( ) -> gid_t {
41- nix :: unistd :: getgid ( ) . as_raw ( )
38+ /// return the real group ID of the calling process
39+ pub fn getgid ( ) -> RawGid {
40+ rustix :: process :: getgid ( ) . as_raw ( )
4241}
4342
44- /// `getuid()` returns the real user ID of the calling process.
45- pub fn getuid ( ) -> uid_t {
43+ /// return the real user ID of the calling process
44+ pub fn getuid ( ) -> RawUid {
4645 rustix:: process:: getuid ( ) . as_raw ( )
4746}
4847
49- /// `getpid()` returns the pid of the calling process.
50- pub fn getpid ( ) -> pid_t {
51- nix :: unistd :: getpid ( ) . as_raw ( )
48+ /// return the pid of the calling process
49+ pub fn getpid ( ) -> RawPid {
50+ rustix :: process :: getpid ( ) . as_raw_pid ( )
5251}
5352
5453/// `getsid()` returns the session ID of the process with process ID pid.
@@ -66,7 +65,7 @@ pub fn getpid() -> pid_t {
6665/// This function only support standard POSIX implementation platform,
6766/// so some system such as redox doesn't supported.
6867#[ cfg( not( target_os = "redox" ) ) ]
69- pub fn getsid ( pid : i32 ) -> Result < pid_t , Errno > {
68+ pub fn getsid ( pid : i32 ) -> Result < RawPid , Errno > {
7069 let pid = if pid == 0 {
7170 None
7271 } else {
@@ -97,7 +96,7 @@ pub trait ChildExt {
9796
9897impl ChildExt for Child {
9998 fn send_signal ( & mut self , signal : usize ) -> io:: Result < ( ) > {
100- let pid = Pid :: from_raw ( self . id ( ) as pid_t ) ;
99+ let pid = Pid :: from_raw ( self . id ( ) as RawPid ) ;
101100 let result = if signal == 0 {
102101 nix_signal:: kill ( pid, None )
103102 } else {
0 commit comments