diff options
| author | Eli Zaretskii | 2015-11-02 19:04:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-11-02 19:04:06 +0200 |
| commit | 470e3028d8a741d97349faa8fdeb148d913a49d0 (patch) | |
| tree | d194711816fd6bc66726b0917ae74ef3116f38b1 /src | |
| parent | 39372e1a1032521be74575bb06f95a3898fbae30 (diff) | |
| download | emacs-470e3028d8a741d97349faa8fdeb148d913a49d0.tar.gz emacs-470e3028d8a741d97349faa8fdeb148d913a49d0.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 6 | ||||
| -rw-r--r-- | src/emacs.c | 10 | ||||
| -rw-r--r-- | src/filelock.c | 7 | ||||
| -rw-r--r-- | src/process.c | 7 | ||||
| -rw-r--r-- | src/sysdep.c | 22 | ||||
| -rw-r--r-- | src/sysselect.h | 38 | ||||
| -rw-r--r-- | src/thread.h | 4 | ||||
| -rw-r--r-- | src/w32.c | 3 | ||||
| -rw-r--r-- | src/w32.h | 26 |
9 files changed, 58 insertions, 65 deletions
diff --git a/src/callproc.c b/src/callproc.c index a6c7bdafdba..bb21c35dccc 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -27,14 +27,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | 27 | ||
| 28 | #include <sys/file.h> | 28 | #include <sys/file.h> |
| 29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| 30 | #ifdef WINDOWSNT | ||
| 31 | #define NOMINMAX | ||
| 32 | #include <sys/socket.h> /* for fcntl */ | ||
| 33 | #endif | ||
| 34 | 30 | ||
| 35 | #include "lisp.h" | 31 | #include "lisp.h" |
| 36 | 32 | ||
| 37 | #ifdef WINDOWSNT | 33 | #ifdef WINDOWSNT |
| 34 | #define NOMINMAX | ||
| 35 | #include <sys/socket.h> /* for fcntl */ | ||
| 38 | #include <windows.h> | 36 | #include <windows.h> |
| 39 | #include "w32.h" | 37 | #include "w32.h" |
| 40 | #define _P_NOWAIT 1 /* from process.h */ | 38 | #define _P_NOWAIT 1 /* from process.h */ |
diff --git a/src/emacs.c b/src/emacs.c index 9dc4e423547..f91e5499916 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -31,20 +31,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 31 | ||
| 32 | #include <close-stream.h> | 32 | #include <close-stream.h> |
| 33 | 33 | ||
| 34 | #define MAIN_PROGRAM | ||
| 35 | #include "lisp.h" | ||
| 36 | |||
| 34 | #ifdef WINDOWSNT | 37 | #ifdef WINDOWSNT |
| 35 | #include <fcntl.h> | 38 | #include <fcntl.h> |
| 36 | #include <sys/socket.h> | 39 | #include <sys/socket.h> |
| 37 | #include <mbstring.h> | 40 | #include <mbstring.h> |
| 41 | #include "w32.h" | ||
| 38 | #include "w32heap.h" | 42 | #include "w32heap.h" |
| 39 | #endif | 43 | #endif |
| 40 | 44 | ||
| 41 | #define MAIN_PROGRAM | ||
| 42 | #include "lisp.h" | ||
| 43 | |||
| 44 | #if defined WINDOWSNT || defined HAVE_NTGUI | 45 | #if defined WINDOWSNT || defined HAVE_NTGUI |
| 45 | #ifdef WINDOWSNT | ||
| 46 | #include "w32.h" | ||
| 47 | #endif | ||
| 48 | #include "w32select.h" | 46 | #include "w32select.h" |
| 49 | #include "w32font.h" | 47 | #include "w32font.h" |
| 50 | #include "w32common.h" | 48 | #include "w32common.h" |
diff --git a/src/filelock.c b/src/filelock.c index b37319c9ae8..7f9b6e7f8e8 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -40,11 +40,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 40 | #include <sys/sysctl.h> | 40 | #include <sys/sysctl.h> |
| 41 | #endif /* __FreeBSD__ */ | 41 | #endif /* __FreeBSD__ */ |
| 42 | 42 | ||
| 43 | #ifdef WINDOWSNT | ||
| 44 | #include <share.h> | ||
| 45 | #include <sys/socket.h> /* for fcntl */ | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #include <errno.h> | 43 | #include <errno.h> |
| 49 | 44 | ||
| 50 | #include <c-ctype.h> | 45 | #include <c-ctype.h> |
| @@ -53,6 +48,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | #include "buffer.h" | 48 | #include "buffer.h" |
| 54 | #include "coding.h" | 49 | #include "coding.h" |
| 55 | #ifdef WINDOWSNT | 50 | #ifdef WINDOWSNT |
| 51 | #include <share.h> | ||
| 52 | #include <sys/socket.h> /* for fcntl */ | ||
| 56 | #include "w32.h" /* for dostounix_filename */ | 53 | #include "w32.h" /* for dostounix_filename */ |
| 57 | #endif | 54 | #endif |
| 58 | 55 | ||
diff --git a/src/process.c b/src/process.c index 791f8f5c308..5e9b687ba60 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -29,6 +29,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | #include <unistd.h> | 29 | #include <unistd.h> |
| 30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
| 31 | 31 | ||
| 32 | #include "lisp.h" | ||
| 33 | |||
| 32 | /* Only MS-DOS does not define `subprocesses'. */ | 34 | /* Only MS-DOS does not define `subprocesses'. */ |
| 33 | #ifdef subprocesses | 35 | #ifdef subprocesses |
| 34 | 36 | ||
| @@ -92,8 +94,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 92 | 94 | ||
| 93 | #endif /* subprocesses */ | 95 | #endif /* subprocesses */ |
| 94 | 96 | ||
| 95 | #include "lisp.h" | ||
| 96 | |||
| 97 | #include "systime.h" | 97 | #include "systime.h" |
| 98 | #include "systty.h" | 98 | #include "systty.h" |
| 99 | 99 | ||
| @@ -126,7 +126,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 126 | #endif | 126 | #endif |
| 127 | 127 | ||
| 128 | #ifdef WINDOWSNT | 128 | #ifdef WINDOWSNT |
| 129 | #include "w32.h" | 129 | extern int sys_select (int, fd_set *, fd_set *, fd_set *, |
| 130 | struct timespec *, sigset_t *); | ||
| 130 | #endif | 131 | #endif |
| 131 | 132 | ||
| 132 | /* Work around GCC 4.7.0 bug with strict overflow checking; see | 133 | /* Work around GCC 4.7.0 bug with strict overflow checking; see |
diff --git a/src/sysdep.c b/src/sysdep.c index ba6be57278e..d75dcd3f9e3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -39,17 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include <c-ctype.h> | 39 | #include <c-ctype.h> |
| 40 | #include <utimens.h> | 40 | #include <utimens.h> |
| 41 | 41 | ||
| 42 | #ifdef HAVE_SOCKETS | ||
| 43 | #include <sys/socket.h> | ||
| 44 | #include <netdb.h> | ||
| 45 | #endif /* HAVE_SOCKETS */ | ||
| 46 | |||
| 47 | #ifdef TRY_AGAIN | ||
| 48 | #ifndef HAVE_H_ERRNO | ||
| 49 | extern int h_errno; | ||
| 50 | #endif | ||
| 51 | #endif /* TRY_AGAIN */ | ||
| 52 | |||
| 53 | #include "lisp.h" | 42 | #include "lisp.h" |
| 54 | #include "sysselect.h" | 43 | #include "sysselect.h" |
| 55 | #include "blockinput.h" | 44 | #include "blockinput.h" |
| @@ -68,6 +57,17 @@ extern int h_errno; | |||
| 68 | # include <math.h> | 57 | # include <math.h> |
| 69 | #endif | 58 | #endif |
| 70 | 59 | ||
| 60 | #ifdef HAVE_SOCKETS | ||
| 61 | #include <sys/socket.h> | ||
| 62 | #include <netdb.h> | ||
| 63 | #endif /* HAVE_SOCKETS */ | ||
| 64 | |||
| 65 | #ifdef TRY_AGAIN | ||
| 66 | #ifndef HAVE_H_ERRNO | ||
| 67 | extern int h_errno; | ||
| 68 | #endif | ||
| 69 | #endif /* TRY_AGAIN */ | ||
| 70 | |||
| 71 | #ifdef WINDOWSNT | 71 | #ifdef WINDOWSNT |
| 72 | #define read sys_read | 72 | #define read sys_read |
| 73 | #define write sys_write | 73 | #define write sys_write |
diff --git a/src/sysselect.h b/src/sysselect.h index e0f7b4e13ee..d6c5d1c7148 100644 --- a/src/sysselect.h +++ b/src/sysselect.h | |||
| @@ -25,40 +25,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include "lisp.h" | 26 | #include "lisp.h" |
| 27 | 27 | ||
| 28 | #ifdef WINDOWSNT | 28 | /* The w32 build defines select stuff in w32.h, which is included |
| 29 | 29 | where w32 needs it, but not where sysselect.h is included. The w32 | |
| 30 | /* File descriptor set emulation. */ | 30 | definitions in w32.h are incompatible with the below. */ |
| 31 | 31 | #ifndef WINDOWSNT | |
| 32 | /* MSVC runtime library has limit of 64 descriptors by default */ | ||
| 33 | #define FD_SETSIZE 64 | ||
| 34 | typedef struct { | ||
| 35 | unsigned int bits[FD_SETSIZE / 32]; | ||
| 36 | } fd_set; | ||
| 37 | |||
| 38 | /* standard access macros */ | ||
| 39 | #define FD_SET(n, p) \ | ||
| 40 | do { \ | ||
| 41 | if ((n) < FD_SETSIZE) { \ | ||
| 42 | (p)->bits[(n)/32] |= (1 << (n)%32); \ | ||
| 43 | } \ | ||
| 44 | } while (0) | ||
| 45 | #define FD_CLR(n, p) \ | ||
| 46 | do { \ | ||
| 47 | if ((n) < FD_SETSIZE) { \ | ||
| 48 | (p)->bits[(n)/32] &= ~(1 << (n)%32); \ | ||
| 49 | } \ | ||
| 50 | } while (0) | ||
| 51 | #define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0) | ||
| 52 | #define FD_ZERO(p) memset((p), 0, sizeof(fd_set)) | ||
| 53 | |||
| 54 | #define SELECT_TYPE fd_set | ||
| 55 | |||
| 56 | #include "systime.h" | ||
| 57 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | ||
| 58 | struct timespec *, sigset_t *); | ||
| 59 | |||
| 60 | #else /* not WINDOWSNT */ | ||
| 61 | |||
| 62 | #ifdef FD_SET | 32 | #ifdef FD_SET |
| 63 | #ifndef FD_SETSIZE | 33 | #ifndef FD_SETSIZE |
| 64 | #define FD_SETSIZE 64 | 34 | #define FD_SETSIZE 64 |
diff --git a/src/thread.h b/src/thread.h index d155837ccad..91bab8284e6 100644 --- a/src/thread.h +++ b/src/thread.h | |||
| @@ -21,6 +21,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include "regex.h" | 22 | #include "regex.h" |
| 23 | 23 | ||
| 24 | #ifdef WINDOWSNT | ||
| 25 | #include <sys/socket.h> | ||
| 26 | #endif | ||
| 27 | |||
| 24 | #include "sysselect.h" /* FIXME */ | 28 | #include "sysselect.h" /* FIXME */ |
| 25 | #include "systime.h" /* FIXME */ | 29 | #include "systime.h" /* FIXME */ |
| 26 | 30 | ||
| @@ -42,8 +42,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | #include <config.h> | 42 | #include <config.h> |
| 43 | #include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ | 43 | #include <mbstring.h> /* for _mbspbrk, _mbslwr, _mbsrchr, ... */ |
| 44 | 44 | ||
| 45 | #include <sys/socket.h> | ||
| 46 | |||
| 47 | #undef access | 45 | #undef access |
| 48 | #undef chdir | 46 | #undef chdir |
| 49 | #undef chmod | 47 | #undef chmod |
| @@ -205,6 +203,7 @@ typedef struct _REPARSE_DATA_BUFFER { | |||
| 205 | #endif | 203 | #endif |
| 206 | 204 | ||
| 207 | /* TCP connection support. */ | 205 | /* TCP connection support. */ |
| 206 | #include <sys/socket.h> | ||
| 208 | #undef socket | 207 | #undef socket |
| 209 | #undef bind | 208 | #undef bind |
| 210 | #undef connect | 209 | #undef connect |
| @@ -25,6 +25,32 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include <windows.h> | 26 | #include <windows.h> |
| 27 | 27 | ||
| 28 | /* File descriptor set emulation. */ | ||
| 29 | |||
| 30 | /* MSVC runtime library has limit of 64 descriptors by default */ | ||
| 31 | #define FD_SETSIZE 64 | ||
| 32 | typedef struct { | ||
| 33 | unsigned int bits[FD_SETSIZE / 32]; | ||
| 34 | } fd_set; | ||
| 35 | |||
| 36 | /* standard access macros */ | ||
| 37 | #define FD_SET(n, p) \ | ||
| 38 | do { \ | ||
| 39 | if ((n) < FD_SETSIZE) { \ | ||
| 40 | (p)->bits[(n)/32] |= (1 << (n)%32); \ | ||
| 41 | } \ | ||
| 42 | } while (0) | ||
| 43 | #define FD_CLR(n, p) \ | ||
| 44 | do { \ | ||
| 45 | if ((n) < FD_SETSIZE) { \ | ||
| 46 | (p)->bits[(n)/32] &= ~(1 << (n)%32); \ | ||
| 47 | } \ | ||
| 48 | } while (0) | ||
| 49 | #define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0) | ||
| 50 | #define FD_ZERO(p) memset((p), 0, sizeof(fd_set)) | ||
| 51 | |||
| 52 | #define SELECT_TYPE fd_set | ||
| 53 | |||
| 28 | /* ------------------------------------------------------------------------- */ | 54 | /* ------------------------------------------------------------------------- */ |
| 29 | 55 | ||
| 30 | /* child_process.status values */ | 56 | /* child_process.status values */ |