use fcntl fallback for additional poll-specific errors
This commit is contained in:
parent
d3465a8f21
commit
2e62fdab76
1 changed files with 8 additions and 7 deletions
|
@ -88,14 +88,15 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
|
||||||
];
|
];
|
||||||
|
|
||||||
while libc::poll(pfds.as_mut_ptr(), 3, 0) == -1 {
|
while libc::poll(pfds.as_mut_ptr(), 3, 0) == -1 {
|
||||||
if errno() == libc::EINTR {
|
match errno() {
|
||||||
continue;
|
libc::EINTR => continue,
|
||||||
|
libc::EINVAL | libc::EAGAIN | libc::ENOMEM => {
|
||||||
|
// RLIMIT_NOFILE or temporary allocation failures
|
||||||
|
// may be preventing use of poll(), fall back to fcntl
|
||||||
|
break 'poll;
|
||||||
|
}
|
||||||
|
_ => libc::abort(),
|
||||||
}
|
}
|
||||||
if errno() == libc::EINVAL {
|
|
||||||
// RLIMIT_NOFILE may be preventing use of poll()
|
|
||||||
break 'poll;
|
|
||||||
}
|
|
||||||
libc::abort();
|
|
||||||
}
|
}
|
||||||
for pfd in pfds {
|
for pfd in pfds {
|
||||||
if pfd.revents & libc::POLLNVAL == 0 {
|
if pfd.revents & libc::POLLNVAL == 0 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue