zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 60242e96dfd509eeb7a5746128410f471eb06dac (tree)
parent 7a41af2632e693cd63476576bbbb965126e45b9b
Author: LemonBoy <thatlemon@gmail.com>
Date:   Mon,  6 May 2019 21:39:02 +0200

Fix definition of epoll_* struct on non x86_64 arches

Diffstat:
Mstd/os/linux.zig | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/std/os/linux.zig b/std/os/linux.zig @@ -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);