aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorJoakim Verona2012-08-15 21:49:40 +0200
committerJoakim Verona2012-08-15 21:49:40 +0200
commitb648c26ec642a1dc58c0bd7e59d6011b964dbe37 (patch)
treef0f3b38ffa9054702f475fc53622e28da14f97b1 /src/process.c
parentc8b0fc1999006af5a4317b44068fac13d9592143 (diff)
parent94c9ece10275f8ca9323c38f93607f1046035c79 (diff)
downloademacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.tar.gz
emacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.zip
upstream
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c473
1 files changed, 236 insertions, 237 deletions
diff --git a/src/process.c b/src/process.c
index 47f10814333..a43655e4da8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -172,10 +172,10 @@ extern Lisp_Object QCfamily;
172/* QCfilter is defined in keyboard.c. */ 172/* QCfilter is defined in keyboard.c. */
173extern Lisp_Object QCfilter; 173extern Lisp_Object QCfilter;
174 174
175#define NETCONN_P(p) (EQ (PVAR (XPROCESS (p), type), Qnetwork)) 175#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
176#define NETCONN1_P(p) (EQ (PVAR (p, type), Qnetwork)) 176#define NETCONN1_P(p) (EQ (p->type, Qnetwork))
177#define SERIALCONN_P(p) (EQ (PVAR (XPROCESS (p), type), Qserial)) 177#define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
178#define SERIALCONN1_P(p) (EQ (PVAR (p, type), Qserial)) 178#define SERIALCONN1_P(p) (EQ (p->type, Qserial))
179 179
180#ifndef HAVE_H_ERRNO 180#ifndef HAVE_H_ERRNO
181extern int h_errno; 181extern int h_errno;
@@ -428,7 +428,7 @@ static void
428update_status (struct Lisp_Process *p) 428update_status (struct Lisp_Process *p)
429{ 429{
430 eassert (p->raw_status_new); 430 eassert (p->raw_status_new);
431 PVAR (p, status) = status_convert (p->raw_status); 431 PSET (p, status, status_convert (p->raw_status));
432 p->raw_status_new = 0; 432 p->raw_status_new = 0;
433} 433}
434 434
@@ -441,7 +441,7 @@ status_convert (int w)
441 if (WIFSTOPPED (w)) 441 if (WIFSTOPPED (w))
442 return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil)); 442 return Fcons (Qstop, Fcons (make_number (WSTOPSIG (w)), Qnil));
443 else if (WIFEXITED (w)) 443 else if (WIFEXITED (w))
444 return Fcons (Qexit, Fcons (make_number (WRETCODE (w)), 444 return Fcons (Qexit, Fcons (make_number (WEXITSTATUS (w)),
445 WCOREDUMP (w) ? Qt : Qnil)); 445 WCOREDUMP (w) ? Qt : Qnil));
446 else if (WIFSIGNALED (w)) 446 else if (WIFSIGNALED (w))
447 return Fcons (Qsignal, Fcons (make_number (WTERMSIG (w)), 447 return Fcons (Qsignal, Fcons (make_number (WTERMSIG (w)),
@@ -479,7 +479,7 @@ decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump)
479static Lisp_Object 479static Lisp_Object
480status_message (struct Lisp_Process *p) 480status_message (struct Lisp_Process *p)
481{ 481{
482 Lisp_Object status = PVAR (p, status); 482 Lisp_Object status = p->status;
483 Lisp_Object symbol; 483 Lisp_Object symbol;
484 int code, coredump; 484 int code, coredump;
485 Lisp_Object string, string2; 485 Lisp_Object string, string2;
@@ -626,8 +626,8 @@ make_process (Lisp_Object name)
626 p = allocate_process (); 626 p = allocate_process ();
627 /* Initialize Lisp data. Note that allocate_process initializes all 627 /* Initialize Lisp data. Note that allocate_process initializes all
628 Lisp data to nil, so do it only for slots which should not be nil. */ 628 Lisp data to nil, so do it only for slots which should not be nil. */
629 PVAR (p, status) = Qrun; 629 PSET (p, status, Qrun);
630 PVAR (p, mark) = Fmake_marker (); 630 PSET (p, mark, Fmake_marker ());
631 631
632 /* Initialize non-Lisp data. Note that allocate_process zeroes out all 632 /* Initialize non-Lisp data. Note that allocate_process zeroes out all
633 non-Lisp data, so do it only for slots which should not be zero. */ 633 non-Lisp data, so do it only for slots which should not be zero. */
@@ -648,7 +648,7 @@ make_process (Lisp_Object name)
648 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); 648 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
649 } 649 }
650 name = name1; 650 name = name1;
651 PVAR (p, name) = name; 651 PSET (p, name, name);
652 XSETPROCESS (val, p); 652 XSETPROCESS (val, p);
653 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 653 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
654 return val; 654 return val;
@@ -745,7 +745,7 @@ nil, indicating the current buffer's process. */)
745 p->raw_status_new = 0; 745 p->raw_status_new = 0;
746 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 746 if (NETCONN1_P (p) || SERIALCONN1_P (p))
747 { 747 {
748 PVAR (p, status) = Fcons (Qexit, Fcons (make_number (0), Qnil)); 748 PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil)));
749 p->tick = ++process_tick; 749 p->tick = ++process_tick;
750 status_notify (p); 750 status_notify (p);
751 redisplay_preserve_echo_area (13); 751 redisplay_preserve_echo_area (13);
@@ -763,9 +763,9 @@ nil, indicating the current buffer's process. */)
763 /* If the process has already signaled, remove it from the list. */ 763 /* If the process has already signaled, remove it from the list. */
764 if (p->raw_status_new) 764 if (p->raw_status_new)
765 update_status (p); 765 update_status (p);
766 symbol = PVAR (p, status); 766 symbol = p->status;
767 if (CONSP (PVAR (p, status))) 767 if (CONSP (p->status))
768 symbol = XCAR (PVAR (p, status)); 768 symbol = XCAR (p->status);
769 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) 769 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit))
770 deleted_pid_list 770 deleted_pid_list
771 = Fdelete (make_fixnum_or_float (pid), deleted_pid_list); 771 = Fdelete (make_fixnum_or_float (pid), deleted_pid_list);
@@ -774,8 +774,7 @@ nil, indicating the current buffer's process. */)
774 { 774 {
775 Fkill_process (process, Qnil); 775 Fkill_process (process, Qnil);
776 /* 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. */
777 PVAR (p, status) 777 PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
778 = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
779 p->tick = ++process_tick; 778 p->tick = ++process_tick;
780 status_notify (p); 779 status_notify (p);
781 redisplay_preserve_echo_area (13); 780 redisplay_preserve_echo_area (13);
@@ -816,14 +815,14 @@ nil, indicating the current buffer's process. */)
816 p = XPROCESS (process); 815 p = XPROCESS (process);
817 if (p->raw_status_new) 816 if (p->raw_status_new)
818 update_status (p); 817 update_status (p);
819 status = PVAR (p, status); 818 status = p->status;
820 if (CONSP (status)) 819 if (CONSP (status))
821 status = XCAR (status); 820 status = XCAR (status);
822 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 821 if (NETCONN1_P (p) || SERIALCONN1_P (p))
823 { 822 {
824 if (EQ (status, Qexit)) 823 if (EQ (status, Qexit))
825 status = Qclosed; 824 status = Qclosed;
826 else if (EQ (PVAR (p, command), Qt)) 825 else if (EQ (p->command, Qt))
827 status = Qstop; 826 status = Qstop;
828 else if (EQ (status, Qrun)) 827 else if (EQ (status, Qrun))
829 status = Qopen; 828 status = Qopen;
@@ -840,8 +839,8 @@ If PROCESS has not yet exited or died, return 0. */)
840 CHECK_PROCESS (process); 839 CHECK_PROCESS (process);
841 if (XPROCESS (process)->raw_status_new) 840 if (XPROCESS (process)->raw_status_new)
842 update_status (XPROCESS (process)); 841 update_status (XPROCESS (process));
843 if (CONSP (PVAR (XPROCESS (process), status))) 842 if (CONSP (XPROCESS (process)->status))
844 return XCAR (XCDR (PVAR (XPROCESS (process), status))); 843 return XCAR (XCDR (XPROCESS (process)->status));
845 return make_number (0); 844 return make_number (0);
846} 845}
847 846
@@ -865,7 +864,7 @@ possibly modified to make it unique among process names. */)
865 (register Lisp_Object process) 864 (register Lisp_Object process)
866{ 865{
867 CHECK_PROCESS (process); 866 CHECK_PROCESS (process);
868 return PVAR (XPROCESS (process), name); 867 return XPROCESS (process)->name;
869} 868}
870 869
871DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0, 870DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
@@ -877,7 +876,7 @@ For a network or serial process, this is nil (process is running) or t
877 (register Lisp_Object process) 876 (register Lisp_Object process)
878{ 877{
879 CHECK_PROCESS (process); 878 CHECK_PROCESS (process);
880 return PVAR (XPROCESS (process), command); 879 return XPROCESS (process)->command;
881} 880}
882 881
883DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0, 882DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
@@ -887,7 +886,7 @@ not the name of the pty that Emacs uses to talk with that terminal. */)
887 (register Lisp_Object process) 886 (register Lisp_Object process)
888{ 887{
889 CHECK_PROCESS (process); 888 CHECK_PROCESS (process);
890 return PVAR (XPROCESS (process), tty_name); 889 return XPROCESS (process)->tty_name;
891} 890}
892 891
893DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer, 892DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
@@ -902,9 +901,9 @@ Return BUFFER. */)
902 if (!NILP (buffer)) 901 if (!NILP (buffer))
903 CHECK_BUFFER (buffer); 902 CHECK_BUFFER (buffer);
904 p = XPROCESS (process); 903 p = XPROCESS (process);
905 PVAR (p, buffer) = buffer; 904 PSET (p, buffer, buffer);
906 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 905 if (NETCONN1_P (p) || SERIALCONN1_P (p))
907 PVAR (p, childp) = Fplist_put (PVAR (p, childp), QCbuffer, buffer); 906 PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer));
908 setup_process_coding_systems (process); 907 setup_process_coding_systems (process);
909 return buffer; 908 return buffer;
910} 909}
@@ -916,7 +915,7 @@ Output from PROCESS is inserted in this buffer unless PROCESS has a filter. */)
916 (register Lisp_Object process) 915 (register Lisp_Object process)
917{ 916{
918 CHECK_PROCESS (process); 917 CHECK_PROCESS (process);
919 return PVAR (XPROCESS (process), buffer); 918 return XPROCESS (process)->buffer;
920} 919}
921 920
922DEFUN ("process-mark", Fprocess_mark, Sprocess_mark, 921DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
@@ -925,7 +924,7 @@ DEFUN ("process-mark", Fprocess_mark, Sprocess_mark,
925 (register Lisp_Object process) 924 (register Lisp_Object process)
926{ 925{
927 CHECK_PROCESS (process); 926 CHECK_PROCESS (process);
928 return PVAR (XPROCESS (process), mark); 927 return XPROCESS (process)->mark;
929} 928}
930 929
931DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, 930DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
@@ -961,23 +960,23 @@ The string argument is normally a multibyte string, except:
961 960
962 if (p->infd >= 0) 961 if (p->infd >= 0)
963 { 962 {
964 if (EQ (filter, Qt) && !EQ (PVAR (p, status), Qlisten)) 963 if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
965 { 964 {
966 FD_CLR (p->infd, &input_wait_mask); 965 FD_CLR (p->infd, &input_wait_mask);
967 FD_CLR (p->infd, &non_keyboard_wait_mask); 966 FD_CLR (p->infd, &non_keyboard_wait_mask);
968 } 967 }
969 else if (EQ (PVAR (p, filter), Qt) 968 else if (EQ (p->filter, Qt)
970 /* Network or serial process not stopped: */ 969 /* Network or serial process not stopped: */
971 && !EQ (PVAR (p, command), Qt)) 970 && !EQ (p->command, Qt))
972 { 971 {
973 FD_SET (p->infd, &input_wait_mask); 972 FD_SET (p->infd, &input_wait_mask);
974 FD_SET (p->infd, &non_keyboard_wait_mask); 973 FD_SET (p->infd, &non_keyboard_wait_mask);
975 } 974 }
976 } 975 }
977 976
978 PVAR (p, filter) = filter; 977 PSET (p, filter, filter);
979 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 978 if (NETCONN1_P (p) || SERIALCONN1_P (p))
980 PVAR (p, childp) = Fplist_put (PVAR (p, childp), QCfilter, filter); 979 PSET (p, childp, Fplist_put (p->childp, QCfilter, filter));
981 setup_process_coding_systems (process); 980 setup_process_coding_systems (process);
982 return filter; 981 return filter;
983} 982}
@@ -989,7 +988,7 @@ See `set-process-filter' for more info on filter functions. */)
989 (register Lisp_Object process) 988 (register Lisp_Object process)
990{ 989{
991 CHECK_PROCESS (process); 990 CHECK_PROCESS (process);
992 return PVAR (XPROCESS (process), filter); 991 return XPROCESS (process)->filter;
993} 992}
994 993
995DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel, 994DEFUN ("set-process-sentinel", Fset_process_sentinel, Sset_process_sentinel,
@@ -1004,9 +1003,9 @@ It gets two arguments: the process, and a string describing the change. */)
1004 CHECK_PROCESS (process); 1003 CHECK_PROCESS (process);
1005 p = XPROCESS (process); 1004 p = XPROCESS (process);
1006 1005
1007 PVAR (p, sentinel) = sentinel; 1006 PSET (p, sentinel, sentinel);
1008 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1007 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1009 PVAR (p, childp) = Fplist_put (PVAR (p, childp), QCsentinel, sentinel); 1008 PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel));
1010 return sentinel; 1009 return sentinel;
1011} 1010}
1012 1011
@@ -1017,7 +1016,7 @@ See `set-process-sentinel' for more info on sentinels. */)
1017 (register Lisp_Object process) 1016 (register Lisp_Object process)
1018{ 1017{
1019 CHECK_PROCESS (process); 1018 CHECK_PROCESS (process);
1020 return PVAR (XPROCESS (process), sentinel); 1019 return XPROCESS (process)->sentinel;
1021} 1020}
1022 1021
1023DEFUN ("set-process-window-size", Fset_process_window_size, 1022DEFUN ("set-process-window-size", Fset_process_window_size,
@@ -1102,7 +1101,7 @@ list of keywords. */)
1102 Lisp_Object contact; 1101 Lisp_Object contact;
1103 1102
1104 CHECK_PROCESS (process); 1103 CHECK_PROCESS (process);
1105 contact = PVAR (XPROCESS (process), childp); 1104 contact = XPROCESS (process)->childp;
1106 1105
1107#ifdef DATAGRAM_SOCKETS 1106#ifdef DATAGRAM_SOCKETS
1108 if (DATAGRAM_CONN_P (process) 1107 if (DATAGRAM_CONN_P (process)
@@ -1128,7 +1127,7 @@ DEFUN ("process-plist", Fprocess_plist, Sprocess_plist,
1128 (register Lisp_Object process) 1127 (register Lisp_Object process)
1129{ 1128{
1130 CHECK_PROCESS (process); 1129 CHECK_PROCESS (process);
1131 return PVAR (XPROCESS (process), plist); 1130 return XPROCESS (process)->plist;
1132} 1131}
1133 1132
1134DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist, 1133DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
@@ -1139,7 +1138,7 @@ DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
1139 CHECK_PROCESS (process); 1138 CHECK_PROCESS (process);
1140 CHECK_LIST (plist); 1139 CHECK_LIST (plist);
1141 1140
1142 PVAR (XPROCESS (process), plist) = plist; 1141 PSET (XPROCESS (process), plist, plist);
1143 return plist; 1142 return plist;
1144} 1143}
1145 1144
@@ -1151,7 +1150,7 @@ The value is nil for a pipe, t or `pty' for a pty, or `stream' for
1151a socket connection. */) 1150a socket connection. */)
1152 (Lisp_Object process) 1151 (Lisp_Object process)
1153{ 1152{
1154 return PVAR (XPROCESS (process), type); 1153 return XPROCESS (process)->type;
1155} 1154}
1156#endif 1155#endif
1157 1156
@@ -1164,7 +1163,7 @@ nil, indicating the current buffer's process. */)
1164{ 1163{
1165 Lisp_Object proc; 1164 Lisp_Object proc;
1166 proc = get_process (process); 1165 proc = get_process (process);
1167 return PVAR (XPROCESS (proc), type); 1166 return XPROCESS (proc)->type;
1168} 1167}
1169 1168
1170DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address, 1169DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address,
@@ -1325,18 +1324,18 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1325 itself; it's all taken care of here. */ 1324 itself; it's all taken care of here. */
1326 record_unwind_protect (start_process_unwind, proc); 1325 record_unwind_protect (start_process_unwind, proc);
1327 1326
1328 PVAR (XPROCESS (proc), childp) = Qt; 1327 PSET (XPROCESS (proc), childp, Qt);
1329 PVAR (XPROCESS (proc), plist) = Qnil; 1328 PSET (XPROCESS (proc), plist, Qnil);
1330 PVAR (XPROCESS (proc), type) = Qreal; 1329 PSET (XPROCESS (proc), type, Qreal);
1331 PVAR (XPROCESS (proc), buffer) = buffer; 1330 PSET (XPROCESS (proc), buffer, buffer);
1332 PVAR (XPROCESS (proc), sentinel) = Qnil; 1331 PSET (XPROCESS (proc), sentinel, Qnil);
1333 PVAR (XPROCESS (proc), filter) = Qnil; 1332 PSET (XPROCESS (proc), filter, Qnil);
1334 PVAR (XPROCESS (proc), command) = Flist (nargs - 2, args + 2); 1333 PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2));
1335 1334
1336#ifdef HAVE_GNUTLS 1335#ifdef HAVE_GNUTLS
1337 /* AKA GNUTLS_INITSTAGE(proc). */ 1336 /* AKA GNUTLS_INITSTAGE(proc). */
1338 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; 1337 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY;
1339 XPROCESS (proc)->gnutls_cred_type = Qnil; 1338 PSET (XPROCESS (proc), gnutls_cred_type, Qnil);
1340#endif 1339#endif
1341 1340
1342#ifdef ADAPTIVE_READ_BUFFERING 1341#ifdef ADAPTIVE_READ_BUFFERING
@@ -1347,7 +1346,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1347 1346
1348 /* Make the process marker point into the process buffer (if any). */ 1347 /* Make the process marker point into the process buffer (if any). */
1349 if (BUFFERP (buffer)) 1348 if (BUFFERP (buffer))
1350 set_marker_both (PVAR (XPROCESS (proc), mark), buffer, 1349 set_marker_both (XPROCESS (proc)->mark, buffer,
1351 BUF_ZV (XBUFFER (buffer)), 1350 BUF_ZV (XBUFFER (buffer)),
1352 BUF_ZV_BYTE (XBUFFER (buffer))); 1351 BUF_ZV_BYTE (XBUFFER (buffer)));
1353 1352
@@ -1376,7 +1375,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1376 else if (CONSP (Vdefault_process_coding_system)) 1375 else if (CONSP (Vdefault_process_coding_system))
1377 val = XCAR (Vdefault_process_coding_system); 1376 val = XCAR (Vdefault_process_coding_system);
1378 } 1377 }
1379 PVAR (XPROCESS (proc), decode_coding_system) = val; 1378 PSET (XPROCESS (proc), decode_coding_system, val);
1380 1379
1381 val = Vcoding_system_for_write; 1380 val = Vcoding_system_for_write;
1382 if (NILP (val)) 1381 if (NILP (val))
@@ -1396,7 +1395,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1396 else if (CONSP (Vdefault_process_coding_system)) 1395 else if (CONSP (Vdefault_process_coding_system))
1397 val = XCDR (Vdefault_process_coding_system); 1396 val = XCDR (Vdefault_process_coding_system);
1398 } 1397 }
1399 PVAR (XPROCESS (proc), encode_coding_system) = val; 1398 PSET (XPROCESS (proc), encode_coding_system, val);
1400 /* Note: At this moment, the above coding system may leave 1399 /* Note: At this moment, the above coding system may leave
1401 text-conversion or eol-conversion unspecified. They will be 1400 text-conversion or eol-conversion unspecified. They will be
1402 decided after we read output from the process and decode it by 1401 decided after we read output from the process and decode it by
@@ -1405,9 +1404,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1405 } 1404 }
1406 1405
1407 1406
1408 PVAR (XPROCESS (proc), decoding_buf) = empty_unibyte_string; 1407 PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string);
1409 XPROCESS (proc)->decoding_carryover = 0; 1408 XPROCESS (proc)->decoding_carryover = 0;
1410 PVAR (XPROCESS (proc), encoding_buf) = empty_unibyte_string; 1409 PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string);
1411 1410
1412 XPROCESS (proc)->inherit_coding_system_flag 1411 XPROCESS (proc)->inherit_coding_system_flag
1413 = !(NILP (buffer) || !inherit_process_coding_system); 1412 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1465,7 +1464,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1465 { 1464 {
1466 if (NILP (arg_encoding)) 1465 if (NILP (arg_encoding))
1467 arg_encoding = (complement_process_encoding_system 1466 arg_encoding = (complement_process_encoding_system
1468 (PVAR (XPROCESS (proc), encode_coding_system))); 1467 (XPROCESS (proc)->encode_coding_system));
1469 XSETCAR (tem, 1468 XSETCAR (tem,
1470 code_convert_string_norecord 1469 code_convert_string_norecord
1471 (XCAR (tem), arg_encoding, 1)); 1470 (XCAR (tem), arg_encoding, 1));
@@ -1629,7 +1628,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1629 more portable (see USG_SUBTTY_WORKS above). */ 1628 more portable (see USG_SUBTTY_WORKS above). */
1630 1629
1631 XPROCESS (process)->pty_flag = pty_flag; 1630 XPROCESS (process)->pty_flag = pty_flag;
1632 PVAR (XPROCESS (process), status) = Qrun; 1631 PSET (XPROCESS (process), status, Qrun);
1633 1632
1634 /* Delay interrupts until we have a chance to store 1633 /* Delay interrupts until we have a chance to store
1635 the new fork's pid in its process structure */ 1634 the new fork's pid in its process structure */
@@ -1868,10 +1867,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1868 1867
1869#ifdef HAVE_PTYS 1868#ifdef HAVE_PTYS
1870 if (pty_flag) 1869 if (pty_flag)
1871 PVAR (XPROCESS (process), tty_name) = build_string (pty_name); 1870 PSET (XPROCESS (process), tty_name, build_string (pty_name));
1872 else 1871 else
1873#endif 1872#endif
1874 PVAR (XPROCESS (process), tty_name) = Qnil; 1873 PSET (XPROCESS (process), tty_name, Qnil);
1875 1874
1876#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1875#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1877 /* Wait for child_setup to complete in case that vfork is 1876 /* Wait for child_setup to complete in case that vfork is
@@ -1966,7 +1965,7 @@ create_pty (Lisp_Object process)
1966 more portable (see USG_SUBTTY_WORKS above). */ 1965 more portable (see USG_SUBTTY_WORKS above). */
1967 1966
1968 XPROCESS (process)->pty_flag = pty_flag; 1967 XPROCESS (process)->pty_flag = pty_flag;
1969 PVAR (XPROCESS (process), status) = Qrun; 1968 PSET (XPROCESS (process), status, Qrun);
1970 setup_process_coding_systems (process); 1969 setup_process_coding_systems (process);
1971 1970
1972 FD_SET (inchannel, &input_wait_mask); 1971 FD_SET (inchannel, &input_wait_mask);
@@ -1977,10 +1976,10 @@ create_pty (Lisp_Object process)
1977 XPROCESS (process)->pid = -2; 1976 XPROCESS (process)->pid = -2;
1978#ifdef HAVE_PTYS 1977#ifdef HAVE_PTYS
1979 if (pty_flag) 1978 if (pty_flag)
1980 PVAR (XPROCESS (process), tty_name) = build_string (pty_name); 1979 PSET (XPROCESS (process), tty_name, build_string (pty_name));
1981 else 1980 else
1982#endif 1981#endif
1983 PVAR (XPROCESS (process), tty_name) = Qnil; 1982 PSET (XPROCESS (process), tty_name, Qnil);
1984} 1983}
1985 1984
1986 1985
@@ -2369,7 +2368,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2369 2368
2370 if (set_socket_option (s, option, value)) 2369 if (set_socket_option (s, option, value))
2371 { 2370 {
2372 PVAR (p, childp) = Fplist_put (PVAR (p, childp), option, value); 2371 PSET (p, childp, Fplist_put (p->childp, option, value));
2373 return Qt; 2372 return Qt;
2374 } 2373 }
2375 2374
@@ -2458,10 +2457,10 @@ usage: (serial-process-configure &rest ARGS) */)
2458 proc = Fplist_get (contact, QCport); 2457 proc = Fplist_get (contact, QCport);
2459 proc = get_process (proc); 2458 proc = get_process (proc);
2460 p = XPROCESS (proc); 2459 p = XPROCESS (proc);
2461 if (!EQ (PVAR (p, type), Qserial)) 2460 if (!EQ (p->type, Qserial))
2462 error ("Not a serial process"); 2461 error ("Not a serial process");
2463 2462
2464 if (NILP (Fplist_get (PVAR (p, childp), QCspeed))) 2463 if (NILP (Fplist_get (p->childp, QCspeed)))
2465 { 2464 {
2466 UNGCPRO; 2465 UNGCPRO;
2467 return Qnil; 2466 return Qnil;
@@ -2602,21 +2601,21 @@ usage: (make-serial-process &rest ARGS) */)
2602 if (NILP (buffer)) 2601 if (NILP (buffer))
2603 buffer = name; 2602 buffer = name;
2604 buffer = Fget_buffer_create (buffer); 2603 buffer = Fget_buffer_create (buffer);
2605 PVAR (p, buffer) = buffer; 2604 PSET (p, buffer, buffer);
2606 2605
2607 PVAR (p, childp) = contact; 2606 PSET (p, childp, contact);
2608 PVAR (p, plist) = Fcopy_sequence (Fplist_get (contact, QCplist)); 2607 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist)));
2609 PVAR (p, type) = Qserial; 2608 PSET (p, type, Qserial);
2610 PVAR (p, sentinel) = Fplist_get (contact, QCsentinel); 2609 PSET (p, sentinel, Fplist_get (contact, QCsentinel));
2611 PVAR (p, filter) = Fplist_get (contact, QCfilter); 2610 PSET (p, filter, Fplist_get (contact, QCfilter));
2612 PVAR (p, log) = Qnil; 2611 PSET (p, log, Qnil);
2613 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2612 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2614 p->kill_without_query = 1; 2613 p->kill_without_query = 1;
2615 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2614 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2616 PVAR (p, command) = Qt; 2615 PSET (p, command, Qt);
2617 p->pty_flag = 0; 2616 p->pty_flag = 0;
2618 2617
2619 if (!EQ (PVAR (p, command), Qt)) 2618 if (!EQ (p->command, Qt))
2620 { 2619 {
2621 FD_SET (fd, &input_wait_mask); 2620 FD_SET (fd, &input_wait_mask);
2622 FD_SET (fd, &non_keyboard_wait_mask); 2621 FD_SET (fd, &non_keyboard_wait_mask);
@@ -2624,7 +2623,7 @@ usage: (make-serial-process &rest ARGS) */)
2624 2623
2625 if (BUFFERP (buffer)) 2624 if (BUFFERP (buffer))
2626 { 2625 {
2627 set_marker_both (PVAR (p, mark), buffer, 2626 set_marker_both (p->mark, buffer,
2628 BUF_ZV (XBUFFER (buffer)), 2627 BUF_ZV (XBUFFER (buffer)),
2629 BUF_ZV_BYTE (XBUFFER (buffer))); 2628 BUF_ZV_BYTE (XBUFFER (buffer)));
2630 } 2629 }
@@ -2645,7 +2644,7 @@ usage: (make-serial-process &rest ARGS) */)
2645 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2644 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2646 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2645 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2647 val = Qnil; 2646 val = Qnil;
2648 PVAR (p, decode_coding_system) = val; 2647 PSET (p, decode_coding_system, val);
2649 2648
2650 val = Qnil; 2649 val = Qnil;
2651 if (!NILP (tem)) 2650 if (!NILP (tem))
@@ -2659,12 +2658,12 @@ usage: (make-serial-process &rest ARGS) */)
2659 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2658 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2660 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2659 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2661 val = Qnil; 2660 val = Qnil;
2662 PVAR (p, encode_coding_system) = val; 2661 PSET (p, encode_coding_system, val);
2663 2662
2664 setup_process_coding_systems (proc); 2663 setup_process_coding_systems (proc);
2665 PVAR (p, decoding_buf) = empty_unibyte_string; 2664 PSET (p, decoding_buf, empty_unibyte_string);
2666 p->decoding_carryover = 0; 2665 p->decoding_carryover = 0;
2667 PVAR (p, encoding_buf) = empty_unibyte_string; 2666 PSET (p, encoding_buf, empty_unibyte_string);
2668 p->inherit_coding_system_flag 2667 p->inherit_coding_system_flag
2669 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2668 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2670 2669
@@ -3401,27 +3400,27 @@ usage: (make-network-process &rest ARGS) */)
3401 3400
3402 p = XPROCESS (proc); 3401 p = XPROCESS (proc);
3403 3402
3404 PVAR (p, childp) = contact; 3403 PSET (p, childp, contact);
3405 PVAR (p, plist) = Fcopy_sequence (Fplist_get (contact, QCplist)); 3404 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist)));
3406 PVAR (p, type) = Qnetwork; 3405 PSET (p, type, Qnetwork);
3407 3406
3408 PVAR (p, buffer) = buffer; 3407 PSET (p, buffer, buffer);
3409 PVAR (p, sentinel) = sentinel; 3408 PSET (p, sentinel, sentinel);
3410 PVAR (p, filter) = filter; 3409 PSET (p, filter, filter);
3411 PVAR (p, log) = Fplist_get (contact, QClog); 3410 PSET (p, log, Fplist_get (contact, QClog));
3412 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3411 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3413 p->kill_without_query = 1; 3412 p->kill_without_query = 1;
3414 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3413 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3415 PVAR (p, command) = Qt; 3414 PSET (p, command, Qt);
3416 p->pid = 0; 3415 p->pid = 0;
3417 p->infd = inch; 3416 p->infd = inch;
3418 p->outfd = outch; 3417 p->outfd = outch;
3419 if (is_server && socktype != SOCK_DGRAM) 3418 if (is_server && socktype != SOCK_DGRAM)
3420 PVAR (p, status) = Qlisten; 3419 PSET (p, status, Qlisten);
3421 3420
3422 /* Make the process marker point into the process buffer (if any). */ 3421 /* Make the process marker point into the process buffer (if any). */
3423 if (BUFFERP (buffer)) 3422 if (BUFFERP (buffer))
3424 set_marker_both (PVAR (p, mark), buffer, 3423 set_marker_both (p->mark, buffer,
3425 BUF_ZV (XBUFFER (buffer)), 3424 BUF_ZV (XBUFFER (buffer)),
3426 BUF_ZV_BYTE (XBUFFER (buffer))); 3425 BUF_ZV_BYTE (XBUFFER (buffer)));
3427 3426
@@ -3431,7 +3430,7 @@ usage: (make-network-process &rest ARGS) */)
3431 /* We may get here if connect did succeed immediately. However, 3430 /* We may get here if connect did succeed immediately. However,
3432 in that case, we still need to signal this like a non-blocking 3431 in that case, we still need to signal this like a non-blocking
3433 connection. */ 3432 connection. */
3434 PVAR (p, status) = Qconnect; 3433 PSET (p, status, Qconnect);
3435 if (!FD_ISSET (inch, &connect_wait_mask)) 3434 if (!FD_ISSET (inch, &connect_wait_mask))
3436 { 3435 {
3437 FD_SET (inch, &connect_wait_mask); 3436 FD_SET (inch, &connect_wait_mask);
@@ -3443,8 +3442,8 @@ usage: (make-network-process &rest ARGS) */)
3443#endif 3442#endif
3444 /* A server may have a client filter setting of Qt, but it must 3443 /* A server may have a client filter setting of Qt, but it must
3445 still listen for incoming connects unless it is stopped. */ 3444 still listen for incoming connects unless it is stopped. */
3446 if ((!EQ (PVAR (p, filter), Qt) && !EQ (PVAR (p, command), Qt)) 3445 if ((!EQ (p->filter, Qt) && !EQ (p->command, Qt))
3447 || (EQ (PVAR (p, status), Qlisten) && NILP (PVAR (p, command)))) 3446 || (EQ (p->status, Qlisten) && NILP (p->command)))
3448 { 3447 {
3449 FD_SET (inch, &input_wait_mask); 3448 FD_SET (inch, &input_wait_mask);
3450 FD_SET (inch, &non_keyboard_wait_mask); 3449 FD_SET (inch, &non_keyboard_wait_mask);
@@ -3498,7 +3497,7 @@ usage: (make-network-process &rest ARGS) */)
3498 else 3497 else
3499 val = Qnil; 3498 val = Qnil;
3500 } 3499 }
3501 PVAR (p, decode_coding_system) = val; 3500 PSET (p, decode_coding_system, val);
3502 3501
3503 if (!NILP (tem)) 3502 if (!NILP (tem))
3504 { 3503 {
@@ -3532,13 +3531,13 @@ usage: (make-network-process &rest ARGS) */)
3532 else 3531 else
3533 val = Qnil; 3532 val = Qnil;
3534 } 3533 }
3535 PVAR (p, encode_coding_system) = val; 3534 PSET (p, encode_coding_system, val);
3536 } 3535 }
3537 setup_process_coding_systems (proc); 3536 setup_process_coding_systems (proc);
3538 3537
3539 PVAR (p, decoding_buf) = empty_unibyte_string; 3538 PSET (p, decoding_buf, empty_unibyte_string);
3540 p->decoding_carryover = 0; 3539 p->decoding_carryover = 0;
3541 PVAR (p, encoding_buf) = empty_unibyte_string; 3540 PSET (p, encoding_buf, empty_unibyte_string);
3542 3541
3543 p->inherit_coding_system_flag 3542 p->inherit_coding_system_flag
3544 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3543 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4031,8 +4030,8 @@ server_accept_connection (Lisp_Object server, int channel)
4031 return; 4030 return;
4032#endif 4031#endif
4033 4032
4034 if (!NILP (PVAR (ps, log))) 4033 if (!NILP (ps->log))
4035 call3 (PVAR (ps, log), server, Qnil, 4034 call3 (ps->log, server, Qnil,
4036 concat3 (build_string ("accept failed with code"), 4035 concat3 (build_string ("accept failed with code"),
4037 Fnumber_to_string (make_number (code)), 4036 Fnumber_to_string (make_number (code)),
4038 build_string ("\n"))); 4037 build_string ("\n")));
@@ -4102,15 +4101,15 @@ server_accept_connection (Lisp_Object server, int channel)
4102 process name of the server process concatenated with the caller 4101 process name of the server process concatenated with the caller
4103 identification. */ 4102 identification. */
4104 4103
4105 if (!NILP (PVAR (ps, filter)) && !EQ (PVAR (ps, filter), Qt)) 4104 if (!NILP (ps->filter) && !EQ (ps->filter, Qt))
4106 buffer = Qnil; 4105 buffer = Qnil;
4107 else 4106 else
4108 { 4107 {
4109 buffer = PVAR (ps, buffer); 4108 buffer = ps->buffer;
4110 if (!NILP (buffer)) 4109 if (!NILP (buffer))
4111 buffer = Fbuffer_name (buffer); 4110 buffer = Fbuffer_name (buffer);
4112 else 4111 else
4113 buffer = PVAR (ps, name); 4112 buffer = ps->name;
4114 if (!NILP (buffer)) 4113 if (!NILP (buffer))
4115 { 4114 {
4116 buffer = concat2 (buffer, caller); 4115 buffer = concat2 (buffer, caller);
@@ -4121,7 +4120,7 @@ server_accept_connection (Lisp_Object server, int channel)
4121 /* Generate a unique name for the new server process. Combine the 4120 /* Generate a unique name for the new server process. Combine the
4122 server process name with the caller identification. */ 4121 server process name with the caller identification. */
4123 4122
4124 name = concat2 (PVAR (ps, name), caller); 4123 name = concat2 (ps->name, caller);
4125 proc = make_process (name); 4124 proc = make_process (name);
4126 4125
4127 chan_process[s] = proc; 4126 chan_process[s] = proc;
@@ -4137,7 +4136,7 @@ server_accept_connection (Lisp_Object server, int channel)
4137 p = XPROCESS (proc); 4136 p = XPROCESS (proc);
4138 4137
4139 /* Build new contact information for this setup. */ 4138 /* Build new contact information for this setup. */
4140 contact = Fcopy_sequence (PVAR (ps, childp)); 4139 contact = Fcopy_sequence (ps->childp);
4141 contact = Fplist_put (contact, QCserver, Qnil); 4140 contact = Fplist_put (contact, QCserver, Qnil);
4142 contact = Fplist_put (contact, QChost, host); 4141 contact = Fplist_put (contact, QChost, host);
4143 if (!NILP (service)) 4142 if (!NILP (service))
@@ -4151,21 +4150,21 @@ server_accept_connection (Lisp_Object server, int channel)
4151 conv_sockaddr_to_lisp (&saddr.sa, len)); 4150 conv_sockaddr_to_lisp (&saddr.sa, len));
4152#endif 4151#endif
4153 4152
4154 PVAR (p, childp) = contact; 4153 PSET (p, childp, contact);
4155 PVAR (p, plist) = Fcopy_sequence (PVAR (ps, plist)); 4154 PSET (p, plist, Fcopy_sequence (ps->plist));
4156 PVAR (p, type) = Qnetwork; 4155 PSET (p, type, Qnetwork);
4157 4156
4158 PVAR (p, buffer) = buffer; 4157 PSET (p, buffer, buffer);
4159 PVAR (p, sentinel) = PVAR (ps, sentinel); 4158 PSET (p, sentinel, ps->sentinel);
4160 PVAR (p, filter) = PVAR (ps, filter); 4159 PSET (p, filter, ps->filter);
4161 PVAR (p, command) = Qnil; 4160 PSET (p, command, Qnil);
4162 p->pid = 0; 4161 p->pid = 0;
4163 p->infd = s; 4162 p->infd = s;
4164 p->outfd = s; 4163 p->outfd = s;
4165 PVAR (p, status) = Qrun; 4164 PSET (p, status, Qrun);
4166 4165
4167 /* Client processes for accepted connections are not stopped initially. */ 4166 /* Client processes for accepted connections are not stopped initially. */
4168 if (!EQ (PVAR (p, filter), Qt)) 4167 if (!EQ (p->filter, Qt))
4169 { 4168 {
4170 FD_SET (s, &input_wait_mask); 4169 FD_SET (s, &input_wait_mask);
4171 FD_SET (s, &non_keyboard_wait_mask); 4170 FD_SET (s, &non_keyboard_wait_mask);
@@ -4179,24 +4178,24 @@ server_accept_connection (Lisp_Object server, int channel)
4179 of the new process should reflect the settings at the time the 4178 of the new process should reflect the settings at the time the
4180 server socket was opened; not the current settings. */ 4179 server socket was opened; not the current settings. */
4181 4180
4182 PVAR (p, decode_coding_system) = PVAR (ps, decode_coding_system); 4181 PSET (p, decode_coding_system, ps->decode_coding_system);
4183 PVAR (p, encode_coding_system) = PVAR (ps, encode_coding_system); 4182 PSET (p, encode_coding_system, ps->encode_coding_system);
4184 setup_process_coding_systems (proc); 4183 setup_process_coding_systems (proc);
4185 4184
4186 PVAR (p, decoding_buf) = empty_unibyte_string; 4185 PSET (p, decoding_buf, empty_unibyte_string);
4187 p->decoding_carryover = 0; 4186 p->decoding_carryover = 0;
4188 PVAR (p, encoding_buf) = empty_unibyte_string; 4187 PSET (p, encoding_buf, empty_unibyte_string);
4189 4188
4190 p->inherit_coding_system_flag 4189 p->inherit_coding_system_flag
4191 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4190 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
4192 4191
4193 if (!NILP (PVAR (ps, log))) 4192 if (!NILP (ps->log))
4194 call3 (PVAR (ps, log), server, proc, 4193 call3 (ps->log, server, proc,
4195 concat3 (build_string ("accept from "), 4194 concat3 (build_string ("accept from "),
4196 (STRINGP (host) ? host : build_string ("-")), 4195 (STRINGP (host) ? host : build_string ("-")),
4197 build_string ("\n"))); 4196 build_string ("\n")));
4198 4197
4199 if (!NILP (PVAR (p, sentinel))) 4198 if (!NILP (p->sentinel))
4200 exec_sentinel (proc, 4199 exec_sentinel (proc,
4201 concat3 (build_string ("open from "), 4200 concat3 (build_string ("open from "),
4202 (STRINGP (host) ? host : build_string ("-")), 4201 (STRINGP (host) ? host : build_string ("-")),
@@ -4287,8 +4286,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4287 FD_ZERO (&Writeok); 4286 FD_ZERO (&Writeok);
4288 4287
4289 if (time_limit == 0 && nsecs == 0 && wait_proc && !NILP (Vinhibit_quit) 4288 if (time_limit == 0 && nsecs == 0 && wait_proc && !NILP (Vinhibit_quit)
4290 && !(CONSP (PVAR (wait_proc, status)) 4289 && !(CONSP (wait_proc->status)
4291 && EQ (XCAR (PVAR (wait_proc, status)), Qexit))) 4290 && EQ (XCAR (wait_proc->status), Qexit)))
4292 message ("Blocking call to accept-process-output with quit inhibited!!"); 4291 message ("Blocking call to accept-process-output with quit inhibited!!");
4293 4292
4294 /* If wait_proc is a process to watch, set wait_channel accordingly. */ 4293 /* If wait_proc is a process to watch, set wait_channel accordingly. */
@@ -4461,8 +4460,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4461 if (wait_proc && wait_proc->raw_status_new) 4460 if (wait_proc && wait_proc->raw_status_new)
4462 update_status (wait_proc); 4461 update_status (wait_proc);
4463 if (wait_proc 4462 if (wait_proc
4464 && ! EQ (PVAR (wait_proc, status), Qrun) 4463 && ! EQ (wait_proc->status, Qrun)
4465 && ! EQ (PVAR (wait_proc, status), Qconnect)) 4464 && ! EQ (wait_proc->status, Qconnect))
4466 { 4465 {
4467 int nread, total_nread = 0; 4466 int nread, total_nread = 0;
4468 4467
@@ -4821,7 +4820,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4821 continue; 4820 continue;
4822 4821
4823 /* If this is a server stream socket, accept connection. */ 4822 /* If this is a server stream socket, accept connection. */
4824 if (EQ (PVAR (XPROCESS (proc), status), Qlisten)) 4823 if (EQ (XPROCESS (proc)->status, Qlisten))
4825 { 4824 {
4826 server_accept_connection (proc, channel); 4825 server_accept_connection (proc, channel);
4827 continue; 4826 continue;
@@ -4887,10 +4886,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4887 if (p->pid == -2) 4886 if (p->pid == -2)
4888 { 4887 {
4889 /* If the EIO occurs on a pty, sigchld_handler's 4888 /* If the EIO occurs on a pty, sigchld_handler's
4890 wait3() will not find the process object to 4889 waitpid() will not find the process object to
4891 delete. Do it here. */ 4890 delete. Do it here. */
4892 p->tick = ++process_tick; 4891 p->tick = ++process_tick;
4893 PVAR (p, status) = Qfailed; 4892 PSET (p, status, Qfailed);
4894 } 4893 }
4895 else 4894 else
4896 kill (getpid (), SIGCHLD); 4895 kill (getpid (), SIGCHLD);
@@ -4909,9 +4908,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4909 deactivate_process (proc); 4908 deactivate_process (proc);
4910 if (XPROCESS (proc)->raw_status_new) 4909 if (XPROCESS (proc)->raw_status_new)
4911 update_status (XPROCESS (proc)); 4910 update_status (XPROCESS (proc));
4912 if (EQ (PVAR (XPROCESS (proc), status), Qrun)) 4911 if (EQ (XPROCESS (proc)->status, Qrun))
4913 PVAR (XPROCESS (proc), status) 4912 PSET (XPROCESS (proc), status,
4914 = Fcons (Qexit, Fcons (make_number (256), Qnil)); 4913 Fcons (Qexit, Fcons (make_number (256), Qnil)));
4915 } 4914 }
4916 } 4915 }
4917#ifdef NON_BLOCKING_CONNECT 4916#ifdef NON_BLOCKING_CONNECT
@@ -4959,18 +4958,18 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4959 if (xerrno) 4958 if (xerrno)
4960 { 4959 {
4961 p->tick = ++process_tick; 4960 p->tick = ++process_tick;
4962 PVAR (p, status) 4961 PSET (p, status,
4963 = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); 4962 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
4964 deactivate_process (proc); 4963 deactivate_process (proc);
4965 } 4964 }
4966 else 4965 else
4967 { 4966 {
4968 PVAR (p, status) = Qrun; 4967 PSET (p, status, Qrun);
4969 /* Execute the sentinel here. If we had relied on 4968 /* Execute the sentinel here. If we had relied on
4970 status_notify to do it later, it will read input 4969 status_notify to do it later, it will read input
4971 from the process before calling the sentinel. */ 4970 from the process before calling the sentinel. */
4972 exec_sentinel (proc, build_string ("open\n")); 4971 exec_sentinel (proc, build_string ("open\n"));
4973 if (!EQ (PVAR (p, filter), Qt) && !EQ (PVAR (p, command), Qt)) 4972 if (!EQ (p->filter, Qt) && !EQ (p->command, Qt))
4974 { 4973 {
4975 FD_SET (p->infd, &input_wait_mask); 4974 FD_SET (p->infd, &input_wait_mask);
4976 FD_SET (p->infd, &non_keyboard_wait_mask); 4975 FD_SET (p->infd, &non_keyboard_wait_mask);
@@ -5042,7 +5041,7 @@ read_process_output (Lisp_Object proc, register int channel)
5042 chars = alloca (carryover + readmax); 5041 chars = alloca (carryover + readmax);
5043 if (carryover) 5042 if (carryover)
5044 /* See the comment above. */ 5043 /* See the comment above. */
5045 memcpy (chars, SDATA (PVAR (p, decoding_buf)), carryover); 5044 memcpy (chars, SDATA (p->decoding_buf), carryover);
5046 5045
5047#ifdef DATAGRAM_SOCKETS 5046#ifdef DATAGRAM_SOCKETS
5048 /* We have a working select, so proc_buffered_char is always -1. */ 5047 /* We have a working select, so proc_buffered_char is always -1. */
@@ -5121,7 +5120,7 @@ read_process_output (Lisp_Object proc, register int channel)
5121 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 5120 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
5122 5121
5123 /* Read and dispose of the process output. */ 5122 /* Read and dispose of the process output. */
5124 outstream = PVAR (p, filter); 5123 outstream = p->filter;
5125 if (!NILP (outstream)) 5124 if (!NILP (outstream))
5126 { 5125 {
5127 Lisp_Object text; 5126 Lisp_Object text;
@@ -5163,9 +5162,9 @@ read_process_output (Lisp_Object proc, register int channel)
5163 text = coding->dst_object; 5162 text = coding->dst_object;
5164 Vlast_coding_system_used = CODING_ID_NAME (coding->id); 5163 Vlast_coding_system_used = CODING_ID_NAME (coding->id);
5165 /* A new coding system might be found. */ 5164 /* A new coding system might be found. */
5166 if (!EQ (PVAR (p, decode_coding_system), Vlast_coding_system_used)) 5165 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5167 { 5166 {
5168 PVAR (p, decode_coding_system) = Vlast_coding_system_used; 5167 PSET (p, decode_coding_system, Vlast_coding_system_used);
5169 5168
5170 /* Don't call setup_coding_system for 5169 /* Don't call setup_coding_system for
5171 proc_decode_coding_system[channel] here. It is done in 5170 proc_decode_coding_system[channel] here. It is done in
@@ -5178,21 +5177,21 @@ read_process_output (Lisp_Object proc, register int channel)
5178 proc_encode_coding_system[p->outfd] surely points to a 5177 proc_encode_coding_system[p->outfd] surely points to a
5179 valid memory because p->outfd will be changed once EOF is 5178 valid memory because p->outfd will be changed once EOF is
5180 sent to the process. */ 5179 sent to the process. */
5181 if (NILP (PVAR (p, encode_coding_system)) 5180 if (NILP (p->encode_coding_system)
5182 && proc_encode_coding_system[p->outfd]) 5181 && proc_encode_coding_system[p->outfd])
5183 { 5182 {
5184 PVAR (p, encode_coding_system) 5183 PSET (p, encode_coding_system,
5185 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil); 5184 coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5186 setup_coding_system (PVAR (p, encode_coding_system), 5185 setup_coding_system (p->encode_coding_system,
5187 proc_encode_coding_system[p->outfd]); 5186 proc_encode_coding_system[p->outfd]);
5188 } 5187 }
5189 } 5188 }
5190 5189
5191 if (coding->carryover_bytes > 0) 5190 if (coding->carryover_bytes > 0)
5192 { 5191 {
5193 if (SCHARS (PVAR (p, decoding_buf)) < coding->carryover_bytes) 5192 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5194 PVAR (p, decoding_buf) = make_uninit_string (coding->carryover_bytes); 5193 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes));
5195 memcpy (SDATA (PVAR (p, decoding_buf)), coding->carryover, 5194 memcpy (SDATA (p->decoding_buf), coding->carryover,
5196 coding->carryover_bytes); 5195 coding->carryover_bytes);
5197 p->decoding_carryover = coding->carryover_bytes; 5196 p->decoding_carryover = coding->carryover_bytes;
5198 } 5197 }
@@ -5228,7 +5227,7 @@ read_process_output (Lisp_Object proc, register int channel)
5228 } 5227 }
5229 5228
5230 /* If no filter, write into buffer if it isn't dead. */ 5229 /* If no filter, write into buffer if it isn't dead. */
5231 else if (!NILP (PVAR (p, buffer)) && !NILP (BVAR (XBUFFER (PVAR (p, buffer)), name))) 5230 else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
5232 { 5231 {
5233 Lisp_Object old_read_only; 5232 Lisp_Object old_read_only;
5234 ptrdiff_t old_begv, old_zv; 5233 ptrdiff_t old_begv, old_zv;
@@ -5238,7 +5237,7 @@ read_process_output (Lisp_Object proc, register int channel)
5238 Lisp_Object text; 5237 Lisp_Object text;
5239 struct buffer *b; 5238 struct buffer *b;
5240 5239
5241 Fset_buffer (PVAR (p, buffer)); 5240 Fset_buffer (p->buffer);
5242 opoint = PT; 5241 opoint = PT;
5243 opoint_byte = PT_BYTE; 5242 opoint_byte = PT_BYTE;
5244 old_read_only = BVAR (current_buffer, read_only); 5243 old_read_only = BVAR (current_buffer, read_only);
@@ -5247,16 +5246,16 @@ read_process_output (Lisp_Object proc, register int channel)
5247 old_begv_byte = BEGV_BYTE; 5246 old_begv_byte = BEGV_BYTE;
5248 old_zv_byte = ZV_BYTE; 5247 old_zv_byte = ZV_BYTE;
5249 5248
5250 BVAR (current_buffer, read_only) = Qnil; 5249 BSET (current_buffer, read_only, Qnil);
5251 5250
5252 /* Insert new output into buffer 5251 /* Insert new output into buffer
5253 at the current end-of-output marker, 5252 at the current end-of-output marker,
5254 thus preserving logical ordering of input and output. */ 5253 thus preserving logical ordering of input and output. */
5255 if (XMARKER (PVAR (p, mark))->buffer) 5254 if (XMARKER (p->mark)->buffer)
5256 SET_PT_BOTH (clip_to_bounds (BEGV, 5255 SET_PT_BOTH (clip_to_bounds (BEGV,
5257 marker_position (PVAR (p, mark)), ZV), 5256 marker_position (p->mark), ZV),
5258 clip_to_bounds (BEGV_BYTE, 5257 clip_to_bounds (BEGV_BYTE,
5259 marker_byte_position (PVAR (p, mark)), 5258 marker_byte_position (p->mark),
5260 ZV_BYTE)); 5259 ZV_BYTE));
5261 else 5260 else
5262 SET_PT_BOTH (ZV, ZV_BYTE); 5261 SET_PT_BOTH (ZV, ZV_BYTE);
@@ -5273,23 +5272,23 @@ read_process_output (Lisp_Object proc, register int channel)
5273 Vlast_coding_system_used = CODING_ID_NAME (coding->id); 5272 Vlast_coding_system_used = CODING_ID_NAME (coding->id);
5274 /* A new coding system might be found. See the comment in the 5273 /* A new coding system might be found. See the comment in the
5275 similar code in the previous `if' block. */ 5274 similar code in the previous `if' block. */
5276 if (!EQ (PVAR (p, decode_coding_system), Vlast_coding_system_used)) 5275 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5277 { 5276 {
5278 PVAR (p, decode_coding_system) = Vlast_coding_system_used; 5277 PSET (p, decode_coding_system, Vlast_coding_system_used);
5279 if (NILP (PVAR (p, encode_coding_system)) 5278 if (NILP (p->encode_coding_system)
5280 && proc_encode_coding_system[p->outfd]) 5279 && proc_encode_coding_system[p->outfd])
5281 { 5280 {
5282 PVAR (p, encode_coding_system) 5281 PSET (p, encode_coding_system,
5283 = coding_inherit_eol_type (Vlast_coding_system_used, Qnil); 5282 coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5284 setup_coding_system (PVAR (p, encode_coding_system), 5283 setup_coding_system (p->encode_coding_system,
5285 proc_encode_coding_system[p->outfd]); 5284 proc_encode_coding_system[p->outfd]);
5286 } 5285 }
5287 } 5286 }
5288 if (coding->carryover_bytes > 0) 5287 if (coding->carryover_bytes > 0)
5289 { 5288 {
5290 if (SCHARS (PVAR (p, decoding_buf)) < coding->carryover_bytes) 5289 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5291 PVAR (p, decoding_buf) = make_uninit_string (coding->carryover_bytes); 5290 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes));
5292 memcpy (SDATA (PVAR (p, decoding_buf)), coding->carryover, 5291 memcpy (SDATA (p->decoding_buf), coding->carryover,
5293 coding->carryover_bytes); 5292 coding->carryover_bytes);
5294 p->decoding_carryover = coding->carryover_bytes; 5293 p->decoding_carryover = coding->carryover_bytes;
5295 } 5294 }
@@ -5307,11 +5306,11 @@ read_process_output (Lisp_Object proc, register int channel)
5307 /* Make sure the process marker's position is valid when the 5306 /* Make sure the process marker's position is valid when the
5308 process buffer is changed in the signal_after_change above. 5307 process buffer is changed in the signal_after_change above.
5309 W3 is known to do that. */ 5308 W3 is known to do that. */
5310 if (BUFFERP (PVAR (p, buffer)) 5309 if (BUFFERP (p->buffer)
5311 && (b = XBUFFER (PVAR (p, buffer)), b != current_buffer)) 5310 && (b = XBUFFER (p->buffer), b != current_buffer))
5312 set_marker_both (PVAR (p, mark), PVAR (p, buffer), BUF_PT (b), BUF_PT_BYTE (b)); 5311 set_marker_both (p->mark, p->buffer, BUF_PT (b), BUF_PT_BYTE (b));
5313 else 5312 else
5314 set_marker_both (PVAR (p, mark), PVAR (p, buffer), PT, PT_BYTE); 5313 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
5315 5314
5316 update_mode_lines++; 5315 update_mode_lines++;
5317 5316
@@ -5338,7 +5337,7 @@ read_process_output (Lisp_Object proc, register int channel)
5338 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5339 5338
5340 5339
5341 BVAR (current_buffer, read_only) = old_read_only; 5340 BSET (current_buffer, read_only, old_read_only);
5342 SET_PT_BOTH (opoint, opoint_byte); 5341 SET_PT_BOTH (opoint, opoint_byte);
5343 } 5342 }
5344 /* Handling the process output should not deactivate the mark. */ 5343 /* Handling the process output should not deactivate the mark. */
@@ -5405,9 +5404,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5405 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5404 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5406 5405
5407 if (front) 5406 if (front)
5408 PVAR (p, write_queue) = Fcons (entry, PVAR (p, write_queue)); 5407 PSET (p, write_queue, Fcons (entry, p->write_queue));
5409 else 5408 else
5410 PVAR (p, write_queue) = nconc2 (PVAR (p, write_queue), Fcons (entry, Qnil)); 5409 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5411} 5410}
5412 5411
5413/* Remove the first element in the write_queue of process P, put its 5412/* Remove the first element in the write_queue of process P, put its
@@ -5421,11 +5420,11 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5421 Lisp_Object entry, offset_length; 5420 Lisp_Object entry, offset_length;
5422 ptrdiff_t offset; 5421 ptrdiff_t offset;
5423 5422
5424 if (NILP (PVAR (p, write_queue))) 5423 if (NILP (p->write_queue))
5425 return 0; 5424 return 0;
5426 5425
5427 entry = XCAR (PVAR (p, write_queue)); 5426 entry = XCAR (p->write_queue);
5428 PVAR (p, write_queue) = XCDR (PVAR (p, write_queue)); 5427 PSET (p, write_queue, XCDR (p->write_queue));
5429 5428
5430 *obj = XCAR (entry); 5429 *obj = XCAR (entry);
5431 offset_length = XCDR (entry); 5430 offset_length = XCDR (entry);
@@ -5459,10 +5458,10 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5459 5458
5460 if (p->raw_status_new) 5459 if (p->raw_status_new)
5461 update_status (p); 5460 update_status (p);
5462 if (! EQ (PVAR (p, status), Qrun)) 5461 if (! EQ (p->status, Qrun))
5463 error ("Process %s not running", SDATA (PVAR (p, name))); 5462 error ("Process %s not running", SDATA (p->name));
5464 if (p->outfd < 0) 5463 if (p->outfd < 0)
5465 error ("Output file descriptor of %s is closed", SDATA (PVAR (p, name))); 5464 error ("Output file descriptor of %s is closed", SDATA (p->name));
5466 5465
5467 coding = proc_encode_coding_system[p->outfd]; 5466 coding = proc_encode_coding_system[p->outfd];
5468 Vlast_coding_system_used = CODING_ID_NAME (coding->id); 5467 Vlast_coding_system_used = CODING_ID_NAME (coding->id);
@@ -5472,9 +5471,9 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5472 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5471 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5473 || EQ (object, Qt)) 5472 || EQ (object, Qt))
5474 { 5473 {
5475 PVAR (p, encode_coding_system) 5474 PSET (p, encode_coding_system,
5476 = complement_process_encoding_system (PVAR (p, encode_coding_system)); 5475 complement_process_encoding_system (p->encode_coding_system));
5477 if (!EQ (Vlast_coding_system_used, PVAR (p, encode_coding_system))) 5476 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5478 { 5477 {
5479 /* The coding system for encoding was changed to raw-text 5478 /* The coding system for encoding was changed to raw-text
5480 because we sent a unibyte text previously. Now we are 5479 because we sent a unibyte text previously. Now we are
@@ -5484,8 +5483,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5484 Another reason we come here is that the coding system 5483 Another reason we come here is that the coding system
5485 was just complemented and a new one was returned by 5484 was just complemented and a new one was returned by
5486 complement_process_encoding_system. */ 5485 complement_process_encoding_system. */
5487 setup_coding_system (PVAR (p, encode_coding_system), coding); 5486 setup_coding_system (p->encode_coding_system, coding);
5488 Vlast_coding_system_used = PVAR (p, encode_coding_system); 5487 Vlast_coding_system_used = p->encode_coding_system;
5489 } 5488 }
5490 coding->src_multibyte = 1; 5489 coding->src_multibyte = 1;
5491 } 5490 }
@@ -5572,7 +5571,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5572 5571
5573 /* If there is already data in the write_queue, put the new data 5572 /* If there is already data in the write_queue, put the new data
5574 in the back of queue. Otherwise, ignore it. */ 5573 in the back of queue. Otherwise, ignore it. */
5575 if (!NILP (PVAR (p, write_queue))) 5574 if (!NILP (p->write_queue))
5576 write_queue_push (p, object, buf, len, 0); 5575 write_queue_push (p, object, buf, len, 0);
5577 5576
5578 do /* while !NILP (p->write_queue) */ 5577 do /* while !NILP (p->write_queue) */
@@ -5686,7 +5685,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5686 cur_len -= written; 5685 cur_len -= written;
5687 } 5686 }
5688 } 5687 }
5689 while (!NILP (PVAR (p, write_queue))); 5688 while (!NILP (p->write_queue));
5690 } 5689 }
5691 else 5690 else
5692 { 5691 {
@@ -5694,10 +5693,10 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5694 proc = process_sent_to; 5693 proc = process_sent_to;
5695 p = XPROCESS (proc); 5694 p = XPROCESS (proc);
5696 p->raw_status_new = 0; 5695 p->raw_status_new = 0;
5697 PVAR (p, status) = Fcons (Qexit, Fcons (make_number (256), Qnil)); 5696 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5698 p->tick = ++process_tick; 5697 p->tick = ++process_tick;
5699 deactivate_process (proc); 5698 deactivate_process (proc);
5700 error ("SIGPIPE raised on process %s; closed it", SDATA (PVAR (p, name))); 5699 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
5701 } 5700 }
5702} 5701}
5703 5702
@@ -5755,12 +5754,12 @@ emacs_get_tty_pgrp (struct Lisp_Process *p)
5755 pid_t gid = -1; 5754 pid_t gid = -1;
5756 5755
5757#ifdef TIOCGPGRP 5756#ifdef TIOCGPGRP
5758 if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (PVAR (p, tty_name))) 5757 if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
5759 { 5758 {
5760 int fd; 5759 int fd;
5761 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the 5760 /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
5762 master side. Try the slave side. */ 5761 master side. Try the slave side. */
5763 fd = emacs_open (SSDATA (PVAR (p, tty_name)), O_RDONLY, 0); 5762 fd = emacs_open (SSDATA (p->tty_name), O_RDONLY, 0);
5764 5763
5765 if (fd != -1) 5764 if (fd != -1)
5766 { 5765 {
@@ -5789,12 +5788,12 @@ return t unconditionally. */)
5789 proc = get_process (process); 5788 proc = get_process (process);
5790 p = XPROCESS (proc); 5789 p = XPROCESS (proc);
5791 5790
5792 if (!EQ (PVAR (p, type), Qreal)) 5791 if (!EQ (p->type, Qreal))
5793 error ("Process %s is not a subprocess", 5792 error ("Process %s is not a subprocess",
5794 SDATA (PVAR (p, name))); 5793 SDATA (p->name));
5795 if (p->infd < 0) 5794 if (p->infd < 0)
5796 error ("Process %s is not active", 5795 error ("Process %s is not active",
5797 SDATA (PVAR (p, name))); 5796 SDATA (p->name));
5798 5797
5799 gid = emacs_get_tty_pgrp (p); 5798 gid = emacs_get_tty_pgrp (p);
5800 5799
@@ -5829,12 +5828,12 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5829 proc = get_process (process); 5828 proc = get_process (process);
5830 p = XPROCESS (proc); 5829 p = XPROCESS (proc);
5831 5830
5832 if (!EQ (PVAR (p, type), Qreal)) 5831 if (!EQ (p->type, Qreal))
5833 error ("Process %s is not a subprocess", 5832 error ("Process %s is not a subprocess",
5834 SDATA (PVAR (p, name))); 5833 SDATA (p->name));
5835 if (p->infd < 0) 5834 if (p->infd < 0)
5836 error ("Process %s is not active", 5835 error ("Process %s is not active",
5837 SDATA (PVAR (p, name))); 5836 SDATA (p->name));
5838 5837
5839 if (!p->pty_flag) 5838 if (!p->pty_flag)
5840 current_group = Qnil; 5839 current_group = Qnil;
@@ -5923,7 +5922,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5923#ifdef SIGCONT 5922#ifdef SIGCONT
5924 case SIGCONT: 5923 case SIGCONT:
5925 p->raw_status_new = 0; 5924 p->raw_status_new = 0;
5926 PVAR (p, status) = Qrun; 5925 PSET (p, status, Qrun);
5927 p->tick = ++process_tick; 5926 p->tick = ++process_tick;
5928 if (!nomsg) 5927 if (!nomsg)
5929 { 5928 {
@@ -6013,13 +6012,13 @@ traffic. */)
6013 struct Lisp_Process *p; 6012 struct Lisp_Process *p;
6014 6013
6015 p = XPROCESS (process); 6014 p = XPROCESS (process);
6016 if (NILP (PVAR (p, command)) 6015 if (NILP (p->command)
6017 && p->infd >= 0) 6016 && p->infd >= 0)
6018 { 6017 {
6019 FD_CLR (p->infd, &input_wait_mask); 6018 FD_CLR (p->infd, &input_wait_mask);
6020 FD_CLR (p->infd, &non_keyboard_wait_mask); 6019 FD_CLR (p->infd, &non_keyboard_wait_mask);
6021 } 6020 }
6022 PVAR (p, command) = Qt; 6021 PSET (p, command, Qt);
6023 return process; 6022 return process;
6024 } 6023 }
6025#ifndef SIGTSTP 6024#ifndef SIGTSTP
@@ -6042,9 +6041,9 @@ traffic. */)
6042 struct Lisp_Process *p; 6041 struct Lisp_Process *p;
6043 6042
6044 p = XPROCESS (process); 6043 p = XPROCESS (process);
6045 if (EQ (PVAR (p, command), Qt) 6044 if (EQ (p->command, Qt)
6046 && p->infd >= 0 6045 && p->infd >= 0
6047 && (!EQ (PVAR (p, filter), Qt) || EQ (PVAR (p, status), Qlisten))) 6046 && (!EQ (p->filter, Qt) || EQ (p->status, Qlisten)))
6048 { 6047 {
6049 FD_SET (p->infd, &input_wait_mask); 6048 FD_SET (p->infd, &input_wait_mask);
6050 FD_SET (p->infd, &non_keyboard_wait_mask); 6049 FD_SET (p->infd, &non_keyboard_wait_mask);
@@ -6055,7 +6054,7 @@ traffic. */)
6055 tcflush (p->infd, TCIFLUSH); 6054 tcflush (p->infd, TCIFLUSH);
6056#endif /* not WINDOWSNT */ 6055#endif /* not WINDOWSNT */
6057 } 6056 }
6058 PVAR (p, command) = Qnil; 6057 PSET (p, command, Qnil);
6059 return process; 6058 return process;
6060 } 6059 }
6061#ifdef SIGCONT 6060#ifdef SIGCONT
@@ -6102,8 +6101,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6102 CHECK_PROCESS (process); 6101 CHECK_PROCESS (process);
6103 pid = XPROCESS (process)->pid; 6102 pid = XPROCESS (process)->pid;
6104 if (pid <= 0) 6103 if (pid <= 0)
6105 error ("Cannot signal process %s", 6104 error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
6106 SDATA (PVAR (XPROCESS (process), name)));
6107 } 6105 }
6108 6106
6109#define parse_signal(NAME, VALUE) \ 6107#define parse_signal(NAME, VALUE) \
@@ -6247,8 +6245,8 @@ process has been transmitted to the serial port. */)
6247 /* Make sure the process is really alive. */ 6245 /* Make sure the process is really alive. */
6248 if (XPROCESS (proc)->raw_status_new) 6246 if (XPROCESS (proc)->raw_status_new)
6249 update_status (XPROCESS (proc)); 6247 update_status (XPROCESS (proc));
6250 if (! EQ (PVAR (XPROCESS (proc), status), Qrun)) 6248 if (! EQ (XPROCESS (proc)->status, Qrun))
6251 error ("Process %s not running", SDATA (PVAR (XPROCESS (proc), name))); 6249 error ("Process %s not running", SDATA (XPROCESS (proc)->name));
6252 6250
6253 if (CODING_REQUIRE_FLUSHING (coding)) 6251 if (CODING_REQUIRE_FLUSHING (coding))
6254 { 6252 {
@@ -6258,7 +6256,7 @@ process has been transmitted to the serial port. */)
6258 6256
6259 if (XPROCESS (proc)->pty_flag) 6257 if (XPROCESS (proc)->pty_flag)
6260 send_process (proc, "\004", 1, Qnil); 6258 send_process (proc, "\004", 1, Qnil);
6261 else if (EQ (PVAR (XPROCESS (proc), type), Qserial)) 6259 else if (EQ (XPROCESS (proc)->type, Qserial))
6262 { 6260 {
6263#ifndef WINDOWSNT 6261#ifndef WINDOWSNT
6264 if (tcdrain (XPROCESS (proc)->outfd) != 0) 6262 if (tcdrain (XPROCESS (proc)->outfd) != 0)
@@ -6275,7 +6273,7 @@ process has been transmitted to the serial port. */)
6275 for communication with the subprocess, call shutdown to cause EOF. 6273 for communication with the subprocess, call shutdown to cause EOF.
6276 (In some old system, shutdown to socketpair doesn't work. 6274 (In some old system, shutdown to socketpair doesn't work.
6277 Then we just can't win.) */ 6275 Then we just can't win.) */
6278 if (EQ (PVAR (XPROCESS (proc), type), Qnetwork) 6276 if (EQ (XPROCESS (proc)->type, Qnetwork)
6279 || XPROCESS (proc)->outfd == XPROCESS (proc)->infd) 6277 || XPROCESS (proc)->outfd == XPROCESS (proc)->infd)
6280 shutdown (XPROCESS (proc)->outfd, 1); 6278 shutdown (XPROCESS (proc)->outfd, 1);
6281 /* In case of socketpair, outfd == infd, so don't close it. */ 6279 /* In case of socketpair, outfd == infd, so don't close it. */
@@ -6352,7 +6350,7 @@ sigchld_handler (int signo)
6352 do 6350 do
6353 { 6351 {
6354 errno = 0; 6352 errno = 0;
6355 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); 6353 pid = waitpid (-1, &w, WNOHANG | WUNTRACED);
6356 } 6354 }
6357 while (pid < 0 && errno == EINTR); 6355 while (pid < 0 && errno == EINTR);
6358 6356
@@ -6388,7 +6386,7 @@ sigchld_handler (int signo)
6388 { 6386 {
6389 proc = XCDR (XCAR (tail)); 6387 proc = XCDR (XCAR (tail));
6390 p = XPROCESS (proc); 6388 p = XPROCESS (proc);
6391 if (EQ (PVAR (p, type), Qreal) && p->pid == pid) 6389 if (EQ (p->type, Qreal) && p->pid == pid)
6392 break; 6390 break;
6393 p = 0; 6391 p = 0;
6394 } 6392 }
@@ -6440,7 +6438,7 @@ sigchld_handler (int signo)
6440 6438
6441 /* Report the status of the synchronous process. */ 6439 /* Report the status of the synchronous process. */
6442 if (WIFEXITED (w)) 6440 if (WIFEXITED (w))
6443 synch_process_retcode = WRETCODE (w); 6441 synch_process_retcode = WEXITSTATUS (w);
6444 else if (WIFSIGNALED (w)) 6442 else if (WIFSIGNALED (w))
6445 synch_process_termsig = WTERMSIG (w); 6443 synch_process_termsig = WTERMSIG (w);
6446 6444
@@ -6472,7 +6470,7 @@ sigchld_handler (int signo)
6472static Lisp_Object 6470static Lisp_Object
6473exec_sentinel_unwind (Lisp_Object data) 6471exec_sentinel_unwind (Lisp_Object data)
6474{ 6472{
6475 PVAR (XPROCESS (XCAR (data)), sentinel) = XCDR (data); 6473 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data));
6476 return Qnil; 6474 return Qnil;
6477} 6475}
6478 6476
@@ -6512,13 +6510,13 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6512 friends don't expect current-buffer to be changed from under them. */ 6510 friends don't expect current-buffer to be changed from under them. */
6513 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 6511 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
6514 6512
6515 sentinel = PVAR (p, sentinel); 6513 sentinel = p->sentinel;
6516 if (NILP (sentinel)) 6514 if (NILP (sentinel))
6517 return; 6515 return;
6518 6516
6519 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6517 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6520 assure that it gets restored no matter how the sentinel exits. */ 6518 assure that it gets restored no matter how the sentinel exits. */
6521 PVAR (p, sentinel) = Qnil; 6519 PSET (p, sentinel, Qnil);
6522 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6520 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6523 /* Inhibit quit so that random quits don't screw up a running filter. */ 6521 /* Inhibit quit so that random quits don't screw up a running filter. */
6524 specbind (Qinhibit_quit, Qt); 6522 specbind (Qinhibit_quit, Qt);
@@ -6606,16 +6604,16 @@ status_notify (struct Lisp_Process *deleting_process)
6606 p->update_tick = p->tick; 6604 p->update_tick = p->tick;
6607 6605
6608 /* If process is still active, read any output that remains. */ 6606 /* If process is still active, read any output that remains. */
6609 while (! EQ (PVAR (p, filter), Qt) 6607 while (! EQ (p->filter, Qt)
6610 && ! EQ (PVAR (p, status), Qconnect) 6608 && ! EQ (p->status, Qconnect)
6611 && ! EQ (PVAR (p, status), Qlisten) 6609 && ! EQ (p->status, Qlisten)
6612 /* Network or serial process not stopped: */ 6610 /* Network or serial process not stopped: */
6613 && ! EQ (PVAR (p, command), Qt) 6611 && ! EQ (p->command, Qt)
6614 && p->infd >= 0 6612 && p->infd >= 0
6615 && p != deleting_process 6613 && p != deleting_process
6616 && read_process_output (proc, p->infd) > 0); 6614 && read_process_output (proc, p->infd) > 0);
6617 6615
6618 buffer = PVAR (p, buffer); 6616 buffer = p->buffer;
6619 6617
6620 /* Get the text to use for the message. */ 6618 /* Get the text to use for the message. */
6621 if (p->raw_status_new) 6619 if (p->raw_status_new)
@@ -6623,9 +6621,9 @@ status_notify (struct Lisp_Process *deleting_process)
6623 msg = status_message (p); 6621 msg = status_message (p);
6624 6622
6625 /* If process is terminated, deactivate it or delete it. */ 6623 /* If process is terminated, deactivate it or delete it. */
6626 symbol = PVAR (p, status); 6624 symbol = p->status;
6627 if (CONSP (PVAR (p, status))) 6625 if (CONSP (p->status))
6628 symbol = XCAR (PVAR (p, status)); 6626 symbol = XCAR (p->status);
6629 6627
6630 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) 6628 if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)
6631 || EQ (symbol, Qclosed)) 6629 || EQ (symbol, Qclosed))
@@ -6642,7 +6640,7 @@ status_notify (struct Lisp_Process *deleting_process)
6642 this code to be run again. */ 6640 this code to be run again. */
6643 p->update_tick = p->tick; 6641 p->update_tick = p->tick;
6644 /* Now output the message suitably. */ 6642 /* Now output the message suitably. */
6645 if (!NILP (PVAR (p, sentinel))) 6643 if (!NILP (p->sentinel))
6646 exec_sentinel (proc, msg); 6644 exec_sentinel (proc, msg);
6647 /* Don't bother with a message in the buffer 6645 /* Don't bother with a message in the buffer
6648 when a process becomes runnable. */ 6646 when a process becomes runnable. */
@@ -6664,8 +6662,8 @@ status_notify (struct Lisp_Process *deleting_process)
6664 /* Insert new output into buffer 6662 /* Insert new output into buffer
6665 at the current end-of-output marker, 6663 at the current end-of-output marker,
6666 thus preserving logical ordering of input and output. */ 6664 thus preserving logical ordering of input and output. */
6667 if (XMARKER (PVAR (p, mark))->buffer) 6665 if (XMARKER (p->mark)->buffer)
6668 Fgoto_char (PVAR (p, mark)); 6666 Fgoto_char (p->mark);
6669 else 6667 else
6670 SET_PT_BOTH (ZV, ZV_BYTE); 6668 SET_PT_BOTH (ZV, ZV_BYTE);
6671 6669
@@ -6673,13 +6671,14 @@ status_notify (struct Lisp_Process *deleting_process)
6673 before_byte = PT_BYTE; 6671 before_byte = PT_BYTE;
6674 6672
6675 tem = BVAR (current_buffer, read_only); 6673 tem = BVAR (current_buffer, read_only);
6676 BVAR (current_buffer, read_only) = Qnil; 6674 BSET (current_buffer, read_only, Qnil);
6677 insert_string ("\nProcess "); 6675 insert_string ("\nProcess ");
6678 Finsert (1, &PVAR (p, name)); 6676 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6679 insert_string (" "); 6678 insert_string (" ");
6680 Finsert (1, &msg); 6679 Finsert (1, &msg);
6681 BVAR (current_buffer, read_only) = tem; 6680 BSET (current_buffer, read_only, tem);
6682 set_marker_both (PVAR (p, mark), PVAR (p, buffer), PT, PT_BYTE); 6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6683 6682
6684 if (opoint >= before) 6683 if (opoint >= before)
6685 SET_PT_BOTH (opoint + (PT - before), 6684 SET_PT_BOTH (opoint + (PT - before),
@@ -6709,14 +6708,14 @@ encode subprocess input. */)
6709 CHECK_PROCESS (process); 6708 CHECK_PROCESS (process);
6710 p = XPROCESS (process); 6709 p = XPROCESS (process);
6711 if (p->infd < 0) 6710 if (p->infd < 0)
6712 error ("Input file descriptor of %s closed", SDATA (PVAR (p, name))); 6711 error ("Input file descriptor of %s closed", SDATA (p->name));
6713 if (p->outfd < 0) 6712 if (p->outfd < 0)
6714 error ("Output file descriptor of %s closed", SDATA (PVAR (p, name))); 6713 error ("Output file descriptor of %s closed", SDATA (p->name));
6715 Fcheck_coding_system (decoding); 6714 Fcheck_coding_system (decoding);
6716 Fcheck_coding_system (encoding); 6715 Fcheck_coding_system (encoding);
6717 encoding = coding_inherit_eol_type (encoding, Qnil); 6716 encoding = coding_inherit_eol_type (encoding, Qnil);
6718 PVAR (p, decode_coding_system) = decoding; 6717 PSET (p, decode_coding_system, decoding);
6719 PVAR (p, encode_coding_system) = encoding; 6718 PSET (p, encode_coding_system, encoding);
6720 setup_process_coding_systems (process); 6719 setup_process_coding_systems (process);
6721 6720
6722 return Qnil; 6721 return Qnil;
@@ -6728,8 +6727,8 @@ DEFUN ("process-coding-system",
6728 (register Lisp_Object process) 6727 (register Lisp_Object process)
6729{ 6728{
6730 CHECK_PROCESS (process); 6729 CHECK_PROCESS (process);
6731 return Fcons (PVAR (XPROCESS (process), decode_coding_system), 6730 return Fcons (XPROCESS (process)->decode_coding_system,
6732 PVAR (XPROCESS (process), encode_coding_system)); 6731 XPROCESS (process)->encode_coding_system);
6733} 6732}
6734 6733
6735DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte, 6734DEFUN ("set-process-filter-multibyte", Fset_process_filter_multibyte,
@@ -6746,8 +6745,8 @@ suppressed. */)
6746 CHECK_PROCESS (process); 6745 CHECK_PROCESS (process);
6747 p = XPROCESS (process); 6746 p = XPROCESS (process);
6748 if (NILP (flag)) 6747 if (NILP (flag))
6749 PVAR (p, decode_coding_system) 6748 PSET (p, decode_coding_system,
6750 = raw_text_coding_system (PVAR (p, decode_coding_system)); 6749 raw_text_coding_system (p->decode_coding_system));
6751 setup_process_coding_systems (process); 6750 setup_process_coding_systems (process);
6752 6751
6753 return Qnil; 6752 return Qnil;
@@ -7085,19 +7084,19 @@ setup_process_coding_systems (Lisp_Object process)
7085 7084
7086 if (!proc_decode_coding_system[inch]) 7085 if (!proc_decode_coding_system[inch])
7087 proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system)); 7086 proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system));
7088 coding_system = PVAR (p, decode_coding_system); 7087 coding_system = p->decode_coding_system;
7089 if (! NILP (PVAR (p, filter))) 7088 if (! NILP (p->filter))
7090 ; 7089 ;
7091 else if (BUFFERP (PVAR (p, buffer))) 7090 else if (BUFFERP (p->buffer))
7092 { 7091 {
7093 if (NILP (BVAR (XBUFFER (PVAR (p, buffer)), enable_multibyte_characters))) 7092 if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)))
7094 coding_system = raw_text_coding_system (coding_system); 7093 coding_system = raw_text_coding_system (coding_system);
7095 } 7094 }
7096 setup_coding_system (coding_system, proc_decode_coding_system[inch]); 7095 setup_coding_system (coding_system, proc_decode_coding_system[inch]);
7097 7096
7098 if (!proc_encode_coding_system[outch]) 7097 if (!proc_encode_coding_system[outch])
7099 proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system)); 7098 proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system));
7100 setup_coding_system (PVAR (p, encode_coding_system), 7099 setup_coding_system (p->encode_coding_system,
7101 proc_encode_coding_system[outch]); 7100 proc_encode_coding_system[outch]);
7102#endif 7101#endif
7103} 7102}
@@ -7143,7 +7142,7 @@ BUFFER may be a buffer or the name of one. */)
7143 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) 7142 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
7144 { 7143 {
7145 proc = Fcdr (XCAR (tail)); 7144 proc = Fcdr (XCAR (tail));
7146 if (PROCESSP (proc) && EQ (PVAR (XPROCESS (proc), buffer), buf)) 7145 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
7147 return proc; 7146 return proc;
7148 } 7147 }
7149#endif /* subprocesses */ 7148#endif /* subprocesses */
@@ -7182,7 +7181,7 @@ kill_buffer_processes (Lisp_Object buffer)
7182 { 7181 {
7183 proc = XCDR (XCAR (tail)); 7182 proc = XCDR (XCAR (tail));
7184 if (PROCESSP (proc) 7183 if (PROCESSP (proc)
7185 && (NILP (buffer) || EQ (PVAR (XPROCESS (proc), buffer), buffer))) 7184 && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
7186 { 7185 {
7187 if (NETCONN_P (proc) || SERIALCONN_P (proc)) 7186 if (NETCONN_P (proc) || SERIALCONN_P (proc))
7188 Fdelete_process (proc); 7187 Fdelete_process (proc);