1 use libc;
2 use std::os::unix::io::RawFd;
3 use crate::Result;
4 use crate::errno::Errno;
5 
6 libc_bitflags! {
7     pub struct EfdFlags: libc::c_int {
8         EFD_CLOEXEC; // Since Linux 2.6.27
9         EFD_NONBLOCK; // Since Linux 2.6.27
10         EFD_SEMAPHORE; // Since Linux 2.6.30
11     }
12 }
13 
eventfd(initval: libc::c_uint, flags: EfdFlags) -> Result<RawFd>14 pub fn eventfd(initval: libc::c_uint, flags: EfdFlags) -> Result<RawFd> {
15     let res = unsafe { libc::eventfd(initval, flags.bits()) };
16 
17     Errno::result(res).map(|r| r as RawFd)
18 }
19