Fix definition of epoll_* struct on non x86_64 arches

master
LemonBoy 2019-05-06 21:39:02 +02:00
parent 7a41af2632
commit 60242e96df
1 changed files with 7 additions and 5 deletions

View File

@ -1390,17 +1390,19 @@ pub fn sched_getaffinity(pid: i32, set: []usize) usize {
return syscall3(SYS_sched_getaffinity, @bitCast(usize, isize(pid)), set.len * @sizeOf(usize), @ptrToInt(set.ptr));
}
pub const epoll_data = packed union {
pub const epoll_data = extern union {
ptr: usize,
fd: i32,
@"u32": u32,
@"u64": u64,
};
pub const epoll_event = packed struct {
events: u32,
data: epoll_data,
};
// On x86_64 the structure is packed so that it matches the definition of its
// 32bit counterpart
pub const epoll_event = if (builtin.arch != .x86_64)
extern struct { events: u32, data: epoll_data }
else
packed struct { events: u32, data: epoll_data };
pub fn epoll_create() usize {
return epoll_create1(0);