authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-10-21 18:24:24+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-29 10:40:26-07:00
logb297c2eae92f25af006cd909d25e98672d39eddc
tree478b1bb4f4da2f3b1d5912597bf354c6cdb8c345
parent1667c937a0869cc266ce43b4ecbde4ad49ca23c5

std: Fix compilation on FreeBSD/Darwin


2 files changed, 12 insertions(+), 1 deletions(-)

lib/std/os.zig+3-1
...@@ -5269,7 +5269,9 @@ pub const PollError = error{...@@ -5269,7 +5269,9 @@ pub const PollError = error{
52695269
5270pub fn poll(fds: []pollfd, timeout: i32) PollError!usize {5270pub fn poll(fds: []pollfd, timeout: i32) PollError!usize {
5271 while (true) {5271 while (true) {
5272 const rc = system.poll(fds.ptr, fds.len, timeout);5272 const fds_count = math.cast(nfds_t, fds.len) catch
5273 return error.SystemResources;
5274 const rc = system.poll(fds.ptr, fds_count, timeout);
5273 if (builtin.os.tag == .windows) {5275 if (builtin.os.tag == .windows) {
5274 if (rc == windows.ws2_32.SOCKET_ERROR) {5276 if (rc == windows.ws2_32.SOCKET_ERROR) {
5275 switch (windows.ws2_32.WSAGetLastError()) {5277 switch (windows.ws2_32.WSAGetLastError()) {
lib/std/os/bits/freebsd.zig+9
...@@ -1505,3 +1505,12 @@ pub const POLLRDBAND = 0x0080;...@@ -1505,3 +1505,12 @@ pub const POLLRDBAND = 0x0080;
1505pub const POLLWRBAND = 0x0100;1505pub const POLLWRBAND = 0x0100;
1506/// like POLLIN, except ignore EOF.1506/// like POLLIN, except ignore EOF.
1507pub const POLLINIGNEOF = 0x2000;1507pub const POLLINIGNEOF = 0x2000;
1508/// some poll error occurred.
1509pub const POLLERR = 0x0008;
1510/// file descriptor was "hung up".
1511pub const POLLHUP = 0x0010;
1512/// requested events "invalid".
1513pub const POLLNVAL = 0x0020;
1514
1515pub const POLLSTANDARD = POLLIN | POLLPRI | POLLOUT | POLLRDNORM | POLLRDBAND |
1516 POLLWRBAND | POLLERR | POLLHUP | POLLNVAL;