From 47b56cd35b98b6d840452bf0ff70b00ff41461e5 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 17 Mar 2023 19:33:23 +0000 Subject: [PATCH] haku adding dl_iterate_phdr bsd extension --- libc-test/build.rs | 1 + src/unix/haiku/mod.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index b9b3cbd27cb55..646f7e708619b 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -4231,6 +4231,7 @@ fn test_haiku(target: &str) { "link.h", "pty.h", "stringlist.h", + "sys/link_elf.h", } // Native API diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index a3678faa938d9..9dfdf8c8caf6f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -445,6 +445,13 @@ s! { pub sl_max: ::size_t, pub sl_cur: ::size_t, } + + 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, + } } s_no_extra_traits! { @@ -2033,6 +2040,16 @@ extern "C" { pub fn getprogname() -> *const ::c_char; pub fn setprogname(progname: *const ::c_char); + 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! {