Commit 2c16a96686

LemonBoy <thatlemon@gmail.com>
2020-10-21 16:29:15
std: Fix poll definitions for FreeBSD/Darwin
1 parent dc810eb
Changed files (2)
lib
lib/std/os/bits/darwin.zig
@@ -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,
lib/std/os/bits/freebsd.zig
@@ -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;