File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -213,3 +213,7 @@ pub fn exit(code: i32) -> ! {
213213pub fn getpid ( ) -> u32 {
214214 syscall:: getpid ( ) . unwrap ( ) as u32
215215}
216+
217+ pub fn getppid ( ) -> u32 {
218+ syscall:: getppid ( ) . unwrap ( ) as u32
219+ }
Original file line number Diff line number Diff line change @@ -191,3 +191,9 @@ impl IntoRawFd for process::ChildStderr {
191191 self . into_inner ( ) . into_fd ( ) . into_raw ( )
192192 }
193193}
194+
195+ /// Returns the OS-assigned process identifier associated with this process's parent.
196+ #[ unstable( feature = "unix_ppid" , issue = "46104" ) ]
197+ pub fn parent_id ( ) -> u32 {
198+ :: sys:: os:: getppid ( )
199+ }
Original file line number Diff line number Diff line change @@ -515,3 +515,7 @@ pub fn exit(code: i32) -> ! {
515515pub fn getpid ( ) -> u32 {
516516 unsafe { libc:: getpid ( ) as u32 }
517517}
518+
519+ pub fn getppid ( ) -> u32 {
520+ unsafe { libc:: getppid ( ) as u32 }
521+ }
You can’t perform that action at this time.
0 commit comments