Skip to content

Commit 03be810

Browse files
committed
Define eventfd on NetBSD
Like FreeBSD, NetBSD supports eventfd, see https://man.netbsd.org/eventfd.2. OpenBSD does not AFAICT. Also, format imports with rustfmt 1.8.0-stable (ed61e7d7e2 2025-11-07).
1 parent 7b336ae commit 03be810

File tree

1 file changed

+10
-0
lines changed
  • src/unix/bsd/netbsdlike/netbsd

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::{
77
};
88

99
pub type blksize_t = i32;
10+
pub type eventfd_t = u64;
1011
pub type fsblkcnt_t = u64;
1112
pub type fsfilcnt_t = u64;
1213
pub type idtype_t = c_int;
@@ -1742,6 +1743,11 @@ pub const RTA_TAG: c_int = 0x100;
17421743
pub const RTAX_TAG: c_int = 8;
17431744
pub const RTAX_MAX: c_int = 9;
17441745

1746+
// For eventfd
1747+
pub const EFD_SEMAPHORE: c_int = crate::O_RDWR;
1748+
pub const EFD_NONBLOCK: c_int = crate::O_NONBLOCK;
1749+
pub const EFD_CLOEXEC: c_int = crate::O_CLOEXEC;
1750+
17451751
// sys/timerfd.h
17461752
pub const TFD_CLOEXEC: i32 = crate::O_CLOEXEC;
17471753
pub const TFD_NONBLOCK: i32 = crate::O_NONBLOCK;
@@ -2197,6 +2203,10 @@ extern "C" {
21972203
pub fn getmntinfo(mntbufp: *mut *mut crate::statvfs, flags: c_int) -> c_int;
21982204
pub fn getvfsstat(buf: *mut crate::statvfs, bufsize: size_t, flags: c_int) -> c_int;
21992205

2206+
pub fn eventfd(init: c_uint, flags: c_int) -> c_int;
2207+
pub fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int;
2208+
pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
2209+
22002210
// Added in `NetBSD` 10.0
22012211
pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int;
22022212
pub fn timerfd_gettime(fd: c_int, curr_value: *mut crate::itimerspec) -> c_int;

0 commit comments

Comments
 (0)