diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-08-26 21:42:11 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 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.tar.bz2 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. 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 @@ -50,3 +83,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifdef MSDOS #define pselect sys_select #endif + +#endif /* EMACS_SYSSELECT_H */ |