rktio: better ltps checking for epoll support
Don't report ltps success for file descriptors that are not supported by epoll. Racket ports probably were not affected, since Racket doesn't try ltps registration for regular files or devices like /dev/null that report always being ready.
This commit is contained in:
parent
c3f61a7626
commit
93ae78af91
|
@ -343,7 +343,17 @@ rktio_ltps_handle_t *rktio_ltps_add(rktio_t *rktio, rktio_ltps_t *lt, rktio_fd_t
|
|||
ev.events = EPOLLIN | (already ? EPOLLOUT : 0);
|
||||
kr = epoll_ctl(lt->fd,
|
||||
(already ? EPOLL_CTL_MOD : EPOLL_CTL_ADD), fd, &ev);
|
||||
log_kqueue_error("read", kr);
|
||||
if ((kr < 0) && (errno == EPERM)) {
|
||||
/* not supported on this fd */
|
||||
v->read_handle = NULL;
|
||||
if (!v->write_handle) {
|
||||
ltps_hash_remove(lt, fd);
|
||||
free(v);
|
||||
}
|
||||
free(s);
|
||||
s = NULL;
|
||||
} else
|
||||
log_kqueue_error("read", kr);
|
||||
}
|
||||
# else
|
||||
RKTIO_FD_SET(fd, r);
|
||||
|
@ -380,7 +390,17 @@ rktio_ltps_handle_t *rktio_ltps_add(rktio_t *rktio, rktio_ltps_t *lt, rktio_fd_t
|
|||
ev.events = EPOLLOUT | (already ? EPOLLIN : 0);
|
||||
kr = epoll_ctl(lt->fd,
|
||||
(already ? EPOLL_CTL_MOD : EPOLL_CTL_ADD), fd, &ev);
|
||||
log_kqueue_error("write", kr);
|
||||
if ((kr < 0) && (errno == EPERM)) {
|
||||
/* not supported on this fd */
|
||||
v->write_handle = NULL;
|
||||
if (!v->read_handle) {
|
||||
ltps_hash_remove(lt, fd);
|
||||
free(v);
|
||||
}
|
||||
free(s);
|
||||
s = NULL;
|
||||
} else
|
||||
log_kqueue_error("write", kr);
|
||||
}
|
||||
# else
|
||||
RKTIO_FD_SET(fd, w);
|
||||
|
|
Loading…
Reference in New Issue
Block a user