comparison src/process.c @ 83310:e58cb448e07c

Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 15 Jun 2005 12:57:51 +0000
parents 63b7247f4be6 d826c3c6df3f
children bdcbdec78dd3
comparison
equal deleted inserted replaced
83309:6aee1e9b0bd7 83310:e58cb448e07c
270 #ifdef ADAPTIVE_READ_BUFFERING 270 #ifdef ADAPTIVE_READ_BUFFERING
271 #define READ_OUTPUT_DELAY_INCREMENT 10000 271 #define READ_OUTPUT_DELAY_INCREMENT 10000
272 #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) 272 #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5)
273 #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) 273 #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7)
274 274
275 /* Number of processes which might be delayed. */ 275 /* Number of processes which have a non-zero read_output_delay,
276 and therefore might be delayed for adaptive read buffering. */
276 277
277 static int process_output_delay_count; 278 static int process_output_delay_count;
278 279
279 /* Non-zero if any process has non-nil process_output_skip. */ 280 /* Non-zero if any process has non-nil read_output_skip. */
280 281
281 static int process_output_skip; 282 static int process_output_skip;
282 283
283 /* Non-nil means to delay reading process output to improve buffering. 284 /* Non-nil means to delay reading process output to improve buffering.
284 A value of t means that delay is reset after each send, any other 285 A value of t means that delay is reset after each send, any other
285 non-nil value does not reset the delay. */ 286 non-nil value does not reset the delay. A value of nil disables
287 adaptive read buffering completely. */
286 static Lisp_Object Vprocess_adaptive_read_buffering; 288 static Lisp_Object Vprocess_adaptive_read_buffering;
287 #else 289 #else
288 #define process_output_delay_count 0 290 #define process_output_delay_count 0
289 #endif 291 #endif
290 292
1533 itself; it's all taken care of here. */ 1535 itself; it's all taken care of here. */
1534 record_unwind_protect (start_process_unwind, proc); 1536 record_unwind_protect (start_process_unwind, proc);
1535 1537
1536 XPROCESS (proc)->childp = Qt; 1538 XPROCESS (proc)->childp = Qt;
1537 XPROCESS (proc)->plist = Qnil; 1539 XPROCESS (proc)->plist = Qnil;
1538 XPROCESS (proc)->command_channel_p = Qnil;
1539 XPROCESS (proc)->buffer = buffer; 1540 XPROCESS (proc)->buffer = buffer;
1540 XPROCESS (proc)->sentinel = Qnil; 1541 XPROCESS (proc)->sentinel = Qnil;
1541 XPROCESS (proc)->filter = Qnil; 1542 XPROCESS (proc)->filter = Qnil;
1542 XPROCESS (proc)->filter_multibyte 1543 XPROCESS (proc)->filter_multibyte
1543 = buffer_defaults.enable_multibyte_characters; 1544 = buffer_defaults.enable_multibyte_characters;
4317 if (check_connect) 4318 if (check_connect)
4318 Connecting = connect_wait_mask; 4319 Connecting = connect_wait_mask;
4319 #endif 4320 #endif
4320 4321
4321 #ifdef ADAPTIVE_READ_BUFFERING 4322 #ifdef ADAPTIVE_READ_BUFFERING
4323 /* Set the timeout for adaptive read buffering if any
4324 process has non-nil read_output_skip and non-zero
4325 read_output_delay, and we are not reading output for a
4326 specific wait_channel. It is not executed if
4327 Vprocess_adaptive_read_buffering is nil. */
4322 if (process_output_skip && check_delay > 0) 4328 if (process_output_skip && check_delay > 0)
4323 { 4329 {
4324 int usecs = EMACS_USECS (timeout); 4330 int usecs = EMACS_USECS (timeout);
4325 if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX) 4331 if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX)
4326 usecs = READ_OUTPUT_DELAY_MAX; 4332 usecs = READ_OUTPUT_DELAY_MAX;
4327 for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++) 4333 for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++)
4328 { 4334 {
4329 proc = chan_process[channel]; 4335 proc = chan_process[channel];
4330 if (NILP (proc)) 4336 if (NILP (proc))
4331 continue; 4337 continue;
4338 /* Find minimum non-zero read_output_delay among the
4339 processes with non-nil read_output_skip. */
4332 if (XINT (XPROCESS (proc)->read_output_delay) > 0) 4340 if (XINT (XPROCESS (proc)->read_output_delay) > 0)
4333 { 4341 {
4334 check_delay--; 4342 check_delay--;
4335 if (NILP (XPROCESS (proc)->read_output_skip)) 4343 if (NILP (XPROCESS (proc)->read_output_skip))
4336 continue; 4344 continue;
4877 save the same match data in safely recursive fashion. */ 4885 save the same match data in safely recursive fashion. */
4878 if (outer_running_asynch_code) 4886 if (outer_running_asynch_code)
4879 { 4887 {
4880 Lisp_Object tem; 4888 Lisp_Object tem;
4881 /* Don't clobber the CURRENT match data, either! */ 4889 /* Don't clobber the CURRENT match data, either! */
4882 tem = Fmatch_data (Qnil, Qnil); 4890 tem = Fmatch_data (Qnil, Qnil, Qnil);
4883 restore_match_data (); 4891 restore_search_regs ();
4884 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 4892 record_unwind_save_match_data ();
4885 Fset_match_data (tem); 4893 Fset_match_data (tem, Qt);
4886 } 4894 }
4887 4895
4888 /* For speed, if a search happens within this code, 4896 /* For speed, if a search happens within this code,
4889 save the match data in a special nonrecursive fashion. */ 4897 save the match data in a special nonrecursive fashion. */
4890 running_asynch_code = 1; 4898 running_asynch_code = 1;
4934 Fcons (proc, Fcons (text, Qnil))), 4942 Fcons (proc, Fcons (text, Qnil))),
4935 !NILP (Vdebug_on_error) ? Qnil : Qerror, 4943 !NILP (Vdebug_on_error) ? Qnil : Qerror,
4936 read_process_output_error_handler); 4944 read_process_output_error_handler);
4937 4945
4938 /* If we saved the match data nonrecursively, restore it now. */ 4946 /* If we saved the match data nonrecursively, restore it now. */
4939 restore_match_data (); 4947 restore_search_regs ();
4940 running_asynch_code = outer_running_asynch_code; 4948 running_asynch_code = outer_running_asynch_code;
4941 4949
4942 /* Handling the process output should not deactivate the mark. */ 4950 /* Handling the process output should not deactivate the mark. */
4943 Vdeactivate_mark = odeactivate; 4951 Vdeactivate_mark = odeactivate;
4944 4952
6338 and we already saved the match data nonrecursively, 6346 and we already saved the match data nonrecursively,
6339 save the same match data in safely recursive fashion. */ 6347 save the same match data in safely recursive fashion. */
6340 if (outer_running_asynch_code) 6348 if (outer_running_asynch_code)
6341 { 6349 {
6342 Lisp_Object tem; 6350 Lisp_Object tem;
6343 tem = Fmatch_data (Qnil, Qnil); 6351 tem = Fmatch_data (Qnil, Qnil, Qnil);
6344 restore_match_data (); 6352 restore_search_regs ();
6345 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 6353 record_unwind_save_match_data ();
6346 Fset_match_data (tem); 6354 Fset_match_data (tem, Qt);
6347 } 6355 }
6348 6356
6349 /* For speed, if a search happens within this code, 6357 /* For speed, if a search happens within this code,
6350 save the match data in a special nonrecursive fashion. */ 6358 save the match data in a special nonrecursive fashion. */
6351 running_asynch_code = 1; 6359 running_asynch_code = 1;
6355 Fcons (proc, Fcons (reason, Qnil))), 6363 Fcons (proc, Fcons (reason, Qnil))),
6356 !NILP (Vdebug_on_error) ? Qnil : Qerror, 6364 !NILP (Vdebug_on_error) ? Qnil : Qerror,
6357 exec_sentinel_error_handler); 6365 exec_sentinel_error_handler);
6358 6366
6359 /* If we saved the match data nonrecursively, restore it now. */ 6367 /* If we saved the match data nonrecursively, restore it now. */
6360 restore_match_data (); 6368 restore_search_regs ();
6361 running_asynch_code = outer_running_asynch_code; 6369 running_asynch_code = outer_running_asynch_code;
6362 6370
6363 Vdeactivate_mark = odeactivate; 6371 Vdeactivate_mark = odeactivate;
6364 6372
6365 /* Restore waiting_for_user_input_p as it was 6373 /* Restore waiting_for_user_input_p as it was
6706 Fprovide (intern ("make-network-process"), subfeatures); 6714 Fprovide (intern ("make-network-process"), subfeatures);
6707 } 6715 }
6708 #endif /* HAVE_SOCKETS */ 6716 #endif /* HAVE_SOCKETS */
6709 6717
6710 #if defined (DARWIN) || defined (MAC_OSX) 6718 #if defined (DARWIN) || defined (MAC_OSX)
6711 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive 6719 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
6712 processes. As such, we only change the default value. */ 6720 processes. As such, we only change the default value. */
6713 if (initialized) 6721 if (initialized)
6714 { 6722 {
6715 char *release = get_operating_system_release(); 6723 char *release = get_operating_system_release();
6716 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION 6724 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
6811 #ifdef ADAPTIVE_READ_BUFFERING 6819 #ifdef ADAPTIVE_READ_BUFFERING
6812 DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, 6820 DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering,
6813 doc: /* If non-nil, improve receive buffering by delaying after short reads. 6821 doc: /* If non-nil, improve receive buffering by delaying after short reads.
6814 On some systems, when Emacs reads the output from a subprocess, the output data 6822 On some systems, when Emacs reads the output from a subprocess, the output data
6815 is read in very small blocks, potentially resulting in very poor performance. 6823 is read in very small blocks, potentially resulting in very poor performance.
6816 This behaviour can be remedied to some extent by setting this variable to a 6824 This behavior can be remedied to some extent by setting this variable to a
6817 non-nil value, as it will automatically delay reading from such processes, to 6825 non-nil value, as it will automatically delay reading from such processes, to
6818 allowing them to produce more output before Emacs tries to read it. 6826 allowing them to produce more output before Emacs tries to read it.
6819 If the value is t, the delay is reset after each write to the process; any other 6827 If the value is t, the delay is reset after each write to the process; any other
6820 non-nil value means that the delay is not reset on write. 6828 non-nil value means that the delay is not reset on write.
6821 The variable takes effect when `start-process' is called. */); 6829 The variable takes effect when `start-process' is called. */);