aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorTom Tromey2012-08-20 07:34:41 -0600
committerTom Tromey2012-08-20 07:34:41 -0600
commit49bc1a9dfc6e81a370bf12157c3c573743ee200a (patch)
tree24df8b040aff367adc11a2c676334ec238651e1d /src/process.c
parentb94de893429bbfbb27572c8c3118fcc876957adb (diff)
parenta05731a0cc2553af0469bd9b7d6ac10cd2e6a817 (diff)
downloademacs-49bc1a9dfc6e81a370bf12157c3c573743ee200a.tar.gz
emacs-49bc1a9dfc6e81a370bf12157c3c573743ee200a.zip
Merge from trunk
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c302
1 files changed, 194 insertions, 108 deletions
diff --git a/src/process.c b/src/process.c
index ada673e3c34..fa138027ec1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -20,6 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22#include <config.h> 22#include <config.h>
23
24#define PROCESS_INLINE EXTERN_INLINE
25
23#include <signal.h> 26#include <signal.h>
24#include <stdio.h> 27#include <stdio.h>
25#include <errno.h> 28#include <errno.h>
@@ -312,6 +315,93 @@ static struct sockaddr_and_len {
312/* Maximum number of bytes to send to a pty without an eof. */ 315/* Maximum number of bytes to send to a pty without an eof. */
313static int pty_max_bytes; 316static int pty_max_bytes;
314 317
318/* These setters are used only in this file, so they can be private. */
319static inline void
320pset_buffer (struct Lisp_Process *p, Lisp_Object val)
321{
322 p->buffer = val;
323}
324static inline void
325pset_command (struct Lisp_Process *p, Lisp_Object val)
326{
327 p->command = val;
328}
329static inline void
330pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
331{
332 p->decode_coding_system = val;
333}
334static inline void
335pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
336{
337 p->decoding_buf = val;
338}
339static inline void
340pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
341{
342 p->encode_coding_system = val;
343}
344static inline void
345pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
346{
347 p->encoding_buf = val;
348}
349static inline void
350pset_filter (struct Lisp_Process *p, Lisp_Object val)
351{
352 p->filter = val;
353}
354static inline void
355pset_log (struct Lisp_Process *p, Lisp_Object val)
356{
357 p->log = val;
358}
359static inline void
360pset_mark (struct Lisp_Process *p, Lisp_Object val)
361{
362 p->mark = val;
363}
364static inline void
365pset_thread (struct Lisp_Process *p, Lisp_Object val)
366{
367 p->thread = val;
368}
369static inline void
370pset_name (struct Lisp_Process *p, Lisp_Object val)
371{
372 p->name = val;
373}
374static inline void
375pset_plist (struct Lisp_Process *p, Lisp_Object val)
376{
377 p->plist = val;
378}
379static inline void
380pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
381{
382 p->sentinel = val;
383}
384static inline void
385pset_status (struct Lisp_Process *p, Lisp_Object val)
386{
387 p->status = val;
388}
389static inline void
390pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
391{
392 p->tty_name = val;
393}
394static inline void
395pset_type (struct Lisp_Process *p, Lisp_Object val)
396{
397 p->type = val;
398}
399static inline void
400pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
401{
402 p->write_queue = val;
403}
404
315 405
316 406
317enum fd_bits 407enum fd_bits
@@ -562,7 +652,7 @@ static void
562update_status (struct Lisp_Process *p) 652update_status (struct Lisp_Process *p)
563{ 653{
564 eassert (p->raw_status_new); 654 eassert (p->raw_status_new);
565 PSET (p, status, status_convert (p->raw_status)); 655 pset_status (p, status_convert (p->raw_status));
566 p->raw_status_new = 0; 656 p->raw_status_new = 0;
567} 657}
568 658
@@ -760,9 +850,9 @@ make_process (Lisp_Object name)
760 p = allocate_process (); 850 p = allocate_process ();
761 /* Initialize Lisp data. Note that allocate_process initializes all 851 /* Initialize Lisp data. Note that allocate_process initializes all
762 Lisp data to nil, so do it only for slots which should not be nil. */ 852 Lisp data to nil, so do it only for slots which should not be nil. */
763 PSET (p, status, Qrun); 853 pset_status (p, Qrun);
764 PSET (p, mark, Fmake_marker ()); 854 pset_mark (p, Fmake_marker ());
765 PSET (p, thread, Fcurrent_thread ()); 855 pset_thread (p, Fcurrent_thread ());
766 856
767 /* Initialize non-Lisp data. Note that allocate_process zeroes out all 857 /* Initialize non-Lisp data. Note that allocate_process zeroes out all
768 non-Lisp data, so do it only for slots which should not be zero. */ 858 non-Lisp data, so do it only for slots which should not be zero. */
@@ -783,7 +873,7 @@ make_process (Lisp_Object name)
783 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); 873 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
784 } 874 }
785 name = name1; 875 name = name1;
786 PSET (p, name, name); 876 pset_name (p, name);
787 XSETPROCESS (val, p); 877 XSETPROCESS (val, p);
788 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 878 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
789 return val; 879 return val;
@@ -901,7 +991,7 @@ nil, indicating the current buffer's process. */)
901 p->raw_status_new = 0; 991 p->raw_status_new = 0;
902 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 992 if (NETCONN1_P (p) || SERIALCONN1_P (p))
903 { 993 {
904 PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil))); 994 pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil)));
905 p->tick = ++process_tick; 995 p->tick = ++process_tick;
906 status_notify (p); 996 status_notify (p);
907 redisplay_preserve_echo_area (13); 997 redisplay_preserve_echo_area (13);
@@ -930,7 +1020,7 @@ nil, indicating the current buffer's process. */)
930 { 1020 {
931 Fkill_process (process, Qnil); 1021 Fkill_process (process, Qnil);
932 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 1022 /* Do this now, since remove_process will make sigchld_handler do nothing. */
933 PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); 1023 pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
934 p->tick = ++process_tick; 1024 p->tick = ++process_tick;
935 status_notify (p); 1025 status_notify (p);
936 redisplay_preserve_echo_area (13); 1026 redisplay_preserve_echo_area (13);
@@ -1057,9 +1147,9 @@ Return BUFFER. */)
1057 if (!NILP (buffer)) 1147 if (!NILP (buffer))
1058 CHECK_BUFFER (buffer); 1148 CHECK_BUFFER (buffer);
1059 p = XPROCESS (process); 1149 p = XPROCESS (process);
1060 PSET (p, buffer, buffer); 1150 pset_buffer (p, buffer);
1061 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1151 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1062 PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer)); 1152 pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer));
1063 setup_process_coding_systems (process); 1153 setup_process_coding_systems (process);
1064 return buffer; 1154 return buffer;
1065} 1155}
@@ -1124,9 +1214,9 @@ The string argument is normally a multibyte string, except:
1124 delete_read_fd (p->infd); 1214 delete_read_fd (p->infd);
1125 } 1215 }
1126 1216
1127 PSET (p, filter, filter); 1217 pset_filter (p, filter);
1128 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1218 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1129 PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); 1219 pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
1130 setup_process_coding_systems (process); 1220 setup_process_coding_systems (process);
1131 return filter; 1221 return filter;
1132} 1222}
@@ -1153,9 +1243,9 @@ It gets two arguments: the process, and a string describing the change. */)
1153 CHECK_PROCESS (process); 1243 CHECK_PROCESS (process);
1154 p = XPROCESS (process); 1244 p = XPROCESS (process);
1155 1245
1156 PSET (p, sentinel, sentinel); 1246 pset_sentinel (p, sentinel);
1157 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1247 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1158 PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel)); 1248 pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel));
1159 return sentinel; 1249 return sentinel;
1160} 1250}
1161 1251
@@ -1324,7 +1414,7 @@ DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
1324 CHECK_PROCESS (process); 1414 CHECK_PROCESS (process);
1325 CHECK_LIST (plist); 1415 CHECK_LIST (plist);
1326 1416
1327 PSET (XPROCESS (process), plist, plist); 1417 pset_plist (XPROCESS (process), plist);
1328 return plist; 1418 return plist;
1329} 1419}
1330 1420
@@ -1510,18 +1600,18 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1510 itself; it's all taken care of here. */ 1600 itself; it's all taken care of here. */
1511 record_unwind_protect (start_process_unwind, proc); 1601 record_unwind_protect (start_process_unwind, proc);
1512 1602
1513 PSET (XPROCESS (proc), childp, Qt); 1603 pset_childp (XPROCESS (proc), Qt);
1514 PSET (XPROCESS (proc), plist, Qnil); 1604 pset_plist (XPROCESS (proc), Qnil);
1515 PSET (XPROCESS (proc), type, Qreal); 1605 pset_type (XPROCESS (proc), Qreal);
1516 PSET (XPROCESS (proc), buffer, buffer); 1606 pset_buffer (XPROCESS (proc), buffer);
1517 PSET (XPROCESS (proc), sentinel, Qnil); 1607 pset_sentinel (XPROCESS (proc), Qnil);
1518 PSET (XPROCESS (proc), filter, Qnil); 1608 pset_filter (XPROCESS (proc), Qnil);
1519 PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2)); 1609 pset_command (XPROCESS (proc), Flist (nargs - 2, args + 2));
1520 1610
1521#ifdef HAVE_GNUTLS 1611#ifdef HAVE_GNUTLS
1522 /* AKA GNUTLS_INITSTAGE(proc). */ 1612 /* AKA GNUTLS_INITSTAGE(proc). */
1523 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; 1613 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY;
1524 PSET (XPROCESS (proc), gnutls_cred_type, Qnil); 1614 pset_gnutls_cred_type (XPROCESS (proc), Qnil);
1525#endif 1615#endif
1526 1616
1527#ifdef ADAPTIVE_READ_BUFFERING 1617#ifdef ADAPTIVE_READ_BUFFERING
@@ -1561,7 +1651,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1561 else if (CONSP (Vdefault_process_coding_system)) 1651 else if (CONSP (Vdefault_process_coding_system))
1562 val = XCAR (Vdefault_process_coding_system); 1652 val = XCAR (Vdefault_process_coding_system);
1563 } 1653 }
1564 PSET (XPROCESS (proc), decode_coding_system, val); 1654 pset_decode_coding_system (XPROCESS (proc), val);
1565 1655
1566 val = Vcoding_system_for_write; 1656 val = Vcoding_system_for_write;
1567 if (NILP (val)) 1657 if (NILP (val))
@@ -1581,7 +1671,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1581 else if (CONSP (Vdefault_process_coding_system)) 1671 else if (CONSP (Vdefault_process_coding_system))
1582 val = XCDR (Vdefault_process_coding_system); 1672 val = XCDR (Vdefault_process_coding_system);
1583 } 1673 }
1584 PSET (XPROCESS (proc), encode_coding_system, val); 1674 pset_encode_coding_system (XPROCESS (proc), val);
1585 /* Note: At this moment, the above coding system may leave 1675 /* Note: At this moment, the above coding system may leave
1586 text-conversion or eol-conversion unspecified. They will be 1676 text-conversion or eol-conversion unspecified. They will be
1587 decided after we read output from the process and decode it by 1677 decided after we read output from the process and decode it by
@@ -1590,9 +1680,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1590 } 1680 }
1591 1681
1592 1682
1593 PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string); 1683 pset_decoding_buf (XPROCESS (proc), empty_unibyte_string);
1594 XPROCESS (proc)->decoding_carryover = 0; 1684 XPROCESS (proc)->decoding_carryover = 0;
1595 PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string); 1685 pset_encoding_buf (XPROCESS (proc), empty_unibyte_string);
1596 1686
1597 XPROCESS (proc)->inherit_coding_system_flag 1687 XPROCESS (proc)->inherit_coding_system_flag
1598 = !(NILP (buffer) || !inherit_process_coding_system); 1688 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1724,9 +1814,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1724 /* Use volatile to protect variables from being clobbered by longjmp. */ 1814 /* Use volatile to protect variables from being clobbered by longjmp. */
1725 volatile int forkin, forkout; 1815 volatile int forkin, forkout;
1726 volatile int pty_flag = 0; 1816 volatile int pty_flag = 0;
1727#ifndef USE_CRT_DLL
1728 extern char **environ;
1729#endif
1730 1817
1731 inchannel = outchannel = -1; 1818 inchannel = outchannel = -1;
1732 1819
@@ -1814,7 +1901,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1814 more portable (see USG_SUBTTY_WORKS above). */ 1901 more portable (see USG_SUBTTY_WORKS above). */
1815 1902
1816 XPROCESS (process)->pty_flag = pty_flag; 1903 XPROCESS (process)->pty_flag = pty_flag;
1817 PSET (XPROCESS (process), status, Qrun); 1904 pset_status (XPROCESS (process), Qrun);
1818 1905
1819 /* Delay interrupts until we have a chance to store 1906 /* Delay interrupts until we have a chance to store
1820 the new fork's pid in its process structure */ 1907 the new fork's pid in its process structure */
@@ -2050,10 +2137,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2050 2137
2051#ifdef HAVE_PTYS 2138#ifdef HAVE_PTYS
2052 if (pty_flag) 2139 if (pty_flag)
2053 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2140 pset_tty_name (XPROCESS (process), build_string (pty_name));
2054 else 2141 else
2055#endif 2142#endif
2056 PSET (XPROCESS (process), tty_name, Qnil); 2143 pset_tty_name (XPROCESS (process), Qnil);
2057 2144
2058#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 2145#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
2059 /* Wait for child_setup to complete in case that vfork is 2146 /* Wait for child_setup to complete in case that vfork is
@@ -2148,7 +2235,7 @@ create_pty (Lisp_Object process)
2148 more portable (see USG_SUBTTY_WORKS above). */ 2235 more portable (see USG_SUBTTY_WORKS above). */
2149 2236
2150 XPROCESS (process)->pty_flag = pty_flag; 2237 XPROCESS (process)->pty_flag = pty_flag;
2151 PSET (XPROCESS (process), status, Qrun); 2238 pset_status (XPROCESS (process), Qrun);
2152 setup_process_coding_systems (process); 2239 setup_process_coding_systems (process);
2153 2240
2154 add_non_keyboard_read_fd (inchannel); 2241 add_non_keyboard_read_fd (inchannel);
@@ -2156,10 +2243,10 @@ create_pty (Lisp_Object process)
2156 XPROCESS (process)->pid = -2; 2243 XPROCESS (process)->pid = -2;
2157#ifdef HAVE_PTYS 2244#ifdef HAVE_PTYS
2158 if (pty_flag) 2245 if (pty_flag)
2159 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2246 pset_tty_name (XPROCESS (process), build_string (pty_name));
2160 else 2247 else
2161#endif 2248#endif
2162 PSET (XPROCESS (process), tty_name, Qnil); 2249 pset_tty_name (XPROCESS (process), Qnil);
2163} 2250}
2164 2251
2165 2252
@@ -2548,7 +2635,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2548 2635
2549 if (set_socket_option (s, option, value)) 2636 if (set_socket_option (s, option, value))
2550 { 2637 {
2551 PSET (p, childp, Fplist_put (p->childp, option, value)); 2638 pset_childp (p, Fplist_put (p->childp, option, value));
2552 return Qt; 2639 return Qt;
2553 } 2640 }
2554 2641
@@ -2781,18 +2868,18 @@ usage: (make-serial-process &rest ARGS) */)
2781 if (NILP (buffer)) 2868 if (NILP (buffer))
2782 buffer = name; 2869 buffer = name;
2783 buffer = Fget_buffer_create (buffer); 2870 buffer = Fget_buffer_create (buffer);
2784 PSET (p, buffer, buffer); 2871 pset_buffer (p, buffer);
2785 2872
2786 PSET (p, childp, contact); 2873 pset_childp (p, contact);
2787 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 2874 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
2788 PSET (p, type, Qserial); 2875 pset_type (p, Qserial);
2789 PSET (p, sentinel, Fplist_get (contact, QCsentinel)); 2876 pset_sentinel (p, Fplist_get (contact, QCsentinel));
2790 PSET (p, filter, Fplist_get (contact, QCfilter)); 2877 pset_filter (p, Fplist_get (contact, QCfilter));
2791 PSET (p, log, Qnil); 2878 pset_log (p, Qnil);
2792 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2879 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2793 p->kill_without_query = 1; 2880 p->kill_without_query = 1;
2794 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2881 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2795 PSET (p, command, Qt); 2882 pset_command (p, Qt);
2796 p->pty_flag = 0; 2883 p->pty_flag = 0;
2797 2884
2798 if (!EQ (p->command, Qt)) 2885 if (!EQ (p->command, Qt))
@@ -2821,7 +2908,7 @@ usage: (make-serial-process &rest ARGS) */)
2821 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2908 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2822 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2909 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2823 val = Qnil; 2910 val = Qnil;
2824 PSET (p, decode_coding_system, val); 2911 pset_decode_coding_system (p, val);
2825 2912
2826 val = Qnil; 2913 val = Qnil;
2827 if (!NILP (tem)) 2914 if (!NILP (tem))
@@ -2835,12 +2922,12 @@ usage: (make-serial-process &rest ARGS) */)
2835 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2922 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2836 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2923 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2837 val = Qnil; 2924 val = Qnil;
2838 PSET (p, encode_coding_system, val); 2925 pset_encode_coding_system (p, val);
2839 2926
2840 setup_process_coding_systems (proc); 2927 setup_process_coding_systems (proc);
2841 PSET (p, decoding_buf, empty_unibyte_string); 2928 pset_decoding_buf (p, empty_unibyte_string);
2842 p->decoding_carryover = 0; 2929 p->decoding_carryover = 0;
2843 PSET (p, encoding_buf, empty_unibyte_string); 2930 pset_encoding_buf (p, empty_unibyte_string);
2844 p->inherit_coding_system_flag 2931 p->inherit_coding_system_flag
2845 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2932 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2846 2933
@@ -3577,23 +3664,23 @@ usage: (make-network-process &rest ARGS) */)
3577 3664
3578 p = XPROCESS (proc); 3665 p = XPROCESS (proc);
3579 3666
3580 PSET (p, childp, contact); 3667 pset_childp (p, contact);
3581 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 3668 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
3582 PSET (p, type, Qnetwork); 3669 pset_type (p, Qnetwork);
3583 3670
3584 PSET (p, buffer, buffer); 3671 pset_buffer (p, buffer);
3585 PSET (p, sentinel, sentinel); 3672 pset_sentinel (p, sentinel);
3586 PSET (p, filter, filter); 3673 pset_filter (p, filter);
3587 PSET (p, log, Fplist_get (contact, QClog)); 3674 pset_log (p, Fplist_get (contact, QClog));
3588 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3675 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3589 p->kill_without_query = 1; 3676 p->kill_without_query = 1;
3590 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3677 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3591 PSET (p, command, Qt); 3678 pset_command (p, Qt);
3592 p->pid = 0; 3679 p->pid = 0;
3593 p->infd = inch; 3680 p->infd = inch;
3594 p->outfd = outch; 3681 p->outfd = outch;
3595 if (is_server && socktype != SOCK_DGRAM) 3682 if (is_server && socktype != SOCK_DGRAM)
3596 PSET (p, status, Qlisten); 3683 pset_status (p, Qlisten);
3597 3684
3598 /* Make the process marker point into the process buffer (if any). */ 3685 /* Make the process marker point into the process buffer (if any). */
3599 if (BUFFERP (buffer)) 3686 if (BUFFERP (buffer))
@@ -3607,7 +3694,7 @@ usage: (make-network-process &rest ARGS) */)
3607 /* We may get here if connect did succeed immediately. However, 3694 /* We may get here if connect did succeed immediately. However,
3608 in that case, we still need to signal this like a non-blocking 3695 in that case, we still need to signal this like a non-blocking
3609 connection. */ 3696 connection. */
3610 PSET (p, status, Qconnect); 3697 pset_status (p, Qconnect);
3611 if ((fd_callback_info[inch].flags & NON_BLOCKING_CONNECT_FD) == 0) 3698 if ((fd_callback_info[inch].flags & NON_BLOCKING_CONNECT_FD) == 0)
3612 add_non_blocking_write_fd (inch); 3699 add_non_blocking_write_fd (inch);
3613 } 3700 }
@@ -3667,7 +3754,7 @@ usage: (make-network-process &rest ARGS) */)
3667 else 3754 else
3668 val = Qnil; 3755 val = Qnil;
3669 } 3756 }
3670 PSET (p, decode_coding_system, val); 3757 pset_decode_coding_system (p, val);
3671 3758
3672 if (!NILP (tem)) 3759 if (!NILP (tem))
3673 { 3760 {
@@ -3701,13 +3788,13 @@ usage: (make-network-process &rest ARGS) */)
3701 else 3788 else
3702 val = Qnil; 3789 val = Qnil;
3703 } 3790 }
3704 PSET (p, encode_coding_system, val); 3791 pset_encode_coding_system (p, val);
3705 } 3792 }
3706 setup_process_coding_systems (proc); 3793 setup_process_coding_systems (proc);
3707 3794
3708 PSET (p, decoding_buf, empty_unibyte_string); 3795 pset_decoding_buf (p, empty_unibyte_string);
3709 p->decoding_carryover = 0; 3796 p->decoding_carryover = 0;
3710 PSET (p, encoding_buf, empty_unibyte_string); 3797 pset_encoding_buf (p, empty_unibyte_string);
3711 3798
3712 p->inherit_coding_system_flag 3799 p->inherit_coding_system_flag
3713 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3800 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4324,18 +4411,18 @@ server_accept_connection (Lisp_Object server, int channel)
4324 conv_sockaddr_to_lisp (&saddr.sa, len)); 4411 conv_sockaddr_to_lisp (&saddr.sa, len));
4325#endif 4412#endif
4326 4413
4327 PSET (p, childp, contact); 4414 pset_childp (p, contact);
4328 PSET (p, plist, Fcopy_sequence (ps->plist)); 4415 pset_plist (p, Fcopy_sequence (ps->plist));
4329 PSET (p, type, Qnetwork); 4416 pset_type (p, Qnetwork);
4330 4417
4331 PSET (p, buffer, buffer); 4418 pset_buffer (p, buffer);
4332 PSET (p, sentinel, ps->sentinel); 4419 pset_sentinel (p, ps->sentinel);
4333 PSET (p, filter, ps->filter); 4420 pset_filter (p, ps->filter);
4334 PSET (p, command, Qnil); 4421 pset_command (p, Qnil);
4335 p->pid = 0; 4422 p->pid = 0;
4336 p->infd = s; 4423 p->infd = s;
4337 p->outfd = s; 4424 p->outfd = s;
4338 PSET (p, status, Qrun); 4425 pset_status (p, Qrun);
4339 4426
4340 /* Client processes for accepted connections are not stopped initially. */ 4427 /* Client processes for accepted connections are not stopped initially. */
4341 if (!EQ (p->filter, Qt)) 4428 if (!EQ (p->filter, Qt))
@@ -4346,13 +4433,13 @@ server_accept_connection (Lisp_Object server, int channel)
4346 of the new process should reflect the settings at the time the 4433 of the new process should reflect the settings at the time the
4347 server socket was opened; not the current settings. */ 4434 server socket was opened; not the current settings. */
4348 4435
4349 PSET (p, decode_coding_system, ps->decode_coding_system); 4436 pset_decode_coding_system (p, ps->decode_coding_system);
4350 PSET (p, encode_coding_system, ps->encode_coding_system); 4437 pset_encode_coding_system (p, ps->encode_coding_system);
4351 setup_process_coding_systems (proc); 4438 setup_process_coding_systems (proc);
4352 4439
4353 PSET (p, decoding_buf, empty_unibyte_string); 4440 pset_decoding_buf (p, empty_unibyte_string);
4354 p->decoding_carryover = 0; 4441 p->decoding_carryover = 0;
4355 PSET (p, encoding_buf, empty_unibyte_string); 4442 pset_encoding_buf (p, empty_unibyte_string);
4356 4443
4357 p->inherit_coding_system_flag 4444 p->inherit_coding_system_flag
4358 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4445 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -5052,7 +5139,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5052 waitpid() will not find the process object to 5139 waitpid() will not find the process object to
5053 delete. Do it here. */ 5140 delete. Do it here. */
5054 p->tick = ++process_tick; 5141 p->tick = ++process_tick;
5055 PSET (p, status, Qfailed); 5142 pset_status (p, Qfailed);
5056 } 5143 }
5057 else 5144 else
5058 kill (getpid (), SIGCHLD); 5145 kill (getpid (), SIGCHLD);
@@ -5072,8 +5159,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5072 if (XPROCESS (proc)->raw_status_new) 5159 if (XPROCESS (proc)->raw_status_new)
5073 update_status (XPROCESS (proc)); 5160 update_status (XPROCESS (proc));
5074 if (EQ (XPROCESS (proc)->status, Qrun)) 5161 if (EQ (XPROCESS (proc)->status, Qrun))
5075 PSET (XPROCESS (proc), status, 5162 pset_status (XPROCESS (proc),
5076 Fcons (Qexit, Fcons (make_number (256), Qnil))); 5163 list2 (Qexit, make_number (256)));
5077 } 5164 }
5078 } 5165 }
5079#ifdef NON_BLOCKING_CONNECT 5166#ifdef NON_BLOCKING_CONNECT
@@ -5119,13 +5206,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5119 if (xerrno) 5206 if (xerrno)
5120 { 5207 {
5121 p->tick = ++process_tick; 5208 p->tick = ++process_tick;
5122 PSET (p, status, 5209 pset_status (p, list2 (Qfailed, make_number (xerrno)));
5123 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
5124 deactivate_process (proc); 5210 deactivate_process (proc);
5125 } 5211 }
5126 else 5212 else
5127 { 5213 {
5128 PSET (p, status, Qrun); 5214 pset_status (p, Qrun);
5129 /* Execute the sentinel here. If we had relied on 5215 /* Execute the sentinel here. If we had relied on
5130 status_notify to do it later, it will read input 5216 status_notify to do it later, it will read input
5131 from the process before calling the sentinel. */ 5217 from the process before calling the sentinel. */
@@ -5322,7 +5408,7 @@ read_process_output (Lisp_Object proc, register int channel)
5322 /* A new coding system might be found. */ 5408 /* A new coding system might be found. */
5323 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5409 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5324 { 5410 {
5325 PSET (p, decode_coding_system, Vlast_coding_system_used); 5411 pset_decode_coding_system (p, Vlast_coding_system_used);
5326 5412
5327 /* Don't call setup_coding_system for 5413 /* Don't call setup_coding_system for
5328 proc_decode_coding_system[channel] here. It is done in 5414 proc_decode_coding_system[channel] here. It is done in
@@ -5338,8 +5424,8 @@ read_process_output (Lisp_Object proc, register int channel)
5338 if (NILP (p->encode_coding_system) 5424 if (NILP (p->encode_coding_system)
5339 && proc_encode_coding_system[p->outfd]) 5425 && proc_encode_coding_system[p->outfd])
5340 { 5426 {
5341 PSET (p, encode_coding_system, 5427 pset_encode_coding_system
5342 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5428 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5343 setup_coding_system (p->encode_coding_system, 5429 setup_coding_system (p->encode_coding_system,
5344 proc_encode_coding_system[p->outfd]); 5430 proc_encode_coding_system[p->outfd]);
5345 } 5431 }
@@ -5348,7 +5434,7 @@ read_process_output (Lisp_Object proc, register int channel)
5348 if (coding->carryover_bytes > 0) 5434 if (coding->carryover_bytes > 0)
5349 { 5435 {
5350 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5436 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5351 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5437 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5352 memcpy (SDATA (p->decoding_buf), coding->carryover, 5438 memcpy (SDATA (p->decoding_buf), coding->carryover,
5353 coding->carryover_bytes); 5439 coding->carryover_bytes);
5354 p->decoding_carryover = coding->carryover_bytes; 5440 p->decoding_carryover = coding->carryover_bytes;
@@ -5404,7 +5490,7 @@ read_process_output (Lisp_Object proc, register int channel)
5404 old_begv_byte = BEGV_BYTE; 5490 old_begv_byte = BEGV_BYTE;
5405 old_zv_byte = ZV_BYTE; 5491 old_zv_byte = ZV_BYTE;
5406 5492
5407 BSET (current_buffer, read_only, Qnil); 5493 bset_read_only (current_buffer, Qnil);
5408 5494
5409 /* Insert new output into buffer 5495 /* Insert new output into buffer
5410 at the current end-of-output marker, 5496 at the current end-of-output marker,
@@ -5432,12 +5518,12 @@ read_process_output (Lisp_Object proc, register int channel)
5432 similar code in the previous `if' block. */ 5518 similar code in the previous `if' block. */
5433 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5519 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5434 { 5520 {
5435 PSET (p, decode_coding_system, Vlast_coding_system_used); 5521 pset_decode_coding_system (p, Vlast_coding_system_used);
5436 if (NILP (p->encode_coding_system) 5522 if (NILP (p->encode_coding_system)
5437 && proc_encode_coding_system[p->outfd]) 5523 && proc_encode_coding_system[p->outfd])
5438 { 5524 {
5439 PSET (p, encode_coding_system, 5525 pset_encode_coding_system
5440 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5526 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5441 setup_coding_system (p->encode_coding_system, 5527 setup_coding_system (p->encode_coding_system,
5442 proc_encode_coding_system[p->outfd]); 5528 proc_encode_coding_system[p->outfd]);
5443 } 5529 }
@@ -5445,7 +5531,7 @@ read_process_output (Lisp_Object proc, register int channel)
5445 if (coding->carryover_bytes > 0) 5531 if (coding->carryover_bytes > 0)
5446 { 5532 {
5447 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5533 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5448 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5534 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5449 memcpy (SDATA (p->decoding_buf), coding->carryover, 5535 memcpy (SDATA (p->decoding_buf), coding->carryover,
5450 coding->carryover_bytes); 5536 coding->carryover_bytes);
5451 p->decoding_carryover = coding->carryover_bytes; 5537 p->decoding_carryover = coding->carryover_bytes;
@@ -5495,7 +5581,7 @@ read_process_output (Lisp_Object proc, register int channel)
5495 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5581 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5496 5582
5497 5583
5498 BSET (current_buffer, read_only, old_read_only); 5584 bset_read_only (current_buffer, old_read_only);
5499 SET_PT_BOTH (opoint, opoint_byte); 5585 SET_PT_BOTH (opoint, opoint_byte);
5500 } 5586 }
5501 /* Handling the process output should not deactivate the mark. */ 5587 /* Handling the process output should not deactivate the mark. */
@@ -5562,9 +5648,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5562 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5648 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5563 5649
5564 if (front) 5650 if (front)
5565 PSET (p, write_queue, Fcons (entry, p->write_queue)); 5651 pset_write_queue (p, Fcons (entry, p->write_queue));
5566 else 5652 else
5567 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5653 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5568} 5654}
5569 5655
5570/* Remove the first element in the write_queue of process P, put its 5656/* Remove the first element in the write_queue of process P, put its
@@ -5582,7 +5668,7 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5582 return 0; 5668 return 0;
5583 5669
5584 entry = XCAR (p->write_queue); 5670 entry = XCAR (p->write_queue);
5585 PSET (p, write_queue, XCDR (p->write_queue)); 5671 pset_write_queue (p, XCDR (p->write_queue));
5586 5672
5587 *obj = XCAR (entry); 5673 *obj = XCAR (entry);
5588 offset_length = XCDR (entry); 5674 offset_length = XCDR (entry);
@@ -5629,8 +5715,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5629 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5715 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5630 || EQ (object, Qt)) 5716 || EQ (object, Qt))
5631 { 5717 {
5632 PSET (p, encode_coding_system, 5718 pset_encode_coding_system
5633 complement_process_encoding_system (p->encode_coding_system)); 5719 (p, complement_process_encoding_system (p->encode_coding_system));
5634 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5720 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5635 { 5721 {
5636 /* The coding system for encoding was changed to raw-text 5722 /* The coding system for encoding was changed to raw-text
@@ -5851,7 +5937,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5851 proc = process_sent_to; 5937 proc = process_sent_to;
5852 p = XPROCESS (proc); 5938 p = XPROCESS (proc);
5853 p->raw_status_new = 0; 5939 p->raw_status_new = 0;
5854 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); 5940 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5855 p->tick = ++process_tick; 5941 p->tick = ++process_tick;
5856 deactivate_process (proc); 5942 deactivate_process (proc);
5857 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5943 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
@@ -6080,7 +6166,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
6080#ifdef SIGCONT 6166#ifdef SIGCONT
6081 case SIGCONT: 6167 case SIGCONT:
6082 p->raw_status_new = 0; 6168 p->raw_status_new = 0;
6083 PSET (p, status, Qrun); 6169 pset_status (p, Qrun);
6084 p->tick = ++process_tick; 6170 p->tick = ++process_tick;
6085 if (!nomsg) 6171 if (!nomsg)
6086 { 6172 {
@@ -6173,7 +6259,7 @@ traffic. */)
6173 if (NILP (p->command) 6259 if (NILP (p->command)
6174 && p->infd >= 0) 6260 && p->infd >= 0)
6175 delete_read_fd (p->infd); 6261 delete_read_fd (p->infd);
6176 PSET (p, command, Qt); 6262 pset_command (p, Qt);
6177 return process; 6263 return process;
6178 } 6264 }
6179#ifndef SIGTSTP 6265#ifndef SIGTSTP
@@ -6208,7 +6294,7 @@ traffic. */)
6208 tcflush (p->infd, TCIFLUSH); 6294 tcflush (p->infd, TCIFLUSH);
6209#endif /* not WINDOWSNT */ 6295#endif /* not WINDOWSNT */
6210 } 6296 }
6211 PSET (p, command, Qnil); 6297 pset_command (p, Qnil);
6212 return process; 6298 return process;
6213 } 6299 }
6214#ifdef SIGCONT 6300#ifdef SIGCONT
@@ -6621,7 +6707,7 @@ sigchld_handler (int signo)
6621static Lisp_Object 6707static Lisp_Object
6622exec_sentinel_unwind (Lisp_Object data) 6708exec_sentinel_unwind (Lisp_Object data)
6623{ 6709{
6624 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); 6710 pset_sentinel (XPROCESS (XCAR (data)), XCDR (data));
6625 return Qnil; 6711 return Qnil;
6626} 6712}
6627 6713
@@ -6667,7 +6753,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6667 6753
6668 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6754 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6669 assure that it gets restored no matter how the sentinel exits. */ 6755 assure that it gets restored no matter how the sentinel exits. */
6670 PSET (p, sentinel, Qnil); 6756 pset_sentinel (p, Qnil);
6671 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6757 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6672 /* Inhibit quit so that random quits don't screw up a running filter. */ 6758 /* Inhibit quit so that random quits don't screw up a running filter. */
6673 specbind (Qinhibit_quit, Qt); 6759 specbind (Qinhibit_quit, Qt);
@@ -6822,13 +6908,13 @@ status_notify (struct Lisp_Process *deleting_process)
6822 before_byte = PT_BYTE; 6908 before_byte = PT_BYTE;
6823 6909
6824 tem = BVAR (current_buffer, read_only); 6910 tem = BVAR (current_buffer, read_only);
6825 BSET (current_buffer, read_only, Qnil); 6911 bset_read_only (current_buffer, Qnil);
6826 insert_string ("\nProcess "); 6912 insert_string ("\nProcess ");
6827 { /* FIXME: temporary kludge */ 6913 { /* FIXME: temporary kludge */
6828 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6914 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6829 insert_string (" "); 6915 insert_string (" ");
6830 Finsert (1, &msg); 6916 Finsert (1, &msg);
6831 BSET (current_buffer, read_only, tem); 6917 bset_read_only (current_buffer, tem);
6832 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6918 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6833 6919
6834 if (opoint >= before) 6920 if (opoint >= before)
@@ -6865,8 +6951,8 @@ encode subprocess input. */)
6865 Fcheck_coding_system (decoding); 6951 Fcheck_coding_system (decoding);
6866 Fcheck_coding_system (encoding); 6952 Fcheck_coding_system (encoding);
6867 encoding = coding_inherit_eol_type (encoding, Qnil); 6953 encoding = coding_inherit_eol_type (encoding, Qnil);
6868 PSET (p, decode_coding_system, decoding); 6954 pset_decode_coding_system (p, decoding);
6869 PSET (p, encode_coding_system, encoding); 6955 pset_encode_coding_system (p, encoding);
6870 setup_process_coding_systems (process); 6956 setup_process_coding_systems (process);
6871 6957
6872 return Qnil; 6958 return Qnil;
@@ -6896,8 +6982,8 @@ suppressed. */)
6896 CHECK_PROCESS (process); 6982 CHECK_PROCESS (process);
6897 p = XPROCESS (process); 6983 p = XPROCESS (process);
6898 if (NILP (flag)) 6984 if (NILP (flag))
6899 PSET (p, decode_coding_system, 6985 pset_decode_coding_system
6900 raw_text_coding_system (p->decode_coding_system)); 6986 (p, raw_text_coding_system (p->decode_coding_system));
6901 setup_process_coding_systems (process); 6987 setup_process_coding_systems (process);
6902 6988
6903 return Qnil; 6989 return Qnil;