Mercurial > emacs
comparison src/process.c @ 83150:cf8f0a3b5cb4
Merged in changes from CVS trunk.
Patches applied:
* 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
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-379
Update from CVS
* 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
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-190
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Mon, 07 Jun 2004 08:00:27 +0000 |
| parents | 62cf3d6337a0 8979bc3ade70 |
| children | 38500c0c86ab |
comparison
equal
deleted
inserted
replaced
| 83149:f004099bad61 | 83150:cf8f0a3b5cb4 |
|---|---|
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 /* Return a string describing a process status list. */ | 446 /* Return a string describing a process status list. */ |
| 447 | 447 |
| 448 Lisp_Object | 448 static Lisp_Object |
| 449 status_message (status) | 449 status_message (p) |
| 450 Lisp_Object status; | 450 struct Lisp_Process *p; |
| 451 { | 451 { |
| 452 Lisp_Object status = p->status; | |
| 452 Lisp_Object symbol; | 453 Lisp_Object symbol; |
| 453 int code, coredump; | 454 int code, coredump; |
| 454 Lisp_Object string, string2; | 455 Lisp_Object string, string2; |
| 455 | 456 |
| 456 decode_status (status, &symbol, &code, &coredump); | 457 decode_status (status, &symbol, &code, &coredump); |
| 467 SSET (string, 0, DOWNCASE (SREF (string, 0))); | 468 SSET (string, 0, DOWNCASE (SREF (string, 0))); |
| 468 return concat2 (string, string2); | 469 return concat2 (string, string2); |
| 469 } | 470 } |
| 470 else if (EQ (symbol, Qexit)) | 471 else if (EQ (symbol, Qexit)) |
| 471 { | 472 { |
| 473 if (NETCONN1_P (p)) | |
| 474 return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n"); | |
| 472 if (code == 0) | 475 if (code == 0) |
| 473 return build_string ("finished\n"); | 476 return build_string ("finished\n"); |
| 474 string = Fnumber_to_string (make_number (code)); | 477 string = Fnumber_to_string (make_number (code)); |
| 475 string2 = build_string (coredump ? " (core dumped)\n" : "\n"); | 478 string2 = build_string (coredump ? " (core dumped)\n" : "\n"); |
| 476 return concat3 (build_string ("exited abnormally with code "), | 479 return concat3 (build_string ("exited abnormally with code "), |
| 762 XPROCESS (process)->raw_status_high = Qnil; | 765 XPROCESS (process)->raw_status_high = Qnil; |
| 763 if (NETCONN_P (process)) | 766 if (NETCONN_P (process)) |
| 764 { | 767 { |
| 765 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); | 768 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
| 766 XSETINT (XPROCESS (process)->tick, ++process_tick); | 769 XSETINT (XPROCESS (process)->tick, ++process_tick); |
| 770 status_notify (); | |
| 767 } | 771 } |
| 768 else if (XINT (XPROCESS (process)->infd) >= 0) | 772 else if (XINT (XPROCESS (process)->infd) >= 0) |
| 769 { | 773 { |
| 770 Fkill_process (process, Qnil); | 774 Fkill_process (process, Qnil); |
| 771 /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 775 /* Do this now, since remove_process will make sigchld_handler do nothing. */ |
| 772 XPROCESS (process)->status | 776 XPROCESS (process)->status |
| 773 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); | 777 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); |
| 774 XSETINT (XPROCESS (process)->tick, ++process_tick); | 778 XSETINT (XPROCESS (process)->tick, ++process_tick); |
| 775 status_notify (); | 779 status_notify (); |
| 776 } | 780 } |
| 777 /* Do not call remove_process here; either status_notify has already done | 781 remove_process (process); |
| 778 it, or will do so the next time emacs polls for input. Thus network | |
| 779 processes are not immediately removed, and their sentinel will be | |
| 780 called. | |
| 781 | |
| 782 Since Fdelete_process is called by kill_buffer_processes, this also | |
| 783 means that a network process sentinel will run after the buffer is | |
| 784 dead, which would not be the case if status_notify() were called | |
| 785 unconditionally here. This way process sentinels observe consistent | |
| 786 behavior with regard to buffer-live-p. | |
| 787 */ | |
| 788 /* remove_process (process); */ | |
| 789 return Qnil; | 782 return Qnil; |
| 790 } | 783 } |
| 791 | 784 |
| 792 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0, | 785 DEFUN ("process-status", Fprocess_status, Sprocess_status, 1, 1, 0, |
| 793 doc: /* Return the status of PROCESS. | 786 doc: /* Return the status of PROCESS. |
| 4701 | 4694 |
| 4702 /* Read pending output from the process channel, | 4695 /* Read pending output from the process channel, |
| 4703 starting with our buffered-ahead character if we have one. | 4696 starting with our buffered-ahead character if we have one. |
| 4704 Yield number of decoded characters read. | 4697 Yield number of decoded characters read. |
| 4705 | 4698 |
| 4706 This function reads at most 1024 characters. | 4699 This function reads at most 4096 characters. |
| 4707 If you want to read all available subprocess output, | 4700 If you want to read all available subprocess output, |
| 4708 you must call it repeatedly until it returns zero. | 4701 you must call it repeatedly until it returns zero. |
| 4709 | 4702 |
| 4710 The characters read are decoded according to PROC's coding-system | 4703 The characters read are decoded according to PROC's coding-system |
| 4711 for decoding. */ | 4704 for decoding. */ |
| 4721 register struct buffer *old = current_buffer; | 4714 register struct buffer *old = current_buffer; |
| 4722 register struct Lisp_Process *p = XPROCESS (proc); | 4715 register struct Lisp_Process *p = XPROCESS (proc); |
| 4723 register int opoint; | 4716 register int opoint; |
| 4724 struct coding_system *coding = proc_decode_coding_system[channel]; | 4717 struct coding_system *coding = proc_decode_coding_system[channel]; |
| 4725 int carryover = XINT (p->decoding_carryover); | 4718 int carryover = XINT (p->decoding_carryover); |
| 4726 int readmax = 1024; | 4719 int readmax = 4096; |
| 4727 | 4720 |
| 4728 #ifdef VMS | 4721 #ifdef VMS |
| 4729 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); | 4722 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); |
| 4730 | 4723 |
| 4731 vs = get_vms_process_pointer (p->pid); | 4724 vs = get_vms_process_pointer (p->pid); |
| 4753 chars = (char *) alloca (nbytes + carryover); | 4746 chars = (char *) alloca (nbytes + carryover); |
| 4754 bcopy (SDATA (p->decoding_buf), buf, carryover); | 4747 bcopy (SDATA (p->decoding_buf), buf, carryover); |
| 4755 bcopy (vs->inputBuffer, chars + carryover, nbytes); | 4748 bcopy (vs->inputBuffer, chars + carryover, nbytes); |
| 4756 } | 4749 } |
| 4757 #else /* not VMS */ | 4750 #else /* not VMS */ |
| 4758 | |
| 4759 #ifdef DATAGRAM_SOCKETS | |
| 4760 /* A datagram is one packet; allow at least 1500+ bytes of data | |
| 4761 corresponding to the typical Ethernet frame size. */ | |
| 4762 if (DATAGRAM_CHAN_P (channel)) | |
| 4763 { | |
| 4764 /* carryover = 0; */ /* Does carryover make sense for datagrams? */ | |
| 4765 readmax += 1024; | |
| 4766 } | |
| 4767 #endif | |
| 4768 | 4751 |
| 4769 chars = (char *) alloca (carryover + readmax); | 4752 chars = (char *) alloca (carryover + readmax); |
| 4770 if (carryover) | 4753 if (carryover) |
| 4771 /* See the comment above. */ | 4754 /* See the comment above. */ |
| 4772 bcopy (SDATA (p->decoding_buf), chars, carryover); | 4755 bcopy (SDATA (p->decoding_buf), chars, carryover); |
| 6397 buffer = p->buffer; | 6380 buffer = p->buffer; |
| 6398 | 6381 |
| 6399 /* Get the text to use for the message. */ | 6382 /* Get the text to use for the message. */ |
| 6400 if (!NILP (p->raw_status_low)) | 6383 if (!NILP (p->raw_status_low)) |
| 6401 update_status (p); | 6384 update_status (p); |
| 6402 msg = status_message (p->status); | 6385 msg = status_message (p); |
| 6403 | 6386 |
| 6404 /* If process is terminated, deactivate it or delete it. */ | 6387 /* If process is terminated, deactivate it or delete it. */ |
| 6405 symbol = p->status; | 6388 symbol = p->status; |
| 6406 if (CONSP (p->status)) | 6389 if (CONSP (p->status)) |
| 6407 symbol = XCAR (p->status); | 6390 symbol = XCAR (p->status); |
