Mercurial > emacs
comparison src/process.c @ 624:2bb7f23b7ea5
*** empty log message ***
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Fri, 01 May 1992 06:20:46 +0000 |
| parents | eca8812e61cd |
| children | 40b255f55df3 |
comparison
equal
deleted
inserted
replaced
| 623:347a8db13650 | 624:2bb7f23b7ea5 |
|---|---|
| 106 #include "buffer.h" | 106 #include "buffer.h" |
| 107 #include "process.h" | 107 #include "process.h" |
| 108 #include "termhooks.h" | 108 #include "termhooks.h" |
| 109 #include "termopts.h" | 109 #include "termopts.h" |
| 110 #include "commands.h" | 110 #include "commands.h" |
| 111 | 111 #include "dispextern.h" |
| 112 extern int screen_garbaged; | |
| 113 | 112 |
| 114 Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed; | 113 Lisp_Object Qrun, Qstop, Qsignal, Qopen, Qclosed; |
| 115 /* Qexit is declared and initialized in eval.c. */ | 114 /* Qexit is declared and initialized in eval.c. */ |
| 116 | 115 |
| 117 /* a process object is a network connection when its childp field is neither | 116 /* a process object is a network connection when its childp field is neither |
| 417 { | 416 { |
| 418 struct stat stb; | 417 struct stat stb; |
| 419 register c, i; | 418 register c, i; |
| 420 int fd; | 419 int fd; |
| 421 | 420 |
| 421 /* Some systems name their pseudoterminals so that there are gaps in | |
| 422 the usual sequence - for example, on HP9000/S700 systems, there | |
| 423 are no pseudoterminals with names ending in 'f'. So we wait for | |
| 424 three failures in a row before deciding that we've reached the | |
| 425 end of the ptys. */ | |
| 426 int failed_count = 0; | |
| 427 | |
| 422 #ifdef PTY_ITERATION | 428 #ifdef PTY_ITERATION |
| 423 PTY_ITERATION | 429 PTY_ITERATION |
| 424 #else | 430 #else |
| 425 for (c = FIRST_PTY_LETTER; c <= 'z'; c++) | 431 for (c = FIRST_PTY_LETTER; c <= 'z'; c++) |
| 426 for (i = 0; i < 16; i++) | 432 for (i = 0; i < 16; i++) |
| 438 sprintf (pty_name, "/dev/pty%c%x", c, i); | 444 sprintf (pty_name, "/dev/pty%c%x", c, i); |
| 439 #endif /* not RTU */ | 445 #endif /* not RTU */ |
| 440 #endif /* not HPUX */ | 446 #endif /* not HPUX */ |
| 441 #endif /* no PTY_NAME_SPRINTF */ | 447 #endif /* no PTY_NAME_SPRINTF */ |
| 442 | 448 |
| 443 #ifndef IRIS | 449 #ifdef IRIS |
| 444 if (stat (pty_name, &stb) < 0) | 450 /* Unusual IRIS code */ |
| 445 return -1; | |
| 446 #ifdef O_NONBLOCK | |
| 447 fd = open (pty_name, O_RDWR | O_NONBLOCK, 0); | |
| 448 #else | |
| 449 fd = open (pty_name, O_RDWR | O_NDELAY, 0); | |
| 450 #endif | |
| 451 #else /* Unusual IRIS code */ | |
| 452 *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0); | 451 *ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0); |
| 453 if (fd < 0) | 452 if (fd < 0) |
| 454 return -1; | 453 return -1; |
| 455 if (fstat (fd, &stb) < 0) | 454 if (fstat (fd, &stb) < 0) |
| 456 return -1; | 455 return -1; |
| 456 #else | |
| 457 if (stat (pty_name, &stb) < 0) | |
| 458 { | |
| 459 failed_count++; | |
| 460 if (failed_count >= 3) | |
| 461 return -1; | |
| 462 } | |
| 463 else | |
| 464 failed_count = 0; | |
| 465 #ifdef O_NONBLOCK | |
| 466 fd = open (pty_name, O_RDWR | O_NONBLOCK, 0); | |
| 467 #else | |
| 468 fd = open (pty_name, O_RDWR | O_NDELAY, 0); | |
| 469 #endif | |
| 457 #endif /* IRIS */ | 470 #endif /* IRIS */ |
| 458 | 471 |
| 459 if (fd >= 0) | 472 if (fd >= 0) |
| 460 { | 473 { |
| 461 /* check to make certain that both sides are available | 474 /* check to make certain that both sides are available |
| 1740 | 1753 |
| 1741 Available = input_wait_mask; | 1754 Available = input_wait_mask; |
| 1742 if (!read_kbd) | 1755 if (!read_kbd) |
| 1743 FD_CLR (0, &Available); | 1756 FD_CLR (0, &Available); |
| 1744 | 1757 |
| 1745 /* If a screen has been newly mapped and needs updating, | |
| 1746 reprocess its display stuff. */ | |
| 1747 if (screen_garbaged) | |
| 1748 redisplay_preserve_echo_area (); | |
| 1749 | |
| 1750 if (read_kbd && detect_input_pending ()) | 1758 if (read_kbd && detect_input_pending ()) |
| 1751 nfds = 0; | 1759 nfds = 0; |
| 1752 else | 1760 else |
| 1753 nfds = select (MAXDESC, &Available, 0, 0, &timeout); | 1761 nfds = select (MAXDESC, &Available, 0, 0, &timeout); |
| 1754 | 1762 |
| 1826 } | 1834 } |
| 1827 #endif vipc | 1835 #endif vipc |
| 1828 | 1836 |
| 1829 if (! wait_proc) | 1837 if (! wait_proc) |
| 1830 got_some_input |= nfds > 0; | 1838 got_some_input |= nfds > 0; |
| 1839 | |
| 1840 /* If checking input just got us a size-change event from X, | |
| 1841 obey it now if we should. */ | |
| 1842 if (read_kbd) | |
| 1843 do_pending_window_change (); | |
| 1844 | |
| 1845 /* If screen size has changed, redisplay now | |
| 1846 for either sit-for or keyboard input. */ | |
| 1847 if (read_kbd && screen_garbaged) | |
| 1848 redisplay_preserve_echo_area (); | |
| 1831 | 1849 |
| 1832 /* Check for data from a process or a command channel */ | 1850 /* Check for data from a process or a command channel */ |
| 1833 for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++) | 1851 for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++) |
| 1834 { | 1852 { |
| 1835 if (FD_ISSET (channel, &Available)) | 1853 if (FD_ISSET (channel, &Available)) |
