+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
#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
/* 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)
+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
#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>
-#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"
#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 "coding.h"
#include "systime.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
-extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
- EMACS_TIME *, void *);
+#include "w32.h"
#endif
#ifndef SOCK_CLOEXEC
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
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)
{
#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"
#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>
}
#endif /* HAVE_PTYS */
\f
-#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)
{
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
#ifdef MSDOS
#define pselect sys_select
#endif
+
+#endif /* EMACS_SYSSELECT_H */
#include <config.h>
#include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */
+#include <sys/socket.h>
+
#undef access
#undef chdir
#undef chmod
#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
#endif
/* TCP connection support. */
-#include <sys/socket.h>
#undef socket
#undef bind
#undef connect
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);
#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 */
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;