From 477425435a2fefce81d6fda970af0e5325da1668 Mon Sep 17 00:00:00 2001
From: Marco A L Barbosa <malbarbo@gmail.com>
Date: Wed, 18 Oct 2017 10:33:20 -0200
Subject: [PATCH] Fix mq_attr for linux x32

---
 src/unix/notbsd/linux/mod.rs | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index 0841dd2e..a5a1a462 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -213,12 +213,30 @@ s! {
         __val: [::c_int; 2],
     }
 
+    // x32 compatibility
+    // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
     pub struct mq_attr {
+        #[cfg(target_arch = "x86_64")]
+        pub mq_flags: i64,
+        #[cfg(target_arch = "x86_64")]
+        pub mq_maxmsg: i64,
+        #[cfg(target_arch = "x86_64")]
+        pub mq_msgsize: i64,
+        #[cfg(target_arch = "x86_64")]
+        pub mq_curmsgs: i64,
+        #[cfg(target_arch = "x86_64")]
+        pad: [i64; 4],
+
+        #[cfg(not(target_arch = "x86_64"))]
         pub mq_flags: ::c_long,
+        #[cfg(not(target_arch = "x86_64"))]
         pub mq_maxmsg: ::c_long,
+        #[cfg(not(target_arch = "x86_64"))]
         pub mq_msgsize: ::c_long,
+        #[cfg(not(target_arch = "x86_64"))]
         pub mq_curmsgs: ::c_long,
-        pad: [::c_long; 4]
+        #[cfg(not(target_arch = "x86_64"))]
+        pad: [::c_long; 4],
     }
 
     pub struct cpu_set_t {
-- 
GitLab