diff options
| author | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
|---|---|---|
| committer | Ken Raeburn | 2015-11-01 01:42:21 -0400 |
| commit | 39372e1a1032521be74575bb06f95a3898fbae30 (patch) | |
| tree | 754bd242a23d2358ea116126fcb0a629947bd9ec /src/sysselect.h | |
| parent | 6a3121904d76e3b2f63007341d48c5c1af55de80 (diff) | |
| parent | e11aaee266da52937a3a031cb108fe13f68958c3 (diff) | |
| download | emacs-39372e1a1032521be74575bb06f95a3898fbae30.tar.gz emacs-39372e1a1032521be74575bb06f95a3898fbae30.zip | |
merge from trunk
Diffstat (limited to 'src/sysselect.h')
| -rw-r--r-- | src/sysselect.h | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/src/sysselect.h b/src/sysselect.h index 244f0f7c067..e0f7b4e13ee 100644 --- a/src/sysselect.h +++ b/src/sysselect.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* sysselect.h - System-dependent definitions for the select function. | 1 | /* sysselect.h - System-dependent definitions for the select function. |
| 2 | Copyright (C) 1995, 2001-2013 Free Software Foundation, Inc. | 2 | Copyright (C) 1995, 2001-2015 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -16,13 +16,15 @@ 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 | 19 | #ifndef SYSSELECT_H |
| 20 | #define EMACS_SYSSELECT_H | 20 | #define SYSSELECT_H 1 |
| 21 | 21 | ||
| 22 | #ifndef DOS_NT | 22 | #ifndef DOS_NT |
| 23 | #include <sys/select.h> | 23 | #include <sys/select.h> |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #include "lisp.h" | ||
| 27 | |||
| 26 | #ifdef WINDOWSNT | 28 | #ifdef WINDOWSNT |
| 27 | 29 | ||
| 28 | /* File descriptor set emulation. */ | 30 | /* File descriptor set emulation. */ |
| @@ -53,20 +55,17 @@ typedef struct { | |||
| 53 | 55 | ||
| 54 | #include "systime.h" | 56 | #include "systime.h" |
| 55 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | 57 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, |
| 56 | EMACS_TIME *, sigset_t *); | 58 | struct timespec *, sigset_t *); |
| 57 | 59 | ||
| 58 | #else /* not WINDOWSNT */ | 60 | #else /* not WINDOWSNT */ |
| 59 | 61 | ||
| 60 | #ifdef FD_SET | 62 | #ifdef FD_SET |
| 61 | #ifdef FD_SETSIZE | 63 | #ifndef FD_SETSIZE |
| 62 | #define MAXDESC FD_SETSIZE | 64 | #define FD_SETSIZE 64 |
| 63 | #else | ||
| 64 | #define MAXDESC 64 | ||
| 65 | #endif | 65 | #endif |
| 66 | #define SELECT_TYPE fd_set | ||
| 67 | #else /* no FD_SET */ | 66 | #else /* no FD_SET */ |
| 68 | #define MAXDESC 32 | 67 | #define FD_SETSIZE 32 |
| 69 | #define SELECT_TYPE int | 68 | typedef int fd_set; |
| 70 | 69 | ||
| 71 | /* Define the macros to access a single-int bitmap of descriptors. */ | 70 | /* Define the macros to access a single-int bitmap of descriptors. */ |
| 72 | #define FD_SET(n, p) (*(p) |= (1 << (n))) | 71 | #define FD_SET(n, p) (*(p) |= (1 << (n))) |
| @@ -84,4 +83,41 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | |||
| 84 | #define pselect sys_select | 83 | #define pselect sys_select |
| 85 | #endif | 84 | #endif |
| 86 | 85 | ||
| 87 | #endif /* EMACS_SYSSELECT_H */ | 86 | #ifndef WINDOWSNT |
| 87 | INLINE_HEADER_BEGIN | ||
| 88 | |||
| 89 | /* Check for out-of-range errors if ENABLE_CHECKING is defined. */ | ||
| 90 | |||
| 91 | INLINE void | ||
| 92 | fd_CLR (int fd, fd_set *set) | ||
| 93 | { | ||
| 94 | eassume (0 <= fd && fd < FD_SETSIZE); | ||
| 95 | FD_CLR (fd, set); | ||
| 96 | } | ||
| 97 | |||
| 98 | INLINE bool | ||
| 99 | fd_ISSET (int fd, fd_set *set) | ||
| 100 | { | ||
| 101 | eassume (0 <= fd && fd < FD_SETSIZE); | ||
| 102 | return FD_ISSET (fd, set) != 0; | ||
| 103 | } | ||
| 104 | |||
| 105 | INLINE void | ||
| 106 | fd_SET (int fd, fd_set *set) | ||
| 107 | { | ||
| 108 | eassume (0 <= fd && fd < FD_SETSIZE); | ||
| 109 | FD_SET (fd, set); | ||
| 110 | } | ||
| 111 | |||
| 112 | #undef FD_CLR | ||
| 113 | #undef FD_ISSET | ||
| 114 | #undef FD_SET | ||
| 115 | #define FD_CLR(fd, set) fd_CLR (fd, set) | ||
| 116 | #define FD_ISSET(fd, set) fd_ISSET (fd, set) | ||
| 117 | #define FD_SET(fd, set) fd_SET (fd, set) | ||
| 118 | |||
| 119 | INLINE_HEADER_END | ||
| 120 | |||
| 121 | #endif /* !WINDOWSNT */ | ||
| 122 | |||
| 123 | #endif | ||