Fix MS-Windows build.
src/callproc.c: src/emacs.c: src/filelock.c: src/process.c: src/sysdep.c: src/w32.c: Reshuffle Windows-specific headers to avoid errors with redefinition of fd_set etc. src/process.c: Don't use num_pending_connects when NON_BLOCKING_CONNECT is not defined. src/sysselect.h: Move definitions of FD_* macros and of SELECT_TYPE here from w32.h. src/w32proc.c (sys_select): Adjust the argument types to what thread.h expects. nt/inc/sys/socket.h: Include stdint.h. Include sysselect.h instead of w32.h.
This commit is contained in:
parent
c160274456
commit
6e9fb70cdf
12 changed files with 103 additions and 59 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-08-26 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* inc/sys/socket.h: Include stdint.h. Include sysselect.h instead
|
||||
of w32.h.
|
||||
|
||||
2013-08-25 Vincent Belaïche <vincentb1@users.sourceforge.net>
|
||||
|
||||
* configure.bat: Rather than disabling, make configure.bat produce
|
||||
|
|
|
@ -53,6 +53,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <ws2tcpip.h>
|
||||
/* process.c uses uint16_t (from C99) for IPv6, but
|
||||
apparently it is not defined in some versions of mingw and msvc. */
|
||||
#include <stdint.h>
|
||||
#ifndef UINT16_C
|
||||
typedef unsigned short uint16_t;
|
||||
#endif
|
||||
|
@ -73,7 +74,7 @@ typedef unsigned short uint16_t;
|
|||
|
||||
/* allow us to provide our own version of fd_set */
|
||||
#define fd_set ws_fd_set
|
||||
#include "w32.h"
|
||||
#include "sysselect.h"
|
||||
#endif /* EMACS_CONFIG_H */
|
||||
|
||||
#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
2013-08-26 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* callproc.c:
|
||||
* emacs.c:
|
||||
* filelock.c:
|
||||
* process.c:
|
||||
* sysdep.c:
|
||||
* w32.c: Reshuffle Windows-specific headers to avoid errors with
|
||||
redefinition of fd_set etc.
|
||||
|
||||
* process.c: Don't use num_pending_connects when
|
||||
NON_BLOCKING_CONNECT is not defined.
|
||||
|
||||
* sysselect.h: Move definitions of FD_* macros and of SELECT_TYPE
|
||||
here from w32.h.
|
||||
|
||||
* w32proc.c (sys_select): Adjust the argument types to what
|
||||
thread.h expects.
|
||||
|
||||
2013-08-24 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* xdisp.c (get_next_display_element): Don't apply to characters
|
||||
|
|
|
@ -26,12 +26,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef WINDOWSNT
|
||||
#define NOMINMAX
|
||||
#include <sys/socket.h> /* for fcntl */
|
||||
#endif
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
#define NOMINMAX
|
||||
#include <sys/socket.h> /* for fcntl */
|
||||
#include <windows.h>
|
||||
#include "w32.h"
|
||||
#define _P_NOWAIT 1 /* from process.h */
|
||||
|
|
|
@ -29,16 +29,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <close-stream.h>
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include "w32.h"
|
||||
#include "w32heap.h"
|
||||
#endif
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
#if defined WINDOWSNT || defined HAVE_NTGUI
|
||||
#ifdef WINDOWSNT
|
||||
#include "w32.h"
|
||||
#endif
|
||||
#include "w32select.h"
|
||||
#include "w32font.h"
|
||||
#include "w32common.h"
|
||||
|
|
|
@ -36,6 +36,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <sys/sysctl.h>
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
#include <share.h>
|
||||
#include <sys/socket.h> /* for fcntl */
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <c-ctype.h>
|
||||
|
@ -46,8 +51,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "coding.h"
|
||||
#include "systime.h"
|
||||
#ifdef WINDOWSNT
|
||||
#include <share.h>
|
||||
#include <sys/socket.h> /* for fcntl */
|
||||
#include "w32.h" /* for dostounix_filename */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
/* Only MS-DOS does not define `subprocesses'. */
|
||||
#ifdef subprocesses
|
||||
|
||||
|
@ -96,6 +94,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#endif /* subprocesses */
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
#include "systime.h"
|
||||
#include "systty.h"
|
||||
|
||||
|
@ -132,8 +132,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#endif
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
|
||||
EMACS_TIME *, void *);
|
||||
#include "w32.h"
|
||||
#endif
|
||||
|
||||
#ifndef SOCK_CLOEXEC
|
||||
|
@ -532,7 +531,9 @@ add_non_blocking_write_fd (int fd)
|
|||
fd_callback_info[fd].flags |= FOR_WRITE | NON_BLOCKING_CONNECT_FD;
|
||||
if (fd > max_desc)
|
||||
max_desc = fd;
|
||||
#ifdef NON_BLOCKING_CONNECT
|
||||
++num_pending_connects;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -560,11 +561,13 @@ delete_write_fd (int fd)
|
|||
eassert (fd < MAXDESC);
|
||||
eassert (fd <= max_desc);
|
||||
|
||||
#ifdef NON_BLOCKING_CONNECT
|
||||
if ((fd_callback_info[fd].flags & NON_BLOCKING_CONNECT_FD) != 0)
|
||||
{
|
||||
if (--num_pending_connects < 0)
|
||||
abort ();
|
||||
}
|
||||
#endif
|
||||
fd_callback_info[fd].flags &= ~(FOR_WRITE | NON_BLOCKING_CONNECT_FD);
|
||||
if (fd_callback_info[fd].flags == 0)
|
||||
{
|
||||
|
|
24
src/sysdep.c
24
src/sysdep.c
|
@ -33,6 +33,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <c-ctype.h>
|
||||
#include <utimens.h>
|
||||
|
||||
#ifdef HAVE_SOCKETS
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#endif /* HAVE_SOCKETS */
|
||||
|
||||
#ifdef TRY_AGAIN
|
||||
#ifndef HAVE_H_ERRNO
|
||||
extern int h_errno;
|
||||
#endif
|
||||
#endif /* TRY_AGAIN */
|
||||
|
||||
#include "lisp.h"
|
||||
#include "sysselect.h"
|
||||
#include "blockinput.h"
|
||||
|
@ -58,7 +69,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifndef STDERR_FILENO
|
||||
#define STDERR_FILENO fileno(GetStdHandle(STD_ERROR_HANDLE))
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include "w32.h"
|
||||
#endif /* not WINDOWSNT */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1325,17 +1336,6 @@ setup_pty (int fd)
|
|||
}
|
||||
#endif /* HAVE_PTYS */
|
||||
|
||||
#ifdef HAVE_SOCKETS
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#endif /* HAVE_SOCKETS */
|
||||
|
||||
#ifdef TRY_AGAIN
|
||||
#ifndef HAVE_H_ERRNO
|
||||
extern int h_errno;
|
||||
#endif
|
||||
#endif /* TRY_AGAIN */
|
||||
|
||||
void
|
||||
init_system_name (void)
|
||||
{
|
||||
|
|
|
@ -16,14 +16,47 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef EMACS_SYSSELECT_H
|
||||
#define EMACS_SYSSELECT_H
|
||||
|
||||
#ifndef DOS_NT
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
/* The w32 build defines select stuff in w32.h, which is included
|
||||
where w32 needs it, but not where sysselect.h is included. The w32
|
||||
definitions in w32.h are incompatible with the below. */
|
||||
#ifndef WINDOWSNT
|
||||
#ifdef WINDOWSNT
|
||||
|
||||
/* File descriptor set emulation. */
|
||||
|
||||
/* MSVC runtime library has limit of 64 descriptors by default */
|
||||
#define FD_SETSIZE 64
|
||||
typedef struct {
|
||||
unsigned int bits[FD_SETSIZE / 32];
|
||||
} fd_set;
|
||||
|
||||
/* standard access macros */
|
||||
#define FD_SET(n, p) \
|
||||
do { \
|
||||
if ((n) < FD_SETSIZE) { \
|
||||
(p)->bits[(n)/32] |= (1 << (n)%32); \
|
||||
} \
|
||||
} while (0)
|
||||
#define FD_CLR(n, p) \
|
||||
do { \
|
||||
if ((n) < FD_SETSIZE) { \
|
||||
(p)->bits[(n)/32] &= ~(1 << (n)%32); \
|
||||
} \
|
||||
} while (0)
|
||||
#define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0)
|
||||
#define FD_ZERO(p) memset((p), 0, sizeof(fd_set))
|
||||
|
||||
#define SELECT_TYPE fd_set
|
||||
|
||||
#include "systime.h"
|
||||
extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
|
||||
EMACS_TIME *, sigset_t *);
|
||||
|
||||
#else /* not WINDOWSNT */
|
||||
|
||||
#ifdef FD_SET
|
||||
#ifdef FD_SETSIZE
|
||||
#define MAXDESC FD_SETSIZE
|
||||
|
@ -50,3 +83,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifdef MSDOS
|
||||
#define pselect sys_select
|
||||
#endif
|
||||
|
||||
#endif /* EMACS_SYSSELECT_H */
|
||||
|
|
|
@ -39,6 +39,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <config.h>
|
||||
#include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#undef access
|
||||
#undef chdir
|
||||
#undef chmod
|
||||
|
@ -70,7 +72,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include <grp.h>
|
||||
|
||||
/* MinGW64 (_W64) defines these in its _mingw.h. */
|
||||
#if defined(__GNUC__) && !defined(_W64)
|
||||
#if !defined(_ANONYMOUS_UNION) && !defined(_ANONYMOUS_STRUCT)
|
||||
#define _ANONYMOUS_UNION
|
||||
#define _ANONYMOUS_STRUCT
|
||||
#endif
|
||||
|
@ -197,7 +199,6 @@ typedef struct _REPARSE_DATA_BUFFER {
|
|||
#endif
|
||||
|
||||
/* TCP connection support. */
|
||||
#include <sys/socket.h>
|
||||
#undef socket
|
||||
#undef bind
|
||||
#undef connect
|
||||
|
@ -247,7 +248,7 @@ static BOOL WINAPI revert_to_self (void);
|
|||
extern int sys_access (const char *, int);
|
||||
extern void *e_malloc (size_t);
|
||||
extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
|
||||
EMACS_TIME *, void *);
|
||||
EMACS_TIME *, sigset_t *);
|
||||
extern int sys_dup (int);
|
||||
|
||||
|
||||
|
|
27
src/w32.h
27
src/w32.h
|
@ -25,33 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/* File descriptor set emulation. */
|
||||
|
||||
/* MSVC runtime library has limit of 64 descriptors by default */
|
||||
#define FD_SETSIZE 64
|
||||
typedef struct {
|
||||
unsigned int bits[FD_SETSIZE / 32];
|
||||
} fd_set;
|
||||
|
||||
/* standard access macros */
|
||||
#define FD_SET(n, p) \
|
||||
do { \
|
||||
if ((n) < FD_SETSIZE) { \
|
||||
(p)->bits[(n)/32] |= (1 << (n)%32); \
|
||||
} \
|
||||
} while (0)
|
||||
#define FD_CLR(n, p) \
|
||||
do { \
|
||||
if ((n) < FD_SETSIZE) { \
|
||||
(p)->bits[(n)/32] &= ~(1 << (n)%32); \
|
||||
} \
|
||||
} while (0)
|
||||
#define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0)
|
||||
#define FD_ZERO(p) memset((p), 0, sizeof(fd_set))
|
||||
|
||||
#define SELECT_TYPE fd_set
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* child_process.status values */
|
||||
|
|
|
@ -1916,7 +1916,7 @@ extern int proc_buffered_char[];
|
|||
|
||||
int
|
||||
sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
|
||||
EMACS_TIME *timeout, void *ignored)
|
||||
EMACS_TIME *timeout, sigset_t *ignored)
|
||||
{
|
||||
SELECT_TYPE orfds;
|
||||
DWORD timeout_ms, start_time;
|
||||
|
|
Loading…
Add table
Reference in a new issue