1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Fix the MS-Windows build

* src/thread.h [WINDOWSNT]: Include sys/socket.h.

* src/sysselect.h: Don't define fd_set and FD_* macros for
MS-Windows here.
* src/w32.h: Define them here.

* src/process.h (sys_select): Declare prototype.

* src/sysdep.c:
* src/process.c:
* src/filelock.c:
* src/emacs.c:
* src/callproc.c: Move inclusion of sys/select.h after lisp.h.
* nt/inc/socket.h: Include w32.h instead of sysselect.h
This commit is contained in:
Eli Zaretskii 2015-11-02 19:04:06 +02:00
parent 39372e1a10
commit 470e3028d8
10 changed files with 59 additions and 66 deletions

View file

@ -74,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 "sysselect.h"
#include "w32.h"
#endif /* EMACS_CONFIG_H */
#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)

View file

@ -27,14 +27,12 @@ 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 */

View file

@ -31,20 +31,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <close-stream.h>
#define MAIN_PROGRAM
#include "lisp.h"
#ifdef WINDOWSNT
#include <fcntl.h>
#include <sys/socket.h>
#include <mbstring.h>
#include "w32.h"
#include "w32heap.h"
#endif
#define MAIN_PROGRAM
#include "lisp.h"
#if defined WINDOWSNT || defined HAVE_NTGUI
#ifdef WINDOWSNT
#include "w32.h"
#endif
#include "w32select.h"
#include "w32font.h"
#include "w32common.h"

View file

@ -40,11 +40,6 @@ 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>
@ -53,6 +48,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "buffer.h"
#include "coding.h"
#ifdef WINDOWSNT
#include <share.h>
#include <sys/socket.h> /* for fcntl */
#include "w32.h" /* for dostounix_filename */
#endif

View file

@ -29,6 +29,8 @@ 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
@ -92,8 +94,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif /* subprocesses */
#include "lisp.h"
#include "systime.h"
#include "systty.h"
@ -126,7 +126,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#ifdef WINDOWSNT
#include "w32.h"
extern int sys_select (int, fd_set *, fd_set *, fd_set *,
struct timespec *, sigset_t *);
#endif
/* Work around GCC 4.7.0 bug with strict overflow checking; see

View file

@ -39,17 +39,6 @@ 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"
@ -68,6 +57,17 @@ extern int h_errno;
# include <math.h>
#endif
#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 */
#ifdef WINDOWSNT
#define read sys_read
#define write sys_write

View file

@ -25,40 +25,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
#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 *,
struct timespec *, sigset_t *);
#else /* not WINDOWSNT */
/* 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 FD_SET
#ifndef FD_SETSIZE
#define FD_SETSIZE 64

View file

@ -21,6 +21,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "regex.h"
#ifdef WINDOWSNT
#include <sys/socket.h>
#endif
#include "sysselect.h" /* FIXME */
#include "systime.h" /* FIXME */

View file

@ -42,8 +42,6 @@ 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
@ -205,6 +203,7 @@ typedef struct _REPARSE_DATA_BUFFER {
#endif
/* TCP connection support. */
#include <sys/socket.h>
#undef socket
#undef bind
#undef connect

View file

@ -25,6 +25,32 @@ 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 */