aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c292
1 files changed, 188 insertions, 104 deletions
diff --git a/src/process.c b/src/process.c
index a43655e4da8..ea463cd9187 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>
@@ -334,6 +337,88 @@ static struct sockaddr_and_len {
334/* Maximum number of bytes to send to a pty without an eof. */ 337/* Maximum number of bytes to send to a pty without an eof. */
335static int pty_max_bytes; 338static int pty_max_bytes;
336 339
340/* These setters are used only in this file, so they can be private. */
341static inline void
342pset_buffer (struct Lisp_Process *p, Lisp_Object val)
343{
344 p->buffer = val;
345}
346static inline void
347pset_command (struct Lisp_Process *p, Lisp_Object val)
348{
349 p->command = val;
350}
351static inline void
352pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
353{
354 p->decode_coding_system = val;
355}
356static inline void
357pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
358{
359 p->decoding_buf = val;
360}
361static inline void
362pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
363{
364 p->encode_coding_system = val;
365}
366static inline void
367pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
368{
369 p->encoding_buf = val;
370}
371static inline void
372pset_filter (struct Lisp_Process *p, Lisp_Object val)
373{
374 p->filter = val;
375}
376static inline void
377pset_log (struct Lisp_Process *p, Lisp_Object val)
378{
379 p->log = val;
380}
381static inline void
382pset_mark (struct Lisp_Process *p, Lisp_Object val)
383{
384 p->mark = val;
385}
386static inline void
387pset_name (struct Lisp_Process *p, Lisp_Object val)
388{
389 p->name = val;
390}
391static inline void
392pset_plist (struct Lisp_Process *p, Lisp_Object val)
393{
394 p->plist = val;
395}
396static inline void
397pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
398{
399 p->sentinel = val;
400}
401static inline void
402pset_status (struct Lisp_Process *p, Lisp_Object val)
403{
404 p->status = val;
405}
406static inline void
407pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
408{
409 p->tty_name = val;
410}
411static inline void
412pset_type (struct Lisp_Process *p, Lisp_Object val)
413{
414 p->type = val;
415}
416static inline void
417pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
418{
419 p->write_queue = val;
420}
421
337 422
338 423
339static struct fd_callback_data 424static struct fd_callback_data
@@ -428,7 +513,7 @@ static void
428update_status (struct Lisp_Process *p) 513update_status (struct Lisp_Process *p)
429{ 514{
430 eassert (p->raw_status_new); 515 eassert (p->raw_status_new);
431 PSET (p, status, status_convert (p->raw_status)); 516 pset_status (p, status_convert (p->raw_status));
432 p->raw_status_new = 0; 517 p->raw_status_new = 0;
433} 518}
434 519
@@ -626,8 +711,8 @@ make_process (Lisp_Object name)
626 p = allocate_process (); 711 p = allocate_process ();
627 /* Initialize Lisp data. Note that allocate_process initializes all 712 /* 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. */ 713 Lisp data to nil, so do it only for slots which should not be nil. */
629 PSET (p, status, Qrun); 714 pset_status (p, Qrun);
630 PSET (p, mark, Fmake_marker ()); 715 pset_mark (p, Fmake_marker ());
631 716
632 /* Initialize non-Lisp data. Note that allocate_process zeroes out all 717 /* 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. */ 718 non-Lisp data, so do it only for slots which should not be zero. */
@@ -648,7 +733,7 @@ make_process (Lisp_Object name)
648 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); 733 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
649 } 734 }
650 name = name1; 735 name = name1;
651 PSET (p, name, name); 736 pset_name (p, name);
652 XSETPROCESS (val, p); 737 XSETPROCESS (val, p);
653 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 738 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
654 return val; 739 return val;
@@ -745,7 +830,7 @@ nil, indicating the current buffer's process. */)
745 p->raw_status_new = 0; 830 p->raw_status_new = 0;
746 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 831 if (NETCONN1_P (p) || SERIALCONN1_P (p))
747 { 832 {
748 PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil))); 833 pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil)));
749 p->tick = ++process_tick; 834 p->tick = ++process_tick;
750 status_notify (p); 835 status_notify (p);
751 redisplay_preserve_echo_area (13); 836 redisplay_preserve_echo_area (13);
@@ -774,7 +859,7 @@ nil, indicating the current buffer's process. */)
774 { 859 {
775 Fkill_process (process, Qnil); 860 Fkill_process (process, Qnil);
776 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 861 /* Do this now, since remove_process will make sigchld_handler do nothing. */
777 PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); 862 pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
778 p->tick = ++process_tick; 863 p->tick = ++process_tick;
779 status_notify (p); 864 status_notify (p);
780 redisplay_preserve_echo_area (13); 865 redisplay_preserve_echo_area (13);
@@ -901,9 +986,9 @@ Return BUFFER. */)
901 if (!NILP (buffer)) 986 if (!NILP (buffer))
902 CHECK_BUFFER (buffer); 987 CHECK_BUFFER (buffer);
903 p = XPROCESS (process); 988 p = XPROCESS (process);
904 PSET (p, buffer, buffer); 989 pset_buffer (p, buffer);
905 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 990 if (NETCONN1_P (p) || SERIALCONN1_P (p))
906 PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer)); 991 pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer));
907 setup_process_coding_systems (process); 992 setup_process_coding_systems (process);
908 return buffer; 993 return buffer;
909} 994}
@@ -974,9 +1059,9 @@ The string argument is normally a multibyte string, except:
974 } 1059 }
975 } 1060 }
976 1061
977 PSET (p, filter, filter); 1062 pset_filter (p, filter);
978 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1063 if (NETCONN1_P (p) || SERIALCONN1_P (p))
979 PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); 1064 pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
980 setup_process_coding_systems (process); 1065 setup_process_coding_systems (process);
981 return filter; 1066 return filter;
982} 1067}
@@ -1003,9 +1088,9 @@ It gets two arguments: the process, and a string describing the change. */)
1003 CHECK_PROCESS (process); 1088 CHECK_PROCESS (process);
1004 p = XPROCESS (process); 1089 p = XPROCESS (process);
1005 1090
1006 PSET (p, sentinel, sentinel); 1091 pset_sentinel (p, sentinel);
1007 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1092 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1008 PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel)); 1093 pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel));
1009 return sentinel; 1094 return sentinel;
1010} 1095}
1011 1096
@@ -1138,7 +1223,7 @@ DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
1138 CHECK_PROCESS (process); 1223 CHECK_PROCESS (process);
1139 CHECK_LIST (plist); 1224 CHECK_LIST (plist);
1140 1225
1141 PSET (XPROCESS (process), plist, plist); 1226 pset_plist (XPROCESS (process), plist);
1142 return plist; 1227 return plist;
1143} 1228}
1144 1229
@@ -1324,18 +1409,18 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1324 itself; it's all taken care of here. */ 1409 itself; it's all taken care of here. */
1325 record_unwind_protect (start_process_unwind, proc); 1410 record_unwind_protect (start_process_unwind, proc);
1326 1411
1327 PSET (XPROCESS (proc), childp, Qt); 1412 pset_childp (XPROCESS (proc), Qt);
1328 PSET (XPROCESS (proc), plist, Qnil); 1413 pset_plist (XPROCESS (proc), Qnil);
1329 PSET (XPROCESS (proc), type, Qreal); 1414 pset_type (XPROCESS (proc), Qreal);
1330 PSET (XPROCESS (proc), buffer, buffer); 1415 pset_buffer (XPROCESS (proc), buffer);
1331 PSET (XPROCESS (proc), sentinel, Qnil); 1416 pset_sentinel (XPROCESS (proc), Qnil);
1332 PSET (XPROCESS (proc), filter, Qnil); 1417 pset_filter (XPROCESS (proc), Qnil);
1333 PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2)); 1418 pset_command (XPROCESS (proc), Flist (nargs - 2, args + 2));
1334 1419
1335#ifdef HAVE_GNUTLS 1420#ifdef HAVE_GNUTLS
1336 /* AKA GNUTLS_INITSTAGE(proc). */ 1421 /* AKA GNUTLS_INITSTAGE(proc). */
1337 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; 1422 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY;
1338 PSET (XPROCESS (proc), gnutls_cred_type, Qnil); 1423 pset_gnutls_cred_type (XPROCESS (proc), Qnil);
1339#endif 1424#endif
1340 1425
1341#ifdef ADAPTIVE_READ_BUFFERING 1426#ifdef ADAPTIVE_READ_BUFFERING
@@ -1375,7 +1460,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1375 else if (CONSP (Vdefault_process_coding_system)) 1460 else if (CONSP (Vdefault_process_coding_system))
1376 val = XCAR (Vdefault_process_coding_system); 1461 val = XCAR (Vdefault_process_coding_system);
1377 } 1462 }
1378 PSET (XPROCESS (proc), decode_coding_system, val); 1463 pset_decode_coding_system (XPROCESS (proc), val);
1379 1464
1380 val = Vcoding_system_for_write; 1465 val = Vcoding_system_for_write;
1381 if (NILP (val)) 1466 if (NILP (val))
@@ -1395,7 +1480,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1395 else if (CONSP (Vdefault_process_coding_system)) 1480 else if (CONSP (Vdefault_process_coding_system))
1396 val = XCDR (Vdefault_process_coding_system); 1481 val = XCDR (Vdefault_process_coding_system);
1397 } 1482 }
1398 PSET (XPROCESS (proc), encode_coding_system, val); 1483 pset_encode_coding_system (XPROCESS (proc), val);
1399 /* Note: At this moment, the above coding system may leave 1484 /* Note: At this moment, the above coding system may leave
1400 text-conversion or eol-conversion unspecified. They will be 1485 text-conversion or eol-conversion unspecified. They will be
1401 decided after we read output from the process and decode it by 1486 decided after we read output from the process and decode it by
@@ -1404,9 +1489,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1404 } 1489 }
1405 1490
1406 1491
1407 PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string); 1492 pset_decoding_buf (XPROCESS (proc), empty_unibyte_string);
1408 XPROCESS (proc)->decoding_carryover = 0; 1493 XPROCESS (proc)->decoding_carryover = 0;
1409 PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string); 1494 pset_encoding_buf (XPROCESS (proc), empty_unibyte_string);
1410 1495
1411 XPROCESS (proc)->inherit_coding_system_flag 1496 XPROCESS (proc)->inherit_coding_system_flag
1412 = !(NILP (buffer) || !inherit_process_coding_system); 1497 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1628,7 +1713,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1628 more portable (see USG_SUBTTY_WORKS above). */ 1713 more portable (see USG_SUBTTY_WORKS above). */
1629 1714
1630 XPROCESS (process)->pty_flag = pty_flag; 1715 XPROCESS (process)->pty_flag = pty_flag;
1631 PSET (XPROCESS (process), status, Qrun); 1716 pset_status (XPROCESS (process), Qrun);
1632 1717
1633 /* Delay interrupts until we have a chance to store 1718 /* Delay interrupts until we have a chance to store
1634 the new fork's pid in its process structure */ 1719 the new fork's pid in its process structure */
@@ -1867,10 +1952,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1867 1952
1868#ifdef HAVE_PTYS 1953#ifdef HAVE_PTYS
1869 if (pty_flag) 1954 if (pty_flag)
1870 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 1955 pset_tty_name (XPROCESS (process), build_string (pty_name));
1871 else 1956 else
1872#endif 1957#endif
1873 PSET (XPROCESS (process), tty_name, Qnil); 1958 pset_tty_name (XPROCESS (process), Qnil);
1874 1959
1875#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1960#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1876 /* Wait for child_setup to complete in case that vfork is 1961 /* Wait for child_setup to complete in case that vfork is
@@ -1965,7 +2050,7 @@ create_pty (Lisp_Object process)
1965 more portable (see USG_SUBTTY_WORKS above). */ 2050 more portable (see USG_SUBTTY_WORKS above). */
1966 2051
1967 XPROCESS (process)->pty_flag = pty_flag; 2052 XPROCESS (process)->pty_flag = pty_flag;
1968 PSET (XPROCESS (process), status, Qrun); 2053 pset_status (XPROCESS (process), Qrun);
1969 setup_process_coding_systems (process); 2054 setup_process_coding_systems (process);
1970 2055
1971 FD_SET (inchannel, &input_wait_mask); 2056 FD_SET (inchannel, &input_wait_mask);
@@ -1976,10 +2061,10 @@ create_pty (Lisp_Object process)
1976 XPROCESS (process)->pid = -2; 2061 XPROCESS (process)->pid = -2;
1977#ifdef HAVE_PTYS 2062#ifdef HAVE_PTYS
1978 if (pty_flag) 2063 if (pty_flag)
1979 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2064 pset_tty_name (XPROCESS (process), build_string (pty_name));
1980 else 2065 else
1981#endif 2066#endif
1982 PSET (XPROCESS (process), tty_name, Qnil); 2067 pset_tty_name (XPROCESS (process), Qnil);
1983} 2068}
1984 2069
1985 2070
@@ -2368,7 +2453,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2368 2453
2369 if (set_socket_option (s, option, value)) 2454 if (set_socket_option (s, option, value))
2370 { 2455 {
2371 PSET (p, childp, Fplist_put (p->childp, option, value)); 2456 pset_childp (p, Fplist_put (p->childp, option, value));
2372 return Qt; 2457 return Qt;
2373 } 2458 }
2374 2459
@@ -2601,18 +2686,18 @@ usage: (make-serial-process &rest ARGS) */)
2601 if (NILP (buffer)) 2686 if (NILP (buffer))
2602 buffer = name; 2687 buffer = name;
2603 buffer = Fget_buffer_create (buffer); 2688 buffer = Fget_buffer_create (buffer);
2604 PSET (p, buffer, buffer); 2689 pset_buffer (p, buffer);
2605 2690
2606 PSET (p, childp, contact); 2691 pset_childp (p, contact);
2607 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 2692 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
2608 PSET (p, type, Qserial); 2693 pset_type (p, Qserial);
2609 PSET (p, sentinel, Fplist_get (contact, QCsentinel)); 2694 pset_sentinel (p, Fplist_get (contact, QCsentinel));
2610 PSET (p, filter, Fplist_get (contact, QCfilter)); 2695 pset_filter (p, Fplist_get (contact, QCfilter));
2611 PSET (p, log, Qnil); 2696 pset_log (p, Qnil);
2612 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2697 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2613 p->kill_without_query = 1; 2698 p->kill_without_query = 1;
2614 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2699 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2615 PSET (p, command, Qt); 2700 pset_command (p, Qt);
2616 p->pty_flag = 0; 2701 p->pty_flag = 0;
2617 2702
2618 if (!EQ (p->command, Qt)) 2703 if (!EQ (p->command, Qt))
@@ -2644,7 +2729,7 @@ usage: (make-serial-process &rest ARGS) */)
2644 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2729 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2645 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2730 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2646 val = Qnil; 2731 val = Qnil;
2647 PSET (p, decode_coding_system, val); 2732 pset_decode_coding_system (p, val);
2648 2733
2649 val = Qnil; 2734 val = Qnil;
2650 if (!NILP (tem)) 2735 if (!NILP (tem))
@@ -2658,12 +2743,12 @@ usage: (make-serial-process &rest ARGS) */)
2658 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2743 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2659 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2744 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2660 val = Qnil; 2745 val = Qnil;
2661 PSET (p, encode_coding_system, val); 2746 pset_encode_coding_system (p, val);
2662 2747
2663 setup_process_coding_systems (proc); 2748 setup_process_coding_systems (proc);
2664 PSET (p, decoding_buf, empty_unibyte_string); 2749 pset_decoding_buf (p, empty_unibyte_string);
2665 p->decoding_carryover = 0; 2750 p->decoding_carryover = 0;
2666 PSET (p, encoding_buf, empty_unibyte_string); 2751 pset_encoding_buf (p, empty_unibyte_string);
2667 p->inherit_coding_system_flag 2752 p->inherit_coding_system_flag
2668 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2753 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2669 2754
@@ -3400,23 +3485,23 @@ usage: (make-network-process &rest ARGS) */)
3400 3485
3401 p = XPROCESS (proc); 3486 p = XPROCESS (proc);
3402 3487
3403 PSET (p, childp, contact); 3488 pset_childp (p, contact);
3404 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 3489 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
3405 PSET (p, type, Qnetwork); 3490 pset_type (p, Qnetwork);
3406 3491
3407 PSET (p, buffer, buffer); 3492 pset_buffer (p, buffer);
3408 PSET (p, sentinel, sentinel); 3493 pset_sentinel (p, sentinel);
3409 PSET (p, filter, filter); 3494 pset_filter (p, filter);
3410 PSET (p, log, Fplist_get (contact, QClog)); 3495 pset_log (p, Fplist_get (contact, QClog));
3411 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3496 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3412 p->kill_without_query = 1; 3497 p->kill_without_query = 1;
3413 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3498 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3414 PSET (p, command, Qt); 3499 pset_command (p, Qt);
3415 p->pid = 0; 3500 p->pid = 0;
3416 p->infd = inch; 3501 p->infd = inch;
3417 p->outfd = outch; 3502 p->outfd = outch;
3418 if (is_server && socktype != SOCK_DGRAM) 3503 if (is_server && socktype != SOCK_DGRAM)
3419 PSET (p, status, Qlisten); 3504 pset_status (p, Qlisten);
3420 3505
3421 /* Make the process marker point into the process buffer (if any). */ 3506 /* Make the process marker point into the process buffer (if any). */
3422 if (BUFFERP (buffer)) 3507 if (BUFFERP (buffer))
@@ -3430,7 +3515,7 @@ usage: (make-network-process &rest ARGS) */)
3430 /* We may get here if connect did succeed immediately. However, 3515 /* We may get here if connect did succeed immediately. However,
3431 in that case, we still need to signal this like a non-blocking 3516 in that case, we still need to signal this like a non-blocking
3432 connection. */ 3517 connection. */
3433 PSET (p, status, Qconnect); 3518 pset_status (p, Qconnect);
3434 if (!FD_ISSET (inch, &connect_wait_mask)) 3519 if (!FD_ISSET (inch, &connect_wait_mask))
3435 { 3520 {
3436 FD_SET (inch, &connect_wait_mask); 3521 FD_SET (inch, &connect_wait_mask);
@@ -3497,7 +3582,7 @@ usage: (make-network-process &rest ARGS) */)
3497 else 3582 else
3498 val = Qnil; 3583 val = Qnil;
3499 } 3584 }
3500 PSET (p, decode_coding_system, val); 3585 pset_decode_coding_system (p, val);
3501 3586
3502 if (!NILP (tem)) 3587 if (!NILP (tem))
3503 { 3588 {
@@ -3531,13 +3616,13 @@ usage: (make-network-process &rest ARGS) */)
3531 else 3616 else
3532 val = Qnil; 3617 val = Qnil;
3533 } 3618 }
3534 PSET (p, encode_coding_system, val); 3619 pset_encode_coding_system (p, val);
3535 } 3620 }
3536 setup_process_coding_systems (proc); 3621 setup_process_coding_systems (proc);
3537 3622
3538 PSET (p, decoding_buf, empty_unibyte_string); 3623 pset_decoding_buf (p, empty_unibyte_string);
3539 p->decoding_carryover = 0; 3624 p->decoding_carryover = 0;
3540 PSET (p, encoding_buf, empty_unibyte_string); 3625 pset_encoding_buf (p, empty_unibyte_string);
3541 3626
3542 p->inherit_coding_system_flag 3627 p->inherit_coding_system_flag
3543 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3628 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4150,18 +4235,18 @@ server_accept_connection (Lisp_Object server, int channel)
4150 conv_sockaddr_to_lisp (&saddr.sa, len)); 4235 conv_sockaddr_to_lisp (&saddr.sa, len));
4151#endif 4236#endif
4152 4237
4153 PSET (p, childp, contact); 4238 pset_childp (p, contact);
4154 PSET (p, plist, Fcopy_sequence (ps->plist)); 4239 pset_plist (p, Fcopy_sequence (ps->plist));
4155 PSET (p, type, Qnetwork); 4240 pset_type (p, Qnetwork);
4156 4241
4157 PSET (p, buffer, buffer); 4242 pset_buffer (p, buffer);
4158 PSET (p, sentinel, ps->sentinel); 4243 pset_sentinel (p, ps->sentinel);
4159 PSET (p, filter, ps->filter); 4244 pset_filter (p, ps->filter);
4160 PSET (p, command, Qnil); 4245 pset_command (p, Qnil);
4161 p->pid = 0; 4246 p->pid = 0;
4162 p->infd = s; 4247 p->infd = s;
4163 p->outfd = s; 4248 p->outfd = s;
4164 PSET (p, status, Qrun); 4249 pset_status (p, Qrun);
4165 4250
4166 /* Client processes for accepted connections are not stopped initially. */ 4251 /* Client processes for accepted connections are not stopped initially. */
4167 if (!EQ (p->filter, Qt)) 4252 if (!EQ (p->filter, Qt))
@@ -4178,13 +4263,13 @@ server_accept_connection (Lisp_Object server, int channel)
4178 of the new process should reflect the settings at the time the 4263 of the new process should reflect the settings at the time the
4179 server socket was opened; not the current settings. */ 4264 server socket was opened; not the current settings. */
4180 4265
4181 PSET (p, decode_coding_system, ps->decode_coding_system); 4266 pset_decode_coding_system (p, ps->decode_coding_system);
4182 PSET (p, encode_coding_system, ps->encode_coding_system); 4267 pset_encode_coding_system (p, ps->encode_coding_system);
4183 setup_process_coding_systems (proc); 4268 setup_process_coding_systems (proc);
4184 4269
4185 PSET (p, decoding_buf, empty_unibyte_string); 4270 pset_decoding_buf (p, empty_unibyte_string);
4186 p->decoding_carryover = 0; 4271 p->decoding_carryover = 0;
4187 PSET (p, encoding_buf, empty_unibyte_string); 4272 pset_encoding_buf (p, empty_unibyte_string);
4188 4273
4189 p->inherit_coding_system_flag 4274 p->inherit_coding_system_flag
4190 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4275 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -4889,7 +4974,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4889 waitpid() will not find the process object to 4974 waitpid() will not find the process object to
4890 delete. Do it here. */ 4975 delete. Do it here. */
4891 p->tick = ++process_tick; 4976 p->tick = ++process_tick;
4892 PSET (p, status, Qfailed); 4977 pset_status (p, Qfailed);
4893 } 4978 }
4894 else 4979 else
4895 kill (getpid (), SIGCHLD); 4980 kill (getpid (), SIGCHLD);
@@ -4909,8 +4994,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4909 if (XPROCESS (proc)->raw_status_new) 4994 if (XPROCESS (proc)->raw_status_new)
4910 update_status (XPROCESS (proc)); 4995 update_status (XPROCESS (proc));
4911 if (EQ (XPROCESS (proc)->status, Qrun)) 4996 if (EQ (XPROCESS (proc)->status, Qrun))
4912 PSET (XPROCESS (proc), status, 4997 pset_status (XPROCESS (proc),
4913 Fcons (Qexit, Fcons (make_number (256), Qnil))); 4998 list2 (Qexit, make_number (256)));
4914 } 4999 }
4915 } 5000 }
4916#ifdef NON_BLOCKING_CONNECT 5001#ifdef NON_BLOCKING_CONNECT
@@ -4958,13 +5043,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4958 if (xerrno) 5043 if (xerrno)
4959 { 5044 {
4960 p->tick = ++process_tick; 5045 p->tick = ++process_tick;
4961 PSET (p, status, 5046 pset_status (p, list2 (Qfailed, make_number (xerrno)));
4962 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
4963 deactivate_process (proc); 5047 deactivate_process (proc);
4964 } 5048 }
4965 else 5049 else
4966 { 5050 {
4967 PSET (p, status, Qrun); 5051 pset_status (p, Qrun);
4968 /* Execute the sentinel here. If we had relied on 5052 /* Execute the sentinel here. If we had relied on
4969 status_notify to do it later, it will read input 5053 status_notify to do it later, it will read input
4970 from the process before calling the sentinel. */ 5054 from the process before calling the sentinel. */
@@ -5164,7 +5248,7 @@ read_process_output (Lisp_Object proc, register int channel)
5164 /* A new coding system might be found. */ 5248 /* A new coding system might be found. */
5165 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5249 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5166 { 5250 {
5167 PSET (p, decode_coding_system, Vlast_coding_system_used); 5251 pset_decode_coding_system (p, Vlast_coding_system_used);
5168 5252
5169 /* Don't call setup_coding_system for 5253 /* Don't call setup_coding_system for
5170 proc_decode_coding_system[channel] here. It is done in 5254 proc_decode_coding_system[channel] here. It is done in
@@ -5180,8 +5264,8 @@ read_process_output (Lisp_Object proc, register int channel)
5180 if (NILP (p->encode_coding_system) 5264 if (NILP (p->encode_coding_system)
5181 && proc_encode_coding_system[p->outfd]) 5265 && proc_encode_coding_system[p->outfd])
5182 { 5266 {
5183 PSET (p, encode_coding_system, 5267 pset_encode_coding_system
5184 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5268 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5185 setup_coding_system (p->encode_coding_system, 5269 setup_coding_system (p->encode_coding_system,
5186 proc_encode_coding_system[p->outfd]); 5270 proc_encode_coding_system[p->outfd]);
5187 } 5271 }
@@ -5190,7 +5274,7 @@ read_process_output (Lisp_Object proc, register int channel)
5190 if (coding->carryover_bytes > 0) 5274 if (coding->carryover_bytes > 0)
5191 { 5275 {
5192 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5276 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5193 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5277 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5194 memcpy (SDATA (p->decoding_buf), coding->carryover, 5278 memcpy (SDATA (p->decoding_buf), coding->carryover,
5195 coding->carryover_bytes); 5279 coding->carryover_bytes);
5196 p->decoding_carryover = coding->carryover_bytes; 5280 p->decoding_carryover = coding->carryover_bytes;
@@ -5246,7 +5330,7 @@ read_process_output (Lisp_Object proc, register int channel)
5246 old_begv_byte = BEGV_BYTE; 5330 old_begv_byte = BEGV_BYTE;
5247 old_zv_byte = ZV_BYTE; 5331 old_zv_byte = ZV_BYTE;
5248 5332
5249 BSET (current_buffer, read_only, Qnil); 5333 bset_read_only (current_buffer, Qnil);
5250 5334
5251 /* Insert new output into buffer 5335 /* Insert new output into buffer
5252 at the current end-of-output marker, 5336 at the current end-of-output marker,
@@ -5274,12 +5358,12 @@ read_process_output (Lisp_Object proc, register int channel)
5274 similar code in the previous `if' block. */ 5358 similar code in the previous `if' block. */
5275 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5359 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5276 { 5360 {
5277 PSET (p, decode_coding_system, Vlast_coding_system_used); 5361 pset_decode_coding_system (p, Vlast_coding_system_used);
5278 if (NILP (p->encode_coding_system) 5362 if (NILP (p->encode_coding_system)
5279 && proc_encode_coding_system[p->outfd]) 5363 && proc_encode_coding_system[p->outfd])
5280 { 5364 {
5281 PSET (p, encode_coding_system, 5365 pset_encode_coding_system
5282 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5366 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5283 setup_coding_system (p->encode_coding_system, 5367 setup_coding_system (p->encode_coding_system,
5284 proc_encode_coding_system[p->outfd]); 5368 proc_encode_coding_system[p->outfd]);
5285 } 5369 }
@@ -5287,7 +5371,7 @@ read_process_output (Lisp_Object proc, register int channel)
5287 if (coding->carryover_bytes > 0) 5371 if (coding->carryover_bytes > 0)
5288 { 5372 {
5289 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5373 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5290 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5374 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5291 memcpy (SDATA (p->decoding_buf), coding->carryover, 5375 memcpy (SDATA (p->decoding_buf), coding->carryover,
5292 coding->carryover_bytes); 5376 coding->carryover_bytes);
5293 p->decoding_carryover = coding->carryover_bytes; 5377 p->decoding_carryover = coding->carryover_bytes;
@@ -5337,7 +5421,7 @@ read_process_output (Lisp_Object proc, register int channel)
5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5421 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5338 5422
5339 5423
5340 BSET (current_buffer, read_only, old_read_only); 5424 bset_read_only (current_buffer, old_read_only);
5341 SET_PT_BOTH (opoint, opoint_byte); 5425 SET_PT_BOTH (opoint, opoint_byte);
5342 } 5426 }
5343 /* Handling the process output should not deactivate the mark. */ 5427 /* Handling the process output should not deactivate the mark. */
@@ -5404,9 +5488,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5404 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5488 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5405 5489
5406 if (front) 5490 if (front)
5407 PSET (p, write_queue, Fcons (entry, p->write_queue)); 5491 pset_write_queue (p, Fcons (entry, p->write_queue));
5408 else 5492 else
5409 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5493 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5410} 5494}
5411 5495
5412/* Remove the first element in the write_queue of process P, put its 5496/* Remove the first element in the write_queue of process P, put its
@@ -5424,7 +5508,7 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5424 return 0; 5508 return 0;
5425 5509
5426 entry = XCAR (p->write_queue); 5510 entry = XCAR (p->write_queue);
5427 PSET (p, write_queue, XCDR (p->write_queue)); 5511 pset_write_queue (p, XCDR (p->write_queue));
5428 5512
5429 *obj = XCAR (entry); 5513 *obj = XCAR (entry);
5430 offset_length = XCDR (entry); 5514 offset_length = XCDR (entry);
@@ -5471,8 +5555,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5471 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5555 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5472 || EQ (object, Qt)) 5556 || EQ (object, Qt))
5473 { 5557 {
5474 PSET (p, encode_coding_system, 5558 pset_encode_coding_system
5475 complement_process_encoding_system (p->encode_coding_system)); 5559 (p, complement_process_encoding_system (p->encode_coding_system));
5476 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5560 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5477 { 5561 {
5478 /* The coding system for encoding was changed to raw-text 5562 /* The coding system for encoding was changed to raw-text
@@ -5693,7 +5777,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5693 proc = process_sent_to; 5777 proc = process_sent_to;
5694 p = XPROCESS (proc); 5778 p = XPROCESS (proc);
5695 p->raw_status_new = 0; 5779 p->raw_status_new = 0;
5696 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); 5780 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5697 p->tick = ++process_tick; 5781 p->tick = ++process_tick;
5698 deactivate_process (proc); 5782 deactivate_process (proc);
5699 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5783 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
@@ -5922,7 +6006,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5922#ifdef SIGCONT 6006#ifdef SIGCONT
5923 case SIGCONT: 6007 case SIGCONT:
5924 p->raw_status_new = 0; 6008 p->raw_status_new = 0;
5925 PSET (p, status, Qrun); 6009 pset_status (p, Qrun);
5926 p->tick = ++process_tick; 6010 p->tick = ++process_tick;
5927 if (!nomsg) 6011 if (!nomsg)
5928 { 6012 {
@@ -6018,7 +6102,7 @@ traffic. */)
6018 FD_CLR (p->infd, &input_wait_mask); 6102 FD_CLR (p->infd, &input_wait_mask);
6019 FD_CLR (p->infd, &non_keyboard_wait_mask); 6103 FD_CLR (p->infd, &non_keyboard_wait_mask);
6020 } 6104 }
6021 PSET (p, command, Qt); 6105 pset_command (p, Qt);
6022 return process; 6106 return process;
6023 } 6107 }
6024#ifndef SIGTSTP 6108#ifndef SIGTSTP
@@ -6054,7 +6138,7 @@ traffic. */)
6054 tcflush (p->infd, TCIFLUSH); 6138 tcflush (p->infd, TCIFLUSH);
6055#endif /* not WINDOWSNT */ 6139#endif /* not WINDOWSNT */
6056 } 6140 }
6057 PSET (p, command, Qnil); 6141 pset_command (p, Qnil);
6058 return process; 6142 return process;
6059 } 6143 }
6060#ifdef SIGCONT 6144#ifdef SIGCONT
@@ -6470,7 +6554,7 @@ sigchld_handler (int signo)
6470static Lisp_Object 6554static Lisp_Object
6471exec_sentinel_unwind (Lisp_Object data) 6555exec_sentinel_unwind (Lisp_Object data)
6472{ 6556{
6473 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); 6557 pset_sentinel (XPROCESS (XCAR (data)), XCDR (data));
6474 return Qnil; 6558 return Qnil;
6475} 6559}
6476 6560
@@ -6516,7 +6600,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6516 6600
6517 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6601 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6518 assure that it gets restored no matter how the sentinel exits. */ 6602 assure that it gets restored no matter how the sentinel exits. */
6519 PSET (p, sentinel, Qnil); 6603 pset_sentinel (p, Qnil);
6520 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6604 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6521 /* Inhibit quit so that random quits don't screw up a running filter. */ 6605 /* Inhibit quit so that random quits don't screw up a running filter. */
6522 specbind (Qinhibit_quit, Qt); 6606 specbind (Qinhibit_quit, Qt);
@@ -6671,13 +6755,13 @@ status_notify (struct Lisp_Process *deleting_process)
6671 before_byte = PT_BYTE; 6755 before_byte = PT_BYTE;
6672 6756
6673 tem = BVAR (current_buffer, read_only); 6757 tem = BVAR (current_buffer, read_only);
6674 BSET (current_buffer, read_only, Qnil); 6758 bset_read_only (current_buffer, Qnil);
6675 insert_string ("\nProcess "); 6759 insert_string ("\nProcess ");
6676 { /* FIXME: temporary kludge */ 6760 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6761 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6678 insert_string (" "); 6762 insert_string (" ");
6679 Finsert (1, &msg); 6763 Finsert (1, &msg);
6680 BSET (current_buffer, read_only, tem); 6764 bset_read_only (current_buffer, tem);
6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6765 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6682 6766
6683 if (opoint >= before) 6767 if (opoint >= before)
@@ -6714,8 +6798,8 @@ encode subprocess input. */)
6714 Fcheck_coding_system (decoding); 6798 Fcheck_coding_system (decoding);
6715 Fcheck_coding_system (encoding); 6799 Fcheck_coding_system (encoding);
6716 encoding = coding_inherit_eol_type (encoding, Qnil); 6800 encoding = coding_inherit_eol_type (encoding, Qnil);
6717 PSET (p, decode_coding_system, decoding); 6801 pset_decode_coding_system (p, decoding);
6718 PSET (p, encode_coding_system, encoding); 6802 pset_encode_coding_system (p, encoding);
6719 setup_process_coding_systems (process); 6803 setup_process_coding_systems (process);
6720 6804
6721 return Qnil; 6805 return Qnil;
@@ -6745,8 +6829,8 @@ suppressed. */)
6745 CHECK_PROCESS (process); 6829 CHECK_PROCESS (process);
6746 p = XPROCESS (process); 6830 p = XPROCESS (process);
6747 if (NILP (flag)) 6831 if (NILP (flag))
6748 PSET (p, decode_coding_system, 6832 pset_decode_coding_system
6749 raw_text_coding_system (p->decode_coding_system)); 6833 (p, raw_text_coding_system (p->decode_coding_system));
6750 setup_process_coding_systems (process); 6834 setup_process_coding_systems (process);
6751 6835
6752 return Qnil; 6836 return Qnil;