We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d48ca3 commit fefe618Copy full SHA for fefe618
src/uucore/src/lib/features/process.rs
@@ -72,8 +72,13 @@ pub fn pid_is_alive(pid: i32) -> bool {
72
if pid <= 0 {
73
return true;
74
}
75
+ #[cfg(target_os = "linux")]
76
+ let errno_ptr = unsafe { libc::__errno_location() };
77
- unsafe { libc::kill(pid, 0) == 0 || *libc::__errno_location() != libc::ESRCH }
78
+ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
79
+ let errno_ptr = unsafe { libc::__error() };
80
+
81
+ unsafe { libc::kill(pid, 0) == 0 || *errno_ptr != libc::ESRCH }
82
83
84
/// `getsid()` returns the session ID of the process with process ID pid.
0 commit comments