summaryrefslogtreecommitdiff
path: root/libc/src/fuchsia/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/fuchsia/mod.rs')
-rw-r--r--libc/src/fuchsia/mod.rs223
1 files changed, 132 insertions, 91 deletions
diff --git a/libc/src/fuchsia/mod.rs b/libc/src/fuchsia/mod.rs
index cef48e5..1d68341 100644
--- a/libc/src/fuchsia/mod.rs
+++ b/libc/src/fuchsia/mod.rs
@@ -5,15 +5,6 @@
// PUB_TYPE
-pub type int8_t = i8;
-pub type int16_t = i16;
-pub type int32_t = i32;
-pub type int64_t = i64;
-pub type uint8_t = u8;
-pub type uint16_t = u16;
-pub type uint32_t = u32;
-pub type uint64_t = u64;
-
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
@@ -27,6 +18,8 @@ pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
+pub type locale_t = *mut ::c_void;
+
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
@@ -110,12 +103,7 @@ impl ::Copy for DIR {}
impl ::Clone for DIR {
fn clone(&self) -> DIR { *self }
}
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum locale_t {}
-impl ::Copy for locale_t {}
-impl ::Clone for locale_t {
- fn clone(&self) -> locale_t { *self }
-}
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct
impl ::Copy for fpos64_t {}
@@ -369,13 +357,6 @@ s! {
pub ai_next: *mut addrinfo,
}
- pub struct sockaddr_nl {
- pub nl_family: ::sa_family_t,
- nl_pad: ::c_ushort,
- pub nl_pid: u32,
- pub nl_groups: u32
- }
-
pub struct sockaddr_ll {
pub sll_family: ::c_ushort,
pub sll_protocol: ::c_ushort,
@@ -420,8 +401,8 @@ s! {
}
pub struct epoll_event {
- pub events: ::uint32_t,
- pub u64: ::uint64_t,
+ pub events: u32,
+ pub u64: u64,
}
pub struct lconv {
@@ -531,40 +512,40 @@ s! {
}
pub struct dqblk {
- pub dqb_bhardlimit: ::uint64_t,
- pub dqb_bsoftlimit: ::uint64_t,
- pub dqb_curspace: ::uint64_t,
- pub dqb_ihardlimit: ::uint64_t,
- pub dqb_isoftlimit: ::uint64_t,
- pub dqb_curinodes: ::uint64_t,
- pub dqb_btime: ::uint64_t,
- pub dqb_itime: ::uint64_t,
- pub dqb_valid: ::uint32_t,
+ pub dqb_bhardlimit: u64,
+ pub dqb_bsoftlimit: u64,
+ pub dqb_curspace: u64,
+ pub dqb_ihardlimit: u64,
+ pub dqb_isoftlimit: u64,
+ pub dqb_curinodes: u64,
+ pub dqb_btime: u64,
+ pub dqb_itime: u64,
+ pub dqb_valid: u32,
}
pub struct signalfd_siginfo {
- pub ssi_signo: ::uint32_t,
- pub ssi_errno: ::int32_t,
- pub ssi_code: ::int32_t,
- pub ssi_pid: ::uint32_t,
- pub ssi_uid: ::uint32_t,
- pub ssi_fd: ::int32_t,
- pub ssi_tid: ::uint32_t,
- pub ssi_band: ::uint32_t,
- pub ssi_overrun: ::uint32_t,
- pub ssi_trapno: ::uint32_t,
- pub ssi_status: ::int32_t,
- pub ssi_int: ::int32_t,
- pub ssi_ptr: ::uint64_t,
- pub ssi_utime: ::uint64_t,
- pub ssi_stime: ::uint64_t,
- pub ssi_addr: ::uint64_t,
- pub ssi_addr_lsb: ::uint16_t,
- _pad2: ::uint16_t,
- pub ssi_syscall: ::int32_t,
- pub ssi_call_addr: ::uint64_t,
- pub ssi_arch: ::uint32_t,
- _pad: [::uint8_t; 28],
+ pub ssi_signo: u32,
+ pub ssi_errno: i32,
+ pub ssi_code: i32,
+ pub ssi_pid: u32,
+ pub ssi_uid: u32,
+ pub ssi_fd: i32,
+ pub ssi_tid: u32,
+ pub ssi_band: u32,
+ pub ssi_overrun: u32,
+ pub ssi_trapno: u32,
+ pub ssi_status: i32,
+ pub ssi_int: i32,
+ pub ssi_ptr: u64,
+ pub ssi_utime: u64,
+ pub ssi_stime: u64,
+ pub ssi_addr: u64,
+ pub ssi_addr_lsb: u16,
+ _pad2: u16,
+ pub ssi_syscall: i32,
+ pub ssi_call_addr: u64,
+ pub ssi_arch: u32,
+ _pad: [u8; 28],
}
pub struct itimerspec {
@@ -576,32 +557,6 @@ s! {
__val: [::c_int; 2],
}
- // x32 compatibility
- // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
- pub struct mq_attr {
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- pub mq_flags: i64,
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- pub mq_maxmsg: i64,
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- pub mq_msgsize: i64,
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- pub mq_curmsgs: i64,
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- pad: [i64; 4],
-
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- pub mq_flags: ::c_long,
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- pub mq_maxmsg: ::c_long,
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- pub mq_msgsize: ::c_long,
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- pub mq_curmsgs: ::c_long,
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- pad: [::c_long; 4],
- }
-
pub struct cpu_set_t {
#[cfg(all(target_pointer_width = "32",
not(target_arch = "x86_64")))]
@@ -974,6 +929,39 @@ s_no_extra_traits! {
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}
+
+ // x32 compatibility
+ // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
+ pub struct mq_attr {
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub mq_flags: i64,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub mq_maxmsg: i64,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub mq_msgsize: i64,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub mq_curmsgs: i64,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pad: [i64; 4],
+
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub mq_flags: ::c_long,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub mq_maxmsg: ::c_long,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub mq_msgsize: ::c_long,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub mq_curmsgs: ::c_long,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pad: [::c_long; 4],
+ }
+
+ pub struct sockaddr_nl {
+ pub nl_family: ::sa_family_t,
+ nl_pad: ::c_ushort,
+ pub nl_pid: u32,
+ pub nl_groups: u32
+ }
}
cfg_if! {
@@ -1214,6 +1202,59 @@ cfg_if! {
self.d_name.hash(state);
}
}
+
+ impl PartialEq for mq_attr {
+ fn eq(&self, other: &mq_attr) -> bool {
+ self.mq_flags == other.mq_flags &&
+ self.mq_maxmsg == other.mq_maxmsg &&
+ self.mq_msgsize == other.mq_msgsize &&
+ self.mq_curmsgs == other.mq_curmsgs
+ }
+ }
+ impl Eq for mq_attr {}
+ impl ::fmt::Debug for mq_attr {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("mq_attr")
+ .field("mq_flags", &self.mq_flags)
+ .field("mq_maxmsg", &self.mq_maxmsg)
+ .field("mq_msgsize", &self.mq_msgsize)
+ .field("mq_curmsgs", &self.mq_curmsgs)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for mq_attr {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.mq_flags.hash(state);
+ self.mq_maxmsg.hash(state);
+ self.mq_msgsize.hash(state);
+ self.mq_curmsgs.hash(state);
+ }
+ }
+
+ impl PartialEq for sockaddr_nl {
+ fn eq(&self, other: &sockaddr_nl) -> bool {
+ self.nl_family == other.nl_family &&
+ self.nl_pid == other.nl_pid &&
+ self.nl_groups == other.nl_groups
+ }
+ }
+ impl Eq for sockaddr_nl {}
+ impl ::fmt::Debug for sockaddr_nl {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sockaddr_nl")
+ .field("nl_family", &self.nl_family)
+ .field("nl_pid", &self.nl_pid)
+ .field("nl_groups", &self.nl_groups)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for sockaddr_nl {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.nl_family.hash(state);
+ self.nl_pid.hash(state);
+ self.nl_groups.hash(state);
+ }
+ }
}
}
@@ -1753,16 +1794,16 @@ pub const MNT_EXPIRE: ::c_int = 0x4;
pub const Q_GETFMT: ::c_int = 0x800004;
pub const Q_GETINFO: ::c_int = 0x800005;
pub const Q_SETINFO: ::c_int = 0x800006;
-pub const QIF_BLIMITS: ::uint32_t = 1;
-pub const QIF_SPACE: ::uint32_t = 2;
-pub const QIF_ILIMITS: ::uint32_t = 4;
-pub const QIF_INODES: ::uint32_t = 8;
-pub const QIF_BTIME: ::uint32_t = 16;
-pub const QIF_ITIME: ::uint32_t = 32;
-pub const QIF_LIMITS: ::uint32_t = 5;
-pub const QIF_USAGE: ::uint32_t = 10;
-pub const QIF_TIMES: ::uint32_t = 48;
-pub const QIF_ALL: ::uint32_t = 63;
+pub const QIF_BLIMITS: u32 = 1;
+pub const QIF_SPACE: u32 = 2;
+pub const QIF_ILIMITS: u32 = 4;
+pub const QIF_INODES: u32 = 8;
+pub const QIF_BTIME: u32 = 16;
+pub const QIF_ITIME: u32 = 32;
+pub const QIF_LIMITS: u32 = 5;
+pub const QIF_USAGE: u32 = 10;
+pub const QIF_TIMES: u32 = 48;
+pub const QIF_ALL: u32 = 63;
pub const MNT_FORCE: ::c_int = 0x1;