mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.2.392
Problem: Netbeans hangs reading from a socket at the maximum block size. Solution: Use select() or poll(). (Xavier de Gaye)
This commit is contained in:
@@ -21,21 +21,6 @@
|
|||||||
# include <X11/Xatom.h>
|
# include <X11/Xatom.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(HAVE_SYS_SELECT_H) && \
|
|
||||||
(!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
|
|
||||||
# include <sys/select.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef HAVE_SELECT
|
|
||||||
# ifdef HAVE_SYS_POLL_H
|
|
||||||
# include <sys/poll.h>
|
|
||||||
# else
|
|
||||||
# ifdef HAVE_POLL_H
|
|
||||||
# include <poll.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file provides procedures that implement the command server
|
* This file provides procedures that implement the command server
|
||||||
* functionality of Vim when in contact with an X11 server.
|
* functionality of Vim when in contact with an X11 server.
|
||||||
|
@@ -735,6 +735,14 @@ messageFromNetbeans(gpointer clientData UNUSED,
|
|||||||
int readlen = 0;
|
int readlen = 0;
|
||||||
#ifndef FEAT_GUI_GTK
|
#ifndef FEAT_GUI_GTK
|
||||||
static int level = 0;
|
static int level = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SELECT
|
||||||
|
struct timeval tval;
|
||||||
|
fd_set rfds;
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_POLL
|
||||||
|
struct pollfd fds;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd < 0)
|
if (sd < 0)
|
||||||
@@ -755,9 +763,26 @@ messageFromNetbeans(gpointer clientData UNUSED,
|
|||||||
return; /* out of memory! */
|
return; /* out of memory! */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep on reading for as long as there is something to read. */
|
/* Keep on reading for as long as there is something to read.
|
||||||
|
* Use select() or poll() to avoid blocking on a message that is exactly
|
||||||
|
* MAXMSGSIZE long. */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SELECT
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(sd, &rfds);
|
||||||
|
tval.tv_sec = 0;
|
||||||
|
tval.tv_usec = 0;
|
||||||
|
if (select(sd + 1, &rfds, NULL, NULL, &tval) <= 0)
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_POLL
|
||||||
|
fds.fd = sd;
|
||||||
|
fds.events = POLLIN;
|
||||||
|
if (poll(&fds, 1, 0) <= 0)
|
||||||
|
break;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
len = sock_read(sd, buf, MAXMSGSIZE);
|
len = sock_read(sd, buf, MAXMSGSIZE);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
break; /* error or nothing more to read */
|
break; /* error or nothing more to read */
|
||||||
|
@@ -28,11 +28,6 @@
|
|||||||
# include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(HAVE_SYS_SELECT_H) && \
|
|
||||||
(!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
|
|
||||||
# include <sys/select.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef WEXITSTATUS
|
# ifndef WEXITSTATUS
|
||||||
# ifdef HAVE_UNION_WAIT
|
# ifdef HAVE_UNION_WAIT
|
||||||
# define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
|
# define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
|
||||||
@@ -65,16 +60,6 @@
|
|||||||
# include <string.h>
|
# include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_SELECT
|
|
||||||
# ifdef HAVE_SYS_POLL_H
|
|
||||||
# include <sys/poll.h>
|
|
||||||
# else
|
|
||||||
# ifdef HAVE_POLL_H
|
|
||||||
# include <poll.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STREAM_H
|
#ifdef HAVE_SYS_STREAM_H
|
||||||
# include <sys/stream.h>
|
# include <sys/stream.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -681,6 +681,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
392,
|
||||||
/**/
|
/**/
|
||||||
391,
|
391,
|
||||||
/**/
|
/**/
|
||||||
|
17
src/vim.h
17
src/vim.h
@@ -477,6 +477,23 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
|||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# if defined(HAVE_SYS_SELECT_H) && \
|
||||||
|
(!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
|
||||||
|
# include <sys/select.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef HAVE_SELECT
|
||||||
|
# ifdef HAVE_SYS_POLL_H
|
||||||
|
# include <sys/poll.h>
|
||||||
|
# define HAVE_POLL
|
||||||
|
# else
|
||||||
|
# ifdef HAVE_POLL_H
|
||||||
|
# include <poll.h>
|
||||||
|
# define HAVE_POLL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
/* ================ end of the header file puzzle =============== */
|
/* ================ end of the header file puzzle =============== */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user