summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-03-05 08:12:51 +0000
committerDavid Carlier <devnexen@gmail.com>2022-03-05 08:12:51 +0000
commit365ffa80e8159ca5728f74d36f4e627bdba23cbb (patch)
tree4d01a6ba5921e211ecab364f60cfdcf3e4f226e8
parentac40e640ceac967124eb8d9feeaa41673a32ed47 (diff)
downloadrust-libc-365ffa80e8159ca5728f74d36f4e627bdba23cbb.tar.gz
openbsd hash search api
-rw-r--r--libc-test/semver/openbsd.txt5
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs18
2 files changed, 23 insertions, 0 deletions
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<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::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")]