From eb9f024d647f67056997900a11dbd19b9e0f8345 Mon Sep 17 00:00:00 2001 From: kolapapa Date: Tue, 10 Nov 2020 16:01:56 +0800 Subject: [PATCH 1/3] mips some definition migration --- src/unix/uclibc/mod.rs | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index a68cb7a02818e..33d6b4459019a 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -22,6 +22,16 @@ pub type nfds_t = ::c_ulong; pub type nl_item = ::c_int; pub type idtype_t = ::c_uint; +pub type Elf32_Addr = u32; +pub type Elf32_Half = u16; +pub type Elf32_Word = u32; +pub type Elf32_Off = u32; + +pub type Elf64_Addr = u64; +pub type Elf64_Half = u16; +pub type Elf64_Word = u32; +pub type Elf64_Off = u64; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} @@ -294,6 +304,41 @@ s! { pub uid: ::uid_t, pub gid: ::gid_t, } + + pub struct dl_phdr_info { + #[cfg(target_pointer_width = "64")] + pub dlpi_addr: Elf64_Addr, + #[cfg(target_pointer_width = "32")] + pub dlpi_addr: Elf32_Addr, + + pub dlpi_name: *const ::c_char, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phdr: *const Elf64_Phdr, + #[cfg(target_pointer_width = "32")] + pub dlpi_phdr: *const Elf32_Phdr, + + #[cfg(target_pointer_width = "64")] + pub dlpi_phnum: Elf64_Half, + #[cfg(target_pointer_width = "32")] + pub dlpi_phnum: Elf32_Half, + + pub dlpi_adds: ::c_ulonglong, + pub dlpi_subs: ::c_ulonglong, + pub dlpi_tls_modid: ::size_t, + pub dlpi_tls_data: *mut ::c_void, + } + + pub struct Elf32_Phdr { + pub p_type: Elf32_Word, + pub p_offset: Elf32_Off, + pub p_vaddr: Elf32_Addr, + pub p_paddr: Elf32_Addr, + pub p_filesz: Elf32_Word, + pub p_memsz: Elf32_Word, + pub p_flags: Elf32_Word, + pub p_align: Elf32_Word, + } } s_no_extra_traits! { @@ -870,6 +915,8 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000; pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; pub const SOCK_RAW: ::c_int = 3; +pub const SOCK_RDM: ::c_int = 4; + pub const IP_MULTICAST_TTL: ::c_int = 33; pub const IP_MULTICAST_LOOP: ::c_int = 34; pub const IP_TTL: ::c_int = 2; @@ -2242,6 +2289,16 @@ extern "C" { f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int; + pub fn dl_iterate_phdr( + callback: ::Option< + unsafe extern "C" fn( + info: *mut ::dl_phdr_info, + size: ::size_t, + data: *mut ::c_void, + ) -> ::c_int, + >, + data: *mut ::c_void, + ) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn uname(buf: *mut ::utsname) -> ::c_int; From d31aad9051128b7efeed43dad2f9d39ce680df0b Mon Sep 17 00:00:00 2001 From: kolapapa Date: Thu, 19 Nov 2020 19:36:07 +0800 Subject: [PATCH 2/3] mips add getnameinfo && EAI_NODATA --- src/unix/uclibc/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index 33d6b4459019a..5cf9a41253296 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1351,10 +1351,12 @@ pub const EAI_BADFLAGS: ::c_int = -1; pub const EAI_NONAME: ::c_int = -2; pub const EAI_AGAIN: ::c_int = -3; pub const EAI_FAIL: ::c_int = -4; +pub const EAI_NODATA: ::c_int = -5; pub const EAI_FAMILY: ::c_int = -6; pub const EAI_SOCKTYPE: ::c_int = -7; pub const EAI_SERVICE: ::c_int = -8; pub const EAI_MEMORY: ::c_int = -10; +pub const EAI_SYSTEM: ::c_int = -11; pub const EAI_OVERFLOW: ::c_int = -12; pub const NI_NUMERICHOST: ::c_int = 1; @@ -2124,6 +2126,15 @@ extern "C" { info: *mut siginfo_t, timeout: *const ::timespec, ) -> ::c_int; + pub fn getnameinfo( + sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int, + ) -> ::c_int; pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int; pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; From 5abac40e80a577b972938fad3ec3d827aa730c9b Mon Sep 17 00:00:00 2001 From: kolapapa Date: Thu, 19 Nov 2020 19:40:26 +0800 Subject: [PATCH 3/3] remove duplicate EAI_SYSTEM --- src/unix/uclibc/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index 5cf9a41253296..24c7e5c398ecc 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1369,8 +1369,6 @@ pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4; -pub const EAI_SYSTEM: ::c_int = -11; - pub const MREMAP_MAYMOVE: ::c_int = 1; pub const MREMAP_FIXED: ::c_int = 2;