Issue #5524 has been updated by Motohiro KOSAKI.

Status changed from Assigned to Feedback
Assignee changed from Motohiro KOSAKI to Yui NARUSE


----------------------------------------
Bug #5524: IO.wait_for_single_fd(closed fd) sticks on other than Linux
http://redmine.ruby-lang.org/issues/5524

Author: Yui NARUSE
Status: Feedback
Priority: Normal
Assignee: Yui NARUSE
Category: 
Target version: 
ruby -v: -


r31428 ????test_wait_for_invalid_fd ????????????追???????????????
IO.wait_for_single_fd(close ????? fd) ??? EBADF ????????????確???????????????????????
??????????????????????? FreeBSD ?????????????????

?????????????????????????????????????????????????????????????????????????
test-all????????????弾????????????????????????

%  cat poll.c
#include <stdio.h>
#include <stdlib.h>
#include <poll.h>
#include <errno.h>
int
main(void) {
    int pipes[2];
    int res = pipe(pipes);
    if (res != 0) abort();
    int r = pipes[0];
    int w = pipes[1];
    res = close(w);
    if (res != 0) abort();

    struct pollfd fds;
    fds.fd = w;
    fds.events = POLLOUT;
    errno = 0;
    res = poll(&fds, 1, 1000);
    fprintf(stderr, "%d %d %d\n", res, errno, fds.revents);
    return 0;
}

?????????????????????????????? POLLVAL ??????????


#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
int
main(void) {
    int pipes[2];
    int res = pipe(pipes);
    if (res != 0) abort();
    int r = pipes[0];
    int w = pipes[1];
    res = close(w);
    if (res != 0) abort();
    fd_set readfds; FD_ZERO(&readfds);
    fd_set writefds; FD_ZERO(&writefds);
    fd_set exceptfds; FD_ZERO(&exceptfds);
    //struct timeval *timeout = NULL;
    //FD_SET(r, &readfds);
    FD_SET(w, &writefds);
    res = select(1, &readfds, &writefds, &exceptfds, NULL);
    return 0;
}

???????????????????????????????????????????????????????Linux?????????????????????????????????????????????????????????????????????????


-- 
http://redmine.ruby-lang.org