diff --git a/libc-test/build.rs b/libc-test/build.rs index 8364f1162c485..ee68b64fd0f7e 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -117,6 +117,7 @@ fn main() { // Just pass all these through, no need for a "struct" prefix "FILE" | "fd_set" | + "Dl_info" | "DIR" => ty.to_string(), // Fixup a few types on windows that don't actually exist. @@ -229,6 +230,7 @@ fn main() { "gettimeofday" if linux || android || freebsd => true, "dlerror" if android => true, // const-ness is added + "dladdr" if musl => true, // const-ness only added recently _ => false, } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 97c9c3028d62c..61d21c635757a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -76,6 +76,13 @@ s! { #[cfg(not(target_os = "android"))] pub ipv6mr_interface: ::c_uint, } + + pub struct Dl_info { + pub dli_fname: *const ::c_char, + pub dli_fbase: *mut ::c_void, + pub dli_sname: *const ::c_char, + pub dli_saddr: *mut ::c_void, + } } pub const WNOHANG: ::c_int = 1; @@ -432,6 +439,7 @@ extern { pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; pub fn dlclose(handle: *mut ::c_void) -> ::c_int; + pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; } // TODO: get rid of this #[cfg(not(...))]