aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-05-06 21:39:02 +0200
committerLemonBoy <thatlemon@gmail.com>2019-05-06 21:39:02 +0200
commit60242e96dfd509eeb7a5746128410f471eb06dac (patch)
tree0437d266c15ddbea7dd93683e624f3e20eb9e5af
parent7a41af2632e693cd63476576bbbb965126e45b9b (diff)
downloadzig-60242e96dfd509eeb7a5746128410f471eb06dac.tar.gz
zig-60242e96dfd509eeb7a5746128410f471eb06dac.zip
Fix definition of epoll_* struct on non x86_64 arches
-rw-r--r--std/os/linux.zig12
1 files changed, 7 insertions, 5 deletions
diff --git a/std/os/linux.zig b/std/os/linux.zig
index 8471a1861b..f39c184ffc 100644
--- 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);