summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/unix/haiku/b32.rs17
-rw-r--r--src/unix/haiku/b64.rs17
-rw-r--r--src/unix/haiku/mod.rs38
3 files changed, 72 insertions, 0 deletions
diff --git a/src/unix/haiku/b32.rs b/src/unix/haiku/b32.rs
index cce8864883..073ae9d4b5 100644
--- a/src/unix/haiku/b32.rs
+++ b/src/unix/haiku/b32.rs
@@ -1,3 +1,20 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type time_t = i32;
+
+pub type Elf_Addr = ::Elf32_Addr;
+pub type Elf_Half = ::Elf32_Half;
+pub type Elf_Phdr = ::Elf32_Phdr;
+
+s! {
+ 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,
+ }
+}
diff --git a/src/unix/haiku/b64.rs b/src/unix/haiku/b64.rs
index 3e66f14c92..456918052d 100644
--- a/src/unix/haiku/b64.rs
+++ b/src/unix/haiku/b64.rs
@@ -1,3 +1,20 @@
pub type c_ulong = u64;
pub type c_long = i64;
pub type time_t = i64;
+
+pub type Elf_Addr = ::Elf64_Addr;
+pub type Elf_Half = ::Elf64_Half;
+pub type Elf_Phdr = ::Elf64_Phdr;
+
+s! {
+ pub struct Elf64_Phdr {
+ pub p_type: ::Elf64_Word,
+ pub p_flags: ::Elf64_Word,
+ pub p_offset: ::Elf64_Off,
+ pub p_vaddr: ::Elf64_Addr,
+ pub p_paddr: ::Elf64_Addr,
+ pub p_filesz: ::Elf64_Xword,
+ pub p_memsz: ::Elf64_Xword,
+ pub p_align: ::Elf64_Xword,
+ }
+}
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index 76a532a011..52d2750765 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -31,6 +31,22 @@ pub type id_t = i32;
pub type idtype_t = ::c_uint;
pub type fd_mask = u32;
+pub type Elf32_Addr = u32;
+pub type Elf32_Half = u16;
+pub type Elf32_Lword = u64;
+pub type Elf32_Off = u32;
+pub type Elf32_Sword = i32;
+pub type Elf32_Word = u32;
+
+pub type Elf64_Addr = u64;
+pub type Elf64_Half = u16;
+pub type Elf64_Lword = u64;
+pub type Elf64_Off = u64;
+pub type Elf64_Sword = i32;
+pub type Elf64_Sxword = i64;
+pub type Elf64_Word = u32;
+pub type Elf64_Xword = u64;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
@@ -343,6 +359,17 @@ s! {
pub sdl_slen: u8,
pub sdl_data: [u8; 46],
}
+
+ pub struct dl_phdr_info {
+ pub dlpi_addr: Elf_Addr,
+ pub dlpi_name: *const ::c_char,
+ pub dlpi_phdr: *const Elf_Phdr,
+ pub dlpi_phnum: Elf_Half,
+ pub dlpi_adds: ::c_ulonglong,
+ pub dlpi_subs: ::c_ulonglong,
+ pub dlpi_tls_modid: usize,
+ pub dlpi_tls_data: *mut ::c_void,
+ }
}
s_no_extra_traits! {
@@ -1650,6 +1677,17 @@ extern "C" {
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
pub fn endutxent();
+
+ pub fn dl_iterate_phdr(
+ callback: ::Option<
+ unsafe extern "C" fn(
+ info: *mut dl_phdr_info,
+ size: usize,
+ data: *mut ::c_void,
+ ) -> ::c_int,
+ >,
+ data: *mut ::c_void,
+ ) -> ::c_int;
}
cfg_if! {