From 968bce4ed4b9175acf229f76bb83ab51ed05fbc2 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 08:57:29 -0200 Subject: [PATCH 1/8] Fix c_long, c_ulong and sysinfo for linux x32 --- src/unix/notbsd/linux/other/b64/mod.rs | 32 ++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/unix/notbsd/linux/other/b64/mod.rs b/src/unix/notbsd/linux/other/b64/mod.rs index aa0e0910..33871f96 100644 --- a/src/unix/notbsd/linux/other/b64/mod.rs +++ b/src/unix/notbsd/linux/other/b64/mod.rs @@ -1,7 +1,15 @@ //! 64-bit specific definitions for linux-like values -pub type c_long = i64; -pub type c_ulong = u64; +cfg_if! { + if #[cfg(target_pointer_width = "32")] { + pub type c_long = i32; + pub type c_ulong = u32; + } else { + pub type c_long = i64; + pub type c_ulong = u64; + } +} + pub type clock_t = i64; pub type time_t = i64; pub type ino_t = u64; @@ -15,18 +23,18 @@ s! { } pub struct sysinfo { - pub uptime: ::c_long, - pub loads: [::c_ulong; 3], - pub totalram: ::c_ulong, - pub freeram: ::c_ulong, - pub sharedram: ::c_ulong, - pub bufferram: ::c_ulong, - pub totalswap: ::c_ulong, - pub freeswap: ::c_ulong, + pub uptime: i64, + pub loads: [u64; 3], + pub totalram: u64, + pub freeram: u64, + pub sharedram: u64, + pub bufferram: u64, + pub totalswap: u64, + pub freeswap: u64, pub procs: ::c_ushort, pub pad: ::c_ushort, - pub totalhigh: ::c_ulong, - pub freehigh: ::c_ulong, + pub totalhigh: u64, + pub freehigh: u64, pub mem_unit: ::c_uint, pub _f: [::c_char; 0], } From 477425435a2fefce81d6fda970af0e5325da1668 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 10:33:20 -0200 Subject: [PATCH 2/8] 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 { From bbc2cfa0969caea273c2ae018b2f08418078ed82 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 10:33:59 -0200 Subject: [PATCH 3/8] Fix timespec, stat, stat64 for linux x32 --- src/unix/mod.rs | 7 ++++++- src/unix/notbsd/linux/mod.rs | 20 ++++++++++---------- src/unix/notbsd/linux/other/b64/x86_64.rs | 12 ++++++------ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index c2a45ff8..d326d881 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -34,9 +34,14 @@ s! { pub tv_usec: suseconds_t, } + // linux x32 compatibility + // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 pub struct timespec { pub tv_sec: time_t, - pub tv_nsec: c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub tv_nsec: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub tv_nsec: ::c_long, } pub struct rlimit { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index a5a1a462..93eed1cd 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -216,26 +216,26 @@ s! { // x32 compatibility // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279 pub struct mq_attr { - #[cfg(target_arch = "x86_64")] + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pub mq_flags: i64, - #[cfg(target_arch = "x86_64")] + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pub mq_maxmsg: i64, - #[cfg(target_arch = "x86_64")] + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pub mq_msgsize: i64, - #[cfg(target_arch = "x86_64")] + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pub mq_curmsgs: i64, - #[cfg(target_arch = "x86_64")] + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] pad: [i64; 4], - #[cfg(not(target_arch = "x86_64"))] + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub mq_flags: ::c_long, - #[cfg(not(target_arch = "x86_64"))] + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub mq_maxmsg: ::c_long, - #[cfg(not(target_arch = "x86_64"))] + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub mq_msgsize: ::c_long, - #[cfg(not(target_arch = "x86_64"))] + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub mq_curmsgs: ::c_long, - #[cfg(not(target_arch = "x86_64"))] + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pad: [::c_long; 4], } diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs index 81b2384a..bec275af 100644 --- a/src/unix/notbsd/linux/other/b64/x86_64.rs +++ b/src/unix/notbsd/linux/other/b64/x86_64.rs @@ -22,11 +22,11 @@ s! { pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt_t, pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, + pub st_atime_nsec: i64, pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, + pub st_mtime_nsec: i64, pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, + pub st_ctime_nsec: i64, __unused: [::c_long; 3], } @@ -43,11 +43,11 @@ s! { pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt64_t, pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, + pub st_atime_nsec: i64, pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, + pub st_mtime_nsec: i64, pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, + pub st_ctime_nsec: i64, __reserved: [::c_long; 3], } From c3408c10e34309064e3081f050b5e4e51b8f84c8 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 12:01:57 -0200 Subject: [PATCH 4/8] Fix utmpx.ut_session for linux x32 --- src/unix/notbsd/linux/other/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 7a58c181..6e33ab38 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -44,7 +44,7 @@ s! { #[cfg(any(target_arch = "aarch64", target_arch = "sparc64", - target_pointer_width = "32"))] + all(target_pointer_width = "32", not(target_arch = "x86_64"))))] pub ut_session: ::c_long, #[cfg(any(target_arch = "aarch64", target_arch = "sparc64", @@ -53,7 +53,7 @@ s! { #[cfg(not(any(target_arch = "aarch64", target_arch = "sparc64", - target_pointer_width = "32")))] + all(target_pointer_width = "32", not(target_arch = "x86_64")))))] pub ut_session: ::int32_t, #[cfg(not(any(target_arch = "aarch64", target_arch = "sparc64", From 343b7c15bea8777399ab5e667239e6bbe8239542 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 12:08:36 -0200 Subject: [PATCH 5/8] Linux x32 does not support sysctl --- libc-test/build.rs | 4 +++- src/unix/notbsd/linux/other/b32/mod.rs | 11 +++++++++++ src/unix/notbsd/linux/other/b64/aarch64.rs | 12 ++++++++++++ src/unix/notbsd/linux/other/b64/mod.rs | 8 ++++++++ src/unix/notbsd/linux/other/b64/not_x32.rs | 10 ++++++++++ src/unix/notbsd/linux/other/b64/powerpc64.rs | 12 ++++++++++++ src/unix/notbsd/linux/other/b64/sparc64.rs | 11 +++++++++++ src/unix/notbsd/linux/other/mod.rs | 7 ------- 8 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 src/unix/notbsd/linux/other/b64/not_x32.rs diff --git a/libc-test/build.rs b/libc-test/build.rs index b7f78907..2c9d35fd 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -9,6 +9,7 @@ fn main() { let aarch64 = target.contains("aarch64"); let i686 = target.contains("i686"); let x86_64 = target.contains("x86_64"); + let x32 = target.ends_with("gnux32"); let windows = target.contains("windows"); let mingw = target.contains("windows-gnu"); let linux = target.contains("unknown-linux"); @@ -135,9 +136,10 @@ fn main() { cfg.header("sys/quota.h"); } - if !musl { + if !musl && !x32 { cfg.header("sys/sysctl.h"); } + if !musl && !uclibc { if !netbsd && !openbsd && !uclibc { diff --git a/src/unix/notbsd/linux/other/b32/mod.rs b/src/unix/notbsd/linux/other/b32/mod.rs index 247f01bb..0d4e66b3 100644 --- a/src/unix/notbsd/linux/other/b32/mod.rs +++ b/src/unix/notbsd/linux/other/b32/mod.rs @@ -281,6 +281,17 @@ pub const PTRACE_SETFPREGS: ::c_uint = 15; pub const PTRACE_GETREGS: ::c_uint = 12; pub const PTRACE_SETREGS: ::c_uint = 13; +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} + cfg_if! { if #[cfg(target_arch = "x86")] { mod x86; diff --git a/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs index 85b6c2d6..c918916d 100644 --- a/src/unix/notbsd/linux/other/b64/aarch64.rs +++ b/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -485,6 +485,7 @@ pub const TIOCSWINSZ: ::c_ulong = 0x5414; pub const FIONREAD: ::c_ulong = 0x541B; // Syscall table +<<<<<<< HEAD pub const SYS_io_setup: ::c_ulong = 0; pub const SYS_io_destroy: ::c_ulong = 1; pub const SYS_io_submit: ::c_ulong = 2; @@ -751,3 +752,14 @@ pub const SYS_pkey_mprotect: ::c_ulong = 288; pub const SYS_pkey_alloc: ::c_ulong = 289; pub const SYS_pkey_free: ::c_ulong = 290; pub const SYS_syscalls: ::c_ulong = 291; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff --git a/src/unix/notbsd/linux/other/b64/mod.rs b/src/unix/notbsd/linux/other/b64/mod.rs index 33871f96..8e241638 100644 --- a/src/unix/notbsd/linux/other/b64/mod.rs +++ b/src/unix/notbsd/linux/other/b64/mod.rs @@ -72,6 +72,14 @@ cfg_if! { } else if #[cfg(any(target_arch = "x86_64"))] { mod x86_64; pub use self::x86_64::*; + cfg_if! { + if #[cfg(target_pointer_width = "32")] { + // x32 + } else { + mod not_x32; + pub use self::not_x32::*; + } + } } else { // Unknown target_arch } diff --git a/src/unix/notbsd/linux/other/b64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs new file mode 100644 index 00000000..bfe5c5e0 --- /dev/null +++ b/src/unix/notbsd/linux/other/b64/not_x32.rs @@ -0,0 +1,10 @@ +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs index cd3701c1..09c662a5 100644 --- a/src/unix/notbsd/linux/other/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -482,6 +482,7 @@ pub const TIOCSWINSZ: ::c_ulong = 0x80087467; pub const FIONREAD: ::c_ulong = 0x4004667f; // Syscall table +<<<<<<< HEAD pub const SYS_restart_syscall: ::c_ulong = 0; pub const SYS_exit: ::c_ulong = 1; pub const SYS_fork: ::c_ulong = 2; @@ -841,3 +842,14 @@ pub const SYS_copy_file_range: ::c_ulong = 379; pub const SYS_preadv2: ::c_ulong = 380; pub const SYS_pwritev2: ::c_ulong = 381; pub const SYS_kexec_file_load: ::c_ulong = 382; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff --git a/src/unix/notbsd/linux/other/b64/sparc64.rs b/src/unix/notbsd/linux/other/b64/sparc64.rs index d9985301..9acea962 100644 --- a/src/unix/notbsd/linux/other/b64/sparc64.rs +++ b/src/unix/notbsd/linux/other/b64/sparc64.rs @@ -419,3 +419,14 @@ pub const TIOCOUTQ: ::c_ulong = 0x40047473; pub const TIOCGWINSZ: ::c_ulong = 0x40087468; pub const TIOCSWINSZ: ::c_ulong = 0x80087467; pub const FIONREAD: ::c_ulong = 0x4004667f; + +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; +} diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 6e33ab38..99353b14 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -568,13 +568,6 @@ extern { #[link(name = "util")] extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; From 1994be3183158446578485b04b44d2bafc79e0f6 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 12:09:21 -0200 Subject: [PATCH 6/8] Linux x32 does not have some SYS_ constants --- src/unix/notbsd/linux/other/b64/not_x32.rs | 12 ++++++++++++ src/unix/notbsd/linux/other/b64/x86_64.rs | 11 ----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/unix/notbsd/linux/other/b64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs index bfe5c5e0..872677f1 100644 --- a/src/unix/notbsd/linux/other/b64/not_x32.rs +++ b/src/unix/notbsd/linux/other/b64/not_x32.rs @@ -1,3 +1,15 @@ +pub const SYS_uselib: ::c_long = 134; +pub const SYS__sysctl: ::c_long = 156; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_vserver: ::c_long = 236; + #[link(name = "util")] extern { pub fn sysctl(name: *mut ::c_int, diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs index bec275af..36dec3cd 100644 --- a/src/unix/notbsd/linux/other/b64/x86_64.rs +++ b/src/unix/notbsd/linux/other/b64/x86_64.rs @@ -730,7 +730,6 @@ pub const SYS_rt_sigsuspend: ::c_long = 130; pub const SYS_sigaltstack: ::c_long = 131; pub const SYS_utime: ::c_long = 132; pub const SYS_mknod: ::c_long = 133; -pub const SYS_uselib: ::c_long = 134; pub const SYS_personality: ::c_long = 135; pub const SYS_ustat: ::c_long = 136; pub const SYS_statfs: ::c_long = 137; @@ -752,7 +751,6 @@ pub const SYS_munlockall: ::c_long = 152; pub const SYS_vhangup: ::c_long = 153; pub const SYS_modify_ldt: ::c_long = 154; pub const SYS_pivot_root: ::c_long = 155; -pub const SYS__sysctl: ::c_long = 156; pub const SYS_prctl: ::c_long = 157; pub const SYS_arch_prctl: ::c_long = 158; pub const SYS_adjtimex: ::c_long = 159; @@ -770,13 +768,9 @@ pub const SYS_sethostname: ::c_long = 170; pub const SYS_setdomainname: ::c_long = 171; pub const SYS_iopl: ::c_long = 172; pub const SYS_ioperm: ::c_long = 173; -pub const SYS_create_module: ::c_long = 174; pub const SYS_init_module: ::c_long = 175; pub const SYS_delete_module: ::c_long = 176; -pub const SYS_get_kernel_syms: ::c_long = 177; -pub const SYS_query_module: ::c_long = 178; pub const SYS_quotactl: ::c_long = 179; -pub const SYS_nfsservctl: ::c_long = 180; pub const SYS_getpmsg: ::c_long = 181; pub const SYS_putpmsg: ::c_long = 182; pub const SYS_afs_syscall: ::c_long = 183; @@ -801,17 +795,13 @@ pub const SYS_time: ::c_long = 201; pub const SYS_futex: ::c_long = 202; pub const SYS_sched_setaffinity: ::c_long = 203; pub const SYS_sched_getaffinity: ::c_long = 204; -pub const SYS_set_thread_area: ::c_long = 205; pub const SYS_io_setup: ::c_long = 206; pub const SYS_io_destroy: ::c_long = 207; pub const SYS_io_getevents: ::c_long = 208; pub const SYS_io_submit: ::c_long = 209; pub const SYS_io_cancel: ::c_long = 210; -pub const SYS_get_thread_area: ::c_long = 211; pub const SYS_lookup_dcookie: ::c_long = 212; pub const SYS_epoll_create: ::c_long = 213; -pub const SYS_epoll_ctl_old: ::c_long = 214; -pub const SYS_epoll_wait_old: ::c_long = 215; pub const SYS_remap_file_pages: ::c_long = 216; pub const SYS_getdents64: ::c_long = 217; pub const SYS_set_tid_address: ::c_long = 218; @@ -832,7 +822,6 @@ pub const SYS_epoll_wait: ::c_long = 232; pub const SYS_epoll_ctl: ::c_long = 233; pub const SYS_tgkill: ::c_long = 234; pub const SYS_utimes: ::c_long = 235; -pub const SYS_vserver: ::c_long = 236; pub const SYS_mbind: ::c_long = 237; pub const SYS_set_mempolicy: ::c_long = 238; pub const SYS_get_mempolicy: ::c_long = 239; From 1ff381788748c472bef01452b19c9f128570f219 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 12:16:11 -0200 Subject: [PATCH 7/8] Move down c_long and c_ulong of linux/other/b64 to accommodate x32 --- src/unix/notbsd/linux/other/b64/aarch64.rs | 2 ++ src/unix/notbsd/linux/other/b64/mod.rs | 13 ++----------- src/unix/notbsd/linux/other/b64/not_x32.rs | 3 +++ src/unix/notbsd/linux/other/b64/powerpc64.rs | 2 ++ src/unix/notbsd/linux/other/b64/sparc64.rs | 2 ++ src/unix/notbsd/linux/other/b64/x32.rs | 2 ++ 6 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 src/unix/notbsd/linux/other/b64/x32.rs diff --git a/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs index c918916d..0496600a 100644 --- a/src/unix/notbsd/linux/other/b64/aarch64.rs +++ b/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -1,5 +1,7 @@ //! AArch64-specific definitions for 64-bit linux-like values +pub type c_long = i64; +pub type c_ulong = u64; pub type c_char = u8; pub type wchar_t = u32; pub type nlink_t = u32; diff --git a/src/unix/notbsd/linux/other/b64/mod.rs b/src/unix/notbsd/linux/other/b64/mod.rs index 8e241638..b7d23c56 100644 --- a/src/unix/notbsd/linux/other/b64/mod.rs +++ b/src/unix/notbsd/linux/other/b64/mod.rs @@ -1,15 +1,5 @@ //! 64-bit specific definitions for linux-like values -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - pub type c_long = i32; - pub type c_ulong = u32; - } else { - pub type c_long = i64; - pub type c_ulong = u64; - } -} - pub type clock_t = i64; pub type time_t = i64; pub type ino_t = u64; @@ -74,7 +64,8 @@ cfg_if! { pub use self::x86_64::*; cfg_if! { if #[cfg(target_pointer_width = "32")] { - // x32 + mod x32; + pub use self::x32::*; } else { mod not_x32; pub use self::not_x32::*; diff --git a/src/unix/notbsd/linux/other/b64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs index 872677f1..fce838c0 100644 --- a/src/unix/notbsd/linux/other/b64/not_x32.rs +++ b/src/unix/notbsd/linux/other/b64/not_x32.rs @@ -1,3 +1,6 @@ +pub type c_long = i64; +pub type c_ulong = u64; + pub const SYS_uselib: ::c_long = 134; pub const SYS__sysctl: ::c_long = 156; pub const SYS_create_module: ::c_long = 174; diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs index 09c662a5..c1c8695b 100644 --- a/src/unix/notbsd/linux/other/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -1,5 +1,7 @@ //! PowerPC64-specific definitions for 64-bit linux-like values +pub type c_long = i64; +pub type c_ulong = u64; pub type c_char = u8; pub type wchar_t = i32; pub type nlink_t = u64; diff --git a/src/unix/notbsd/linux/other/b64/sparc64.rs b/src/unix/notbsd/linux/other/b64/sparc64.rs index 9acea962..279ba73c 100644 --- a/src/unix/notbsd/linux/other/b64/sparc64.rs +++ b/src/unix/notbsd/linux/other/b64/sparc64.rs @@ -1,5 +1,7 @@ //! SPARC64-specific definitions for 64-bit linux-like values +pub type c_long = i64; +pub type c_ulong = u64; pub type c_char = i8; pub type wchar_t = i32; pub type nlink_t = u32; diff --git a/src/unix/notbsd/linux/other/b64/x32.rs b/src/unix/notbsd/linux/other/b64/x32.rs new file mode 100644 index 00000000..9b0b338b --- /dev/null +++ b/src/unix/notbsd/linux/other/b64/x32.rs @@ -0,0 +1,2 @@ +pub type c_long = i32; +pub type c_ulong = u32; From a5bd4b5668587d829669d13173adda1d2a889e93 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 18 Oct 2017 20:32:44 -0200 Subject: [PATCH 8/8] Fix style --- src/unix/notbsd/linux/other/b64/aarch64.rs | 1 - src/unix/notbsd/linux/other/b64/powerpc64.rs | 1 - src/unix/notbsd/linux/other/mod.rs | 6 ++++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs index 0496600a..c213f13c 100644 --- a/src/unix/notbsd/linux/other/b64/aarch64.rs +++ b/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -487,7 +487,6 @@ pub const TIOCSWINSZ: ::c_ulong = 0x5414; pub const FIONREAD: ::c_ulong = 0x541B; // Syscall table -<<<<<<< HEAD pub const SYS_io_setup: ::c_ulong = 0; pub const SYS_io_destroy: ::c_ulong = 1; pub const SYS_io_submit: ::c_ulong = 2; diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs index c1c8695b..14e5cdfa 100644 --- a/src/unix/notbsd/linux/other/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -484,7 +484,6 @@ pub const TIOCSWINSZ: ::c_ulong = 0x80087467; pub const FIONREAD: ::c_ulong = 0x4004667f; // Syscall table -<<<<<<< HEAD pub const SYS_restart_syscall: ::c_ulong = 0; pub const SYS_exit: ::c_ulong = 1; pub const SYS_fork: ::c_ulong = 2; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 99353b14..2013e60b 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -44,7 +44,8 @@ s! { #[cfg(any(target_arch = "aarch64", target_arch = "sparc64", - all(target_pointer_width = "32", not(target_arch = "x86_64"))))] + all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] pub ut_session: ::c_long, #[cfg(any(target_arch = "aarch64", target_arch = "sparc64", @@ -53,7 +54,8 @@ s! { #[cfg(not(any(target_arch = "aarch64", target_arch = "sparc64", - all(target_pointer_width = "32", not(target_arch = "x86_64")))))] + all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] pub ut_session: ::int32_t, #[cfg(not(any(target_arch = "aarch64", target_arch = "sparc64",