From 79b28535304c34be79a55847783a37a0793ca068 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 28 Jun 2019 15:30:12 +0200 Subject: [PATCH] Add __int128 to unix --- libc-test/build.rs | 10 +++++++++- src/unix/mod.rs | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 722a513c32fea..28e559eef312b 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -177,6 +177,14 @@ fn test_apple(target: &str) { } }); + cfg.skip_field(move |struct_, field| { + match (struct_, field) { + // __int128 does not have fields in C + ("__int128", "value") => true, + _ => false, + } + }); + cfg.skip_field_type(move |struct_, field| { match (struct_, field) { // FIXME: actually a union @@ -198,7 +206,7 @@ fn test_apple(target: &str) { cfg.type_name(move |ty, is_struct, is_union| { match ty { // Just pass all these through, no need for a "struct" prefix - "FILE" | "DIR" | "Dl_info" => ty.to_string(), + "FILE" | "DIR" | "Dl_info" | "__int128" => ty.to_string(), // OSX calls this something else "sighandler_t" => "sig_t".to_string(), diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 8295dfc020c9c..695372a4c55fe 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -38,6 +38,11 @@ impl ::Clone for DIR { } pub type locale_t = *mut :: c_void; +#[cfg(target_pointer_width = "64")] +#[repr(C, align(16))] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] +pub struct __int128{ pub value: i128 } + s! { pub struct group { pub gr_name: *mut ::c_char,