Skip to content

Commit 90442a0

Browse files
committed
Don't use non linux enums on linux
1 parent e9867ad commit 90442a0

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

crashtracker/src/crash_info/sig_info.rs

+51
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,24 @@ impl From<libc::c_int> for SignalNames {
8585
libc::SIGWINCH => SignalNames::SIGWINCH,
8686
libc::SIGIO => SignalNames::SIGIO,
8787
libc::SIGSYS => SignalNames::SIGSYS,
88+
#[cfg(not(any(
89+
target_os = "android",
90+
target_os = "emscripten",
91+
target_os = "fuchsia",
92+
target_os = "linux",
93+
target_os = "redox",
94+
target_os = "haiku"
95+
)))]
8896
libc::SIGEMT => SignalNames::SIGEMT,
97+
#[cfg(not(any(
98+
target_os = "android",
99+
target_os = "emscripten",
100+
target_os = "fuchsia",
101+
target_os = "linux",
102+
target_os = "redox",
103+
target_os = "haiku",
104+
target_os = "aix"
105+
)))]
89106
libc::SIGINFO => SignalNames::SIGINFO,
90107
_ => SignalNames::UNKNOWN,
91108
}
@@ -125,7 +142,24 @@ impl From<nix::sys::signal::Signal> for SignalNames {
125142
nix::sys::signal::Signal::SIGWINCH => SignalNames::SIGWINCH,
126143
nix::sys::signal::Signal::SIGIO => SignalNames::SIGIO,
127144
nix::sys::signal::Signal::SIGSYS => SignalNames::SIGSYS,
145+
#[cfg(not(any(
146+
target_os = "android",
147+
target_os = "emscripten",
148+
target_os = "fuchsia",
149+
target_os = "linux",
150+
target_os = "redox",
151+
target_os = "haiku"
152+
)))]
128153
nix::sys::signal::Signal::SIGEMT => SignalNames::SIGEMT,
154+
#[cfg(not(any(
155+
target_os = "android",
156+
target_os = "emscripten",
157+
target_os = "fuchsia",
158+
target_os = "linux",
159+
target_os = "redox",
160+
target_os = "haiku",
161+
target_os = "aix"
162+
)))]
129163
nix::sys::signal::Signal::SIGINFO => SignalNames::SIGINFO,
130164
_ => SignalNames::UNKNOWN,
131165
}
@@ -165,7 +199,24 @@ pub fn signal_from_signum(value: libc::c_int) -> anyhow::Result<nix::sys::signal
165199
libc::SIGWINCH => nix::sys::signal::Signal::SIGWINCH,
166200
libc::SIGIO => nix::sys::signal::Signal::SIGIO,
167201
libc::SIGSYS => nix::sys::signal::Signal::SIGSYS,
202+
#[cfg(not(any(
203+
target_os = "android",
204+
target_os = "emscripten",
205+
target_os = "fuchsia",
206+
target_os = "linux",
207+
target_os = "redox",
208+
target_os = "haiku"
209+
)))]
168210
libc::SIGEMT => nix::sys::signal::Signal::SIGEMT,
211+
#[cfg(not(any(
212+
target_os = "android",
213+
target_os = "emscripten",
214+
target_os = "fuchsia",
215+
target_os = "linux",
216+
target_os = "redox",
217+
target_os = "haiku",
218+
target_os = "aix"
219+
)))]
169220
libc::SIGINFO => nix::sys::signal::Signal::SIGINFO,
170221
_ => anyhow::bail!("Unexpected signal number {value}"),
171222
};

0 commit comments

Comments
 (0)