use super::abi::*;
use crate::{
result_from_value,
RawFd,
};
pub const POLLIN: i16 = 0x1;
pub const POLLPRI: i16 = 0x2;
pub const POLLOUT: i16 = 0x4;
pub const POLLERR: i16 = 0x8;
pub const POLLHUP: i16 = 0x10;
pub const POLLNVAL: i16 = 0x20;
pub const POLLRDNORM: i16 = 0x40;
pub const POLLRDBAND: i16 = 0x80;
pub const POLLWRNORM: i16 = 0x100;
pub const POLLWRBAND: i16 = 0x200;
pub const POLLMSG: i16 = 0x400;
pub const POLLREMOVE: i16 = 0x1000;
pub const POLLRDHUP: i16 = 0x2000;
#[repr(C)]
#[allow(non_camel_case_types)]
pub struct pollfd {
pub fd: RawFd,
pub events: i16,
pub revents: i16,
}
#[inline]
pub fn poll(fds: &mut [pollfd], timeout_ms: i32) -> crate::Result<usize> {
let ret = unsafe { syscall_3(7, fds.as_mut_ptr() as usize, fds.len(), timeout_ms as usize) };
result_from_value(ret)
}