std: Fix poll definitions for FreeBSD/Darwin

This commit is contained in:
LemonBoy 2020-10-21 16:29:15 +02:00 committed by Andrew Kelley
parent dc810eb73b
commit 2c16a96686
2 changed files with 26 additions and 1 deletions

View File

@ -1461,7 +1461,7 @@ pub const LOCK_EX = 2;
pub const LOCK_UN = 8;
pub const LOCK_NB = 4;
pub const nfds_t = usize;
pub const nfds_t = u32;
pub const pollfd = extern struct {
fd: fd_t,
events: i16,

View File

@ -1480,3 +1480,28 @@ pub const rlimit = extern struct {
pub const SHUT_RD = 0;
pub const SHUT_WR = 1;
pub const SHUT_RDWR = 2;
pub const nfds_t = u32;
pub const pollfd = extern struct {
fd: fd_t,
events: i16,
revents: i16,
};
/// any readable data available.
pub const POLLIN = 0x0001;
/// OOB/Urgent readable data.
pub const POLLPRI = 0x0002;
/// file descriptor is writeable.
pub const POLLOUT = 0x0004;
/// non-OOB/URG data available.
pub const POLLRDNORM = 0x0040;
/// no write type differentiation.
pub const POLLWRNORM = POLLOUT;
/// OOB/Urgent readable data.
pub const POLLRDBAND = 0x0080;
/// OOB/Urgent data can be written.
pub const POLLWRBAND = 0x0100;
/// like POLLIN, except ignore EOF.
pub const POLLINIGNEOF = 0x2000;