diff options
| author | Eli Zaretskii | 2013-08-26 21:42:11 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-08-26 21:42:11 +0300 |
| commit | 6e9fb70cdf763da6d264932f14f5a67d354ec38d (patch) | |
| tree | 8c9ecd47a5078c8b1c20662853a095523a7b1989 /src/sysselect.h | |
| parent | c160274456eb7bb09776b888f5274933f2ec2399 (diff) | |
| download | emacs-6e9fb70cdf763da6d264932f14f5a67d354ec38d.tar.gz emacs-6e9fb70cdf763da6d264932f14f5a67d354ec38d.zip | |
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.
Diffstat (limited to 'src/sysselect.h')
| -rw-r--r-- | src/sysselect.h | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/src/sysselect.h b/src/sysselect.h index 0a4f7e3ad96..244f0f7c067 100644 --- a/src/sysselect.h +++ b/src/sysselect.h | |||
| @@ -16,14 +16,47 @@ GNU General Public License for more details. | |||
| 16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 | ||
| 19 | #ifndef EMACS_SYSSELECT_H | ||
| 20 | #define EMACS_SYSSELECT_H | ||
| 21 | |||
| 19 | #ifndef DOS_NT | 22 | #ifndef DOS_NT |
| 20 | #include <sys/select.h> | 23 | #include <sys/select.h> |
| 21 | #endif | 24 | #endif |
| 22 | 25 | ||
| 23 | /* The w32 build defines select stuff in w32.h, which is included | 26 | #ifdef WINDOWSNT |
| 24 | where w32 needs it, but not where sysselect.h is included. The w32 | 27 | |
| 25 | definitions in w32.h are incompatible with the below. */ | 28 | /* File descriptor set emulation. */ |
| 26 | #ifndef WINDOWSNT | 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 | |||
| 54 | #include "systime.h" | ||
| 55 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | ||
| 56 | EMACS_TIME *, sigset_t *); | ||
| 57 | |||
| 58 | #else /* not WINDOWSNT */ | ||
| 59 | |||
| 27 | #ifdef FD_SET | 60 | #ifdef FD_SET |
| 28 | #ifdef FD_SETSIZE | 61 | #ifdef FD_SETSIZE |
| 29 | #define MAXDESC FD_SETSIZE | 62 | #define MAXDESC FD_SETSIZE |
| @@ -50,3 +83,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 50 | #ifdef MSDOS | 83 | #ifdef MSDOS |
| 51 | #define pselect sys_select | 84 | #define pselect sys_select |
| 52 | #endif | 85 | #endif |
| 86 | |||
| 87 | #endif /* EMACS_SYSSELECT_H */ | ||