Skip to content

Commit 83ab9a3

Browse files
committed
Add signalfd and related to android
1 parent 575c65a commit 83ab9a3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

libc-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ fn main() {
173173
if linux {
174174
cfg.header("mqueue.h");
175175
cfg.header("ucontext.h");
176-
cfg.header("sys/signalfd.h");
177176
if !uclibc {
178177
// optionally included in uclibc
179178
cfg.header("sys/xattr.h");
@@ -200,6 +199,7 @@ fn main() {
200199
cfg.header("sys/eventfd.h");
201200
cfg.header("sys/prctl.h");
202201
cfg.header("sys/sendfile.h");
202+
cfg.header("sys/signalfd.h");
203203
cfg.header("sys/vfs.h");
204204
cfg.header("sys/syscall.h");
205205
cfg.header("sys/personality.h");

src/unix/notbsd/android/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,27 @@ s! {
146146
#[cfg(target_pointer_width = "64")]
147147
__f_reserved: [u32; 6],
148148
}
149+
150+
pub struct signalfd_siginfo {
151+
pub ssi_signo: ::uint32_t,
152+
pub ssi_errno: ::int32_t,
153+
pub ssi_code: ::int32_t,
154+
pub ssi_pid: ::uint32_t,
155+
pub ssi_uid: ::uint32_t,
156+
pub ssi_fd: ::int32_t,
157+
pub ssi_tid: ::uint32_t,
158+
pub ssi_band: ::uint32_t,
159+
pub ssi_overrun: ::uint32_t,
160+
pub ssi_trapno: ::uint32_t,
161+
pub ssi_status: ::int32_t,
162+
pub ssi_int: ::int32_t,
163+
pub ssi_ptr: ::c_ulonglong,
164+
pub ssi_utime: ::c_ulonglong,
165+
pub ssi_stime: ::c_ulonglong,
166+
pub ssi_addr: ::c_ulonglong,
167+
pub ssi_addr_lsb: ::uint16_t,
168+
_pad: [::uint8_t; 46],
169+
}
149170
}
150171

151172
pub const O_TRUNC: ::c_int = 512;
@@ -810,6 +831,9 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG;
810831
pub const POLLWRNORM: ::c_short = 0x100;
811832
pub const POLLWRBAND: ::c_short = 0x200;
812833

834+
pub const SFD_CLOEXEC: ::c_int = O_CLOEXEC;
835+
pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK;
836+
813837
f! {
814838
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
815839
for slot in cpuset.__bits.iter_mut() {
@@ -889,6 +913,8 @@ extern {
889913

890914
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
891915
len: ::off_t) -> ::c_int;
916+
pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int)
917+
-> ::c_int;
892918
}
893919

894920
cfg_if! {

0 commit comments

Comments
 (0)