Mercurial > emacs
diff src/process.c @ 89943:4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221
Restore deleted tagline in etc/TUTORIAL.ru
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229
Remove TeX output files from the archive
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264
Update from CVS: lispref/display.texi: emacs -> Emacs.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275
Update from CVS: man/makefile.w32-in: Revert last change
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296
Allow restarting an existing debugger session that's exited
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328
Update from CVS: src/.gdbinit (xsymbol): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345
Tweak source regexps so that building in place won't cause problems
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352
Update from CVS: lisp/flymake.el: New file.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362
Support " [...]" style defaults in minibuffer-electric-default-mode
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363
(read-number): Use canonical format for default in prompt.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368
Improve display-supports-face-attributes-p on non-ttys
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Rewrite face-differs-from-default-p
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Simplify face-differs-from-default-p; don't consider :stipple.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
(tty_supports_face_attributes_p): Ensure attributes differ from default
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
(Fdisplay_supports_face_attributes_p): Work around bootstrapping problem
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Face merging cleanups
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396
Tweak arch tagging to make build/install-in-place less annoying
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397
Work around vc-arch problems when building eshell
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399
Tweak directory permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401
More build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403
Yet more build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Jun 2004 07:56:49 +0000 |
parents | ab6b6e8cffe6 5839db7619ca |
children | b9eee0a7bef5 |
line wrap: on
line diff
--- a/src/process.c Sat May 29 02:17:09 2004 +0000 +++ b/src/process.c Mon Jun 28 07:56:49 2004 +0000 @@ -445,10 +445,11 @@ /* Return a string describing a process status list. */ -Lisp_Object -status_message (status) - Lisp_Object status; +static Lisp_Object +status_message (p) + struct Lisp_Process *p; { + Lisp_Object status = p->status; Lisp_Object symbol; int code, coredump; Lisp_Object string, string2; @@ -469,6 +470,8 @@ } else if (EQ (symbol, Qexit)) { + if (NETCONN1_P (p)) + return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n"); if (code == 0) return build_string ("finished\n"); string = Fnumber_to_string (make_number (code)); @@ -532,7 +535,7 @@ three failures in a row before deciding that we've reached the end of the ptys. */ int failed_count = 0; - + if (stat (pty_name, &stb) < 0) { failed_count++; @@ -765,6 +768,7 @@ { XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); XSETINT (XPROCESS (process)->tick, ++process_tick); + status_notify (); } else if (XINT (XPROCESS (process)->infd) >= 0) { @@ -843,7 +847,7 @@ DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, doc: /* Return the process id of PROCESS. -This is the pid of the Unix process which PROCESS uses or talks to. +This is the pid of the external process which PROCESS uses or talks to. For a network connection, this value is nil. */) (process) register Lisp_Object process; @@ -1082,7 +1086,7 @@ Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag, 2, 2, 0, doc: /* Specify if query is needed for PROCESS when Emacs is exited. -If the second argument FLAG is non-nil, emacs will query the user before +If the second argument FLAG is non-nil, Emacs will query the user before exiting if PROCESS is running. */) (process, flag) register Lisp_Object process, flag; @@ -1095,7 +1099,7 @@ DEFUN ("process-query-on-exit-flag", Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag, 1, 1, 0, - doc: /* Return the current value of query on exit flag for PROCESS. */) + doc: /* Return the current value of query-on-exit flag for PROCESS. */) (process) register Lisp_Object process; { @@ -1458,12 +1462,12 @@ DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, doc: /* Start a program in a subprocess. Return the process object for it. NAME is name for process. It is modified if necessary to make it unique. -BUFFER is the buffer or (buffer-name) to associate with the process. +BUFFER is the buffer (or buffer name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated with any buffer. -Third arg is program file name. It is searched for in PATH. +PROGRAM is the program file name. It is searched for in PATH. Remaining arguments are strings to give program as arguments. usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) @@ -2609,7 +2613,7 @@ a blocking connect (i.e. wait) for stream type connections. :noquery BOOL -- Query the user unless BOOL is non-nil, and process is -running when emacs is exited. +running when Emacs is exited. :stop BOOL -- Start process in the `stopped' state if BOOL non-nil. In the stopped state, a server process does not accept new @@ -2955,7 +2959,7 @@ struct hostent *host_info_ptr; /* gethostbyname may fail with TRY_AGAIN, but we don't honour that, - as it may `hang' emacs for a very long time. */ + as it may `hang' Emacs for a very long time. */ immediate_quit = 1; QUIT; host_info_ptr = gethostbyname (SDATA (host)); @@ -3616,6 +3620,8 @@ #endif #endif /* HAVE_SOCKETS */ +/* Turn off input and output for process PROC. */ + void deactivate_process (proc) Lisp_Object proc; @@ -3635,7 +3641,7 @@ p->read_output_skip = Qnil; } #endif - + if (inchannel >= 0) { /* Beware SIGCHLD hereabouts. */ @@ -3965,7 +3971,7 @@ /* This variable is different from waiting_for_input in keyboard.c. It is used to communicate to a lisp process-filter/sentinel (via the - function Fwaiting_for_user_input_p below) whether emacs was waiting + function Fwaiting_for_user_input_p below) whether Emacs was waiting for user-input when that process-filter was called. waiting_for_input cannot be used as that is by definition 0 when lisp code is being evalled. @@ -4019,8 +4025,8 @@ int do_display; { register int channel, nfds; - static SELECT_TYPE Available; - static SELECT_TYPE Connecting; + SELECT_TYPE Available; + SELECT_TYPE Connecting; int check_connect, check_delay, no_avail; int xerrno; Lisp_Object proc; @@ -4031,6 +4037,7 @@ /* Either nil or a cons cell, the car of which is of interest and may be changed outside of this routine. */ Lisp_Object wait_for_cell = Qnil; + int saved_waiting_for_user_input_p = waiting_for_user_input_p; FD_ZERO (&Available); FD_ZERO (&Connecting); @@ -4581,7 +4588,8 @@ } } #ifdef NON_BLOCKING_CONNECT - if (check_connect && FD_ISSET (channel, &Connecting)) + if (check_connect && FD_ISSET (channel, &Connecting) + && FD_ISSET (channel, &connect_wait_mask)) { struct Lisp_Process *p; @@ -4644,7 +4652,7 @@ } /* end for each file descriptor */ } /* end while exit conditions not met */ - waiting_for_user_input_p = 0; + waiting_for_user_input_p = saved_waiting_for_user_input_p; /* If calling from keyboard input, do not quit since we want to return C-g as an input character. @@ -4691,7 +4699,7 @@ starting with our buffered-ahead character if we have one. Yield number of decoded characters read. - This function reads at most 1024 characters. + This function reads at most 4096 characters. If you want to read all available subprocess output, you must call it repeatedly until it returns zero. @@ -4711,7 +4719,7 @@ register int opoint; struct coding_system *coding = proc_decode_coding_system[channel]; int carryover = XINT (p->decoding_carryover); - int readmax = 1024; + int readmax = 4096; #ifdef VMS VMS_PROC_STUFF *vs, *get_vms_process_pointer(); @@ -4744,16 +4752,6 @@ } #else /* not VMS */ -#ifdef DATAGRAM_SOCKETS - /* A datagram is one packet; allow at least 1500+ bytes of data - corresponding to the typical Ethernet frame size. */ - if (DATAGRAM_CHAN_P (channel)) - { - /* carryover = 0; */ /* Does carryover make sense for datagrams? */ - readmax += 1024; - } -#endif - chars = (char *) alloca (carryover + readmax); if (carryover) /* See the comment above. */ @@ -5069,7 +5067,7 @@ DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, 0, 0, 0, - doc: /* Returns non-nil if emacs is waiting for input from the user. + doc: /* Returns non-nil if Emacs is waiting for input from the user. This is intended for use by asynchronous process output filters and sentinels. */) () { @@ -5446,7 +5444,7 @@ { int gid = -1; -#ifdef TIOCGPGRP +#ifdef TIOCGPGRP if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) { int fd; @@ -5643,7 +5641,7 @@ we should just assume that p->pid is also the process group id. */ gid = emacs_get_tty_pgrp (p); - + if (gid == -1) /* If we can't get the information, assume the shell owns the tty. */ @@ -5726,7 +5724,7 @@ DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, doc: /* Interrupt process PROCESS. PROCESS may be a process, a buffer, or the name of a process or buffer. -nil or no arg means current buffer's process. +No arg or nil means current buffer's process. Second arg CURRENT-GROUP non-nil means send signal to the current process-group of the process's controlling terminal rather than to the process's own process group. @@ -6385,7 +6383,7 @@ /* Get the text to use for the message. */ if (!NILP (p->raw_status_low)) update_status (p); - msg = status_message (p->status); + msg = status_message (p); /* If process is terminated, deactivate it or delete it. */ symbol = p->status; @@ -6471,13 +6469,13 @@ doc: /* Set coding systems of PROCESS to DECODING and ENCODING. DECODING will be used to decode subprocess output and ENCODING to encode subprocess input. */) - (proc, decoding, encoding) - register Lisp_Object proc, decoding, encoding; + (process, decoding, encoding) + register Lisp_Object process, decoding, encoding; { register struct Lisp_Process *p; - CHECK_PROCESS (proc); - p = XPROCESS (proc); + CHECK_PROCESS (process); + p = XPROCESS (process); if (XINT (p->infd) < 0) error ("Input file descriptor of %s closed", SDATA (p->name)); if (XINT (p->outfd) < 0) @@ -6487,7 +6485,7 @@ p->decode_coding_system = decoding; p->encode_coding_system = encoding; - setup_process_coding_systems (proc); + setup_process_coding_systems (process); return Qnil; } @@ -6495,12 +6493,12 @@ DEFUN ("process-coding-system", Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0, doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */) - (proc) - register Lisp_Object proc; + (process) + register Lisp_Object process; { - CHECK_PROCESS (proc); - return Fcons (XPROCESS (proc)->decode_coding_system, - XPROCESS (proc)->encode_coding_system); + CHECK_PROCESS (process); + return Fcons (XPROCESS (process)->decode_coding_system, + XPROCESS (process)->encode_coding_system); } DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte, @@ -6510,15 +6508,15 @@ If FLAG is nil, the filter is given unibyte strings. In this case, all character code conversion except for end-of-line conversion is suppressed. */) - (proc, flag) - Lisp_Object proc, flag; + (process, flag) + Lisp_Object process, flag; { register struct Lisp_Process *p; - CHECK_PROCESS (proc); - p = XPROCESS (proc); + CHECK_PROCESS (process); + p = XPROCESS (process); p->filter_multibyte = flag; - setup_process_coding_systems (proc); + setup_process_coding_systems (process); return Qnil; } @@ -6526,13 +6524,13 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, Sprocess_filter_multibyte_p, 1, 1, 0, doc: /* Return t if a multibyte string is given to PROCESS's filter.*/) - (proc) - Lisp_Object proc; + (process) + Lisp_Object process; { register struct Lisp_Process *p; - CHECK_PROCESS (proc); - p = XPROCESS (proc); + CHECK_PROCESS (process); + p = XPROCESS (process); return (NILP (p->filter_multibyte) ? Qnil : Qt); } @@ -6753,11 +6751,11 @@ #ifdef ADAPTIVE_READ_BUFFERING DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, doc: /* If non-nil, improve receive buffering by delaying after short reads. -On some systems, when emacs reads the output from a subprocess, the output data +On some systems, when Emacs reads the output from a subprocess, the output data is read in very small blocks, potentially resulting in very poor performance. This behaviour can be remedied to some extent by setting this variable to a non-nil value, as it will automatically delay reading from such processes, to -allowing them to produce more output before emacs tries to read it. +allowing them to produce more output before Emacs tries to read it. If the value is t, the delay is reset after each write to the process; any other non-nil value means that the delay is not reset on write. The variable takes effect when `start-process' is called. */);