* 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
/* 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)
#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 */
#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"
#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>
#include "buffer.h"
#include "coding.h"
#ifdef WINDOWSNT
+#include <share.h>
+#include <sys/socket.h> /* for fcntl */
#include "w32.h" /* for dostounix_filename */
#endif
#include <unistd.h>
#include <fcntl.h>
+#include "lisp.h"
+
/* Only MS-DOS does not define `subprocesses'. */
#ifdef subprocesses
#endif /* subprocesses */
-#include "lisp.h"
-
#include "systime.h"
#include "systty.h"
#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
#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"
# 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
#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
#include "regex.h"
+#ifdef WINDOWSNT
+#include <sys/socket.h>
+#endif
+
#include "sysselect.h" /* FIXME */
#include "systime.h" /* FIXME */
#include <config.h>
#include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */
-#include <sys/socket.h>
-
#undef access
#undef chdir
#undef chmod
#endif
/* TCP connection support. */
+#include <sys/socket.h>
#undef socket
#undef bind
#undef connect
#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 */