Skip to content

Commit db8c677

Browse files
committed
Auto merge of #2709 - devnexen:obsd_search_upd, r=Amanieu
openbsd hash search api
2 parents ac40e64 + 365ffa8 commit db8c677

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

libc-test/semver/openbsd.txt

+5
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ ENOTBLK
156156
ENOMEDIUM
157157
ENOTRECOVERABLE
158158
ENOTSUP
159+
ENTER
159160
EOF
160161
EOWNERDEAD
161162
EPROCLIM
@@ -189,6 +190,7 @@ EV_SYSFLAGS
189190
EXTA
190191
EXTB
191192
EXTPROC
193+
FIND
192194
Elf32_Addr
193195
Elf32_Half
194196
Elf32_Lword
@@ -993,6 +995,9 @@ getthrid
993995
glob
994996
glob_t
995997
globfree
998+
hcreate
999+
hdestroy
1000+
hsearch
9961001
id_t
9971002
if_data
9981003
if_freenameindex

src/unix/bsd/netbsdlike/openbsd/mod.rs

+18
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ pub type Elf64_Sxword = i64;
3535
pub type Elf64_Word = u32;
3636
pub type Elf64_Xword = u64;
3737

38+
// search.h
39+
40+
pub type ENTRY = entry;
41+
pub type ACTION = ::c_uint;
42+
3843
cfg_if! {
3944
if #[cfg(target_pointer_width = "64")] {
4045
type Elf_Addr = Elf64_Addr;
@@ -423,6 +428,12 @@ s! {
423428
pub struct ptrace_thread_state {
424429
pub pts_tid: ::pid_t,
425430
}
431+
432+
// search.h
433+
pub struct entry {
434+
pub key: *mut ::c_char,
435+
pub data: *mut ::c_void,
436+
}
426437
}
427438

428439
impl siginfo_t {
@@ -1471,6 +1482,10 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
14711482

14721483
pub const WCONTINUED: ::c_int = 8;
14731484

1485+
// search.h
1486+
pub const FIND: ::ACTION = 0;
1487+
pub const ENTER: ::ACTION = 1;
1488+
14741489
const_fn! {
14751490
{const} fn _ALIGN(p: usize) -> usize {
14761491
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -1652,6 +1667,9 @@ extern "C" {
16521667
width: ::size_t,
16531668
compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>,
16541669
) -> *mut ::c_void;
1670+
pub fn hcreate(nelt: ::size_t) -> ::c_int;
1671+
pub fn hdestroy();
1672+
pub fn hsearch(entry: ::ENTRY, action: ::ACTION) -> *mut ::ENTRY;
16551673
}
16561674

16571675
#[link(name = "execinfo")]

0 commit comments

Comments
 (0)