aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/haiku
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-05-24 18:07:22 -0700
committerDaniel Mueller <deso@posteo.net>2019-05-24 18:07:22 -0700
commit82cf43dd887801b8b22b8aae8c02854d921915d5 (patch)
treeb1bf3710bd07fe83e396a5db8563f3e6c5e85689 /libc/src/unix/haiku
parent06722702ea35434189d7de2b13a00209b2ebbd6d (diff)
downloadnitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.gz
nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.bz2
Update libc crate to 0.2.55
This change updates the libc crate to version 0.2.55. Import subrepo libc/:libc at caf17a0641d29dc624621177f5756804dd180c13
Diffstat (limited to 'libc/src/unix/haiku')
-rw-r--r--libc/src/unix/haiku/mod.rs194
1 files changed, 161 insertions, 33 deletions
diff --git a/libc/src/unix/haiku/mod.rs b/libc/src/unix/haiku/mod.rs
index 2aa5d13..26519a4 100644
--- a/libc/src/unix/haiku/mod.rs
+++ b/libc/src/unix/haiku/mod.rs
@@ -1,5 +1,3 @@
-use dox::{mem, Option};
-
pub type rlim_t = ::uintptr_t;
pub type sa_family_t = u8;
pub type pthread_key_t = ::c_int;
@@ -31,9 +29,23 @@ pub type nl_item = ::c_int;
pub type id_t = i32;
pub type idtype_t = ::c_uint;
+#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
+impl ::Copy for timezone {}
+impl ::Clone for timezone {
+ fn clone(&self) -> timezone { *self }
+}
s! {
+ pub struct in_addr {
+ pub s_addr: ::in_addr_t,
+ }
+
+ pub struct ip_mreq {
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
+ }
+
pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
@@ -57,20 +69,6 @@ s! {
pub sin6_scope_id: u32,
}
- pub struct sockaddr_un {
- pub sun_len: u8,
- pub sun_family: sa_family_t,
- pub sun_path: [::c_char; 126]
- }
-
- pub struct sockaddr_storage {
- pub ss_len: u8,
- pub ss_family: sa_family_t,
- __ss_pad1: [u8; 6],
- __ss_pad2: u64,
- __ss_pad3: [u8; 112],
- }
-
pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
@@ -199,15 +197,6 @@ s! {
pub st_blocks: blkcnt_t,
}
- pub struct dirent {
- pub d_dev: dev_t,
- pub d_pdev: dev_t,
- pub d_ino: ino_t,
- pub d_pino: i64,
- pub d_reclen: ::c_ushort,
- pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
- }
-
pub struct glob_t {
pub gl_pathc: ::size_t,
__unused1: ::size_t,
@@ -319,6 +308,139 @@ s! {
}
}
+s_no_extra_traits! {
+ pub struct sockaddr_un {
+ pub sun_len: u8,
+ pub sun_family: sa_family_t,
+ pub sun_path: [::c_char; 126]
+ }
+ pub struct sockaddr_storage {
+ pub ss_len: u8,
+ pub ss_family: sa_family_t,
+ __ss_pad1: [u8; 6],
+ __ss_pad2: u64,
+ __ss_pad3: [u8; 112],
+ }
+ pub struct dirent {
+ pub d_dev: dev_t,
+ pub d_pdev: dev_t,
+ pub d_ino: ino_t,
+ pub d_pino: i64,
+ pub d_reclen: ::c_ushort,
+ pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for sockaddr_un {
+ fn eq(&self, other: &sockaddr_un) -> bool {
+ self.sun_len == other.sun_len
+ && self.sun_family == other.sun_family
+ && self
+ .sun_path
+ .iter()
+ .zip(other.sun_path.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for sockaddr_un {}
+ impl ::fmt::Debug for sockaddr_un {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sockaddr_un")
+ .field("sun_len", &self.sun_len)
+ .field("sun_family", &self.sun_family)
+ // FIXME: .field("sun_path", &self.sun_path)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for sockaddr_un {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.sun_len.hash(state);
+ self.sun_family.hash(state);
+ self.sun_path.hash(state);
+ }
+ }
+
+ impl PartialEq for sockaddr_storage {
+ fn eq(&self, other: &sockaddr_storage) -> bool {
+ self.ss_len == other.ss_len
+ && self.ss_family == other.ss_family
+ && self
+ .__ss_pad1
+ .iter()
+ .zip(other.__ss_pad1.iter())
+ .all(|(a, b)| a == b)
+ && self.__ss_pad2 == other.__ss_pad2
+ && self
+ .__ss_pad3
+ .iter()
+ .zip(other.__ss_pad3.iter())
+ .all(|(a, b)| a == b)
+ }
+ }
+ impl Eq for sockaddr_storage {}
+ impl ::fmt::Debug for sockaddr_storage {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sockaddr_storage")
+ .field("ss_len", &self.ss_len)
+ .field("ss_family", &self.ss_family)
+ .field("__ss_pad1", &self.__ss_pad1)
+ .field("__ss_pad2", &self.__ss_pad2)
+ // FIXME: .field("__ss_pad3", &self.__ss_pad3)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for sockaddr_storage {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.ss_len.hash(state);
+ self.ss_family.hash(state);
+ self.__ss_pad1.hash(state);
+ self.__ss_pad2.hash(state);
+ self.__ss_pad3.hash(state);
+ }
+ }
+
+ impl PartialEq for dirent {
+ fn eq(&self, other: &dirent) -> bool {
+ self.d_dev == other.d_dev
+ && self.d_pdev == other.d_pdev
+ && self.d_ino == other.d_ino
+ && self.d_pino == other.d_pino
+ && self.d_reclen == other.d_reclen
+ && self
+ .d_name
+ .iter()
+ .zip(other.d_name.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for dirent {}
+ impl ::fmt::Debug for dirent {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("dirent")
+ .field("d_dev", &self.d_dev)
+ .field("d_pdev", &self.d_pdev)
+ .field("d_ino", &self.d_ino)
+ .field("d_pino", &self.d_pino)
+ .field("d_reclen", &self.d_reclen)
+ // FIXME: .field("d_name", &self.d_name)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for dirent {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.d_dev.hash(state);
+ self.d_pdev.hash(state);
+ self.d_ino.hash(state);
+ self.d_pino.hash(state);
+ self.d_reclen.hash(state);
+ self.d_name.hash(state);
+ }
+ }
+ }
+}
+
// intentionally not public, only used for fd_set
cfg_if! {
if #[cfg(target_pointer_width = "32")] {
@@ -1028,20 +1150,20 @@ pub const TCIOFLUSH: ::c_int = 0x03;
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
- let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
(*set).fds_bits[fd / size] &= !(1 << (fd % size));
return
}
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
let fd = fd as usize;
- let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
}
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
- let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
(*set).fds_bits[fd / size] |= 1 << (fd % size);
return
}
@@ -1096,6 +1218,12 @@ extern {
#[link(name = "bsd")]
extern {
+ pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
+ pub fn sem_init(sem: *mut sem_t,
+ pshared: ::c_int,
+ value: ::c_uint)
+ -> ::c_int;
+
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
pub fn pthread_create(thread: *mut ::pthread_t,
@@ -1132,7 +1260,7 @@ extern {
pub fn glob(pattern: *const ::c_char,
flags: ::c_int,
- errfunc: Option<extern fn(epath: *const ::c_char,
+ errfunc: ::Option<extern fn(epath: *const ::c_char,
errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
@@ -1178,7 +1306,7 @@ extern {
pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
environment: *const *const ::c_char) -> ::c_int;
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
- pub fn getgrgid_r(uid: ::uid_t,
+ pub fn getgrgid_r(gid: ::gid_t,
grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
@@ -1224,9 +1352,9 @@ extern {
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t,
sig: *mut ::c_int) -> ::c_int;
- pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
- parent: Option<unsafe extern fn()>,
- child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>,
+ parent: ::Option<unsafe extern fn()>,
+ child: ::Option<unsafe extern fn()>) -> ::c_int;
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "popen$UNIX2003")]