Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
89942:9cb747ae49af | 89943:4c90ffeb71c5 |
---|---|
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 "), |
530 the usual sequence - for example, on HP9000/S700 systems, there | 533 the usual sequence - for example, on HP9000/S700 systems, there |
531 are no pseudoterminals with names ending in 'f'. So we wait for | 534 are no pseudoterminals with names ending in 'f'. So we wait for |
532 three failures in a row before deciding that we've reached the | 535 three failures in a row before deciding that we've reached the |
533 end of the ptys. */ | 536 end of the ptys. */ |
534 int failed_count = 0; | 537 int failed_count = 0; |
535 | 538 |
536 if (stat (pty_name, &stb) < 0) | 539 if (stat (pty_name, &stb) < 0) |
537 { | 540 { |
538 failed_count++; | 541 failed_count++; |
539 if (failed_count >= 3) | 542 if (failed_count >= 3) |
540 return -1; | 543 return -1; |
763 XPROCESS (process)->raw_status_high = Qnil; | 766 XPROCESS (process)->raw_status_high = Qnil; |
764 if (NETCONN_P (process)) | 767 if (NETCONN_P (process)) |
765 { | 768 { |
766 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); | 769 XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
767 XSETINT (XPROCESS (process)->tick, ++process_tick); | 770 XSETINT (XPROCESS (process)->tick, ++process_tick); |
771 status_notify (); | |
768 } | 772 } |
769 else if (XINT (XPROCESS (process)->infd) >= 0) | 773 else if (XINT (XPROCESS (process)->infd) >= 0) |
770 { | 774 { |
771 Fkill_process (process, Qnil); | 775 Fkill_process (process, Qnil); |
772 /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 776 /* Do this now, since remove_process will make sigchld_handler do nothing. */ |
841 return make_number (0); | 845 return make_number (0); |
842 } | 846 } |
843 | 847 |
844 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, | 848 DEFUN ("process-id", Fprocess_id, Sprocess_id, 1, 1, 0, |
845 doc: /* Return the process id of PROCESS. | 849 doc: /* Return the process id of PROCESS. |
846 This is the pid of the Unix process which PROCESS uses or talks to. | 850 This is the pid of the external process which PROCESS uses or talks to. |
847 For a network connection, this value is nil. */) | 851 For a network connection, this value is nil. */) |
848 (process) | 852 (process) |
849 register Lisp_Object process; | 853 register Lisp_Object process; |
850 { | 854 { |
851 CHECK_PROCESS (process); | 855 CHECK_PROCESS (process); |
1080 | 1084 |
1081 DEFUN ("set-process-query-on-exit-flag", | 1085 DEFUN ("set-process-query-on-exit-flag", |
1082 Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag, | 1086 Fset_process_query_on_exit_flag, Sset_process_query_on_exit_flag, |
1083 2, 2, 0, | 1087 2, 2, 0, |
1084 doc: /* Specify if query is needed for PROCESS when Emacs is exited. | 1088 doc: /* Specify if query is needed for PROCESS when Emacs is exited. |
1085 If the second argument FLAG is non-nil, emacs will query the user before | 1089 If the second argument FLAG is non-nil, Emacs will query the user before |
1086 exiting if PROCESS is running. */) | 1090 exiting if PROCESS is running. */) |
1087 (process, flag) | 1091 (process, flag) |
1088 register Lisp_Object process, flag; | 1092 register Lisp_Object process, flag; |
1089 { | 1093 { |
1090 CHECK_PROCESS (process); | 1094 CHECK_PROCESS (process); |
1093 } | 1097 } |
1094 | 1098 |
1095 DEFUN ("process-query-on-exit-flag", | 1099 DEFUN ("process-query-on-exit-flag", |
1096 Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag, | 1100 Fprocess_query_on_exit_flag, Sprocess_query_on_exit_flag, |
1097 1, 1, 0, | 1101 1, 1, 0, |
1098 doc: /* Return the current value of query on exit flag for PROCESS. */) | 1102 doc: /* Return the current value of query-on-exit flag for PROCESS. */) |
1099 (process) | 1103 (process) |
1100 register Lisp_Object process; | 1104 register Lisp_Object process; |
1101 { | 1105 { |
1102 CHECK_PROCESS (process); | 1106 CHECK_PROCESS (process); |
1103 return Fnull (XPROCESS (process)->kill_without_query); | 1107 return Fnull (XPROCESS (process)->kill_without_query); |
1456 static Lisp_Object start_process_unwind (); | 1460 static Lisp_Object start_process_unwind (); |
1457 | 1461 |
1458 DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, | 1462 DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, |
1459 doc: /* Start a program in a subprocess. Return the process object for it. | 1463 doc: /* Start a program in a subprocess. Return the process object for it. |
1460 NAME is name for process. It is modified if necessary to make it unique. | 1464 NAME is name for process. It is modified if necessary to make it unique. |
1461 BUFFER is the buffer or (buffer-name) to associate with the process. | 1465 BUFFER is the buffer (or buffer name) to associate with the process. |
1462 Process output goes at end of that buffer, unless you specify | 1466 Process output goes at end of that buffer, unless you specify |
1463 an output stream or filter function to handle the output. | 1467 an output stream or filter function to handle the output. |
1464 BUFFER may be also nil, meaning that this process is not associated | 1468 BUFFER may be also nil, meaning that this process is not associated |
1465 with any buffer. | 1469 with any buffer. |
1466 Third arg is program file name. It is searched for in PATH. | 1470 PROGRAM is the program file name. It is searched for in PATH. |
1467 Remaining arguments are strings to give program as arguments. | 1471 Remaining arguments are strings to give program as arguments. |
1468 | 1472 |
1469 usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | 1473 usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) |
1470 (nargs, args) | 1474 (nargs, args) |
1471 int nargs; | 1475 int nargs; |
2607 sentinel function will be called with second arg matching "open" (if | 2611 sentinel function will be called with second arg matching "open" (if |
2608 successful) or "failed" when the connect completes. Default is to use | 2612 successful) or "failed" when the connect completes. Default is to use |
2609 a blocking connect (i.e. wait) for stream type connections. | 2613 a blocking connect (i.e. wait) for stream type connections. |
2610 | 2614 |
2611 :noquery BOOL -- Query the user unless BOOL is non-nil, and process is | 2615 :noquery BOOL -- Query the user unless BOOL is non-nil, and process is |
2612 running when emacs is exited. | 2616 running when Emacs is exited. |
2613 | 2617 |
2614 :stop BOOL -- Start process in the `stopped' state if BOOL non-nil. | 2618 :stop BOOL -- Start process in the `stopped' state if BOOL non-nil. |
2615 In the stopped state, a server process does not accept new | 2619 In the stopped state, a server process does not accept new |
2616 connections, and a client process does not handle incoming traffic. | 2620 connections, and a client process does not handle incoming traffic. |
2617 The stopped state is cleared by `continue-process' and set by | 2621 The stopped state is cleared by `continue-process' and set by |
2953 if (!NILP (host)) | 2957 if (!NILP (host)) |
2954 { | 2958 { |
2955 struct hostent *host_info_ptr; | 2959 struct hostent *host_info_ptr; |
2956 | 2960 |
2957 /* gethostbyname may fail with TRY_AGAIN, but we don't honour that, | 2961 /* gethostbyname may fail with TRY_AGAIN, but we don't honour that, |
2958 as it may `hang' emacs for a very long time. */ | 2962 as it may `hang' Emacs for a very long time. */ |
2959 immediate_quit = 1; | 2963 immediate_quit = 1; |
2960 QUIT; | 2964 QUIT; |
2961 host_info_ptr = gethostbyname (SDATA (host)); | 2965 host_info_ptr = gethostbyname (SDATA (host)); |
2962 immediate_quit = 0; | 2966 immediate_quit = 0; |
2963 | 2967 |
3614 return any ? res : Qnil; | 3618 return any ? res : Qnil; |
3615 } | 3619 } |
3616 #endif | 3620 #endif |
3617 #endif /* HAVE_SOCKETS */ | 3621 #endif /* HAVE_SOCKETS */ |
3618 | 3622 |
3623 /* Turn off input and output for process PROC. */ | |
3624 | |
3619 void | 3625 void |
3620 deactivate_process (proc) | 3626 deactivate_process (proc) |
3621 Lisp_Object proc; | 3627 Lisp_Object proc; |
3622 { | 3628 { |
3623 register int inchannel, outchannel; | 3629 register int inchannel, outchannel; |
3633 process_output_delay_count = 0; | 3639 process_output_delay_count = 0; |
3634 XSETINT (p->read_output_delay, 0); | 3640 XSETINT (p->read_output_delay, 0); |
3635 p->read_output_skip = Qnil; | 3641 p->read_output_skip = Qnil; |
3636 } | 3642 } |
3637 #endif | 3643 #endif |
3638 | 3644 |
3639 if (inchannel >= 0) | 3645 if (inchannel >= 0) |
3640 { | 3646 { |
3641 /* Beware SIGCHLD hereabouts. */ | 3647 /* Beware SIGCHLD hereabouts. */ |
3642 flush_pending_output (inchannel); | 3648 flush_pending_output (inchannel); |
3643 #ifdef VMS | 3649 #ifdef VMS |
3963 build_string ("\n"))); | 3969 build_string ("\n"))); |
3964 } | 3970 } |
3965 | 3971 |
3966 /* This variable is different from waiting_for_input in keyboard.c. | 3972 /* This variable is different from waiting_for_input in keyboard.c. |
3967 It is used to communicate to a lisp process-filter/sentinel (via the | 3973 It is used to communicate to a lisp process-filter/sentinel (via the |
3968 function Fwaiting_for_user_input_p below) whether emacs was waiting | 3974 function Fwaiting_for_user_input_p below) whether Emacs was waiting |
3969 for user-input when that process-filter was called. | 3975 for user-input when that process-filter was called. |
3970 waiting_for_input cannot be used as that is by definition 0 when | 3976 waiting_for_input cannot be used as that is by definition 0 when |
3971 lisp code is being evalled. | 3977 lisp code is being evalled. |
3972 This is also used in record_asynch_buffer_change. | 3978 This is also used in record_asynch_buffer_change. |
3973 For that purpose, this must be 0 | 3979 For that purpose, this must be 0 |
4017 int time_limit, microsecs; | 4023 int time_limit, microsecs; |
4018 Lisp_Object read_kbd; | 4024 Lisp_Object read_kbd; |
4019 int do_display; | 4025 int do_display; |
4020 { | 4026 { |
4021 register int channel, nfds; | 4027 register int channel, nfds; |
4022 static SELECT_TYPE Available; | 4028 SELECT_TYPE Available; |
4023 static SELECT_TYPE Connecting; | 4029 SELECT_TYPE Connecting; |
4024 int check_connect, check_delay, no_avail; | 4030 int check_connect, check_delay, no_avail; |
4025 int xerrno; | 4031 int xerrno; |
4026 Lisp_Object proc; | 4032 Lisp_Object proc; |
4027 EMACS_TIME timeout, end_time; | 4033 EMACS_TIME timeout, end_time; |
4028 int wait_channel = -1; | 4034 int wait_channel = -1; |
4029 struct Lisp_Process *wait_proc = 0; | 4035 struct Lisp_Process *wait_proc = 0; |
4030 int got_some_input = 0; | 4036 int got_some_input = 0; |
4031 /* Either nil or a cons cell, the car of which is of interest and | 4037 /* Either nil or a cons cell, the car of which is of interest and |
4032 may be changed outside of this routine. */ | 4038 may be changed outside of this routine. */ |
4033 Lisp_Object wait_for_cell = Qnil; | 4039 Lisp_Object wait_for_cell = Qnil; |
4040 int saved_waiting_for_user_input_p = waiting_for_user_input_p; | |
4034 | 4041 |
4035 FD_ZERO (&Available); | 4042 FD_ZERO (&Available); |
4036 FD_ZERO (&Connecting); | 4043 FD_ZERO (&Connecting); |
4037 | 4044 |
4038 /* If read_kbd is a process to watch, set wait_proc and wait_channel | 4045 /* If read_kbd is a process to watch, set wait_proc and wait_channel |
4579 XPROCESS (proc)->status | 4586 XPROCESS (proc)->status |
4580 = Fcons (Qexit, Fcons (make_number (256), Qnil)); | 4587 = Fcons (Qexit, Fcons (make_number (256), Qnil)); |
4581 } | 4588 } |
4582 } | 4589 } |
4583 #ifdef NON_BLOCKING_CONNECT | 4590 #ifdef NON_BLOCKING_CONNECT |
4584 if (check_connect && FD_ISSET (channel, &Connecting)) | 4591 if (check_connect && FD_ISSET (channel, &Connecting) |
4592 && FD_ISSET (channel, &connect_wait_mask)) | |
4585 { | 4593 { |
4586 struct Lisp_Process *p; | 4594 struct Lisp_Process *p; |
4587 | 4595 |
4588 FD_CLR (channel, &connect_wait_mask); | 4596 FD_CLR (channel, &connect_wait_mask); |
4589 if (--num_pending_connects < 0) | 4597 if (--num_pending_connects < 0) |
4642 } | 4650 } |
4643 #endif /* NON_BLOCKING_CONNECT */ | 4651 #endif /* NON_BLOCKING_CONNECT */ |
4644 } /* end for each file descriptor */ | 4652 } /* end for each file descriptor */ |
4645 } /* end while exit conditions not met */ | 4653 } /* end while exit conditions not met */ |
4646 | 4654 |
4647 waiting_for_user_input_p = 0; | 4655 waiting_for_user_input_p = saved_waiting_for_user_input_p; |
4648 | 4656 |
4649 /* If calling from keyboard input, do not quit | 4657 /* If calling from keyboard input, do not quit |
4650 since we want to return C-g as an input character. | 4658 since we want to return C-g as an input character. |
4651 Otherwise, do pending quit if requested. */ | 4659 Otherwise, do pending quit if requested. */ |
4652 if (XINT (read_kbd) >= 0) | 4660 if (XINT (read_kbd) >= 0) |
4689 | 4697 |
4690 /* Read pending output from the process channel, | 4698 /* Read pending output from the process channel, |
4691 starting with our buffered-ahead character if we have one. | 4699 starting with our buffered-ahead character if we have one. |
4692 Yield number of decoded characters read. | 4700 Yield number of decoded characters read. |
4693 | 4701 |
4694 This function reads at most 1024 characters. | 4702 This function reads at most 4096 characters. |
4695 If you want to read all available subprocess output, | 4703 If you want to read all available subprocess output, |
4696 you must call it repeatedly until it returns zero. | 4704 you must call it repeatedly until it returns zero. |
4697 | 4705 |
4698 The characters read are decoded according to PROC's coding-system | 4706 The characters read are decoded according to PROC's coding-system |
4699 for decoding. */ | 4707 for decoding. */ |
4709 register struct buffer *old = current_buffer; | 4717 register struct buffer *old = current_buffer; |
4710 register struct Lisp_Process *p = XPROCESS (proc); | 4718 register struct Lisp_Process *p = XPROCESS (proc); |
4711 register int opoint; | 4719 register int opoint; |
4712 struct coding_system *coding = proc_decode_coding_system[channel]; | 4720 struct coding_system *coding = proc_decode_coding_system[channel]; |
4713 int carryover = XINT (p->decoding_carryover); | 4721 int carryover = XINT (p->decoding_carryover); |
4714 int readmax = 1024; | 4722 int readmax = 4096; |
4715 | 4723 |
4716 #ifdef VMS | 4724 #ifdef VMS |
4717 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); | 4725 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); |
4718 | 4726 |
4719 vs = get_vms_process_pointer (p->pid); | 4727 vs = get_vms_process_pointer (p->pid); |
4741 chars = (char *) alloca (nbytes + carryover); | 4749 chars = (char *) alloca (nbytes + carryover); |
4742 bcopy (SDATA (p->decoding_buf), buf, carryover); | 4750 bcopy (SDATA (p->decoding_buf), buf, carryover); |
4743 bcopy (vs->inputBuffer, chars + carryover, nbytes); | 4751 bcopy (vs->inputBuffer, chars + carryover, nbytes); |
4744 } | 4752 } |
4745 #else /* not VMS */ | 4753 #else /* not VMS */ |
4746 | |
4747 #ifdef DATAGRAM_SOCKETS | |
4748 /* A datagram is one packet; allow at least 1500+ bytes of data | |
4749 corresponding to the typical Ethernet frame size. */ | |
4750 if (DATAGRAM_CHAN_P (channel)) | |
4751 { | |
4752 /* carryover = 0; */ /* Does carryover make sense for datagrams? */ | |
4753 readmax += 1024; | |
4754 } | |
4755 #endif | |
4756 | 4754 |
4757 chars = (char *) alloca (carryover + readmax); | 4755 chars = (char *) alloca (carryover + readmax); |
4758 if (carryover) | 4756 if (carryover) |
4759 /* See the comment above. */ | 4757 /* See the comment above. */ |
4760 bcopy (SDATA (p->decoding_buf), chars, carryover); | 4758 bcopy (SDATA (p->decoding_buf), chars, carryover); |
5067 return nbytes; | 5065 return nbytes; |
5068 } | 5066 } |
5069 | 5067 |
5070 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, | 5068 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, |
5071 0, 0, 0, | 5069 0, 0, 0, |
5072 doc: /* Returns non-nil if emacs is waiting for input from the user. | 5070 doc: /* Returns non-nil if Emacs is waiting for input from the user. |
5073 This is intended for use by asynchronous process output filters and sentinels. */) | 5071 This is intended for use by asynchronous process output filters and sentinels. */) |
5074 () | 5072 () |
5075 { | 5073 { |
5076 return (waiting_for_user_input_p ? Qt : Qnil); | 5074 return (waiting_for_user_input_p ? Qt : Qnil); |
5077 } | 5075 } |
5444 emacs_get_tty_pgrp (p) | 5442 emacs_get_tty_pgrp (p) |
5445 struct Lisp_Process *p; | 5443 struct Lisp_Process *p; |
5446 { | 5444 { |
5447 int gid = -1; | 5445 int gid = -1; |
5448 | 5446 |
5449 #ifdef TIOCGPGRP | 5447 #ifdef TIOCGPGRP |
5450 if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) | 5448 if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) |
5451 { | 5449 { |
5452 int fd; | 5450 int fd; |
5453 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the | 5451 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the |
5454 master side. Try the slave side. */ | 5452 master side. Try the slave side. */ |
5641 But, TIOCGPGRP does not work on E50 ;-P works fine on E60" | 5639 But, TIOCGPGRP does not work on E50 ;-P works fine on E60" |
5642 His patch indicates that if TIOCGPGRP returns an error, then | 5640 His patch indicates that if TIOCGPGRP returns an error, then |
5643 we should just assume that p->pid is also the process group id. */ | 5641 we should just assume that p->pid is also the process group id. */ |
5644 | 5642 |
5645 gid = emacs_get_tty_pgrp (p); | 5643 gid = emacs_get_tty_pgrp (p); |
5646 | 5644 |
5647 if (gid == -1) | 5645 if (gid == -1) |
5648 /* If we can't get the information, assume | 5646 /* If we can't get the information, assume |
5649 the shell owns the tty. */ | 5647 the shell owns the tty. */ |
5650 gid = XFASTINT (p->pid); | 5648 gid = XFASTINT (p->pid); |
5651 | 5649 |
5724 } | 5722 } |
5725 | 5723 |
5726 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, | 5724 DEFUN ("interrupt-process", Finterrupt_process, Sinterrupt_process, 0, 2, 0, |
5727 doc: /* Interrupt process PROCESS. | 5725 doc: /* Interrupt process PROCESS. |
5728 PROCESS may be a process, a buffer, or the name of a process or buffer. | 5726 PROCESS may be a process, a buffer, or the name of a process or buffer. |
5729 nil or no arg means current buffer's process. | 5727 No arg or nil means current buffer's process. |
5730 Second arg CURRENT-GROUP non-nil means send signal to | 5728 Second arg CURRENT-GROUP non-nil means send signal to |
5731 the current process-group of the process's controlling terminal | 5729 the current process-group of the process's controlling terminal |
5732 rather than to the process's own process group. | 5730 rather than to the process's own process group. |
5733 If the process is a shell, this means interrupt current subjob | 5731 If the process is a shell, this means interrupt current subjob |
5734 rather than the shell. | 5732 rather than the shell. |
6383 buffer = p->buffer; | 6381 buffer = p->buffer; |
6384 | 6382 |
6385 /* Get the text to use for the message. */ | 6383 /* Get the text to use for the message. */ |
6386 if (!NILP (p->raw_status_low)) | 6384 if (!NILP (p->raw_status_low)) |
6387 update_status (p); | 6385 update_status (p); |
6388 msg = status_message (p->status); | 6386 msg = status_message (p); |
6389 | 6387 |
6390 /* If process is terminated, deactivate it or delete it. */ | 6388 /* If process is terminated, deactivate it or delete it. */ |
6391 symbol = p->status; | 6389 symbol = p->status; |
6392 if (CONSP (p->status)) | 6390 if (CONSP (p->status)) |
6393 symbol = XCAR (p->status); | 6391 symbol = XCAR (p->status); |
6469 DEFUN ("set-process-coding-system", Fset_process_coding_system, | 6467 DEFUN ("set-process-coding-system", Fset_process_coding_system, |
6470 Sset_process_coding_system, 1, 3, 0, | 6468 Sset_process_coding_system, 1, 3, 0, |
6471 doc: /* Set coding systems of PROCESS to DECODING and ENCODING. | 6469 doc: /* Set coding systems of PROCESS to DECODING and ENCODING. |
6472 DECODING will be used to decode subprocess output and ENCODING to | 6470 DECODING will be used to decode subprocess output and ENCODING to |
6473 encode subprocess input. */) | 6471 encode subprocess input. */) |
6474 (proc, decoding, encoding) | 6472 (process, decoding, encoding) |
6475 register Lisp_Object proc, decoding, encoding; | 6473 register Lisp_Object process, decoding, encoding; |
6476 { | 6474 { |
6477 register struct Lisp_Process *p; | 6475 register struct Lisp_Process *p; |
6478 | 6476 |
6479 CHECK_PROCESS (proc); | 6477 CHECK_PROCESS (process); |
6480 p = XPROCESS (proc); | 6478 p = XPROCESS (process); |
6481 if (XINT (p->infd) < 0) | 6479 if (XINT (p->infd) < 0) |
6482 error ("Input file descriptor of %s closed", SDATA (p->name)); | 6480 error ("Input file descriptor of %s closed", SDATA (p->name)); |
6483 if (XINT (p->outfd) < 0) | 6481 if (XINT (p->outfd) < 0) |
6484 error ("Output file descriptor of %s closed", SDATA (p->name)); | 6482 error ("Output file descriptor of %s closed", SDATA (p->name)); |
6485 Fcheck_coding_system (decoding); | 6483 Fcheck_coding_system (decoding); |
6486 Fcheck_coding_system (encoding); | 6484 Fcheck_coding_system (encoding); |
6487 | 6485 |
6488 p->decode_coding_system = decoding; | 6486 p->decode_coding_system = decoding; |
6489 p->encode_coding_system = encoding; | 6487 p->encode_coding_system = encoding; |
6490 setup_process_coding_systems (proc); | 6488 setup_process_coding_systems (process); |
6491 | 6489 |
6492 return Qnil; | 6490 return Qnil; |
6493 } | 6491 } |
6494 | 6492 |
6495 DEFUN ("process-coding-system", | 6493 DEFUN ("process-coding-system", |
6496 Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0, | 6494 Fprocess_coding_system, Sprocess_coding_system, 1, 1, 0, |
6497 doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */) | 6495 doc: /* Return a cons of coding systems for decoding and encoding of PROCESS. */) |
6498 (proc) | 6496 (process) |
6499 register Lisp_Object proc; | 6497 register Lisp_Object process; |
6500 { | 6498 { |
6501 CHECK_PROCESS (proc); | 6499 CHECK_PROCESS (process); |
6502 return Fcons (XPROCESS (proc)->decode_coding_system, | 6500 return Fcons (XPROCESS (process)->decode_coding_system, |
6503 XPROCESS (proc)->encode_coding_system); | 6501 XPROCESS (process)->encode_coding_system); |
6504 } | 6502 } |
6505 | 6503 |
6506 DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte, | 6504 DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte, |
6507 Sset_process_filter_multibyte, 2, 2, 0, | 6505 Sset_process_filter_multibyte, 2, 2, 0, |
6508 doc: /* Set multibyteness of the strings given to PROCESS's filter. | 6506 doc: /* Set multibyteness of the strings given to PROCESS's filter. |
6509 If FLAG is non-nil, the filter is given multibyte strings. | 6507 If FLAG is non-nil, the filter is given multibyte strings. |
6510 If FLAG is nil, the filter is given unibyte strings. In this case, | 6508 If FLAG is nil, the filter is given unibyte strings. In this case, |
6511 all character code conversion except for end-of-line conversion is | 6509 all character code conversion except for end-of-line conversion is |
6512 suppressed. */) | 6510 suppressed. */) |
6513 (proc, flag) | 6511 (process, flag) |
6514 Lisp_Object proc, flag; | 6512 Lisp_Object process, flag; |
6515 { | 6513 { |
6516 register struct Lisp_Process *p; | 6514 register struct Lisp_Process *p; |
6517 | 6515 |
6518 CHECK_PROCESS (proc); | 6516 CHECK_PROCESS (process); |
6519 p = XPROCESS (proc); | 6517 p = XPROCESS (process); |
6520 p->filter_multibyte = flag; | 6518 p->filter_multibyte = flag; |
6521 setup_process_coding_systems (proc); | 6519 setup_process_coding_systems (process); |
6522 | 6520 |
6523 return Qnil; | 6521 return Qnil; |
6524 } | 6522 } |
6525 | 6523 |
6526 DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, | 6524 DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p, |
6527 Sprocess_filter_multibyte_p, 1, 1, 0, | 6525 Sprocess_filter_multibyte_p, 1, 1, 0, |
6528 doc: /* Return t if a multibyte string is given to PROCESS's filter.*/) | 6526 doc: /* Return t if a multibyte string is given to PROCESS's filter.*/) |
6529 (proc) | 6527 (process) |
6530 Lisp_Object proc; | 6528 Lisp_Object process; |
6531 { | 6529 { |
6532 register struct Lisp_Process *p; | 6530 register struct Lisp_Process *p; |
6533 | 6531 |
6534 CHECK_PROCESS (proc); | 6532 CHECK_PROCESS (process); |
6535 p = XPROCESS (proc); | 6533 p = XPROCESS (process); |
6536 | 6534 |
6537 return (NILP (p->filter_multibyte) ? Qnil : Qt); | 6535 return (NILP (p->filter_multibyte) ? Qnil : Qt); |
6538 } | 6536 } |
6539 | 6537 |
6540 | 6538 |
6751 Vprocess_connection_type = Qt; | 6749 Vprocess_connection_type = Qt; |
6752 | 6750 |
6753 #ifdef ADAPTIVE_READ_BUFFERING | 6751 #ifdef ADAPTIVE_READ_BUFFERING |
6754 DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, | 6752 DEFVAR_LISP ("process-adaptive-read-buffering", &Vprocess_adaptive_read_buffering, |
6755 doc: /* If non-nil, improve receive buffering by delaying after short reads. | 6753 doc: /* If non-nil, improve receive buffering by delaying after short reads. |
6756 On some systems, when emacs reads the output from a subprocess, the output data | 6754 On some systems, when Emacs reads the output from a subprocess, the output data |
6757 is read in very small blocks, potentially resulting in very poor performance. | 6755 is read in very small blocks, potentially resulting in very poor performance. |
6758 This behaviour can be remedied to some extent by setting this variable to a | 6756 This behaviour can be remedied to some extent by setting this variable to a |
6759 non-nil value, as it will automatically delay reading from such processes, to | 6757 non-nil value, as it will automatically delay reading from such processes, to |
6760 allowing them to produce more output before emacs tries to read it. | 6758 allowing them to produce more output before Emacs tries to read it. |
6761 If the value is t, the delay is reset after each write to the process; any other | 6759 If the value is t, the delay is reset after each write to the process; any other |
6762 non-nil value means that the delay is not reset on write. | 6760 non-nil value means that the delay is not reset on write. |
6763 The variable takes effect when `start-process' is called. */); | 6761 The variable takes effect when `start-process' is called. */); |
6764 Vprocess_adaptive_read_buffering = Qt; | 6762 Vprocess_adaptive_read_buffering = Qt; |
6765 #endif | 6763 #endif |