aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorMiles Bader2005-08-26 09:51:52 +0000
committerMiles Bader2005-08-26 09:51:52 +0000
commitd4cccb140682cfa548a8658f905764ceb4a38cb2 (patch)
tree5230af18ee25b37efed50fa38cac1eefb47d03fc /src/process.c
parent5e10f34207ff594cd6570928bc0292a7b53297b8 (diff)
parentf3f01d5df3156fb408b43da0c670796c37ed084f (diff)
downloademacs-d4cccb140682cfa548a8658f905764ceb4a38cb2.tar.gz
emacs-d4cccb140682cfa548a8658f905764ceb4a38cb2.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-78
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 514-518) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 104-105) - Update from CVS
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c70
1 files changed, 40 insertions, 30 deletions
diff --git a/src/process.c b/src/process.c
index 1890a2a0893..a7ef9c36589 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1,6 +1,7 @@
1/* Asynchronous subprocess control for GNU Emacs. 1/* Asynchronous subprocess control for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1998, 1999, 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995,
3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3 1996, 1998, 1999, 2001, 2002, 2003, 2004,
4 2005 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -293,7 +294,10 @@ static Lisp_Object Vprocess_adaptive_read_buffering;
293 294
294#include "sysselect.h" 295#include "sysselect.h"
295 296
296extern int keyboard_bit_set P_ ((SELECT_TYPE *)); 297static int keyboard_bit_set P_ ((SELECT_TYPE *));
298static void deactivate_process P_ ((Lisp_Object));
299static void status_notify P_ ((struct Lisp_Process *));
300static int read_process_output P_ ((Lisp_Object, int));
297 301
298/* If we support a window system, turn on the code to poll periodically 302/* If we support a window system, turn on the code to poll periodically
299 to detect C-g. It isn't actually used when doing interrupt input. */ 303 to detect C-g. It isn't actually used when doing interrupt input. */
@@ -390,9 +394,9 @@ static char pty_name[24];
390/* Compute the Lisp form of the process status, p->status, from 394/* Compute the Lisp form of the process status, p->status, from
391 the numeric status that was returned by `wait'. */ 395 the numeric status that was returned by `wait'. */
392 396
393Lisp_Object status_convert (); 397static Lisp_Object status_convert ();
394 398
395void 399static void
396update_status (p) 400update_status (p)
397 struct Lisp_Process *p; 401 struct Lisp_Process *p;
398{ 402{
@@ -406,7 +410,7 @@ update_status (p)
406/* Convert a process status word in Unix format to 410/* Convert a process status word in Unix format to
407 the list that we use internally. */ 411 the list that we use internally. */
408 412
409Lisp_Object 413static Lisp_Object
410status_convert (w) 414status_convert (w)
411 WAITTYPE w; 415 WAITTYPE w;
412{ 416{
@@ -425,7 +429,7 @@ status_convert (w)
425/* Given a status-list, extract the three pieces of information 429/* Given a status-list, extract the three pieces of information
426 and store them individually through the three pointers. */ 430 and store them individually through the three pointers. */
427 431
428void 432static void
429decode_status (l, symbol, code, coredump) 433decode_status (l, symbol, code, coredump)
430 Lisp_Object l; 434 Lisp_Object l;
431 Lisp_Object *symbol; 435 Lisp_Object *symbol;
@@ -504,7 +508,7 @@ status_message (p)
504 The file name of the terminal corresponding to the pty 508 The file name of the terminal corresponding to the pty
505 is left in the variable pty_name. */ 509 is left in the variable pty_name. */
506 510
507int 511static int
508allocate_pty () 512allocate_pty ()
509{ 513{
510 register int c, i; 514 register int c, i;
@@ -589,7 +593,7 @@ allocate_pty ()
589} 593}
590#endif /* HAVE_PTYS */ 594#endif /* HAVE_PTYS */
591 595
592Lisp_Object 596static Lisp_Object
593make_process (name) 597make_process (name)
594 Lisp_Object name; 598 Lisp_Object name;
595{ 599{
@@ -633,7 +637,7 @@ make_process (name)
633 return val; 637 return val;
634} 638}
635 639
636void 640static void
637remove_process (proc) 641remove_process (proc)
638 register Lisp_Object proc; 642 register Lisp_Object proc;
639{ 643{
@@ -768,23 +772,27 @@ nil, indicating the current buffer's process. */)
768 (process) 772 (process)
769 register Lisp_Object process; 773 register Lisp_Object process;
770{ 774{
775 register struct Lisp_Process *p;
776
771 process = get_process (process); 777 process = get_process (process);
772 XPROCESS (process)->raw_status_low = Qnil; 778 p = XPROCESS (process);
773 XPROCESS (process)->raw_status_high = Qnil; 779
774 if (NETCONN_P (process)) 780 p->raw_status_low = Qnil;
781 p->raw_status_high = Qnil;
782 if (NETCONN1_P (p))
775 { 783 {
776 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 784 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
777 XSETINT (XPROCESS (process)->tick, ++process_tick); 785 XSETINT (p->tick, ++process_tick);
778 status_notify (); 786 status_notify (p);
779 } 787 }
780 else if (XINT (XPROCESS (process)->infd) >= 0) 788 else if (XINT (p->infd) >= 0)
781 { 789 {
782 Fkill_process (process, Qnil); 790 Fkill_process (process, Qnil);
783 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 791 /* Do this now, since remove_process will make sigchld_handler do nothing. */
784 XPROCESS (process)->status 792 p->status
785 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); 793 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
786 XSETINT (XPROCESS (process)->tick, ++process_tick); 794 XSETINT (p->tick, ++process_tick);
787 status_notify (); 795 status_notify (p);
788 } 796 }
789 remove_process (process); 797 remove_process (process);
790 return Qnil; 798 return Qnil;
@@ -1238,7 +1246,7 @@ IP address. Returns nil if format of ADDRESS is invalid. */)
1238} 1246}
1239#endif 1247#endif
1240 1248
1241Lisp_Object 1249static Lisp_Object
1242list_processes_1 (query_only) 1250list_processes_1 (query_only)
1243 Lisp_Object query_only; 1251 Lisp_Object query_only;
1244{ 1252{
@@ -1708,7 +1716,7 @@ start_process_unwind (proc)
1708 return Qnil; 1716 return Qnil;
1709} 1717}
1710 1718
1711void 1719static void
1712create_process_1 (timer) 1720create_process_1 (timer)
1713 struct atimer *timer; 1721 struct atimer *timer;
1714{ 1722{
@@ -2531,7 +2539,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2531 2539
2532/* A version of request_sigio suitable for a record_unwind_protect. */ 2540/* A version of request_sigio suitable for a record_unwind_protect. */
2533 2541
2534Lisp_Object 2542static Lisp_Object
2535unwind_request_sigio (dummy) 2543unwind_request_sigio (dummy)
2536 Lisp_Object dummy; 2544 Lisp_Object dummy;
2537{ 2545{
@@ -4222,7 +4230,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4222 /* It's okay for us to do this and then continue with 4230 /* It's okay for us to do this and then continue with
4223 the loop, since timeout has already been zeroed out. */ 4231 the loop, since timeout has already been zeroed out. */
4224 clear_waiting_for_input (); 4232 clear_waiting_for_input ();
4225 status_notify (); 4233 status_notify (NULL);
4226 } 4234 }
4227 } 4235 }
4228 4236
@@ -4740,7 +4748,7 @@ read_process_output_error_handler (error)
4740 The characters read are decoded according to PROC's coding-system 4748 The characters read are decoded according to PROC's coding-system
4741 for decoding. */ 4749 for decoding. */
4742 4750
4743int 4751static int
4744read_process_output (proc, channel) 4752read_process_output (proc, channel)
4745 Lisp_Object proc; 4753 Lisp_Object proc;
4746 register int channel; 4754 register int channel;
@@ -5135,7 +5143,7 @@ send_process_trap ()
5135 5143
5136 This function can evaluate Lisp code and can garbage collect. */ 5144 This function can evaluate Lisp code and can garbage collect. */
5137 5145
5138void 5146static void
5139send_process (proc, buf, len, object) 5147send_process (proc, buf, len, object)
5140 volatile Lisp_Object proc; 5148 volatile Lisp_Object proc;
5141 unsigned char *volatile buf; 5149 unsigned char *volatile buf;
@@ -5722,7 +5730,7 @@ process_send_signal (process, signo, current_group, nomsg)
5722 p->status = Qrun; 5730 p->status = Qrun;
5723 XSETINT (p->tick, ++process_tick); 5731 XSETINT (p->tick, ++process_tick);
5724 if (!nomsg) 5732 if (!nomsg)
5725 status_notify (); 5733 status_notify (NULL);
5726 break; 5734 break;
5727#endif /* ! defined (SIGCONT) */ 5735#endif /* ! defined (SIGCONT) */
5728 case SIGINT: 5736 case SIGINT:
@@ -6390,8 +6398,9 @@ exec_sentinel (proc, reason)
6390 This is usually done while Emacs is waiting for keyboard input 6398 This is usually done while Emacs is waiting for keyboard input
6391 but can be done at other times. */ 6399 but can be done at other times. */
6392 6400
6393void 6401static void
6394status_notify () 6402status_notify (deleting_process)
6403 struct Lisp_Process *deleting_process;
6395{ 6404{
6396 register Lisp_Object proc, buffer; 6405 register Lisp_Object proc, buffer;
6397 Lisp_Object tail, msg; 6406 Lisp_Object tail, msg;
@@ -6427,6 +6436,7 @@ status_notify ()
6427 && ! EQ (p->status, Qlisten) 6436 && ! EQ (p->status, Qlisten)
6428 && ! EQ (p->command, Qt) /* Network process not stopped. */ 6437 && ! EQ (p->command, Qt) /* Network process not stopped. */
6429 && XINT (p->infd) >= 0 6438 && XINT (p->infd) >= 0
6439 && p != deleting_process
6430 && read_process_output (proc, XINT (p->infd)) > 0); 6440 && read_process_output (proc, XINT (p->infd)) > 0);
6431 6441
6432 buffer = p->buffer; 6442 buffer = p->buffer;
@@ -6630,7 +6640,7 @@ delete_keyboard_wait_descriptor (desc)
6630/* Return nonzero if *MASK has a bit set 6640/* Return nonzero if *MASK has a bit set
6631 that corresponds to one of the keyboard input descriptors. */ 6641 that corresponds to one of the keyboard input descriptors. */
6632 6642
6633int 6643static int
6634keyboard_bit_set (mask) 6644keyboard_bit_set (mask)
6635 SELECT_TYPE *mask; 6645 SELECT_TYPE *mask;
6636{ 6646{