Mercurial > emacs
comparison src/process.c @ 7486:cfe4840ffde9
(Fopen_network_stream): Call bind_polling_period; later unbind the binding.
(POLL_FOR_INPUT): Define, if appropriate.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 13 May 1994 08:31:05 +0000 |
parents | 8d9e41a175fa |
children | 53186c2698e5 |
comparison
equal
deleted
inserted
replaced
7485:a1b7f72e0ea2 | 7486:cfe4840ffde9 |
---|---|
209 #define FD_CLR(n, p) (*(p) &= ~(1 << (n))) | 209 #define FD_CLR(n, p) (*(p) &= ~(1 << (n))) |
210 #define FD_ISSET(n, p) (*(p) & (1 << (n))) | 210 #define FD_ISSET(n, p) (*(p) & (1 << (n))) |
211 #define FD_ZERO(p) (*(p) = 0) | 211 #define FD_ZERO(p) (*(p) = 0) |
212 #endif /* no FD_SET */ | 212 #endif /* no FD_SET */ |
213 | 213 |
214 /* If we support X Windows, turn on the code to poll periodically | |
215 to detect C-g. It isn't actually used when doing interrupt input. */ | |
216 #ifdef HAVE_X_WINDOWS | |
217 #define POLL_FOR_INPUT | |
218 #endif | |
219 | |
214 /* Mask of bits indicating the descriptors that we wait for input on */ | 220 /* Mask of bits indicating the descriptors that we wait for input on */ |
215 | 221 |
216 static SELECT_TYPE input_wait_mask; | 222 static SELECT_TYPE input_wait_mask; |
217 | 223 |
218 /* The largest descriptor currently in use for a process object. */ | 224 /* The largest descriptor currently in use for a process object. */ |
1483 char errstring[80]; | 1489 char errstring[80]; |
1484 int port; | 1490 int port; |
1485 struct hostent host_info_fixed; | 1491 struct hostent host_info_fixed; |
1486 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1492 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
1487 int retry = 0; | 1493 int retry = 0; |
1494 int count = specpdl_ptr - specpdl; | |
1488 | 1495 |
1489 GCPRO4 (name, buffer, host, service); | 1496 GCPRO4 (name, buffer, host, service); |
1490 CHECK_STRING (name, 0); | 1497 CHECK_STRING (name, 0); |
1491 CHECK_STRING (host, 0); | 1498 CHECK_STRING (host, 0); |
1492 if (XTYPE(service) == Lisp_Int) | 1499 if (XTYPE (service) == Lisp_Int) |
1493 port = htons ((unsigned short) XINT (service)); | 1500 port = htons ((unsigned short) XINT (service)); |
1494 else | 1501 else |
1495 { | 1502 { |
1496 CHECK_STRING (service, 0); | 1503 CHECK_STRING (service, 0); |
1497 svc_info = getservbyname (XSTRING (service)->data, "tcp"); | 1504 svc_info = getservbyname (XSTRING (service)->data, "tcp"); |
1541 which have this bug. On systems which use polling, there's no way | 1548 which have this bug. On systems which use polling, there's no way |
1542 to quit if polling is turned off. */ | 1549 to quit if polling is turned off. */ |
1543 if (interrupt_input) | 1550 if (interrupt_input) |
1544 unrequest_sigio (); | 1551 unrequest_sigio (); |
1545 | 1552 |
1553 /* Slow down polling to every ten seconds. | |
1554 Some kernels have a bug which causes retrying connect to fail | |
1555 after a connect. */ | |
1556 #ifdef POLL_FOR_INPUT | |
1557 bind_polling_period (10); | |
1558 #endif | |
1559 | |
1546 loop: | 1560 loop: |
1547 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1 | 1561 if (connect (s, (struct sockaddr *) &address, sizeof address) == -1 |
1548 && errno != EISCONN) | 1562 && errno != EISCONN) |
1549 { | 1563 { |
1550 int xerrno = errno; | 1564 int xerrno = errno; |
1564 | 1578 |
1565 errno = xerrno; | 1579 errno = xerrno; |
1566 report_file_error ("connection failed", | 1580 report_file_error ("connection failed", |
1567 Fcons (host, Fcons (name, Qnil))); | 1581 Fcons (host, Fcons (name, Qnil))); |
1568 } | 1582 } |
1583 | |
1584 #ifdef POLL_FOR_INPUT | |
1585 unbind_to (count, Qnil); | |
1586 #endif | |
1569 | 1587 |
1570 if (interrupt_input) | 1588 if (interrupt_input) |
1571 request_sigio (); | 1589 request_sigio (); |
1572 | 1590 |
1573 #else /* TERM */ | 1591 #else /* TERM */ |