File tree 3 files changed +14
-0
lines changed
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) -> ! {
213
213
pub fn getpid ( ) -> u32 {
214
214
syscall:: getpid ( ) . unwrap ( ) as u32
215
215
}
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 {
191
191
self . into_inner ( ) . into_fd ( ) . into_raw ( )
192
192
}
193
193
}
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) -> ! {
515
515
pub fn getpid ( ) -> u32 {
516
516
unsafe { libc:: getpid ( ) as u32 }
517
517
}
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