aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c295
1 files changed, 188 insertions, 107 deletions
diff --git a/src/process.c b/src/process.c
index a43655e4da8..7f6f6bafbea 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);
@@ -1538,9 +1623,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1538 /* Use volatile to protect variables from being clobbered by longjmp. */ 1623 /* Use volatile to protect variables from being clobbered by longjmp. */
1539 volatile int forkin, forkout; 1624 volatile int forkin, forkout;
1540 volatile int pty_flag = 0; 1625 volatile int pty_flag = 0;
1541#ifndef USE_CRT_DLL
1542 extern char **environ;
1543#endif
1544 1626
1545 inchannel = outchannel = -1; 1627 inchannel = outchannel = -1;
1546 1628
@@ -1628,7 +1710,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1628 more portable (see USG_SUBTTY_WORKS above). */ 1710 more portable (see USG_SUBTTY_WORKS above). */
1629 1711
1630 XPROCESS (process)->pty_flag = pty_flag; 1712 XPROCESS (process)->pty_flag = pty_flag;
1631 PSET (XPROCESS (process), status, Qrun); 1713 pset_status (XPROCESS (process), Qrun);
1632 1714
1633 /* Delay interrupts until we have a chance to store 1715 /* Delay interrupts until we have a chance to store
1634 the new fork's pid in its process structure */ 1716 the new fork's pid in its process structure */
@@ -1867,10 +1949,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1867 1949
1868#ifdef HAVE_PTYS 1950#ifdef HAVE_PTYS
1869 if (pty_flag) 1951 if (pty_flag)
1870 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 1952 pset_tty_name (XPROCESS (process), build_string (pty_name));
1871 else 1953 else
1872#endif 1954#endif
1873 PSET (XPROCESS (process), tty_name, Qnil); 1955 pset_tty_name (XPROCESS (process), Qnil);
1874 1956
1875#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1957#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1876 /* Wait for child_setup to complete in case that vfork is 1958 /* Wait for child_setup to complete in case that vfork is
@@ -1965,7 +2047,7 @@ create_pty (Lisp_Object process)
1965 more portable (see USG_SUBTTY_WORKS above). */ 2047 more portable (see USG_SUBTTY_WORKS above). */
1966 2048
1967 XPROCESS (process)->pty_flag = pty_flag; 2049 XPROCESS (process)->pty_flag = pty_flag;
1968 PSET (XPROCESS (process), status, Qrun); 2050 pset_status (XPROCESS (process), Qrun);
1969 setup_process_coding_systems (process); 2051 setup_process_coding_systems (process);
1970 2052
1971 FD_SET (inchannel, &input_wait_mask); 2053 FD_SET (inchannel, &input_wait_mask);
@@ -1976,10 +2058,10 @@ create_pty (Lisp_Object process)
1976 XPROCESS (process)->pid = -2; 2058 XPROCESS (process)->pid = -2;
1977#ifdef HAVE_PTYS 2059#ifdef HAVE_PTYS
1978 if (pty_flag) 2060 if (pty_flag)
1979 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2061 pset_tty_name (XPROCESS (process), build_string (pty_name));
1980 else 2062 else
1981#endif 2063#endif
1982 PSET (XPROCESS (process), tty_name, Qnil); 2064 pset_tty_name (XPROCESS (process), Qnil);
1983} 2065}
1984 2066
1985 2067
@@ -2368,7 +2450,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2368 2450
2369 if (set_socket_option (s, option, value)) 2451 if (set_socket_option (s, option, value))
2370 { 2452 {
2371 PSET (p, childp, Fplist_put (p->childp, option, value)); 2453 pset_childp (p, Fplist_put (p->childp, option, value));
2372 return Qt; 2454 return Qt;
2373 } 2455 }
2374 2456
@@ -2601,18 +2683,18 @@ usage: (make-serial-process &rest ARGS) */)
2601 if (NILP (buffer)) 2683 if (NILP (buffer))
2602 buffer = name; 2684 buffer = name;
2603 buffer = Fget_buffer_create (buffer); 2685 buffer = Fget_buffer_create (buffer);
2604 PSET (p, buffer, buffer); 2686 pset_buffer (p, buffer);
2605 2687
2606 PSET (p, childp, contact); 2688 pset_childp (p, contact);
2607 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 2689 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
2608 PSET (p, type, Qserial); 2690 pset_type (p, Qserial);
2609 PSET (p, sentinel, Fplist_get (contact, QCsentinel)); 2691 pset_sentinel (p, Fplist_get (contact, QCsentinel));
2610 PSET (p, filter, Fplist_get (contact, QCfilter)); 2692 pset_filter (p, Fplist_get (contact, QCfilter));
2611 PSET (p, log, Qnil); 2693 pset_log (p, Qnil);
2612 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2694 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2613 p->kill_without_query = 1; 2695 p->kill_without_query = 1;
2614 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2696 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2615 PSET (p, command, Qt); 2697 pset_command (p, Qt);
2616 p->pty_flag = 0; 2698 p->pty_flag = 0;
2617 2699
2618 if (!EQ (p->command, Qt)) 2700 if (!EQ (p->command, Qt))
@@ -2644,7 +2726,7 @@ usage: (make-serial-process &rest ARGS) */)
2644 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2726 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2645 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2727 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2646 val = Qnil; 2728 val = Qnil;
2647 PSET (p, decode_coding_system, val); 2729 pset_decode_coding_system (p, val);
2648 2730
2649 val = Qnil; 2731 val = Qnil;
2650 if (!NILP (tem)) 2732 if (!NILP (tem))
@@ -2658,12 +2740,12 @@ usage: (make-serial-process &rest ARGS) */)
2658 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2740 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2659 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2741 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2660 val = Qnil; 2742 val = Qnil;
2661 PSET (p, encode_coding_system, val); 2743 pset_encode_coding_system (p, val);
2662 2744
2663 setup_process_coding_systems (proc); 2745 setup_process_coding_systems (proc);
2664 PSET (p, decoding_buf, empty_unibyte_string); 2746 pset_decoding_buf (p, empty_unibyte_string);
2665 p->decoding_carryover = 0; 2747 p->decoding_carryover = 0;
2666 PSET (p, encoding_buf, empty_unibyte_string); 2748 pset_encoding_buf (p, empty_unibyte_string);
2667 p->inherit_coding_system_flag 2749 p->inherit_coding_system_flag
2668 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2750 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2669 2751
@@ -3400,23 +3482,23 @@ usage: (make-network-process &rest ARGS) */)
3400 3482
3401 p = XPROCESS (proc); 3483 p = XPROCESS (proc);
3402 3484
3403 PSET (p, childp, contact); 3485 pset_childp (p, contact);
3404 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 3486 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
3405 PSET (p, type, Qnetwork); 3487 pset_type (p, Qnetwork);
3406 3488
3407 PSET (p, buffer, buffer); 3489 pset_buffer (p, buffer);
3408 PSET (p, sentinel, sentinel); 3490 pset_sentinel (p, sentinel);
3409 PSET (p, filter, filter); 3491 pset_filter (p, filter);
3410 PSET (p, log, Fplist_get (contact, QClog)); 3492 pset_log (p, Fplist_get (contact, QClog));
3411 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3493 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3412 p->kill_without_query = 1; 3494 p->kill_without_query = 1;
3413 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3495 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3414 PSET (p, command, Qt); 3496 pset_command (p, Qt);
3415 p->pid = 0; 3497 p->pid = 0;
3416 p->infd = inch; 3498 p->infd = inch;
3417 p->outfd = outch; 3499 p->outfd = outch;
3418 if (is_server && socktype != SOCK_DGRAM) 3500 if (is_server && socktype != SOCK_DGRAM)
3419 PSET (p, status, Qlisten); 3501 pset_status (p, Qlisten);
3420 3502
3421 /* Make the process marker point into the process buffer (if any). */ 3503 /* Make the process marker point into the process buffer (if any). */
3422 if (BUFFERP (buffer)) 3504 if (BUFFERP (buffer))
@@ -3430,7 +3512,7 @@ usage: (make-network-process &rest ARGS) */)
3430 /* We may get here if connect did succeed immediately. However, 3512 /* We may get here if connect did succeed immediately. However,
3431 in that case, we still need to signal this like a non-blocking 3513 in that case, we still need to signal this like a non-blocking
3432 connection. */ 3514 connection. */
3433 PSET (p, status, Qconnect); 3515 pset_status (p, Qconnect);
3434 if (!FD_ISSET (inch, &connect_wait_mask)) 3516 if (!FD_ISSET (inch, &connect_wait_mask))
3435 { 3517 {
3436 FD_SET (inch, &connect_wait_mask); 3518 FD_SET (inch, &connect_wait_mask);
@@ -3497,7 +3579,7 @@ usage: (make-network-process &rest ARGS) */)
3497 else 3579 else
3498 val = Qnil; 3580 val = Qnil;
3499 } 3581 }
3500 PSET (p, decode_coding_system, val); 3582 pset_decode_coding_system (p, val);
3501 3583
3502 if (!NILP (tem)) 3584 if (!NILP (tem))
3503 { 3585 {
@@ -3531,13 +3613,13 @@ usage: (make-network-process &rest ARGS) */)
3531 else 3613 else
3532 val = Qnil; 3614 val = Qnil;
3533 } 3615 }
3534 PSET (p, encode_coding_system, val); 3616 pset_encode_coding_system (p, val);
3535 } 3617 }
3536 setup_process_coding_systems (proc); 3618 setup_process_coding_systems (proc);
3537 3619
3538 PSET (p, decoding_buf, empty_unibyte_string); 3620 pset_decoding_buf (p, empty_unibyte_string);
3539 p->decoding_carryover = 0; 3621 p->decoding_carryover = 0;
3540 PSET (p, encoding_buf, empty_unibyte_string); 3622 pset_encoding_buf (p, empty_unibyte_string);
3541 3623
3542 p->inherit_coding_system_flag 3624 p->inherit_coding_system_flag
3543 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3625 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4150,18 +4232,18 @@ server_accept_connection (Lisp_Object server, int channel)
4150 conv_sockaddr_to_lisp (&saddr.sa, len)); 4232 conv_sockaddr_to_lisp (&saddr.sa, len));
4151#endif 4233#endif
4152 4234
4153 PSET (p, childp, contact); 4235 pset_childp (p, contact);
4154 PSET (p, plist, Fcopy_sequence (ps->plist)); 4236 pset_plist (p, Fcopy_sequence (ps->plist));
4155 PSET (p, type, Qnetwork); 4237 pset_type (p, Qnetwork);
4156 4238
4157 PSET (p, buffer, buffer); 4239 pset_buffer (p, buffer);
4158 PSET (p, sentinel, ps->sentinel); 4240 pset_sentinel (p, ps->sentinel);
4159 PSET (p, filter, ps->filter); 4241 pset_filter (p, ps->filter);
4160 PSET (p, command, Qnil); 4242 pset_command (p, Qnil);
4161 p->pid = 0; 4243 p->pid = 0;
4162 p->infd = s; 4244 p->infd = s;
4163 p->outfd = s; 4245 p->outfd = s;
4164 PSET (p, status, Qrun); 4246 pset_status (p, Qrun);
4165 4247
4166 /* Client processes for accepted connections are not stopped initially. */ 4248 /* Client processes for accepted connections are not stopped initially. */
4167 if (!EQ (p->filter, Qt)) 4249 if (!EQ (p->filter, Qt))
@@ -4178,13 +4260,13 @@ server_accept_connection (Lisp_Object server, int channel)
4178 of the new process should reflect the settings at the time the 4260 of the new process should reflect the settings at the time the
4179 server socket was opened; not the current settings. */ 4261 server socket was opened; not the current settings. */
4180 4262
4181 PSET (p, decode_coding_system, ps->decode_coding_system); 4263 pset_decode_coding_system (p, ps->decode_coding_system);
4182 PSET (p, encode_coding_system, ps->encode_coding_system); 4264 pset_encode_coding_system (p, ps->encode_coding_system);
4183 setup_process_coding_systems (proc); 4265 setup_process_coding_systems (proc);
4184 4266
4185 PSET (p, decoding_buf, empty_unibyte_string); 4267 pset_decoding_buf (p, empty_unibyte_string);
4186 p->decoding_carryover = 0; 4268 p->decoding_carryover = 0;
4187 PSET (p, encoding_buf, empty_unibyte_string); 4269 pset_encoding_buf (p, empty_unibyte_string);
4188 4270
4189 p->inherit_coding_system_flag 4271 p->inherit_coding_system_flag
4190 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4272 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -4889,7 +4971,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4889 waitpid() will not find the process object to 4971 waitpid() will not find the process object to
4890 delete. Do it here. */ 4972 delete. Do it here. */
4891 p->tick = ++process_tick; 4973 p->tick = ++process_tick;
4892 PSET (p, status, Qfailed); 4974 pset_status (p, Qfailed);
4893 } 4975 }
4894 else 4976 else
4895 kill (getpid (), SIGCHLD); 4977 kill (getpid (), SIGCHLD);
@@ -4909,8 +4991,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4909 if (XPROCESS (proc)->raw_status_new) 4991 if (XPROCESS (proc)->raw_status_new)
4910 update_status (XPROCESS (proc)); 4992 update_status (XPROCESS (proc));
4911 if (EQ (XPROCESS (proc)->status, Qrun)) 4993 if (EQ (XPROCESS (proc)->status, Qrun))
4912 PSET (XPROCESS (proc), status, 4994 pset_status (XPROCESS (proc),
4913 Fcons (Qexit, Fcons (make_number (256), Qnil))); 4995 list2 (Qexit, make_number (256)));
4914 } 4996 }
4915 } 4997 }
4916#ifdef NON_BLOCKING_CONNECT 4998#ifdef NON_BLOCKING_CONNECT
@@ -4958,13 +5040,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4958 if (xerrno) 5040 if (xerrno)
4959 { 5041 {
4960 p->tick = ++process_tick; 5042 p->tick = ++process_tick;
4961 PSET (p, status, 5043 pset_status (p, list2 (Qfailed, make_number (xerrno)));
4962 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
4963 deactivate_process (proc); 5044 deactivate_process (proc);
4964 } 5045 }
4965 else 5046 else
4966 { 5047 {
4967 PSET (p, status, Qrun); 5048 pset_status (p, Qrun);
4968 /* Execute the sentinel here. If we had relied on 5049 /* Execute the sentinel here. If we had relied on
4969 status_notify to do it later, it will read input 5050 status_notify to do it later, it will read input
4970 from the process before calling the sentinel. */ 5051 from the process before calling the sentinel. */
@@ -5164,7 +5245,7 @@ read_process_output (Lisp_Object proc, register int channel)
5164 /* A new coding system might be found. */ 5245 /* A new coding system might be found. */
5165 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5246 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5166 { 5247 {
5167 PSET (p, decode_coding_system, Vlast_coding_system_used); 5248 pset_decode_coding_system (p, Vlast_coding_system_used);
5168 5249
5169 /* Don't call setup_coding_system for 5250 /* Don't call setup_coding_system for
5170 proc_decode_coding_system[channel] here. It is done in 5251 proc_decode_coding_system[channel] here. It is done in
@@ -5180,8 +5261,8 @@ read_process_output (Lisp_Object proc, register int channel)
5180 if (NILP (p->encode_coding_system) 5261 if (NILP (p->encode_coding_system)
5181 && proc_encode_coding_system[p->outfd]) 5262 && proc_encode_coding_system[p->outfd])
5182 { 5263 {
5183 PSET (p, encode_coding_system, 5264 pset_encode_coding_system
5184 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5265 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5185 setup_coding_system (p->encode_coding_system, 5266 setup_coding_system (p->encode_coding_system,
5186 proc_encode_coding_system[p->outfd]); 5267 proc_encode_coding_system[p->outfd]);
5187 } 5268 }
@@ -5190,7 +5271,7 @@ read_process_output (Lisp_Object proc, register int channel)
5190 if (coding->carryover_bytes > 0) 5271 if (coding->carryover_bytes > 0)
5191 { 5272 {
5192 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5273 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5193 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5274 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5194 memcpy (SDATA (p->decoding_buf), coding->carryover, 5275 memcpy (SDATA (p->decoding_buf), coding->carryover,
5195 coding->carryover_bytes); 5276 coding->carryover_bytes);
5196 p->decoding_carryover = coding->carryover_bytes; 5277 p->decoding_carryover = coding->carryover_bytes;
@@ -5246,7 +5327,7 @@ read_process_output (Lisp_Object proc, register int channel)
5246 old_begv_byte = BEGV_BYTE; 5327 old_begv_byte = BEGV_BYTE;
5247 old_zv_byte = ZV_BYTE; 5328 old_zv_byte = ZV_BYTE;
5248 5329
5249 BSET (current_buffer, read_only, Qnil); 5330 bset_read_only (current_buffer, Qnil);
5250 5331
5251 /* Insert new output into buffer 5332 /* Insert new output into buffer
5252 at the current end-of-output marker, 5333 at the current end-of-output marker,
@@ -5274,12 +5355,12 @@ read_process_output (Lisp_Object proc, register int channel)
5274 similar code in the previous `if' block. */ 5355 similar code in the previous `if' block. */
5275 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5356 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5276 { 5357 {
5277 PSET (p, decode_coding_system, Vlast_coding_system_used); 5358 pset_decode_coding_system (p, Vlast_coding_system_used);
5278 if (NILP (p->encode_coding_system) 5359 if (NILP (p->encode_coding_system)
5279 && proc_encode_coding_system[p->outfd]) 5360 && proc_encode_coding_system[p->outfd])
5280 { 5361 {
5281 PSET (p, encode_coding_system, 5362 pset_encode_coding_system
5282 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5363 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5283 setup_coding_system (p->encode_coding_system, 5364 setup_coding_system (p->encode_coding_system,
5284 proc_encode_coding_system[p->outfd]); 5365 proc_encode_coding_system[p->outfd]);
5285 } 5366 }
@@ -5287,7 +5368,7 @@ read_process_output (Lisp_Object proc, register int channel)
5287 if (coding->carryover_bytes > 0) 5368 if (coding->carryover_bytes > 0)
5288 { 5369 {
5289 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5370 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5290 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5371 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5291 memcpy (SDATA (p->decoding_buf), coding->carryover, 5372 memcpy (SDATA (p->decoding_buf), coding->carryover,
5292 coding->carryover_bytes); 5373 coding->carryover_bytes);
5293 p->decoding_carryover = coding->carryover_bytes; 5374 p->decoding_carryover = coding->carryover_bytes;
@@ -5337,7 +5418,7 @@ read_process_output (Lisp_Object proc, register int channel)
5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5418 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5338 5419
5339 5420
5340 BSET (current_buffer, read_only, old_read_only); 5421 bset_read_only (current_buffer, old_read_only);
5341 SET_PT_BOTH (opoint, opoint_byte); 5422 SET_PT_BOTH (opoint, opoint_byte);
5342 } 5423 }
5343 /* Handling the process output should not deactivate the mark. */ 5424 /* Handling the process output should not deactivate the mark. */
@@ -5404,9 +5485,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5404 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5485 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5405 5486
5406 if (front) 5487 if (front)
5407 PSET (p, write_queue, Fcons (entry, p->write_queue)); 5488 pset_write_queue (p, Fcons (entry, p->write_queue));
5408 else 5489 else
5409 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5490 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5410} 5491}
5411 5492
5412/* Remove the first element in the write_queue of process P, put its 5493/* Remove the first element in the write_queue of process P, put its
@@ -5424,7 +5505,7 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5424 return 0; 5505 return 0;
5425 5506
5426 entry = XCAR (p->write_queue); 5507 entry = XCAR (p->write_queue);
5427 PSET (p, write_queue, XCDR (p->write_queue)); 5508 pset_write_queue (p, XCDR (p->write_queue));
5428 5509
5429 *obj = XCAR (entry); 5510 *obj = XCAR (entry);
5430 offset_length = XCDR (entry); 5511 offset_length = XCDR (entry);
@@ -5471,8 +5552,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5471 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5552 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5472 || EQ (object, Qt)) 5553 || EQ (object, Qt))
5473 { 5554 {
5474 PSET (p, encode_coding_system, 5555 pset_encode_coding_system
5475 complement_process_encoding_system (p->encode_coding_system)); 5556 (p, complement_process_encoding_system (p->encode_coding_system));
5476 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5557 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5477 { 5558 {
5478 /* The coding system for encoding was changed to raw-text 5559 /* The coding system for encoding was changed to raw-text
@@ -5693,7 +5774,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5693 proc = process_sent_to; 5774 proc = process_sent_to;
5694 p = XPROCESS (proc); 5775 p = XPROCESS (proc);
5695 p->raw_status_new = 0; 5776 p->raw_status_new = 0;
5696 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); 5777 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5697 p->tick = ++process_tick; 5778 p->tick = ++process_tick;
5698 deactivate_process (proc); 5779 deactivate_process (proc);
5699 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5780 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
@@ -5922,7 +6003,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5922#ifdef SIGCONT 6003#ifdef SIGCONT
5923 case SIGCONT: 6004 case SIGCONT:
5924 p->raw_status_new = 0; 6005 p->raw_status_new = 0;
5925 PSET (p, status, Qrun); 6006 pset_status (p, Qrun);
5926 p->tick = ++process_tick; 6007 p->tick = ++process_tick;
5927 if (!nomsg) 6008 if (!nomsg)
5928 { 6009 {
@@ -6018,7 +6099,7 @@ traffic. */)
6018 FD_CLR (p->infd, &input_wait_mask); 6099 FD_CLR (p->infd, &input_wait_mask);
6019 FD_CLR (p->infd, &non_keyboard_wait_mask); 6100 FD_CLR (p->infd, &non_keyboard_wait_mask);
6020 } 6101 }
6021 PSET (p, command, Qt); 6102 pset_command (p, Qt);
6022 return process; 6103 return process;
6023 } 6104 }
6024#ifndef SIGTSTP 6105#ifndef SIGTSTP
@@ -6054,7 +6135,7 @@ traffic. */)
6054 tcflush (p->infd, TCIFLUSH); 6135 tcflush (p->infd, TCIFLUSH);
6055#endif /* not WINDOWSNT */ 6136#endif /* not WINDOWSNT */
6056 } 6137 }
6057 PSET (p, command, Qnil); 6138 pset_command (p, Qnil);
6058 return process; 6139 return process;
6059 } 6140 }
6060#ifdef SIGCONT 6141#ifdef SIGCONT
@@ -6470,7 +6551,7 @@ sigchld_handler (int signo)
6470static Lisp_Object 6551static Lisp_Object
6471exec_sentinel_unwind (Lisp_Object data) 6552exec_sentinel_unwind (Lisp_Object data)
6472{ 6553{
6473 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); 6554 pset_sentinel (XPROCESS (XCAR (data)), XCDR (data));
6474 return Qnil; 6555 return Qnil;
6475} 6556}
6476 6557
@@ -6516,7 +6597,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6516 6597
6517 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6598 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6518 assure that it gets restored no matter how the sentinel exits. */ 6599 assure that it gets restored no matter how the sentinel exits. */
6519 PSET (p, sentinel, Qnil); 6600 pset_sentinel (p, Qnil);
6520 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6601 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6521 /* Inhibit quit so that random quits don't screw up a running filter. */ 6602 /* Inhibit quit so that random quits don't screw up a running filter. */
6522 specbind (Qinhibit_quit, Qt); 6603 specbind (Qinhibit_quit, Qt);
@@ -6671,13 +6752,13 @@ status_notify (struct Lisp_Process *deleting_process)
6671 before_byte = PT_BYTE; 6752 before_byte = PT_BYTE;
6672 6753
6673 tem = BVAR (current_buffer, read_only); 6754 tem = BVAR (current_buffer, read_only);
6674 BSET (current_buffer, read_only, Qnil); 6755 bset_read_only (current_buffer, Qnil);
6675 insert_string ("\nProcess "); 6756 insert_string ("\nProcess ");
6676 { /* FIXME: temporary kludge */ 6757 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6758 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6678 insert_string (" "); 6759 insert_string (" ");
6679 Finsert (1, &msg); 6760 Finsert (1, &msg);
6680 BSET (current_buffer, read_only, tem); 6761 bset_read_only (current_buffer, tem);
6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6762 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6682 6763
6683 if (opoint >= before) 6764 if (opoint >= before)
@@ -6714,8 +6795,8 @@ encode subprocess input. */)
6714 Fcheck_coding_system (decoding); 6795 Fcheck_coding_system (decoding);
6715 Fcheck_coding_system (encoding); 6796 Fcheck_coding_system (encoding);
6716 encoding = coding_inherit_eol_type (encoding, Qnil); 6797 encoding = coding_inherit_eol_type (encoding, Qnil);
6717 PSET (p, decode_coding_system, decoding); 6798 pset_decode_coding_system (p, decoding);
6718 PSET (p, encode_coding_system, encoding); 6799 pset_encode_coding_system (p, encoding);
6719 setup_process_coding_systems (process); 6800 setup_process_coding_systems (process);
6720 6801
6721 return Qnil; 6802 return Qnil;
@@ -6745,8 +6826,8 @@ suppressed. */)
6745 CHECK_PROCESS (process); 6826 CHECK_PROCESS (process);
6746 p = XPROCESS (process); 6827 p = XPROCESS (process);
6747 if (NILP (flag)) 6828 if (NILP (flag))
6748 PSET (p, decode_coding_system, 6829 pset_decode_coding_system
6749 raw_text_coding_system (p->decode_coding_system)); 6830 (p, raw_text_coding_system (p->decode_coding_system));
6750 setup_process_coding_systems (process); 6831 setup_process_coding_systems (process);
6751 6832
6752 return Qnil; 6833 return Qnil;