From 365ffa80e8159ca5728f74d36f4e627bdba23cbb Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 5 Mar 2022 08:12:51 +0000 Subject: openbsd hash search api --- libc-test/semver/openbsd.txt | 5 +++++ src/unix/bsd/netbsdlike/openbsd/mod.rs | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 73f5b37540..c8b55d626c 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -156,6 +156,7 @@ ENOTBLK ENOMEDIUM ENOTRECOVERABLE ENOTSUP +ENTER EOF EOWNERDEAD EPROCLIM @@ -189,6 +190,7 @@ EV_SYSFLAGS EXTA EXTB EXTPROC +FIND Elf32_Addr Elf32_Half Elf32_Lword @@ -993,6 +995,9 @@ getthrid glob glob_t globfree +hcreate +hdestroy +hsearch id_t if_data if_freenameindex diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 7717801103..b2b37e4a97 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -35,6 +35,11 @@ pub type Elf64_Sxword = i64; pub type Elf64_Word = u32; pub type Elf64_Xword = u64; +// search.h + +pub type ENTRY = entry; +pub type ACTION = ::c_uint; + cfg_if! { if #[cfg(target_pointer_width = "64")] { type Elf_Addr = Elf64_Addr; @@ -423,6 +428,12 @@ s! { pub struct ptrace_thread_state { pub pts_tid: ::pid_t, } + + // search.h + pub struct entry { + pub key: *mut ::c_char, + pub data: *mut ::c_void, + } } impl siginfo_t { @@ -1471,6 +1482,10 @@ pub const PTRACE_FORK: ::c_int = 0x0002; pub const WCONTINUED: ::c_int = 8; +// search.h +pub const FIND: ::ACTION = 0; +pub const ENTER: ::ACTION = 1; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -1652,6 +1667,9 @@ extern "C" { width: ::size_t, compar: ::Option ::c_int>, ) -> *mut ::c_void; + pub fn hcreate(nelt: ::size_t) -> ::c_int; + pub fn hdestroy(); + pub fn hsearch(entry: ::ENTRY, action: ::ACTION) -> *mut ::ENTRY; } #[link(name = "execinfo")] -- cgit v1.2.1