diff options
| author | Richard M. Stallman | 1994-03-02 22:50:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-02 22:50:31 +0000 |
| commit | 93b4f6997403fdc595168871276bee651c8c07c6 (patch) | |
| tree | e24494d2b7d657c7b63188f8430123f7cc8a160a /src | |
| parent | 7a8cc3071ee4a5085c7fedb97a479da9ef9ed03d (diff) | |
| download | emacs-93b4f6997403fdc595168871276bee651c8c07c6.tar.gz emacs-93b4f6997403fdc595168871276bee651c8c07c6.zip | |
Include unistd.h.
(pty_max_bytes): New variable.
(send_process): Send an eof after each pty_max_bytes bytes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c index 6512da71df3..18b9947e0b4 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -38,6 +38,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 38 | #include <sys/types.h> /* some typedefs are used in sys/file.h */ | 38 | #include <sys/types.h> /* some typedefs are used in sys/file.h */ |
| 39 | #include <sys/file.h> | 39 | #include <sys/file.h> |
| 40 | #include <sys/stat.h> | 40 | #include <sys/stat.h> |
| 41 | #ifdef HAVE_UNISTD_H | ||
| 42 | #include <unistd.h> | ||
| 43 | #endif | ||
| 41 | 44 | ||
| 42 | #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ | 45 | #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ |
| 43 | #include <sys/socket.h> | 46 | #include <sys/socket.h> |
| @@ -233,6 +236,9 @@ static Lisp_Object Vprocess_alist; | |||
| 233 | static int proc_buffered_char[MAXDESC]; | 236 | static int proc_buffered_char[MAXDESC]; |
| 234 | 237 | ||
| 235 | static Lisp_Object get_process (); | 238 | static Lisp_Object get_process (); |
| 239 | |||
| 240 | /* Maximum number of bytes to send to a pty without an eof. */ | ||
| 241 | static int pty_max_bytes; | ||
| 236 | 242 | ||
| 237 | /* Compute the Lisp form of the process status, p->status, from | 243 | /* Compute the Lisp form of the process status, p->status, from |
| 238 | the numeric status that was returned by `wait'. */ | 244 | the numeric status that was returned by `wait'. */ |
| @@ -2249,12 +2255,31 @@ send_process (proc, buf, len) | |||
| 2249 | { | 2255 | { |
| 2250 | int this = len; | 2256 | int this = len; |
| 2251 | SIGTYPE (*old_sigpipe)(); | 2257 | SIGTYPE (*old_sigpipe)(); |
| 2258 | int flush_pty = 0; | ||
| 2259 | |||
| 2260 | if (pty_max_bytes == 0) | ||
| 2261 | { | ||
| 2262 | #ifdef _PC_MAX_CANON | ||
| 2263 | pty_max_bytes = fpathconf (XFASTINT (XPROCESS (proc)->outfd), | ||
| 2264 | _PC_MAX_CANON); | ||
| 2265 | #else | ||
| 2266 | pty_max_bytes = 250; | ||
| 2267 | #endif | ||
| 2268 | } | ||
| 2269 | |||
| 2270 | /* Don't send more than pty_max_bytes bytes at a time. */ | ||
| 2271 | /* Subtract 1 to leave room for the EOF. */ | ||
| 2272 | if (this >= pty_max_bytes && XPROCESS (proc)->pty_flag != 0) | ||
| 2273 | this = pty_max_bytes - 1; | ||
| 2252 | 2274 | ||
| 2253 | /* Don't send more than 500 bytes at a time. */ | ||
| 2254 | if (this > 500) | ||
| 2255 | this = 500; | ||
| 2256 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); | 2275 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); |
| 2257 | rv = write (XINT (XPROCESS (proc)->outfd), buf, this); | 2276 | rv = write (XINT (XPROCESS (proc)->outfd), buf, this); |
| 2277 | |||
| 2278 | /* If we sent just part of the string, put in an EOF | ||
| 2279 | to force it through, before we send the rest. */ | ||
| 2280 | if (this < len) | ||
| 2281 | Fprocess_send_eof (proc); | ||
| 2282 | |||
| 2258 | signal (SIGPIPE, old_sigpipe); | 2283 | signal (SIGPIPE, old_sigpipe); |
| 2259 | if (rv < 0) | 2284 | if (rv < 0) |
| 2260 | { | 2285 | { |