summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <a3li@gentoo.org>2010-01-10 22:46:50 +0100
committerAlex Legler <a3li@gentoo.org>2010-01-10 22:46:50 +0100
commitc53aea93109af5b061d3e50fe7d62499a4324b24 (patch)
tree21e81b50519e79cf11f22749a12b2beb6b997511
parentRemove sprintf_buffer_corruption, merged upstream (diff)
downloadruby-scripts-c53aea93109af5b061d3e50fe7d62499a4324b24.tar.gz
ruby-scripts-c53aea93109af5b061d3e50fe7d62499a4324b24.tar.bz2
ruby-scripts-c53aea93109af5b061d3e50fe7d62499a4324b24.zip
Remove IO deadlock patch, merged upstreampatchset-1.8.6_p388
-rw-r--r--patchsets/patches-1.8.6_p388/010_io_deadlock.patch111
1 files changed, 0 insertions, 111 deletions
diff --git a/patchsets/patches-1.8.6_p388/010_io_deadlock.patch b/patchsets/patches-1.8.6_p388/010_io_deadlock.patch
deleted file mode 100644
index aebd652..0000000
--- a/patchsets/patches-1.8.6_p388/010_io_deadlock.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-Backport #1001; handle EBADF in select() to avoid Interpreter-wide deadlock when native close() is called on fd which is currently being IO#select()ed.
-
-http://redmine.ruby-lang.org/issues/show/1001
-Upstream: yes
-
---- branches/ruby_1_8_6/eval.c 2009/08/20 15:08:07 24599
-+++ branches/ruby_1_8_6/eval.c 2009/08/20 17:22:00 24600
-@@ -74,7 +74,16 @@
-
- #include <time.h>
-
--#ifdef __BEOS__
-+#if defined(HAVE_FCNTL_H) || defined(_WIN32)
-+#include <fcntl.h>
-+#elif defined(HAVE_SYS_FCNTL_H)
-+#include <sys/fcntl.h>
-+#endif
-+#ifdef __CYGWIN__
-+#include <io.h>
-+#endif
-+
-+#if defined(__BEOS__) && !defined(BONE)
- #include <net/socket.h>
- #endif
-
-@@ -10801,20 +10810,60 @@
- #ifdef ERESTART
- if (e == ERESTART) goto again;
- #endif
-- FOREACH_THREAD_FROM(curr, th) {
-- if (th->wait_for & WAIT_SELECT) {
-- int v = 0;
--
-- v |= find_bad_fds(&readfds, &th->readfds, th->fd);
-- v |= find_bad_fds(&writefds, &th->writefds, th->fd);
-- v |= find_bad_fds(&exceptfds, &th->exceptfds, th->fd);
-- if (v) {
-- th->select_value = n;
-- n = max;
-- }
-- }
-- }
-- END_FOREACH_FROM(curr, th);
-+ if (e == EBADF) {
-+ int badfd = -1;
-+ int fd;
-+ int dummy;
-+ for (fd = 0; fd <= max; fd++) {
-+ if ((FD_ISSET(fd, &readfds) ||
-+ FD_ISSET(fd, &writefds) ||
-+ FD_ISSET(fd, &exceptfds)) &&
-+ fcntl(fd, F_GETFD, &dummy) == -1 &&
-+ errno == EBADF) {
-+ badfd = fd;
-+ break;
-+ }
-+ }
-+ if (badfd != -1) {
-+ FOREACH_THREAD_FROM(curr, th) {
-+ if (th->wait_for & WAIT_FD) {
-+ if (th->fd == badfd) {
-+ found = 1;
-+ th->status = THREAD_RUNNABLE;
-+ th->fd = 0;
-+ break;
-+ }
-+ }
-+ if (th->wait_for & WAIT_SELECT) {
-+ if (FD_ISSET(badfd, &th->readfds) ||
-+ FD_ISSET(badfd, &th->writefds) ||
-+ FD_ISSET(badfd, &th->exceptfds)) {
-+ found = 1;
-+ th->status = THREAD_RUNNABLE;
-+ th->select_value = -EBADF;
-+ break;
-+ }
-+ }
-+ }
-+ END_FOREACH_FROM(curr, th);
-+ }
-+ }
-+ else {
-+ FOREACH_THREAD_FROM(curr, th) {
-+ if (th->wait_for & WAIT_SELECT) {
-+ int v = 0;
-+
-+ v |= find_bad_fds(&readfds, &th->readfds, th->fd);
-+ v |= find_bad_fds(&writefds, &th->writefds, th->fd);
-+ v |= find_bad_fds(&exceptfds, &th->exceptfds, th->fd);
-+ if (v) {
-+ th->select_value = n;
-+ n = max;
-+ }
-+ }
-+ }
-+ END_FOREACH_FROM(curr, th);
-+ }
- }
- if (select_timeout && n == 0) {
- if (now < 0.0) now = timeofday();
-@@ -11125,6 +11174,10 @@
- if (read) *read = curr_thread->readfds;
- if (write) *write = curr_thread->writefds;
- if (except) *except = curr_thread->exceptfds;
-+ if (curr_thread->select_value < 0) {
-+ errno = -curr_thread->select_value;
-+ return -1;
-+ }
- return curr_thread->select_value;
- }
-