home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.2 / 7.2.392 < prev    next >
Encoding:
Internet Message Format  |  2010-03-09  |  4.8 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.392
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.2.392
  11. Problem:    Netbeans hangs reading from a socket at the maximum block size.
  12. Solution:   Use select() or poll(). (Xavier de Gaye)
  13. Files:        src/vim.h, src/os_unixx.h, src/if_xcmdsrv.c, src/netbeans.c
  14.  
  15.  
  16. *** ../vim-7.2.391/src/vim.h    2010-03-02 15:55:51.000000000 +0100
  17. --- src/vim.h    2010-03-10 15:14:03.000000000 +0100
  18. ***************
  19. *** 477,482 ****
  20. --- 477,499 ----
  21.   # include <stdarg.h>
  22.   #endif
  23.   
  24. + # if defined(HAVE_SYS_SELECT_H) && \
  25. +     (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
  26. + #  include <sys/select.h>
  27. + # endif
  28. + # ifndef HAVE_SELECT
  29. + #  ifdef HAVE_SYS_POLL_H
  30. + #   include <sys/poll.h>
  31. + #   define HAVE_POLL
  32. + #  else
  33. + #   ifdef HAVE_POLL_H
  34. + #    include <poll.h>
  35. + #    define HAVE_POLL
  36. + #   endif
  37. + #  endif
  38. + # endif
  39.   /* ================ end of the header file puzzle =============== */
  40.   
  41.   /*
  42. *** ../vim-7.2.391/src/os_unixx.h    2006-03-25 22:48:00.000000000 +0100
  43. --- src/os_unixx.h    2010-03-10 15:14:49.000000000 +0100
  44. ***************
  45. *** 28,38 ****
  46.   #  include <sys/wait.h>
  47.   # endif
  48.   
  49. - # if defined(HAVE_SYS_SELECT_H) && \
  50. -     (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
  51. - #  include <sys/select.h>
  52. - # endif
  53.   # ifndef WEXITSTATUS
  54.   #  ifdef HAVE_UNION_WAIT
  55.   #   define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
  56. --- 28,33 ----
  57. ***************
  58. *** 65,80 ****
  59.   # include <string.h>
  60.   #endif
  61.   
  62. - #ifndef HAVE_SELECT
  63. - # ifdef HAVE_SYS_POLL_H
  64. - #  include <sys/poll.h>
  65. - # else
  66. - #  ifdef HAVE_POLL_H
  67. - #   include <poll.h>
  68. - #  endif
  69. - # endif
  70. - #endif
  71.   #ifdef HAVE_SYS_STREAM_H
  72.   # include <sys/stream.h>
  73.   #endif
  74. --- 60,65 ----
  75. *** ../vim-7.2.391/src/if_xcmdsrv.c    2009-05-16 17:29:37.000000000 +0200
  76. --- src/if_xcmdsrv.c    2010-03-10 15:14:09.000000000 +0100
  77. ***************
  78. *** 21,41 ****
  79.   #  include <X11/Xatom.h>
  80.   # endif
  81.   
  82. - # if defined(HAVE_SYS_SELECT_H) && \
  83. -     (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
  84. - #  include <sys/select.h>
  85. - # endif
  86. - # ifndef HAVE_SELECT
  87. - #  ifdef HAVE_SYS_POLL_H
  88. - #   include <sys/poll.h>
  89. - #  else
  90. - #   ifdef HAVE_POLL_H
  91. - #    include <poll.h>
  92. - #   endif
  93. - #  endif
  94. - # endif
  95.   /*
  96.    * This file provides procedures that implement the command server
  97.    * functionality of Vim when in contact with an X11 server.
  98. --- 21,26 ----
  99. *** ../vim-7.2.391/src/netbeans.c    2010-01-19 15:12:33.000000000 +0100
  100. --- src/netbeans.c    2010-03-10 15:21:37.000000000 +0100
  101. ***************
  102. *** 736,741 ****
  103. --- 736,749 ----
  104.   #ifndef FEAT_GUI_GTK
  105.       static int        level = 0;
  106.   #endif
  107. + #ifdef HAVE_SELECT
  108. +     struct timeval    tval;
  109. +     fd_set        rfds;
  110. + #else
  111. + # ifdef HAVE_POLL
  112. +     struct pollfd    fds;
  113. + # endif
  114. + #endif
  115.   
  116.       if (sd < 0)
  117.       {
  118. ***************
  119. *** 755,763 ****
  120.           return;    /* out of memory! */
  121.       }
  122.   
  123. !     /* Keep on reading for as long as there is something to read. */
  124.       for (;;)
  125.       {
  126.       len = sock_read(sd, buf, MAXMSGSIZE);
  127.       if (len <= 0)
  128.           break;    /* error or nothing more to read */
  129. --- 763,788 ----
  130.           return;    /* out of memory! */
  131.       }
  132.   
  133. !     /* Keep on reading for as long as there is something to read.
  134. !      * Use select() or poll() to avoid blocking on a message that is exactly
  135. !      * MAXMSGSIZE long. */
  136.       for (;;)
  137.       {
  138. + #ifdef HAVE_SELECT
  139. +     FD_ZERO(&rfds);
  140. +         FD_SET(sd, &rfds);
  141. +         tval.tv_sec = 0;
  142. +         tval.tv_usec = 0;
  143. +         if (select(sd + 1, &rfds, NULL, NULL, &tval) <= 0)
  144. +             break;
  145. + #else
  146. + # ifdef HAVE_POLL
  147. +     fds.fd = sd;
  148. +     fds.events = POLLIN;
  149. +         if (poll(&fds, 1, 0) <= 0)
  150. +             break;
  151. + # endif
  152. + #endif
  153.       len = sock_read(sd, buf, MAXMSGSIZE);
  154.       if (len <= 0)
  155.           break;    /* error or nothing more to read */
  156. *** ../vim-7.2.391/src/version.c    2010-03-10 14:46:21.000000000 +0100
  157. --- src/version.c    2010-03-10 16:10:48.000000000 +0100
  158. ***************
  159. *** 683,684 ****
  160. --- 683,686 ----
  161.   {   /* Add new patch number below this line */
  162. + /**/
  163. +     392,
  164.   /**/
  165.  
  166. -- 
  167. WOMAN:   I didn't know we had a king. I thought we were an autonomous
  168.          collective.
  169. DENNIS:  You're fooling yourself.  We're living in a dictatorship.  A
  170.          self-perpetuating autocracy in which the working classes--
  171. WOMAN:   Oh there you go, bringing class into it again.
  172. DENNIS:  That's what it's all about if only people would--
  173.                                   The Quest for the Holy Grail (Monty Python)
  174.  
  175.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  176. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  177. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  178.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  179.