Skip to content

Commit

Permalink
Auto merge of #2527 - devnexen:obsd_execinfo, r=JohnTitor
Browse files Browse the repository at this point in the history
openbsd backtrace api addition
  • Loading branch information
bors committed Nov 10, 2021
2 parents c781f0b + 2676fd3 commit d4ac6fd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Expand Up @@ -393,6 +393,7 @@ fn test_openbsd(target: &str) {
headers! { cfg:
"elf.h",
"errno.h",
"execinfo.h",
"fcntl.h",
"limits.h",
"link.h",
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/openbsd.txt
Expand Up @@ -913,6 +913,10 @@ arc4random_buf
arc4random_uniform
arphdr
atof
backtrace
backtrace_symbols
backtrace_symbols_fd
backtrace_symbols_fmt
bsearch
caddr_t
calloc_conceal
Expand Down
16 changes: 16 additions & 0 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Expand Up @@ -1606,6 +1606,22 @@ extern "C" {
pub fn calloc_conceal(nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
}

#[link(name = "execinfo")]
extern "C" {
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd(
addrlist: *const *mut ::c_void,
len: ::size_t,
fd: ::c_int,
) -> ::c_int;
pub fn backtrace_symbols_fmt(
addrlist: *const *mut ::c_void,
len: ::size_t,
fmt: *const ::c_char,
) -> *mut *mut ::c_char;
}

cfg_if! {
if #[cfg(libc_union)] {
extern {
Expand Down

0 comments on commit d4ac6fd

Please sign in to comment.