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