aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorMiles Bader2007-07-15 02:05:20 +0000
committerMiles Bader2007-07-15 02:05:20 +0000
commit7eb1e4534e88a32fe5e549e630fdabf3e062be2b (patch)
tree34fc72789f1cfbfeb067cf507f8871c322df300a /src/process.c
parent76d11d2cf9623e9f4c38e8239c4444ffc1fae485 (diff)
parent6f8a87c027ebd6f9cfdac5c0df97d651227bec62 (diff)
downloademacs-7eb1e4534e88a32fe5e549e630fdabf3e062be2b.tar.gz
emacs-7eb1e4534e88a32fe5e549e630fdabf3e062be2b.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 803-813) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 51-58) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 233-236) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-25
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c311
1 files changed, 150 insertions, 161 deletions
diff --git a/src/process.c b/src/process.c
index 9a7cf29963f..b63edbe0b6d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -121,14 +121,6 @@ Boston, MA 02110-1301, USA. */
121#include <sys/wait.h> 121#include <sys/wait.h>
122#endif 122#endif
123 123
124/* Disable IPv6 support for w32 until someone figures out how to do it
125 properly. */
126#ifdef WINDOWSNT
127# ifdef AF_INET6
128# undef AF_INET6
129# endif
130#endif
131
132#include "lisp.h" 124#include "lisp.h"
133#include "systime.h" 125#include "systime.h"
134#include "systty.h" 126#include "systty.h"
@@ -393,7 +385,7 @@ struct sockaddr_and_len {
393 int len; 385 int len;
394} datagram_address[MAXDESC]; 386} datagram_address[MAXDESC];
395#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) 387#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0)
396#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XINT (XPROCESS (proc)->infd)].sa != 0) 388#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0)
397#else 389#else
398#define DATAGRAM_CHAN_P(chan) (0) 390#define DATAGRAM_CHAN_P(chan) (0)
399#define DATAGRAM_CONN_P(proc) (0) 391#define DATAGRAM_CONN_P(proc) (0)
@@ -628,19 +620,19 @@ make_process (name)
628 620
629 p = allocate_process (); 621 p = allocate_process ();
630 622
631 XSETINT (p->infd, -1); 623 p->infd = -1;
632 XSETINT (p->outfd, -1); 624 p->outfd = -1;
633 XSETFASTINT (p->tick, 0); 625 p->tick = 0;
634 XSETFASTINT (p->update_tick, 0); 626 p->update_tick = 0;
635 p->pid = 0; 627 p->pid = 0;
636 p->raw_status_new = 0; 628 p->raw_status_new = 0;
637 p->status = Qrun; 629 p->status = Qrun;
638 p->mark = Fmake_marker (); 630 p->mark = Fmake_marker ();
639 631
640#ifdef ADAPTIVE_READ_BUFFERING 632#ifdef ADAPTIVE_READ_BUFFERING
641 p->adaptive_read_buffering = Qnil; 633 p->adaptive_read_buffering = 0;
642 XSETFASTINT (p->read_output_delay, 0); 634 p->read_output_delay = 0;
643 p->read_output_skip = Qnil; 635 p->read_output_skip = 0;
644#endif 636#endif
645 637
646 /* If name is already in use, modify it until it is unused. */ 638 /* If name is already in use, modify it until it is unused. */
@@ -679,8 +671,8 @@ setup_process_coding_systems (process)
679 Lisp_Object process; 671 Lisp_Object process;
680{ 672{
681 struct Lisp_Process *p = XPROCESS (process); 673 struct Lisp_Process *p = XPROCESS (process);
682 int inch = XINT (p->infd); 674 int inch = p->infd;
683 int outch = XINT (p->outfd); 675 int outch = p->outfd;
684 676
685 if (inch < 0 || outch < 0) 677 if (inch < 0 || outch < 0)
686 return; 678 return;
@@ -692,7 +684,7 @@ setup_process_coding_systems (process)
692 proc_decode_coding_system[inch]); 684 proc_decode_coding_system[inch]);
693 if (! NILP (p->filter)) 685 if (! NILP (p->filter))
694 { 686 {
695 if (NILP (p->filter_multibyte)) 687 if (!p->filter_multibyte)
696 setup_raw_text_coding_system (proc_decode_coding_system[inch]); 688 setup_raw_text_coding_system (proc_decode_coding_system[inch]);
697 } 689 }
698 else if (BUFFERP (p->buffer)) 690 else if (BUFFERP (p->buffer))
@@ -815,10 +807,10 @@ nil, indicating the current buffer's process. */)
815 if (NETCONN1_P (p)) 807 if (NETCONN1_P (p))
816 { 808 {
817 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 809 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
818 XSETINT (p->tick, ++process_tick); 810 p->tick = ++process_tick;
819 status_notify (p); 811 status_notify (p);
820 } 812 }
821 else if (XINT (p->infd) >= 0) 813 else if (p->infd >= 0)
822 { 814 {
823#ifdef SIGCHLD 815#ifdef SIGCHLD
824 Lisp_Object symbol; 816 Lisp_Object symbol;
@@ -846,7 +838,7 @@ nil, indicating the current buffer's process. */)
846 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 838 /* Do this now, since remove_process will make sigchld_handler do nothing. */
847 p->status 839 p->status
848 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); 840 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
849 XSETINT (p->tick, ++process_tick); 841 p->tick = ++process_tick;
850 status_notify (p); 842 status_notify (p);
851 } 843 }
852 } 844 }
@@ -1038,18 +1030,18 @@ The string argument is normally a multibyte string, except:
1038 (debug) 1030 (debug)
1039 (set-process-filter process ...) */ 1031 (set-process-filter process ...) */
1040 1032
1041 if (XINT (p->infd) >= 0) 1033 if (p->infd >= 0)
1042 { 1034 {
1043 if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) 1035 if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
1044 { 1036 {
1045 FD_CLR (XINT (p->infd), &input_wait_mask); 1037 FD_CLR (p->infd, &input_wait_mask);
1046 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 1038 FD_CLR (p->infd, &non_keyboard_wait_mask);
1047 } 1039 }
1048 else if (EQ (p->filter, Qt) 1040 else if (EQ (p->filter, Qt)
1049 && !EQ (p->command, Qt)) /* Network process not stopped. */ 1041 && !EQ (p->command, Qt)) /* Network process not stopped. */
1050 { 1042 {
1051 FD_SET (XINT (p->infd), &input_wait_mask); 1043 FD_SET (p->infd, &input_wait_mask);
1052 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 1044 FD_SET (p->infd, &non_keyboard_wait_mask);
1053 } 1045 }
1054 } 1046 }
1055 1047
@@ -1111,8 +1103,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size,
1111 CHECK_NATNUM (height); 1103 CHECK_NATNUM (height);
1112 CHECK_NATNUM (width); 1104 CHECK_NATNUM (width);
1113 1105
1114 if (XINT (XPROCESS (process)->infd) < 0 1106 if (XPROCESS (process)->infd < 0
1115 || set_window_size (XINT (XPROCESS (process)->infd), 1107 || set_window_size (XPROCESS (process)->infd,
1116 XINT (height), XINT (width)) <= 0) 1108 XINT (height), XINT (width)) <= 0)
1117 return Qnil; 1109 return Qnil;
1118 else 1110 else
@@ -1140,7 +1132,7 @@ for the process which will run. */)
1140 register Lisp_Object process, flag; 1132 register Lisp_Object process, flag;
1141{ 1133{
1142 CHECK_PROCESS (process); 1134 CHECK_PROCESS (process);
1143 XPROCESS (process)->inherit_coding_system_flag = flag; 1135 XPROCESS (process)->inherit_coding_system_flag = !NILP (flag);
1144 return flag; 1136 return flag;
1145} 1137}
1146 1138
@@ -1155,7 +1147,7 @@ the process output. */)
1155 register Lisp_Object process; 1147 register Lisp_Object process;
1156{ 1148{
1157 CHECK_PROCESS (process); 1149 CHECK_PROCESS (process);
1158 return XPROCESS (process)->inherit_coding_system_flag; 1150 return XPROCESS (process)->inherit_coding_system_flag ? Qt : Qnil;
1159} 1151}
1160 1152
1161DEFUN ("set-process-query-on-exit-flag", 1153DEFUN ("set-process-query-on-exit-flag",
@@ -1168,7 +1160,7 @@ exiting if PROCESS is running. */)
1168 register Lisp_Object process, flag; 1160 register Lisp_Object process, flag;
1169{ 1161{
1170 CHECK_PROCESS (process); 1162 CHECK_PROCESS (process);
1171 XPROCESS (process)->kill_without_query = Fnull (flag); 1163 XPROCESS (process)->kill_without_query = NILP (flag);
1172 return flag; 1164 return flag;
1173} 1165}
1174 1166
@@ -1180,7 +1172,7 @@ DEFUN ("process-query-on-exit-flag",
1180 register Lisp_Object process; 1172 register Lisp_Object process;
1181{ 1173{
1182 CHECK_PROCESS (process); 1174 CHECK_PROCESS (process);
1183 return Fnull (XPROCESS (process)->kill_without_query); 1175 return (XPROCESS (process)->kill_without_query ? Qnil : Qt);
1184} 1176}
1185 1177
1186#ifdef DATAGRAM_SOCKETS 1178#ifdef DATAGRAM_SOCKETS
@@ -1355,7 +1347,7 @@ list_processes_1 (query_only)
1355 p = XPROCESS (proc); 1347 p = XPROCESS (proc);
1356 if (NILP (p->childp)) 1348 if (NILP (p->childp))
1357 continue; 1349 continue;
1358 if (!NILP (query_only) && !NILP (p->kill_without_query)) 1350 if (!NILP (query_only) && p->kill_without_query)
1359 continue; 1351 continue;
1360 if (STRINGP (p->name) 1352 if (STRINGP (p->name)
1361 && ( i = SCHARS (p->name), (i > w_proc))) 1353 && ( i = SCHARS (p->name), (i > w_proc)))
@@ -1418,7 +1410,7 @@ list_processes_1 (query_only)
1418 p = XPROCESS (proc); 1410 p = XPROCESS (proc);
1419 if (NILP (p->childp)) 1411 if (NILP (p->childp))
1420 continue; 1412 continue;
1421 if (!NILP (query_only) && !NILP (p->kill_without_query)) 1413 if (!NILP (query_only) && p->kill_without_query)
1422 continue; 1414 continue;
1423 1415
1424 Finsert (1, &p->name); 1416 Finsert (1, &p->name);
@@ -1494,7 +1486,7 @@ list_processes_1 (query_only)
1494 if (NILP (port)) 1486 if (NILP (port))
1495 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); 1487 port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil);
1496 sprintf (tembuf, "(network %s server on %s)\n", 1488 sprintf (tembuf, "(network %s server on %s)\n",
1497 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), 1489 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1498 (STRINGP (port) ? (char *)SDATA (port) : "?")); 1490 (STRINGP (port) ? (char *)SDATA (port) : "?"));
1499 insert_string (tembuf); 1491 insert_string (tembuf);
1500 } 1492 }
@@ -1512,7 +1504,7 @@ list_processes_1 (query_only)
1512 if (NILP (host)) 1504 if (NILP (host))
1513 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); 1505 host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil);
1514 sprintf (tembuf, "(network %s connection to %s)\n", 1506 sprintf (tembuf, "(network %s connection to %s)\n",
1515 (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), 1507 (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"),
1516 (STRINGP (host) ? (char *)SDATA (host) : "?")); 1508 (STRINGP (host) ? (char *)SDATA (host) : "?"));
1517 insert_string (tembuf); 1509 insert_string (tembuf);
1518 } 1510 }
@@ -1643,11 +1635,13 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1643 XPROCESS (proc)->sentinel = Qnil; 1635 XPROCESS (proc)->sentinel = Qnil;
1644 XPROCESS (proc)->filter = Qnil; 1636 XPROCESS (proc)->filter = Qnil;
1645 XPROCESS (proc)->filter_multibyte 1637 XPROCESS (proc)->filter_multibyte
1646 = buffer_defaults.enable_multibyte_characters; 1638 = !NILP (buffer_defaults.enable_multibyte_characters);
1647 XPROCESS (proc)->command = Flist (nargs - 2, args + 2); 1639 XPROCESS (proc)->command = Flist (nargs - 2, args + 2);
1648 1640
1649#ifdef ADAPTIVE_READ_BUFFERING 1641#ifdef ADAPTIVE_READ_BUFFERING
1650 XPROCESS (proc)->adaptive_read_buffering = Vprocess_adaptive_read_buffering; 1642 XPROCESS (proc)->adaptive_read_buffering
1643 = (NILP (Vprocess_adaptive_read_buffering) ? 0
1644 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2);
1651#endif 1645#endif
1652 1646
1653 /* Make the process marker point into the process buffer (if any). */ 1647 /* Make the process marker point into the process buffer (if any). */
@@ -1778,13 +1772,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1778#endif /* not VMS */ 1772#endif /* not VMS */
1779 1773
1780 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1774 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1781 XPROCESS (proc)->decoding_carryover = make_number (0); 1775 XPROCESS (proc)->decoding_carryover = 0;
1782 XPROCESS (proc)->encoding_buf = make_uninit_string (0); 1776 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
1783 XPROCESS (proc)->encoding_carryover = make_number (0);
1784 1777
1785 XPROCESS (proc)->inherit_coding_system_flag 1778 XPROCESS (proc)->inherit_coding_system_flag
1786 = (NILP (buffer) || !inherit_process_coding_system 1779 = (NILP (buffer) || !inherit_process_coding_system);
1787 ? Qnil : Qt);
1788 1780
1789 create_process (proc, (char **) new_argv, current_dir); 1781 create_process (proc, (char **) new_argv, current_dir);
1790 1782
@@ -1956,15 +1948,15 @@ create_process (process, new_argv, current_dir)
1956 /* Record this as an active process, with its channels. 1948 /* Record this as an active process, with its channels.
1957 As a result, child_setup will close Emacs's side of the pipes. */ 1949 As a result, child_setup will close Emacs's side of the pipes. */
1958 chan_process[inchannel] = process; 1950 chan_process[inchannel] = process;
1959 XSETINT (XPROCESS (process)->infd, inchannel); 1951 XPROCESS (process)->infd = inchannel;
1960 XSETINT (XPROCESS (process)->outfd, outchannel); 1952 XPROCESS (process)->outfd = outchannel;
1961 1953
1962 /* Previously we recorded the tty descriptor used in the subprocess. 1954 /* Previously we recorded the tty descriptor used in the subprocess.
1963 It was only used for getting the foreground tty process, so now 1955 It was only used for getting the foreground tty process, so now
1964 we just reopen the device (see emacs_get_tty_pgrp) as this is 1956 we just reopen the device (see emacs_get_tty_pgrp) as this is
1965 more portable (see USG_SUBTTY_WORKS above). */ 1957 more portable (see USG_SUBTTY_WORKS above). */
1966 1958
1967 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil); 1959 XPROCESS (process)->pty_flag = pty_flag;
1968 XPROCESS (process)->status = Qrun; 1960 XPROCESS (process)->status = Qrun;
1969 setup_process_coding_systems (process); 1961 setup_process_coding_systems (process);
1970 1962
@@ -2481,7 +2473,7 @@ DEFUN ("process-datagram-address", Fprocess_datagram_address, Sprocess_datagram_
2481 if (!DATAGRAM_CONN_P (process)) 2473 if (!DATAGRAM_CONN_P (process))
2482 return Qnil; 2474 return Qnil;
2483 2475
2484 channel = XINT (XPROCESS (process)->infd); 2476 channel = XPROCESS (process)->infd;
2485 return conv_sockaddr_to_lisp (datagram_address[channel].sa, 2477 return conv_sockaddr_to_lisp (datagram_address[channel].sa,
2486 datagram_address[channel].len); 2478 datagram_address[channel].len);
2487} 2479}
@@ -2501,7 +2493,7 @@ Returns nil upon error setting address, ADDRESS otherwise. */)
2501 if (!DATAGRAM_CONN_P (process)) 2493 if (!DATAGRAM_CONN_P (process))
2502 return Qnil; 2494 return Qnil;
2503 2495
2504 channel = XINT (XPROCESS (process)->infd); 2496 channel = XPROCESS (process)->infd;
2505 2497
2506 len = get_lisp_to_sockaddr_size (address, &family); 2498 len = get_lisp_to_sockaddr_size (address, &family);
2507 if (datagram_address[channel].len != len) 2499 if (datagram_address[channel].len != len)
@@ -2666,7 +2658,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2666 if (!NETCONN1_P (p)) 2658 if (!NETCONN1_P (p))
2667 error ("Process is not a network process"); 2659 error ("Process is not a network process");
2668 2660
2669 s = XINT (p->infd); 2661 s = p->infd;
2670 if (s < 0) 2662 if (s < 0)
2671 error ("Process is not running"); 2663 error ("Process is not running");
2672 2664
@@ -3425,18 +3417,18 @@ usage: (make-network-process &rest ARGS) */)
3425 p->buffer = buffer; 3417 p->buffer = buffer;
3426 p->sentinel = sentinel; 3418 p->sentinel = sentinel;
3427 p->filter = filter; 3419 p->filter = filter;
3428 p->filter_multibyte = buffer_defaults.enable_multibyte_characters; 3420 p->filter_multibyte = !NILP (buffer_defaults.enable_multibyte_characters);
3429 /* Override the above only if :filter-multibyte is specified. */ 3421 /* Override the above only if :filter-multibyte is specified. */
3430 if (! NILP (Fplist_member (contact, QCfilter_multibyte))) 3422 if (! NILP (Fplist_member (contact, QCfilter_multibyte)))
3431 p->filter_multibyte = Fplist_get (contact, QCfilter_multibyte); 3423 p->filter_multibyte = !NILP (Fplist_get (contact, QCfilter_multibyte));
3432 p->log = Fplist_get (contact, QClog); 3424 p->log = Fplist_get (contact, QClog);
3433 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3425 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3434 p->kill_without_query = Qt; 3426 p->kill_without_query = 1;
3435 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3427 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3436 p->command = Qt; 3428 p->command = Qt;
3437 p->pid = 0; 3429 p->pid = 0;
3438 XSETINT (p->infd, inch); 3430 p->infd = inch;
3439 XSETINT (p->outfd, outch); 3431 p->outfd = outch;
3440 if (is_server && socktype == SOCK_STREAM) 3432 if (is_server && socktype == SOCK_STREAM)
3441 p->status = Qlisten; 3433 p->status = Qlisten;
3442 3434
@@ -3557,13 +3549,11 @@ usage: (make-network-process &rest ARGS) */)
3557 setup_process_coding_systems (proc); 3549 setup_process_coding_systems (proc);
3558 3550
3559 p->decoding_buf = make_uninit_string (0); 3551 p->decoding_buf = make_uninit_string (0);
3560 p->decoding_carryover = make_number (0); 3552 p->decoding_carryover = 0;
3561 p->encoding_buf = make_uninit_string (0); 3553 p->encoding_buf = make_uninit_string (0);
3562 p->encoding_carryover = make_number (0);
3563 3554
3564 p->inherit_coding_system_flag 3555 p->inherit_coding_system_flag
3565 = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system 3556 = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
3566 ? Qnil : Qt);
3567 3557
3568 UNGCPRO; 3558 UNGCPRO;
3569 return proc; 3559 return proc;
@@ -3826,16 +3816,16 @@ deactivate_process (proc)
3826 register int inchannel, outchannel; 3816 register int inchannel, outchannel;
3827 register struct Lisp_Process *p = XPROCESS (proc); 3817 register struct Lisp_Process *p = XPROCESS (proc);
3828 3818
3829 inchannel = XINT (p->infd); 3819 inchannel = p->infd;
3830 outchannel = XINT (p->outfd); 3820 outchannel = p->outfd;
3831 3821
3832#ifdef ADAPTIVE_READ_BUFFERING 3822#ifdef ADAPTIVE_READ_BUFFERING
3833 if (XINT (p->read_output_delay) > 0) 3823 if (p->read_output_delay > 0)
3834 { 3824 {
3835 if (--process_output_delay_count < 0) 3825 if (--process_output_delay_count < 0)
3836 process_output_delay_count = 0; 3826 process_output_delay_count = 0;
3837 XSETINT (p->read_output_delay, 0); 3827 p->read_output_delay = 0;
3838 p->read_output_skip = Qnil; 3828 p->read_output_skip = 0;
3839 } 3829 }
3840#endif 3830#endif
3841 3831
@@ -3857,8 +3847,8 @@ deactivate_process (proc)
3857 emacs_close (outchannel); 3847 emacs_close (outchannel);
3858#endif 3848#endif
3859 3849
3860 XSETINT (p->infd, -1); 3850 p->infd = -1;
3861 XSETINT (p->outfd, -1); 3851 p->outfd = -1;
3862#ifdef DATAGRAM_SOCKETS 3852#ifdef DATAGRAM_SOCKETS
3863 if (DATAGRAM_CHAN_P (inchannel)) 3853 if (DATAGRAM_CHAN_P (inchannel))
3864 { 3854 {
@@ -3906,8 +3896,8 @@ close_process_descs ()
3906 process = chan_process[i]; 3896 process = chan_process[i];
3907 if (!NILP (process)) 3897 if (!NILP (process))
3908 { 3898 {
3909 int in = XINT (XPROCESS (process)->infd); 3899 int in = XPROCESS (process)->infd;
3910 int out = XINT (XPROCESS (process)->outfd); 3900 int out = XPROCESS (process)->outfd;
3911 if (in >= 0) 3901 if (in >= 0)
3912 emacs_close (in); 3902 emacs_close (in);
3913 if (out >= 0 && in != out) 3903 if (out >= 0 && in != out)
@@ -4151,8 +4141,8 @@ server_accept_connection (server, channel)
4151 p->filter = ps->filter; 4141 p->filter = ps->filter;
4152 p->command = Qnil; 4142 p->command = Qnil;
4153 p->pid = 0; 4143 p->pid = 0;
4154 XSETINT (p->infd, s); 4144 p->infd = s;
4155 XSETINT (p->outfd, s); 4145 p->outfd = s;
4156 p->status = Qrun; 4146 p->status = Qrun;
4157 4147
4158 /* Client processes for accepted connections are not stopped initially. */ 4148 /* Client processes for accepted connections are not stopped initially. */
@@ -4175,12 +4165,11 @@ server_accept_connection (server, channel)
4175 setup_process_coding_systems (proc); 4165 setup_process_coding_systems (proc);
4176 4166
4177 p->decoding_buf = make_uninit_string (0); 4167 p->decoding_buf = make_uninit_string (0);
4178 p->decoding_carryover = make_number (0); 4168 p->decoding_carryover = 0;
4179 p->encoding_buf = make_uninit_string (0); 4169 p->encoding_buf = make_uninit_string (0);
4180 p->encoding_carryover = make_number (0);
4181 4170
4182 p->inherit_coding_system_flag 4171 p->inherit_coding_system_flag
4183 = (NILP (buffer) ? Qnil : ps->inherit_coding_system_flag); 4172 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
4184 4173
4185 if (!NILP (ps->log)) 4174 if (!NILP (ps->log))
4186 call3 (ps->log, server, proc, 4175 call3 (ps->log, server, proc,
@@ -4305,7 +4294,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4305 4294
4306 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4295 /* If wait_proc is a process to watch, set wait_channel accordingly. */
4307 if (wait_proc != NULL) 4296 if (wait_proc != NULL)
4308 wait_channel = XINT (wait_proc->infd); 4297 wait_channel = wait_proc->infd;
4309 4298
4310 record_unwind_protect (wait_reading_process_output_unwind, 4299 record_unwind_protect (wait_reading_process_output_unwind,
4311 make_number (waiting_for_user_input_p)); 4300 make_number (waiting_for_user_input_p));
@@ -4490,9 +4479,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4490 XSETPROCESS (proc, wait_proc); 4479 XSETPROCESS (proc, wait_proc);
4491 4480
4492 /* Read data from the process, until we exhaust it. */ 4481 /* Read data from the process, until we exhaust it. */
4493 while (XINT (wait_proc->infd) >= 0) 4482 while (wait_proc->infd >= 0)
4494 { 4483 {
4495 nread = read_process_output (proc, XINT (wait_proc->infd)); 4484 nread = read_process_output (proc, wait_proc->infd);
4496 4485
4497 if (nread == 0) 4486 if (nread == 0)
4498 break; 4487 break;
@@ -4522,9 +4511,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4522 4511
4523 if (wait_proc && just_wait_proc) 4512 if (wait_proc && just_wait_proc)
4524 { 4513 {
4525 if (XINT (wait_proc->infd) < 0) /* Terminated */ 4514 if (wait_proc->infd < 0) /* Terminated */
4526 break; 4515 break;
4527 FD_SET (XINT (wait_proc->infd), &Available); 4516 FD_SET (wait_proc->infd, &Available);
4528 check_delay = 0; 4517 check_delay = 0;
4529 IF_NON_BLOCKING_CONNECT (check_connect = 0); 4518 IF_NON_BLOCKING_CONNECT (check_connect = 0);
4530 } 4519 }
@@ -4572,7 +4561,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4572 4561
4573#ifdef ADAPTIVE_READ_BUFFERING 4562#ifdef ADAPTIVE_READ_BUFFERING
4574 /* Set the timeout for adaptive read buffering if any 4563 /* Set the timeout for adaptive read buffering if any
4575 process has non-nil read_output_skip and non-zero 4564 process has non-zero read_output_skip and non-zero
4576 read_output_delay, and we are not reading output for a 4565 read_output_delay, and we are not reading output for a
4577 specific wait_channel. It is not executed if 4566 specific wait_channel. It is not executed if
4578 Vprocess_adaptive_read_buffering is nil. */ 4567 Vprocess_adaptive_read_buffering is nil. */
@@ -4587,16 +4576,16 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4587 if (NILP (proc)) 4576 if (NILP (proc))
4588 continue; 4577 continue;
4589 /* Find minimum non-zero read_output_delay among the 4578 /* Find minimum non-zero read_output_delay among the
4590 processes with non-nil read_output_skip. */ 4579 processes with non-zero read_output_skip. */
4591 if (XINT (XPROCESS (proc)->read_output_delay) > 0) 4580 if (XPROCESS (proc)->read_output_delay > 0)
4592 { 4581 {
4593 check_delay--; 4582 check_delay--;
4594 if (NILP (XPROCESS (proc)->read_output_skip)) 4583 if (!XPROCESS (proc)->read_output_skip)
4595 continue; 4584 continue;
4596 FD_CLR (channel, &Available); 4585 FD_CLR (channel, &Available);
4597 XPROCESS (proc)->read_output_skip = Qnil; 4586 XPROCESS (proc)->read_output_skip = 0;
4598 if (XINT (XPROCESS (proc)->read_output_delay) < usecs) 4587 if (XPROCESS (proc)->read_output_delay < usecs)
4599 usecs = XINT (XPROCESS (proc)->read_output_delay); 4588 usecs = XPROCESS (proc)->read_output_delay;
4600 } 4589 }
4601 } 4590 }
4602 EMACS_SET_SECS_USECS (timeout, 0, usecs); 4591 EMACS_SET_SECS_USECS (timeout, 0, usecs);
@@ -4869,7 +4858,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4869 else 4858 else
4870 { 4859 {
4871 /* Preserve status of processes already terminated. */ 4860 /* Preserve status of processes already terminated. */
4872 XSETINT (XPROCESS (proc)->tick, ++process_tick); 4861 XPROCESS (proc)->tick = ++process_tick;
4873 deactivate_process (proc); 4862 deactivate_process (proc);
4874 if (XPROCESS (proc)->raw_status_new) 4863 if (XPROCESS (proc)->raw_status_new)
4875 update_status (XPROCESS (proc)); 4864 update_status (XPROCESS (proc));
@@ -4921,7 +4910,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4921#endif 4910#endif
4922 if (xerrno) 4911 if (xerrno)
4923 { 4912 {
4924 XSETINT (p->tick, ++process_tick); 4913 p->tick = ++process_tick;
4925 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); 4914 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil));
4926 deactivate_process (proc); 4915 deactivate_process (proc);
4927 } 4916 }
@@ -4934,8 +4923,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4934 exec_sentinel (proc, build_string ("open\n")); 4923 exec_sentinel (proc, build_string ("open\n"));
4935 if (!EQ (p->filter, Qt) && !EQ (p->command, Qt)) 4924 if (!EQ (p->filter, Qt) && !EQ (p->command, Qt))
4936 { 4925 {
4937 FD_SET (XINT (p->infd), &input_wait_mask); 4926 FD_SET (p->infd, &input_wait_mask);
4938 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 4927 FD_SET (p->infd, &non_keyboard_wait_mask);
4939 } 4928 }
4940 } 4929 }
4941 } 4930 }
@@ -5009,7 +4998,7 @@ read_process_output (proc, channel)
5009 register struct Lisp_Process *p = XPROCESS (proc); 4998 register struct Lisp_Process *p = XPROCESS (proc);
5010 register int opoint; 4999 register int opoint;
5011 struct coding_system *coding = proc_decode_coding_system[channel]; 5000 struct coding_system *coding = proc_decode_coding_system[channel];
5012 int carryover = XINT (p->decoding_carryover); 5001 int carryover = p->decoding_carryover;
5013 int readmax = 4096; 5002 int readmax = 4096;
5014 5003
5015#ifdef VMS 5004#ifdef VMS
@@ -5062,9 +5051,9 @@ read_process_output (proc, channel)
5062 { 5051 {
5063 nbytes = emacs_read (channel, chars + carryover, readmax); 5052 nbytes = emacs_read (channel, chars + carryover, readmax);
5064#ifdef ADAPTIVE_READ_BUFFERING 5053#ifdef ADAPTIVE_READ_BUFFERING
5065 if (nbytes > 0 && !NILP (p->adaptive_read_buffering)) 5054 if (nbytes > 0 && p->adaptive_read_buffering)
5066 { 5055 {
5067 int delay = XINT (p->read_output_delay); 5056 int delay = p->read_output_delay;
5068 if (nbytes < 256) 5057 if (nbytes < 256)
5069 { 5058 {
5070 if (delay < READ_OUTPUT_DELAY_MAX_MAX) 5059 if (delay < READ_OUTPUT_DELAY_MAX_MAX)
@@ -5080,10 +5069,10 @@ read_process_output (proc, channel)
5080 if (delay == 0) 5069 if (delay == 0)
5081 process_output_delay_count--; 5070 process_output_delay_count--;
5082 } 5071 }
5083 XSETINT (p->read_output_delay, delay); 5072 p->read_output_delay = delay;
5084 if (delay) 5073 if (delay)
5085 { 5074 {
5086 p->read_output_skip = Qt; 5075 p->read_output_skip = 1;
5087 process_output_skip = 1; 5076 process_output_skip = 1;
5088 } 5077 }
5089 } 5078 }
@@ -5101,7 +5090,7 @@ read_process_output (proc, channel)
5101 } 5090 }
5102#endif /* not VMS */ 5091#endif /* not VMS */
5103 5092
5104 XSETINT (p->decoding_carryover, 0); 5093 p->decoding_carryover = 0;
5105 5094
5106 /* At this point, NBYTES holds number of bytes just received 5095 /* At this point, NBYTES holds number of bytes just received
5107 (including the one in proc_buffered_char[channel]). */ 5096 (including the one in proc_buffered_char[channel]). */
@@ -5175,14 +5164,14 @@ read_process_output (proc, channel)
5175 valid memory because p->outfd will be changed once EOF is 5164 valid memory because p->outfd will be changed once EOF is
5176 sent to the process. */ 5165 sent to the process. */
5177 if (NILP (p->encode_coding_system) 5166 if (NILP (p->encode_coding_system)
5178 && proc_encode_coding_system[XINT (p->outfd)]) 5167 && proc_encode_coding_system[p->outfd])
5179 { 5168 {
5180 p->encode_coding_system = coding->symbol; 5169 p->encode_coding_system = coding->symbol;
5181 setup_coding_system (coding->symbol, 5170 setup_coding_system (coding->symbol,
5182 proc_encode_coding_system[XINT (p->outfd)]); 5171 proc_encode_coding_system[p->outfd]);
5183 if (proc_encode_coding_system[XINT (p->outfd)]->eol_type 5172 if (proc_encode_coding_system[p->outfd]->eol_type
5184 == CODING_EOL_UNDECIDED) 5173 == CODING_EOL_UNDECIDED)
5185 proc_encode_coding_system[XINT (p->outfd)]->eol_type 5174 proc_encode_coding_system[p->outfd]->eol_type
5186 = system_eol_type; 5175 = system_eol_type;
5187 } 5176 }
5188 } 5177 }
@@ -5195,9 +5184,9 @@ read_process_output (proc, channel)
5195 p->decoding_buf = make_uninit_string (carryover); 5184 p->decoding_buf = make_uninit_string (carryover);
5196 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 5185 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
5197 carryover); 5186 carryover);
5198 XSETINT (p->decoding_carryover, carryover); 5187 p->decoding_carryover = carryover;
5199 /* Adjust the multibyteness of TEXT to that of the filter. */ 5188 /* Adjust the multibyteness of TEXT to that of the filter. */
5200 if (NILP (p->filter_multibyte) != ! STRING_MULTIBYTE (text)) 5189 if (p->filter_multibyte != STRING_MULTIBYTE (text))
5201 text = (STRING_MULTIBYTE (text) 5190 text = (STRING_MULTIBYTE (text)
5202 ? Fstring_as_unibyte (text) 5191 ? Fstring_as_unibyte (text)
5203 : Fstring_to_multibyte (text)); 5192 : Fstring_to_multibyte (text));
@@ -5289,14 +5278,14 @@ read_process_output (proc, channel)
5289 { 5278 {
5290 p->decode_coding_system = coding->symbol; 5279 p->decode_coding_system = coding->symbol;
5291 if (NILP (p->encode_coding_system) 5280 if (NILP (p->encode_coding_system)
5292 && proc_encode_coding_system[XINT (p->outfd)]) 5281 && proc_encode_coding_system[p->outfd])
5293 { 5282 {
5294 p->encode_coding_system = coding->symbol; 5283 p->encode_coding_system = coding->symbol;
5295 setup_coding_system (coding->symbol, 5284 setup_coding_system (coding->symbol,
5296 proc_encode_coding_system[XINT (p->outfd)]); 5285 proc_encode_coding_system[p->outfd]);
5297 if (proc_encode_coding_system[XINT (p->outfd)]->eol_type 5286 if (proc_encode_coding_system[p->outfd]->eol_type
5298 == CODING_EOL_UNDECIDED) 5287 == CODING_EOL_UNDECIDED)
5299 proc_encode_coding_system[XINT (p->outfd)]->eol_type 5288 proc_encode_coding_system[p->outfd]->eol_type
5300 = system_eol_type; 5289 = system_eol_type;
5301 } 5290 }
5302 } 5291 }
@@ -5308,7 +5297,7 @@ read_process_output (proc, channel)
5308 p->decoding_buf = make_uninit_string (carryover); 5297 p->decoding_buf = make_uninit_string (carryover);
5309 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 5298 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
5310 carryover); 5299 carryover);
5311 XSETINT (p->decoding_carryover, carryover); 5300 p->decoding_carryover = carryover;
5312 5301
5313 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5302 /* Adjust the multibyteness of TEXT to that of the buffer. */
5314 if (NILP (current_buffer->enable_multibyte_characters) 5303 if (NILP (current_buffer->enable_multibyte_characters)
@@ -5427,10 +5416,10 @@ send_process (proc, buf, len, object)
5427 update_status (p); 5416 update_status (p);
5428 if (! EQ (p->status, Qrun)) 5417 if (! EQ (p->status, Qrun))
5429 error ("Process %s not running", SDATA (p->name)); 5418 error ("Process %s not running", SDATA (p->name));
5430 if (XINT (p->outfd) < 0) 5419 if (p->outfd < 0)
5431 error ("Output file descriptor of %s is closed", SDATA (p->name)); 5420 error ("Output file descriptor of %s is closed", SDATA (p->name));
5432 5421
5433 coding = proc_encode_coding_system[XINT (p->outfd)]; 5422 coding = proc_encode_coding_system[p->outfd];
5434 Vlast_coding_system_used = coding->symbol; 5423 Vlast_coding_system_used = coding->symbol;
5435 5424
5436 if ((STRINGP (object) && STRING_MULTIBYTE (object)) 5425 if ((STRINGP (object) && STRING_MULTIBYTE (object))
@@ -5523,7 +5512,7 @@ send_process (proc, buf, len, object)
5523 if (pty_max_bytes == 0) 5512 if (pty_max_bytes == 0)
5524 { 5513 {
5525#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON) 5514#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
5526 pty_max_bytes = fpathconf (XFASTINT (p->outfd), _PC_MAX_CANON); 5515 pty_max_bytes = fpathconf (p->outfd, _PC_MAX_CANON);
5527 if (pty_max_bytes < 0) 5516 if (pty_max_bytes < 0)
5528 pty_max_bytes = 250; 5517 pty_max_bytes = 250;
5529#else 5518#else
@@ -5545,7 +5534,7 @@ send_process (proc, buf, len, object)
5545 5534
5546 /* Decide how much data we can send in one batch. 5535 /* Decide how much data we can send in one batch.
5547 Long lines need to be split into multiple batches. */ 5536 Long lines need to be split into multiple batches. */
5548 if (!NILP (p->pty_flag)) 5537 if (p->pty_flag)
5549 { 5538 {
5550 /* Starting this at zero is always correct when not the first 5539 /* Starting this at zero is always correct when not the first
5551 iteration because the previous iteration ended by sending C-d. 5540 iteration because the previous iteration ended by sending C-d.
@@ -5574,7 +5563,7 @@ send_process (proc, buf, len, object)
5574 /* Send this batch, using one or more write calls. */ 5563 /* Send this batch, using one or more write calls. */
5575 while (this > 0) 5564 while (this > 0)
5576 { 5565 {
5577 int outfd = XINT (p->outfd); 5566 int outfd = p->outfd;
5578 old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); 5567 old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap);
5579#ifdef DATAGRAM_SOCKETS 5568#ifdef DATAGRAM_SOCKETS
5580 if (DATAGRAM_CHAN_P (outfd)) 5569 if (DATAGRAM_CHAN_P (outfd))
@@ -5594,12 +5583,12 @@ send_process (proc, buf, len, object)
5594 { 5583 {
5595 rv = emacs_write (outfd, (char *) buf, this); 5584 rv = emacs_write (outfd, (char *) buf, this);
5596#ifdef ADAPTIVE_READ_BUFFERING 5585#ifdef ADAPTIVE_READ_BUFFERING
5597 if (XINT (p->read_output_delay) > 0 5586 if (p->read_output_delay > 0
5598 && EQ (p->adaptive_read_buffering, Qt)) 5587 && p->adaptive_read_buffering == 1)
5599 { 5588 {
5600 XSETFASTINT (p->read_output_delay, 0); 5589 p->read_output_delay = 0;
5601 process_output_delay_count--; 5590 process_output_delay_count--;
5602 p->read_output_skip = Qnil; 5591 p->read_output_skip = 0;
5603 } 5592 }
5604#endif 5593#endif
5605 } 5594 }
@@ -5642,7 +5631,7 @@ send_process (proc, buf, len, object)
5642 if (errno == EAGAIN) 5631 if (errno == EAGAIN)
5643 { 5632 {
5644 int flags = FWRITE; 5633 int flags = FWRITE;
5645 ioctl (XINT (p->outfd), TIOCFLUSH, &flags); 5634 ioctl (p->outfd, TIOCFLUSH, &flags);
5646 } 5635 }
5647#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ 5636#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
5648 5637
@@ -5691,7 +5680,7 @@ send_process (proc, buf, len, object)
5691#endif 5680#endif
5692 p->raw_status_new = 0; 5681 p->raw_status_new = 0;
5693 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); 5682 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil));
5694 XSETINT (p->tick, ++process_tick); 5683 p->tick = ++process_tick;
5695 deactivate_process (proc); 5684 deactivate_process (proc);
5696#ifdef VMS 5685#ifdef VMS
5697 error ("Error writing to process %s; closed it", SDATA (p->name)); 5686 error ("Error writing to process %s; closed it", SDATA (p->name));
@@ -5743,10 +5732,10 @@ send_process_object (proc, start, end)
5743 update_status (p); 5732 update_status (p);
5744 if (! EQ (p->status, Qrun)) 5733 if (! EQ (p->status, Qrun))
5745 error ("Process %s not running", SDATA (p->name)); 5734 error ("Process %s not running", SDATA (p->name));
5746 if (XINT (p->outfd) < 0) 5735 if (p->outfd < 0)
5747 error ("Output file descriptor of %s is closed", SDATA (p->name)); 5736 error ("Output file descriptor of %s is closed", SDATA (p->name));
5748 5737
5749 coding = proc_encode_coding_system[XINT (p->outfd)]; 5738 coding = proc_encode_coding_system[p->outfd];
5750 if (! EQ (coding->symbol, p->encode_coding_system)) 5739 if (! EQ (coding->symbol, p->encode_coding_system))
5751 /* The coding system for encoding was changed to raw-text 5740 /* The coding system for encoding was changed to raw-text
5752 because we sent a unibyte text previously. Now we are 5741 because we sent a unibyte text previously. Now we are
@@ -5835,7 +5824,7 @@ emacs_get_tty_pgrp (p)
5835 int gid = -1; 5824 int gid = -1;
5836 5825
5837#ifdef TIOCGPGRP 5826#ifdef TIOCGPGRP
5838 if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) 5827 if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
5839 { 5828 {
5840 int fd; 5829 int fd;
5841 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the 5830 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
@@ -5873,7 +5862,7 @@ return t unconditionally. */)
5873 if (!EQ (p->childp, Qt)) 5862 if (!EQ (p->childp, Qt))
5874 error ("Process %s is not a subprocess", 5863 error ("Process %s is not a subprocess",
5875 SDATA (p->name)); 5864 SDATA (p->name));
5876 if (XINT (p->infd) < 0) 5865 if (p->infd < 0)
5877 error ("Process %s is not active", 5866 error ("Process %s is not active",
5878 SDATA (p->name)); 5867 SDATA (p->name));
5879 5868
@@ -5916,11 +5905,11 @@ process_send_signal (process, signo, current_group, nomsg)
5916 if (!EQ (p->childp, Qt)) 5905 if (!EQ (p->childp, Qt))
5917 error ("Process %s is not a subprocess", 5906 error ("Process %s is not a subprocess",
5918 SDATA (p->name)); 5907 SDATA (p->name));
5919 if (XINT (p->infd) < 0) 5908 if (p->infd < 0)
5920 error ("Process %s is not active", 5909 error ("Process %s is not active",
5921 SDATA (p->name)); 5910 SDATA (p->name));
5922 5911
5923 if (NILP (p->pty_flag)) 5912 if (!p->pty_flag)
5924 current_group = Qnil; 5913 current_group = Qnil;
5925 5914
5926 /* If we are using pgrps, get a pgrp number and make it negative. */ 5915 /* If we are using pgrps, get a pgrp number and make it negative. */
@@ -5939,7 +5928,7 @@ process_send_signal (process, signo, current_group, nomsg)
5939 struct termios t; 5928 struct termios t;
5940 cc_t *sig_char = NULL; 5929 cc_t *sig_char = NULL;
5941 5930
5942 tcgetattr (XINT (p->infd), &t); 5931 tcgetattr (p->infd, &t);
5943 5932
5944 switch (signo) 5933 switch (signo)
5945 { 5934 {
@@ -5979,16 +5968,16 @@ process_send_signal (process, signo, current_group, nomsg)
5979 switch (signo) 5968 switch (signo)
5980 { 5969 {
5981 case SIGINT: 5970 case SIGINT:
5982 ioctl (XINT (p->infd), TIOCGETC, &c); 5971 ioctl (p->infd, TIOCGETC, &c);
5983 send_process (proc, &c.t_intrc, 1, Qnil); 5972 send_process (proc, &c.t_intrc, 1, Qnil);
5984 return; 5973 return;
5985 case SIGQUIT: 5974 case SIGQUIT:
5986 ioctl (XINT (p->infd), TIOCGETC, &c); 5975 ioctl (p->infd, TIOCGETC, &c);
5987 send_process (proc, &c.t_quitc, 1, Qnil); 5976 send_process (proc, &c.t_quitc, 1, Qnil);
5988 return; 5977 return;
5989#ifdef SIGTSTP 5978#ifdef SIGTSTP
5990 case SIGTSTP: 5979 case SIGTSTP:
5991 ioctl (XINT (p->infd), TIOCGLTC, &lc); 5980 ioctl (p->infd, TIOCGLTC, &lc);
5992 send_process (proc, &lc.t_suspc, 1, Qnil); 5981 send_process (proc, &lc.t_suspc, 1, Qnil);
5993 return; 5982 return;
5994#endif /* ! defined (SIGTSTP) */ 5983#endif /* ! defined (SIGTSTP) */
@@ -6003,16 +5992,16 @@ process_send_signal (process, signo, current_group, nomsg)
6003 switch (signo) 5992 switch (signo)
6004 { 5993 {
6005 case SIGINT: 5994 case SIGINT:
6006 ioctl (XINT (p->infd), TCGETA, &t); 5995 ioctl (p->infd, TCGETA, &t);
6007 send_process (proc, &t.c_cc[VINTR], 1, Qnil); 5996 send_process (proc, &t.c_cc[VINTR], 1, Qnil);
6008 return; 5997 return;
6009 case SIGQUIT: 5998 case SIGQUIT:
6010 ioctl (XINT (p->infd), TCGETA, &t); 5999 ioctl (p->infd, TCGETA, &t);
6011 send_process (proc, &t.c_cc[VQUIT], 1, Qnil); 6000 send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
6012 return; 6001 return;
6013#ifdef SIGTSTP 6002#ifdef SIGTSTP
6014 case SIGTSTP: 6003 case SIGTSTP:
6015 ioctl (XINT (p->infd), TCGETA, &t); 6004 ioctl (p->infd, TCGETA, &t);
6016 send_process (proc, &t.c_cc[VSWTCH], 1, Qnil); 6005 send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
6017 return; 6006 return;
6018#endif /* ! defined (SIGTSTP) */ 6007#endif /* ! defined (SIGTSTP) */
@@ -6070,7 +6059,7 @@ process_send_signal (process, signo, current_group, nomsg)
6070 case SIGCONT: 6059 case SIGCONT:
6071 p->raw_status_new = 0; 6060 p->raw_status_new = 0;
6072 p->status = Qrun; 6061 p->status = Qrun;
6073 XSETINT (p->tick, ++process_tick); 6062 p->tick = ++process_tick;
6074 if (!nomsg) 6063 if (!nomsg)
6075 status_notify (NULL); 6064 status_notify (NULL);
6076 break; 6065 break;
@@ -6090,7 +6079,7 @@ process_send_signal (process, signo, current_group, nomsg)
6090 sys$forcex (&(p->pid), 0, 1); 6079 sys$forcex (&(p->pid), 0, 1);
6091 whoosh: 6080 whoosh:
6092#endif 6081#endif
6093 flush_pending_output (XINT (p->infd)); 6082 flush_pending_output (p->infd);
6094 break; 6083 break;
6095 } 6084 }
6096 6085
@@ -6107,7 +6096,7 @@ process_send_signal (process, signo, current_group, nomsg)
6107#ifdef TIOCSIGSEND 6096#ifdef TIOCSIGSEND
6108 if (!NILP (current_group)) 6097 if (!NILP (current_group))
6109 { 6098 {
6110 if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1) 6099 if (ioctl (p->infd, TIOCSIGSEND, signo) == -1)
6111 EMACS_KILLPG (gid, signo); 6100 EMACS_KILLPG (gid, signo);
6112 } 6101 }
6113 else 6102 else
@@ -6173,10 +6162,10 @@ If PROCESS is a network process, inhibit handling of incoming traffic. */)
6173 6162
6174 p = XPROCESS (process); 6163 p = XPROCESS (process);
6175 if (NILP (p->command) 6164 if (NILP (p->command)
6176 && XINT (p->infd) >= 0) 6165 && p->infd >= 0)
6177 { 6166 {
6178 FD_CLR (XINT (p->infd), &input_wait_mask); 6167 FD_CLR (p->infd, &input_wait_mask);
6179 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 6168 FD_CLR (p->infd, &non_keyboard_wait_mask);
6180 } 6169 }
6181 p->command = Qt; 6170 p->command = Qt;
6182 return process; 6171 return process;
@@ -6204,11 +6193,11 @@ If PROCESS is a network process, resume handling of incoming traffic. */)
6204 6193
6205 p = XPROCESS (process); 6194 p = XPROCESS (process);
6206 if (EQ (p->command, Qt) 6195 if (EQ (p->command, Qt)
6207 && XINT (p->infd) >= 0 6196 && p->infd >= 0
6208 && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten))) 6197 && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
6209 { 6198 {
6210 FD_SET (XINT (p->infd), &input_wait_mask); 6199 FD_SET (p->infd, &input_wait_mask);
6211 FD_SET (XINT (p->infd), &non_keyboard_wait_mask); 6200 FD_SET (p->infd, &non_keyboard_wait_mask);
6212 } 6201 }
6213 p->command = Qnil; 6202 p->command = Qnil;
6214 return process; 6203 return process;
@@ -6405,7 +6394,7 @@ text to PROCESS after you call this function. */)
6405 return process; 6394 return process;
6406 6395
6407 proc = get_process (process); 6396 proc = get_process (process);
6408 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 6397 coding = proc_encode_coding_system[XPROCESS (proc)->outfd];
6409 6398
6410 /* Make sure the process is really alive. */ 6399 /* Make sure the process is really alive. */
6411 if (XPROCESS (proc)->raw_status_new) 6400 if (XPROCESS (proc)->raw_status_new)
@@ -6422,7 +6411,7 @@ text to PROCESS after you call this function. */)
6422#ifdef VMS 6411#ifdef VMS
6423 send_process (proc, "\032", 1, Qnil); /* ^z */ 6412 send_process (proc, "\032", 1, Qnil); /* ^z */
6424#else 6413#else
6425 if (!NILP (XPROCESS (proc)->pty_flag)) 6414 if (XPROCESS (proc)->pty_flag)
6426 send_process (proc, "\004", 1, Qnil); 6415 send_process (proc, "\004", 1, Qnil);
6427 else 6416 else
6428 { 6417 {
@@ -6434,18 +6423,18 @@ text to PROCESS after you call this function. */)
6434 (In some old system, shutdown to socketpair doesn't work. 6423 (In some old system, shutdown to socketpair doesn't work.
6435 Then we just can't win.) */ 6424 Then we just can't win.) */
6436 if (XPROCESS (proc)->pid == 0 6425 if (XPROCESS (proc)->pid == 0
6437 || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd)) 6426 || XPROCESS (proc)->outfd == XPROCESS (proc)->infd)
6438 shutdown (XINT (XPROCESS (proc)->outfd), 1); 6427 shutdown (XPROCESS (proc)->outfd, 1);
6439 /* In case of socketpair, outfd == infd, so don't close it. */ 6428 /* In case of socketpair, outfd == infd, so don't close it. */
6440 if (XINT (XPROCESS (proc)->outfd) != XINT (XPROCESS (proc)->infd)) 6429 if (XPROCESS (proc)->outfd != XPROCESS (proc)->infd)
6441 emacs_close (XINT (XPROCESS (proc)->outfd)); 6430 emacs_close (XPROCESS (proc)->outfd);
6442#else /* not HAVE_SHUTDOWN */ 6431#else /* not HAVE_SHUTDOWN */
6443 emacs_close (XINT (XPROCESS (proc)->outfd)); 6432 emacs_close (XPROCESS (proc)->outfd);
6444#endif /* not HAVE_SHUTDOWN */ 6433#endif /* not HAVE_SHUTDOWN */
6445 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); 6434 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
6446 if (new_outfd < 0) 6435 if (new_outfd < 0)
6447 abort (); 6436 abort ();
6448 old_outfd = XINT (XPROCESS (proc)->outfd); 6437 old_outfd = XPROCESS (proc)->outfd;
6449 6438
6450 if (!proc_encode_coding_system[new_outfd]) 6439 if (!proc_encode_coding_system[new_outfd])
6451 proc_encode_coding_system[new_outfd] 6440 proc_encode_coding_system[new_outfd]
@@ -6456,7 +6445,7 @@ text to PROCESS after you call this function. */)
6456 bzero (proc_encode_coding_system[old_outfd], 6445 bzero (proc_encode_coding_system[old_outfd],
6457 sizeof (struct coding_system)); 6446 sizeof (struct coding_system));
6458 6447
6459 XSETINT (XPROCESS (proc)->outfd, new_outfd); 6448 XPROCESS (proc)->outfd = new_outfd;
6460 } 6449 }
6461#endif /* VMS */ 6450#endif /* VMS */
6462 return process; 6451 return process;
@@ -6479,7 +6468,7 @@ kill_buffer_processes (buffer)
6479 { 6468 {
6480 if (NETCONN_P (proc)) 6469 if (NETCONN_P (proc))
6481 Fdelete_process (proc); 6470 Fdelete_process (proc);
6482 else if (XINT (XPROCESS (proc)->infd) >= 0) 6471 else if (XPROCESS (proc)->infd >= 0)
6483 process_send_signal (proc, SIGHUP, Qnil, 1); 6472 process_send_signal (proc, SIGHUP, Qnil, 1);
6484 } 6473 }
6485 } 6474 }
@@ -6609,21 +6598,21 @@ sigchld_handler (signo)
6609 union { int i; WAITTYPE wt; } u; 6598 union { int i; WAITTYPE wt; } u;
6610 int clear_desc_flag = 0; 6599 int clear_desc_flag = 0;
6611 6600
6612 XSETINT (p->tick, ++process_tick); 6601 p->tick = ++process_tick;
6613 u.wt = w; 6602 u.wt = w;
6614 p->raw_status = u.i; 6603 p->raw_status = u.i;
6615 p->raw_status_new = 1; 6604 p->raw_status_new = 1;
6616 6605
6617 /* If process has terminated, stop waiting for its output. */ 6606 /* If process has terminated, stop waiting for its output. */
6618 if ((WIFSIGNALED (w) || WIFEXITED (w)) 6607 if ((WIFSIGNALED (w) || WIFEXITED (w))
6619 && XINT (p->infd) >= 0) 6608 && p->infd >= 0)
6620 clear_desc_flag = 1; 6609 clear_desc_flag = 1;
6621 6610
6622 /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ 6611 /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */
6623 if (clear_desc_flag) 6612 if (clear_desc_flag)
6624 { 6613 {
6625 FD_CLR (XINT (p->infd), &input_wait_mask); 6614 FD_CLR (p->infd, &input_wait_mask);
6626 FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); 6615 FD_CLR (p->infd, &non_keyboard_wait_mask);
6627 } 6616 }
6628 6617
6629 /* Tell wait_reading_process_output that it needs to wake up and 6618 /* Tell wait_reading_process_output that it needs to wake up and
@@ -6800,18 +6789,18 @@ status_notify (deleting_process)
6800 proc = Fcdr (Fcar (tail)); 6789 proc = Fcdr (Fcar (tail));
6801 p = XPROCESS (proc); 6790 p = XPROCESS (proc);
6802 6791
6803 if (XINT (p->tick) != XINT (p->update_tick)) 6792 if (p->tick != p->update_tick)
6804 { 6793 {
6805 XSETINT (p->update_tick, XINT (p->tick)); 6794 p->update_tick = p->tick;
6806 6795
6807 /* If process is still active, read any output that remains. */ 6796 /* If process is still active, read any output that remains. */
6808 while (! EQ (p->filter, Qt) 6797 while (! EQ (p->filter, Qt)
6809 && ! EQ (p->status, Qconnect) 6798 && ! EQ (p->status, Qconnect)
6810 && ! EQ (p->status, Qlisten) 6799 && ! EQ (p->status, Qlisten)
6811 && ! EQ (p->command, Qt) /* Network process not stopped. */ 6800 && ! EQ (p->command, Qt) /* Network process not stopped. */
6812 && XINT (p->infd) >= 0 6801 && p->infd >= 0
6813 && p != deleting_process 6802 && p != deleting_process
6814 && read_process_output (proc, XINT (p->infd)) > 0); 6803 && read_process_output (proc, p->infd) > 0);
6815 6804
6816 buffer = p->buffer; 6805 buffer = p->buffer;
6817 6806
@@ -6838,7 +6827,7 @@ status_notify (deleting_process)
6838 So set p->update_tick again 6827 So set p->update_tick again
6839 so that an error in the sentinel will not cause 6828 so that an error in the sentinel will not cause
6840 this code to be run again. */ 6829 this code to be run again. */
6841 XSETINT (p->update_tick, XINT (p->tick)); 6830 p->update_tick = p->tick;
6842 /* Now output the message suitably. */ 6831 /* Now output the message suitably. */
6843 if (!NILP (p->sentinel)) 6832 if (!NILP (p->sentinel))
6844 exec_sentinel (proc, msg); 6833 exec_sentinel (proc, msg);
@@ -6911,9 +6900,9 @@ encode subprocess input. */)
6911 6900
6912 CHECK_PROCESS (process); 6901 CHECK_PROCESS (process);
6913 p = XPROCESS (process); 6902 p = XPROCESS (process);
6914 if (XINT (p->infd) < 0) 6903 if (p->infd < 0)
6915 error ("Input file descriptor of %s closed", SDATA (p->name)); 6904 error ("Input file descriptor of %s closed", SDATA (p->name));
6916 if (XINT (p->outfd) < 0) 6905 if (p->outfd < 0)
6917 error ("Output file descriptor of %s closed", SDATA (p->name)); 6906 error ("Output file descriptor of %s closed", SDATA (p->name));
6918 Fcheck_coding_system (decoding); 6907 Fcheck_coding_system (decoding);
6919 Fcheck_coding_system (encoding); 6908 Fcheck_coding_system (encoding);
@@ -6950,7 +6939,7 @@ suppressed. */)
6950 6939
6951 CHECK_PROCESS (process); 6940 CHECK_PROCESS (process);
6952 p = XPROCESS (process); 6941 p = XPROCESS (process);
6953 p->filter_multibyte = flag; 6942 p->filter_multibyte = !NILP (flag);
6954 setup_process_coding_systems (process); 6943 setup_process_coding_systems (process);
6955 6944
6956 return Qnil; 6945 return Qnil;
@@ -6967,7 +6956,7 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
6967 CHECK_PROCESS (process); 6956 CHECK_PROCESS (process);
6968 p = XPROCESS (process); 6957 p = XPROCESS (process);
6969 6958
6970 return (NILP (p->filter_multibyte) ? Qnil : Qt); 6959 return (p->filter_multibyte ? Qt : Qnil);
6971} 6960}
6972 6961
6973 6962