[前][次][番号順一覧][スレッド一覧]

ruby-changes:53616

From: normal <ko1@a...>
Date: Tue, 20 Nov 2018 16:27:34 +0900 (JST)
Subject: [ruby-changes:53616] normal:r65832 (trunk): thread_pthread.c (rb_reserved_fd_p): false-positive on negative FD

normal	2018-11-20 16:27:28 +0900 (Tue, 20 Nov 2018)

  New Revision: 65832

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65832

  Log:
    thread_pthread.c (rb_reserved_fd_p): false-positive on negative FD
    
    Negative-numbered FDs are never valid FDs on POSIX-like
    platforms, and we initialize our self-pipes/eventfd values
    to "-1", so stop treating -1 as a reserved FD if our system
    is too low on resources to allocate FDs at startup.

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 65831)
+++ thread_pthread.c	(revision 65832)
@@ -1842,6 +1842,10 @@ ruby_stack_overflowed_p(const rb_thread_ https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1842
 int
 rb_reserved_fd_p(int fd)
 {
+    /* no false-positive if out-of-FD at startup */
+    if (fd < 0)
+        return 0;
+
 #if UBF_TIMER == UBF_TIMER_PTHREAD
     if (fd == timer_pthread.low[0] || fd == timer_pthread.low[1])
         goto check_pid;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]