aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-06-29 23:07:22 +0000
committerJim Blandy1993-06-29 23:07:22 +0000
commitc34efc6cd8222d6d5af8614f9d28650108aa9d3e (patch)
tree1ab62851f4a7454917cd4126ad1a84961d2e46b1 /src
parentddf768c3cf57a412f525b53aa30f014db963deec (diff)
downloademacs-c34efc6cd8222d6d5af8614f9d28650108aa9d3e.tar.gz
emacs-c34efc6cd8222d6d5af8614f9d28650108aa9d3e.zip
* xterm.c: Add CPP tangle from process.c to get definitions for
FD_SET, etcetera. (XTread_socket): Use those macros when testing for dropped connection.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/xterm.c b/src/xterm.c
index bc14b6ff009..e4b514c17f4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -93,6 +93,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
93/*#include <X/Xproto.h> */ 93/*#include <X/Xproto.h> */
94#endif /* ! defined (HAVE_X11) */ 94#endif /* ! defined (HAVE_X11) */
95 95
96#ifdef FD_SET
97/* We could get this from param.h, but better not to depend on finding that.
98 And better not to risk that it might define other symbols used in this
99 file. */
100#ifdef FD_SETSIZE
101#define MAXDESC FD_SETSIZE
102#else
103#define MAXDESC 64
104#endif
105#define SELECT_TYPE fd_set
106#else /* no FD_SET */
107#define MAXDESC 32
108#define SELECT_TYPE int
109
110/* Define the macros to access a single-int bitmap of descriptors. */
111#define FD_SET(n, p) (*(p) |= (1 << (n)))
112#define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
113#define FD_ISSET(n, p) (*(p) & (1 << (n)))
114#define FD_ZERO(p) (*(p) = 0)
115#endif /* no FD_SET */
116
96/* For sending Meta-characters. Do we need this? */ 117/* For sending Meta-characters. Do we need this? */
97#define METABIT 0200 118#define METABIT 0200
98 119
@@ -3274,12 +3295,12 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3274 /* AOJ 880406: if select returns true but XPending doesn't, it means that 3295 /* AOJ 880406: if select returns true but XPending doesn't, it means that
3275 there is an EOF condition; in other words, that X has died. 3296 there is an EOF condition; in other words, that X has died.
3276 Act as if there had been a hangup. */ 3297 Act as if there had been a hangup. */
3277
3278 int fd = ConnectionNumber (x_current_display); 3298 int fd = ConnectionNumber (x_current_display);
3279 int mask = 1 << fd; 3299 SELECT_TYPE mask;
3280 3300
3301 FD_SET(fd, &mask);
3281 if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, 3302 if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0,
3282 (EMACS_TIME) 0) 3303 (EMACS_TIME *) 0)
3283 && !XStuffPending ()) 3304 && !XStuffPending ())
3284 kill (getpid (), SIGHUP); 3305 kill (getpid (), SIGHUP);
3285 } 3306 }