< :Á°¤ÎÈÖ¹æ
^ :ÈÖ¹æ½ç¥ê¥¹¥È
> :¼¡¤ÎÈÖ¹æ
P :Á°¤Îµ»ö¡Ê¥¹¥ì¥Ã¥É°Üư¡Ë
N :¼¡¤Îµ»ö¡Ê¥¹¥ì¥Ã¥É°Üư¡Ë
|<:Á°¤Î¥¹¥ì¥Ã¥É
>|:¼¡¤Î¥¹¥ì¥Ã¥É
^ :ÊÖ»öÀè
_:¼«Ê¬¤Ø¤ÎÊÖ»ö
>:Ʊ¤¸ÊÖ»öÀè¤ò»ý¤Äµ»ö¡ÊÁ°¡Ë
<:Ʊ¤¸ÊÖ»öÀè¤ò»ý¤Äµ»ö¡Ê¸å¡Ë
---:ʬ³ä¤·¤Æ¥¹¥ì¥Ã¥Éɽ¼¨¡¢ºÆÉ½¼¨
| :ʬ³ä¤·¤Æ¡Ê½Ä¡Ë¥¹¥ì¥Ã¥Éɽ¼¨¡¢ºÆÉ½¼¨
~ :¥¹¥ì¥Ã¥É¤Î¥Õ¥ì¡¼¥à¾Ãµî
.:¥¤¥ó¥Ç¥Ã¥¯¥¹
..:¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
Issue #5524 has been updated by Motohiro KOSAKI.
??ªã?????????????®ã????¹ã???????ã?? select???maxfdså¼???°ã??????????£ã?¦ã???????®ã?§ã??????????ªã????®ã?¯æ??å¾?????????§ã?¯ã?ªã????§ã??????????????以ä????®ä¿®æ£ã???????¦ã??FreeBSD???
???????????¦ã??????????¾ã????????
~/projects/test/select_ebadf% diff -u select_badf.c.orig select_badf.c
diff -u select_badf.c.orig select_badf.c
--- select_badf.c.orig 2011-11-08 11:33:44.000000000 -0500
+++ select_badf.c 2011-11-08 11:38:26.000000000 -0500
@@ -3,6 +3,8 @@
#include <sys/select.h>
#include <unistd.h>
+#define max(x,y) ((x > y) ? x : y)
+
int
main(void) {
int pipes[2];
@@ -18,7 +20,8 @@
//struct timeval *timeout = NULL;
//FD_SET(r, &readfds);
FD_SET(w, &writefds);
- res = select(1, &readfds, &writefds, &exceptfds, NULL);
+ res = select(max(r,w)+1, &readfds, &writefds, &exceptfds, NULL);
+
return 0;
}
----------------------------------------
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: Assigned
Priority: Normal
Assignee: Motohiro KOSAKI
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