Skip to content

Commit e48cc89

Browse files
committed
Allow nix to compile on arm-linux-androideabi
1 parent 1bd18d5 commit e48cc89

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

src/macros.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,22 @@ macro_rules! libc_bitflags {
130130
}
131131
};
132132

133+
// Munch last ident with as
134+
(@accumulate_flags
135+
$prefix:tt,
136+
[$($flags:tt)*];
137+
$flag:ident as $ty:ty
138+
) => {
139+
libc_bitflags! {
140+
@accumulate_flags
141+
$prefix,
142+
[
143+
$($flags)*
144+
const $flag = libc::$flag as $ty;
145+
];
146+
}
147+
};
148+
133149
// Munch an ident; covers terminating comma case.
134150
(@accumulate_flags
135151
$prefix:tt,
@@ -147,6 +163,23 @@ macro_rules! libc_bitflags {
147163
}
148164
};
149165

166+
// Munch an ident; covers terminating comma case with as.
167+
(@accumulate_flags
168+
$prefix:tt,
169+
[$($flags:tt)*];
170+
$flag:ident as $ty:ty, $($tail:tt)*
171+
) => {
172+
libc_bitflags! {
173+
@accumulate_flags
174+
$prefix,
175+
[
176+
$($flags)*
177+
const $flag = libc::$flag as $ty;
178+
];
179+
$($tail)*
180+
}
181+
};
182+
150183
// (non-pub) Entry rule.
151184
(
152185
$(#[$attr:meta])*

src/sys/signal.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ pub const SIGIOT : Signal = SIGABRT;
198198
pub const SIGPOLL : Signal = SIGIO;
199199
pub const SIGUNUSED : Signal = SIGSYS;
200200

201+
#[cfg(not(target_os = "android"))]
201202
libc_bitflags!{
202203
pub flags SaFlags: libc::c_int {
203204
SA_NOCLDSTOP,
@@ -210,6 +211,19 @@ libc_bitflags!{
210211
}
211212
}
212213

214+
#[cfg(target_os = "android")]
215+
libc_bitflags!{
216+
pub flags SaFlags: libc::c_ulong {
217+
SA_NOCLDSTOP as libc::c_ulong,
218+
SA_NOCLDWAIT as libc::c_ulong,
219+
SA_NODEFER as libc::c_ulong,
220+
SA_ONSTACK as libc::c_ulong,
221+
SA_RESETHAND as libc::c_ulong,
222+
SA_RESTART as libc::c_ulong,
223+
SA_SIGINFO as libc::c_ulong,
224+
}
225+
}
226+
213227
#[repr(i32)]
214228
#[derive(Clone, Copy, PartialEq)]
215229
pub enum SigmaskHow {

src/sys/termios.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ mod ffi {
3939
pub use self::non_android::*;
4040

4141
// On Android before 5.0, Bionic directly inline these to ioctl() calls.
42-
#[inline]
4342
#[cfg(all(target_os = "android", not(target_arch = "mips")))]
4443
mod android {
4544
use libc;

0 commit comments

Comments
 (0)