diff options
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 317669d6a1a..a86e7c5f8e4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7041,40 +7041,22 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7041 | 7041 | ||
| 7042 | /* Now read; for one reason or another, this will not block. | 7042 | /* Now read; for one reason or another, this will not block. |
| 7043 | NREAD is set to the number of chars read. */ | 7043 | NREAD is set to the number of chars read. */ |
| 7044 | do | 7044 | nread = emacs_read (fileno (tty->input), (char *) cbuf, n_to_read); |
| 7045 | { | 7045 | /* POSIX infers that processes which are not in the session leader's |
| 7046 | nread = emacs_read (fileno (tty->input), (char *) cbuf, n_to_read); | 7046 | process group won't get SIGHUPs at logout time. BSDI adheres to |
| 7047 | /* POSIX infers that processes which are not in the session leader's | 7047 | this part standard and returns -1 from read (0) with errno==EIO |
| 7048 | process group won't get SIGHUPs at logout time. BSDI adheres to | 7048 | when the control tty is taken away. |
| 7049 | this part standard and returns -1 from read (0) with errno==EIO | 7049 | Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ |
| 7050 | when the control tty is taken away. | 7050 | if (nread == -1 && errno == EIO) |
| 7051 | Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ | 7051 | return -2; /* Close this terminal. */ |
| 7052 | if (nread == -1 && errno == EIO) | 7052 | #if defined AIX && defined _BSD |
| 7053 | return -2; /* Close this terminal. */ | 7053 | /* The kernel sometimes fails to deliver SIGHUP for ptys. |
| 7054 | #if defined (AIX) && defined (_BSD) | 7054 | This looks incorrect, but it isn't, because _BSD causes |
| 7055 | /* The kernel sometimes fails to deliver SIGHUP for ptys. | 7055 | O_NDELAY to be defined in fcntl.h as O_NONBLOCK, |
| 7056 | This looks incorrect, but it isn't, because _BSD causes | 7056 | and that causes a value other than 0 when there is no input. */ |
| 7057 | O_NDELAY to be defined in fcntl.h as O_NONBLOCK, | 7057 | if (nread == 0) |
| 7058 | and that causes a value other than 0 when there is no input. */ | 7058 | return -2; /* Close this terminal. */ |
| 7059 | if (nread == 0) | ||
| 7060 | return -2; /* Close this terminal. */ | ||
| 7061 | #endif | ||
| 7062 | } | ||
| 7063 | while ( | ||
| 7064 | /* We used to retry the read if it was interrupted. | ||
| 7065 | But this does the wrong thing when O_NONBLOCK causes | ||
| 7066 | an EAGAIN error. Does anybody know of a situation | ||
| 7067 | where a retry is actually needed? */ | ||
| 7068 | #if 0 | ||
| 7069 | nread < 0 && (errno == EAGAIN || errno == EFAULT | ||
| 7070 | #ifdef EBADSLT | ||
| 7071 | || errno == EBADSLT | ||
| 7072 | #endif | ||
| 7073 | ) | ||
| 7074 | #else | ||
| 7075 | 0 | ||
| 7076 | #endif | 7059 | #endif |
| 7077 | ); | ||
| 7078 | 7060 | ||
| 7079 | #ifndef USABLE_FIONREAD | 7061 | #ifndef USABLE_FIONREAD |
| 7080 | #if defined (USG) || defined (CYGWIN) | 7062 | #if defined (USG) || defined (CYGWIN) |