mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 10:28:48 +00:00
std: Fix compilation on FreeBSD/Darwin
This commit is contained in:
parent
1667c937a0
commit
b297c2eae9
@ -5269,7 +5269,9 @@ pub const PollError = error{
|
||||
|
||||
pub fn poll(fds: []pollfd, timeout: i32) PollError!usize {
|
||||
while (true) {
|
||||
const rc = system.poll(fds.ptr, fds.len, timeout);
|
||||
const fds_count = math.cast(nfds_t, fds.len) catch
|
||||
return error.SystemResources;
|
||||
const rc = system.poll(fds.ptr, fds_count, timeout);
|
||||
if (builtin.os.tag == .windows) {
|
||||
if (rc == windows.ws2_32.SOCKET_ERROR) {
|
||||
switch (windows.ws2_32.WSAGetLastError()) {
|
||||
|
@ -1505,3 +1505,12 @@ pub const POLLRDBAND = 0x0080;
|
||||
pub const POLLWRBAND = 0x0100;
|
||||
/// like POLLIN, except ignore EOF.
|
||||
pub const POLLINIGNEOF = 0x2000;
|
||||
/// some poll error occurred.
|
||||
pub const POLLERR = 0x0008;
|
||||
/// file descriptor was "hung up".
|
||||
pub const POLLHUP = 0x0010;
|
||||
/// requested events "invalid".
|
||||
pub const POLLNVAL = 0x0020;
|
||||
|
||||
pub const POLLSTANDARD = POLLIN | POLLPRI | POLLOUT | POLLRDNORM | POLLRDBAND |
|
||||
POLLWRBAND | POLLERR | POLLHUP | POLLNVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user