Mercurial > hg > xemacs-beta
comparison src/process.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
105 | 105 |
106 /* List of process objects. */ | 106 /* List of process objects. */ |
107 Lisp_Object Vprocess_list; | 107 Lisp_Object Vprocess_list; |
108 | 108 |
109 extern Lisp_Object Vlisp_EXEC_SUFFIXES; | 109 extern Lisp_Object Vlisp_EXEC_SUFFIXES; |
110 Lisp_Object Vnull_device; | |
110 | 111 |
111 | 112 |
112 | 113 |
113 static Lisp_Object | 114 static Lisp_Object |
114 mark_process (Lisp_Object obj) | 115 mark_process (Lisp_Object obj) |
206 } | 207 } |
207 | 208 |
208 Lisp_Process * | 209 Lisp_Process * |
209 get_process_from_usid (USID usid) | 210 get_process_from_usid (USID usid) |
210 { | 211 { |
211 CONST void *vval; | 212 const void *vval; |
212 | 213 |
213 assert (usid != USID_ERROR && usid != USID_DONTHASH); | 214 assert (usid != USID_ERROR && usid != USID_DONTHASH); |
214 | 215 |
215 if (gethash ((CONST void*)usid, usid_to_process, &vval)) | 216 if (gethash ((const void*)usid, usid_to_process, &vval)) |
216 { | 217 { |
217 Lisp_Object proc; | 218 Lisp_Object proc; |
218 CVOID_TO_LISP (proc, vval); | 219 CVOID_TO_LISP (proc, vval); |
219 return XPROCESS (proc); | 220 return XPROCESS (proc); |
220 } | 221 } |
481 | 482 |
482 if (usid != USID_DONTHASH) | 483 if (usid != USID_DONTHASH) |
483 { | 484 { |
484 Lisp_Object proc = Qnil; | 485 Lisp_Object proc = Qnil; |
485 XSETPROCESS (proc, p); | 486 XSETPROCESS (proc, p); |
486 puthash ((CONST void*)usid, LISP_TO_VOID (proc), usid_to_process); | 487 puthash ((const void*)usid, LISP_TO_VOID (proc), usid_to_process); |
487 } | 488 } |
488 | 489 |
489 MAYBE_PROCMETH (init_process_io_handles, (p, in, out, flags)); | 490 MAYBE_PROCMETH (init_process_io_handles, (p, in, out, flags)); |
490 | 491 |
491 #ifdef FILE_CODING | 492 #ifdef FILE_CODING |
605 program = Fexpand_file_name (tem, Qnil); | 606 program = Fexpand_file_name (tem, Qnil); |
606 NUNGCPRO; | 607 NUNGCPRO; |
607 } | 608 } |
608 else | 609 else |
609 { | 610 { |
610 if (!NILP (Ffile_directory_p (program))) | 611 /* we still need to canonicalize it and ensure it has the proper |
611 error ("Specified program for new process is a directory"); | 612 ending, e.g. .exe */ |
612 } | 613 struct gcpro ngcpro1; |
614 | |
615 tem = Qnil; | |
616 NGCPRO1 (tem); | |
617 locate_file (list1 (build_string ("")), program, Vlisp_EXEC_SUFFIXES, | |
618 &tem, X_OK); | |
619 if (NILP (tem)) | |
620 report_file_error ("Searching for program", list1 (program)); | |
621 program = tem; | |
622 NUNGCPRO; | |
623 } | |
624 | |
625 if (!NILP (Ffile_directory_p (program))) | |
626 invalid_operation ("Specified program for new process is a directory", | |
627 program); | |
613 | 628 |
614 proc = make_process_internal (name); | 629 proc = make_process_internal (name); |
615 | 630 |
616 XPROCESS (proc)->buffer = buffer; | 631 XPROCESS (proc)->buffer = buffer; |
617 XPROCESS (proc)->command = Flist (nargs - 2, | 632 XPROCESS (proc)->command = Flist (nargs - 2, |
661 exactly like a normal process when reading and writing. Only | 676 exactly like a normal process when reading and writing. Only |
662 differences are in status display and process deletion. A network | 677 differences are in status display and process deletion. A network |
663 connection has no PID; you cannot signal it. All you can do is | 678 connection has no PID; you cannot signal it. All you can do is |
664 deactivate and close it via delete-process */ | 679 deactivate and close it via delete-process */ |
665 | 680 |
666 DEFUN ("open-network-stream-internal", Fopen_network_stream_internal, 4, 5, 0, /* | 681 DEFUN ("open-network-stream-internal", Fopen_network_stream_internal, 4, 5, |
682 0, /* | |
667 Open a TCP connection for a service to a host. | 683 Open a TCP connection for a service to a host. |
668 Return a subprocess-object to represent the connection. | 684 Return a subprocess-object to represent the connection. |
669 Input and output work as for subprocesses; `delete-process' closes it. | 685 Input and output work as for subprocesses; `delete-process' closes it. |
670 | 686 |
671 NAME is name for process. It is modified if necessary to make it unique. | 687 NAME is name for process. It is modified if necessary to make it unique. |
679 specifying a port number to connect to. | 695 specifying a port number to connect to. |
680 Fifth argument PROTOCOL is a network protocol. Currently 'tcp | 696 Fifth argument PROTOCOL is a network protocol. Currently 'tcp |
681 (Transmission Control Protocol) and 'udp (User Datagram Protocol) are | 697 (Transmission Control Protocol) and 'udp (User Datagram Protocol) are |
682 supported. When omitted, 'tcp is assumed. | 698 supported. When omitted, 'tcp is assumed. |
683 | 699 |
684 Ouput via `process-send-string' and input via buffer or filter (see | 700 Output via `process-send-string' and input via buffer or filter (see |
685 `set-process-filter') are stream-oriented. That means UDP datagrams are | 701 `set-process-filter') are stream-oriented. That means UDP datagrams are |
686 not guaranteed to be sent and received in discrete packets. (But small | 702 not guaranteed to be sent and received in discrete packets. (But small |
687 datagrams around 500 bytes that are not truncated by `process-send-string' | 703 datagrams around 500 bytes that are not truncated by `process-send-string' |
688 are usually fine.) Note further that UDP protocol does not guard against | 704 are usually fine.) Note further that UDP protocol does not guard against |
689 lost packets. | 705 lost packets. |
962 Note that START and LEN are in Bufpos's if RELOCATABLE is a buffer, | 978 Note that START and LEN are in Bufpos's if RELOCATABLE is a buffer, |
963 and in Bytecounts otherwise. */ | 979 and in Bytecounts otherwise. */ |
964 | 980 |
965 void | 981 void |
966 send_process (Lisp_Object proc, | 982 send_process (Lisp_Object proc, |
967 Lisp_Object relocatable, CONST Bufbyte *nonrelocatable, | 983 Lisp_Object relocatable, const Bufbyte *nonrelocatable, |
968 int start, int len) | 984 int start, int len) |
969 { | 985 { |
970 /* This function can GC */ | 986 /* This function can GC */ |
971 struct gcpro gcpro1, gcpro2; | 987 struct gcpro gcpro1, gcpro2; |
972 Lisp_Object lstream = Qnil; | 988 Lisp_Object lstream = Qnil; |
1071 { | 1087 { |
1072 CHECK_PROCESS (proc); | 1088 CHECK_PROCESS (proc); |
1073 return XPROCESS (proc)->filter; | 1089 return XPROCESS (proc)->filter; |
1074 } | 1090 } |
1075 | 1091 |
1076 DEFUN ("process-send-region", Fprocess_send_region, 3, 3, 0, /* | 1092 DEFUN ("process-send-region", Fprocess_send_region, 3, 4, 0, /* |
1077 Send current contents of region as input to PROCESS. | 1093 Send current contents of the region between START and END as input to PROCESS. |
1078 PROCESS may be a process name or an actual process. | 1094 PROCESS may be a process name or an actual process. |
1079 Called from program, takes three arguments, PROCESS, START and END. | 1095 BUFFER specifies the buffer to look in; if nil, the current buffer is used. |
1080 If the region is more than 500 or so characters long, | 1096 If the region is more than 500 or so characters long, |
1081 it is sent in several bunches. This may happen even for shorter regions. | 1097 it is sent in several bunches. This may happen even for shorter regions. |
1082 Output from processes can arrive in between bunches. | 1098 Output from processes can arrive in between bunches. |
1083 */ | 1099 */ |
1084 (process, start, end)) | 1100 (process, start, end, buffer)) |
1085 { | 1101 { |
1086 /* This function can GC */ | 1102 /* This function can GC */ |
1087 Lisp_Object proc = get_process (process); | 1103 Lisp_Object proc = get_process (process); |
1088 Bufpos st, en; | 1104 Bufpos st, en; |
1089 | 1105 struct buffer *buf = decode_buffer (buffer, 0); |
1090 get_buffer_range_char (current_buffer, start, end, &st, &en, 0); | 1106 |
1091 | 1107 XSETBUFFER (buffer, buf); |
1092 send_process (proc, Fcurrent_buffer (), 0, | 1108 get_buffer_range_char (buf, start, end, &st, &en, 0); |
1093 st, en - st); | 1109 |
1110 send_process (proc, buffer, 0, st, en - st); | |
1094 return Qnil; | 1111 return Qnil; |
1095 } | 1112 } |
1096 | 1113 |
1097 DEFUN ("process-send-string", Fprocess_send_string, 2, 4, 0, /* | 1114 DEFUN ("process-send-string", Fprocess_send_string, 2, 4, 0, /* |
1098 Send PROCESS the contents of STRING as input. | 1115 Send PROCESS the contents of STRING as input. |
1264 CHECK_PROCESS (proc); | 1281 CHECK_PROCESS (proc); |
1265 return XPROCESS (proc)->sentinel; | 1282 return XPROCESS (proc)->sentinel; |
1266 } | 1283 } |
1267 | 1284 |
1268 | 1285 |
1269 CONST char * | 1286 const char * |
1270 signal_name (int signum) | 1287 signal_name (int signum) |
1271 { | 1288 { |
1272 if (signum >= 0 && signum < NSIG) | 1289 if (signum >= 0 && signum < NSIG) |
1273 return (CONST char *) sys_siglist[signum]; | 1290 return (const char *) sys_siglist[signum]; |
1274 | 1291 |
1275 return (CONST char *) GETTEXT ("unknown signal"); | 1292 return (const char *) GETTEXT ("unknown signal"); |
1276 } | 1293 } |
1277 | 1294 |
1278 void | 1295 void |
1279 update_process_status (Lisp_Object p, | 1296 update_process_status (Lisp_Object p, |
1280 Lisp_Object status_symbol, | 1297 Lisp_Object status_symbol, |
1519 return make_int (XPROCESS (proc)->exit_code); | 1536 return make_int (XPROCESS (proc)->exit_code); |
1520 } | 1537 } |
1521 | 1538 |
1522 | 1539 |
1523 | 1540 |
1524 /* send a signal number SIGNO to PROCESS. | 1541 static int |
1525 CURRENT_GROUP means send to the process group that currently owns | 1542 decode_signal (Lisp_Object signal_) |
1526 the terminal being used to communicate with PROCESS. | 1543 { |
1527 This is used for various commands in shell mode. | 1544 if (INTP (signal_)) |
1528 If NOMSG is zero, insert signal-announcements into process's buffers | 1545 return XINT (signal_); |
1529 right away. | |
1530 | |
1531 If we can, we try to signal PROCESS by sending control characters | |
1532 down the pty. This allows us to signal inferiors who have changed | |
1533 their uid, for which killpg would return an EPERM error. */ | |
1534 | |
1535 static void | |
1536 process_send_signal (Lisp_Object process, int signo, | |
1537 int current_group, int nomsg) | |
1538 { | |
1539 /* This function can GC */ | |
1540 Lisp_Object proc = get_process (process); | |
1541 | |
1542 if (network_connection_p (proc)) | |
1543 error ("Network connection %s is not a subprocess", | |
1544 XSTRING_DATA (XPROCESS(proc)->name)); | |
1545 CHECK_LIVE_PROCESS (proc); | |
1546 | |
1547 MAYBE_PROCMETH (kill_child_process, (proc, signo, current_group, nomsg)); | |
1548 } | |
1549 | |
1550 DEFUN ("interrupt-process", Finterrupt_process, 0, 2, 0, /* | |
1551 Interrupt process PROCESS. May be process or name of one. | |
1552 Nil or no arg means current buffer's process. | |
1553 Second arg CURRENT-GROUP non-nil means send signal to | |
1554 the current process-group of the process's controlling terminal | |
1555 rather than to the process's own process group. | |
1556 If the process is a shell, this means interrupt current subjob | |
1557 rather than the shell. | |
1558 */ | |
1559 (process, current_group)) | |
1560 { | |
1561 /* This function can GC */ | |
1562 process_send_signal (process, SIGINT, !NILP (current_group), 0); | |
1563 return process; | |
1564 } | |
1565 | |
1566 DEFUN ("kill-process", Fkill_process, 0, 2, 0, /* | |
1567 Kill process PROCESS. May be process or name of one. | |
1568 See function `interrupt-process' for more details on usage. | |
1569 */ | |
1570 (process, current_group)) | |
1571 { | |
1572 /* This function can GC */ | |
1573 #ifdef SIGKILL | |
1574 process_send_signal (process, SIGKILL, !NILP (current_group), 0); | |
1575 #else | |
1576 error ("kill-process: Not supported on this system"); | |
1577 #endif | |
1578 return process; | |
1579 } | |
1580 | |
1581 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /* | |
1582 Send QUIT signal to process PROCESS. May be process or name of one. | |
1583 See function `interrupt-process' for more details on usage. | |
1584 */ | |
1585 (process, current_group)) | |
1586 { | |
1587 /* This function can GC */ | |
1588 #ifdef SIGQUIT | |
1589 process_send_signal (process, SIGQUIT, !NILP (current_group), 0); | |
1590 #else | |
1591 error ("quit-process: Not supported on this system"); | |
1592 #endif | |
1593 return process; | |
1594 } | |
1595 | |
1596 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /* | |
1597 Stop process PROCESS. May be process or name of one. | |
1598 See function `interrupt-process' for more details on usage. | |
1599 */ | |
1600 (process, current_group)) | |
1601 { | |
1602 /* This function can GC */ | |
1603 #ifdef SIGTSTP | |
1604 process_send_signal (process, SIGTSTP, !NILP (current_group), 0); | |
1605 #else | |
1606 error ("stop-process: Not supported on this system"); | |
1607 #endif | |
1608 return process; | |
1609 } | |
1610 | |
1611 DEFUN ("continue-process", Fcontinue_process, 0, 2, 0, /* | |
1612 Continue process PROCESS. May be process or name of one. | |
1613 See function `interrupt-process' for more details on usage. | |
1614 */ | |
1615 (process, current_group)) | |
1616 { | |
1617 /* This function can GC */ | |
1618 #ifdef SIGCONT | |
1619 process_send_signal (process, SIGCONT, !NILP (current_group), 0); | |
1620 #else | |
1621 error ("continue-process: Not supported on this system"); | |
1622 #endif | |
1623 return process; | |
1624 } | |
1625 | |
1626 DEFUN ("signal-process", Fsignal_process, 2, 2, | |
1627 "nProcess number: \nnSignal code: ", /* | |
1628 Send the process with process id PID the signal with code SIGCODE. | |
1629 PID must be an integer. The process need not be a child of this Emacs. | |
1630 SIGCODE may be an integer, or a symbol whose name is a signal name. | |
1631 */ | |
1632 (pid, sigcode)) | |
1633 { | |
1634 CHECK_INT (pid); | |
1635 | |
1636 if (INTP (sigcode)) | |
1637 ; | |
1638 else | 1546 else |
1639 { | 1547 { |
1640 Bufbyte *name; | 1548 Bufbyte *name; |
1641 | 1549 |
1642 CHECK_SYMBOL (sigcode); | 1550 CHECK_SYMBOL (signal_); |
1643 name = string_data (XSYMBOL (sigcode)->name); | 1551 name = string_data (XSYMBOL (signal_)->name); |
1644 | 1552 |
1645 #define handle_signal(signal) \ | 1553 #define handle_signal(sym) do { \ |
1646 else if (!strcmp ((CONST char *) name, #signal)) \ | 1554 if (!strcmp ((const char *) name, #sym)) \ |
1647 XSETINT (sigcode, signal) | 1555 return sym; \ |
1648 | 1556 } while (0) |
1649 if (0) | 1557 |
1650 ; | |
1651 handle_signal (SIGINT); /* ANSI */ | 1558 handle_signal (SIGINT); /* ANSI */ |
1652 handle_signal (SIGILL); /* ANSI */ | 1559 handle_signal (SIGILL); /* ANSI */ |
1653 handle_signal (SIGABRT); /* ANSI */ | 1560 handle_signal (SIGABRT); /* ANSI */ |
1654 handle_signal (SIGFPE); /* ANSI */ | 1561 handle_signal (SIGFPE); /* ANSI */ |
1655 handle_signal (SIGSEGV); /* ANSI */ | 1562 handle_signal (SIGSEGV); /* ANSI */ |
1779 handle_signal (SIGGRANT); | 1686 handle_signal (SIGGRANT); |
1780 #endif | 1687 #endif |
1781 #ifdef SIGPWR | 1688 #ifdef SIGPWR |
1782 handle_signal (SIGPWR); | 1689 handle_signal (SIGPWR); |
1783 #endif | 1690 #endif |
1784 else | |
1785 error ("Undefined signal name %s", name); | |
1786 } | |
1787 | 1691 |
1788 #undef handle_signal | 1692 #undef handle_signal |
1789 | 1693 |
1694 error ("Undefined signal name %s", name); | |
1695 return 0; /* Unreached */ | |
1696 } | |
1697 } | |
1698 | |
1699 /* Send signal number SIGNO to PROCESS. | |
1700 CURRENT-GROUP non-nil means send signal to the current | |
1701 foreground process group of the process's controlling terminal rather | |
1702 than to the process's own process group. | |
1703 This is used for various commands in shell mode. | |
1704 If NOMSG is zero, insert signal-announcements into process's buffers | |
1705 right away. | |
1706 | |
1707 If we can, we try to signal PROCESS by sending control characters | |
1708 down the pty. This allows us to signal inferiors who have changed | |
1709 their uid, for which kill() would return an EPERM error, or to | |
1710 processes running on another computer through a remote login. */ | |
1711 | |
1712 static void | |
1713 process_send_signal (Lisp_Object process, int signo, | |
1714 int current_group, int nomsg) | |
1715 { | |
1716 /* This function can GC */ | |
1717 Lisp_Object proc = get_process (process); | |
1718 | |
1719 if (network_connection_p (proc)) | |
1720 error ("Network connection %s is not a subprocess", | |
1721 XSTRING_DATA (XPROCESS(proc)->name)); | |
1722 CHECK_LIVE_PROCESS (proc); | |
1723 | |
1724 MAYBE_PROCMETH (kill_child_process, (proc, signo, current_group, nomsg)); | |
1725 } | |
1726 | |
1727 DEFUN ("process-send-signal", Fprocess_send_signal, 1, 3, 0, /* | |
1728 Send signal SIGNAL to process PROCESS. | |
1729 SIGNAL may be an integer, or a symbol naming a signal, like `SIGSEGV'. | |
1730 PROCESS may be a process, a buffer, the name of a process or buffer, or | |
1731 nil, indicating the current buffer's process. | |
1732 Third arg CURRENT-GROUP non-nil means send signal to the current | |
1733 foreground process group of the process's controlling terminal rather | |
1734 than to the process's own process group. | |
1735 If the process is a shell that supports job control, this means | |
1736 send the signal to the current subjob rather than the shell. | |
1737 */ | |
1738 (signal_, process, current_group)) | |
1739 { | |
1740 /* This function can GC */ | |
1741 process_send_signal (process, decode_signal (signal_), | |
1742 !NILP (current_group), 0); | |
1743 return process; | |
1744 } | |
1745 | |
1746 DEFUN ("interrupt-process", Finterrupt_process, 0, 2, 0, /* | |
1747 Interrupt process PROCESS. | |
1748 See function `process-send-signal' for more details on usage. | |
1749 */ | |
1750 (process, current_group)) | |
1751 { | |
1752 /* This function can GC */ | |
1753 process_send_signal (process, SIGINT, !NILP (current_group), 0); | |
1754 return process; | |
1755 } | |
1756 | |
1757 DEFUN ("kill-process", Fkill_process, 0, 2, 0, /* | |
1758 Kill process PROCESS. | |
1759 See function `process-send-signal' for more details on usage. | |
1760 */ | |
1761 (process, current_group)) | |
1762 { | |
1763 /* This function can GC */ | |
1764 #ifdef SIGKILL | |
1765 process_send_signal (process, SIGKILL, !NILP (current_group), 0); | |
1766 #else | |
1767 error ("kill-process: Not supported on this system"); | |
1768 #endif | |
1769 return process; | |
1770 } | |
1771 | |
1772 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /* | |
1773 Send QUIT signal to process PROCESS. | |
1774 See function `process-send-signal' for more details on usage. | |
1775 */ | |
1776 (process, current_group)) | |
1777 { | |
1778 /* This function can GC */ | |
1779 #ifdef SIGQUIT | |
1780 process_send_signal (process, SIGQUIT, !NILP (current_group), 0); | |
1781 #else | |
1782 error ("quit-process: Not supported on this system"); | |
1783 #endif | |
1784 return process; | |
1785 } | |
1786 | |
1787 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /* | |
1788 Stop process PROCESS. | |
1789 See function `process-send-signal' for more details on usage. | |
1790 */ | |
1791 (process, current_group)) | |
1792 { | |
1793 /* This function can GC */ | |
1794 #ifdef SIGTSTP | |
1795 process_send_signal (process, SIGTSTP, !NILP (current_group), 0); | |
1796 #else | |
1797 error ("stop-process: Not supported on this system"); | |
1798 #endif | |
1799 return process; | |
1800 } | |
1801 | |
1802 DEFUN ("continue-process", Fcontinue_process, 0, 2, 0, /* | |
1803 Continue process PROCESS. | |
1804 See function `process-send-signal' for more details on usage. | |
1805 */ | |
1806 (process, current_group)) | |
1807 { | |
1808 /* This function can GC */ | |
1809 #ifdef SIGCONT | |
1810 process_send_signal (process, SIGCONT, !NILP (current_group), 0); | |
1811 #else | |
1812 error ("continue-process: Not supported on this system"); | |
1813 #endif | |
1814 return process; | |
1815 } | |
1816 | |
1817 DEFUN ("signal-process", Fsignal_process, 2, 2, | |
1818 "nProcess number: \nnSignal code: ", /* | |
1819 Send the process with process id PID the signal with code SIGNAL. | |
1820 PID must be an integer. The process need not be a child of this Emacs. | |
1821 SIGNAL may be an integer, or a symbol naming a signal, like `SIGSEGV'. | |
1822 */ | |
1823 (pid, signal_)) | |
1824 { | |
1825 CHECK_INT (pid); | |
1826 | |
1790 return make_int (PROCMETH_OR_GIVEN (kill_process_by_pid, | 1827 return make_int (PROCMETH_OR_GIVEN (kill_process_by_pid, |
1791 (XINT (pid), XINT (sigcode)), -1)); | 1828 (XINT (pid), decode_signal (signal_)), |
1829 -1)); | |
1792 } | 1830 } |
1793 | 1831 |
1794 DEFUN ("process-send-eof", Fprocess_send_eof, 0, 1, 0, /* | 1832 DEFUN ("process-send-eof", Fprocess_send_eof, 0, 1, 0, /* |
1795 Make PROCESS see end-of-file in its input. | 1833 Make PROCESS see end-of-file in its input. |
1796 PROCESS may be a process, a buffer, the name of a process or buffer, or | 1834 PROCESS may be a process, a buffer, the name of a process or buffer, or |
1857 else | 1895 else |
1858 usid = event_stream_delete_stream_pair (p->pipe_instream, | 1896 usid = event_stream_delete_stream_pair (p->pipe_instream, |
1859 p->pipe_outstream); | 1897 p->pipe_outstream); |
1860 | 1898 |
1861 if (usid != USID_DONTHASH) | 1899 if (usid != USID_DONTHASH) |
1862 remhash ((CONST void*)usid, usid_to_process); | 1900 remhash ((const void*)usid, usid_to_process); |
1863 | 1901 |
1864 p->pipe_instream = Qnil; | 1902 p->pipe_instream = Qnil; |
1865 p->pipe_outstream = Qnil; | 1903 p->pipe_outstream = Qnil; |
1866 #ifdef FILE_CODING | 1904 #ifdef FILE_CODING |
1867 p->coding_instream = Qnil; | 1905 p->coding_instream = Qnil; |
1988 #endif /* 0 */ | 2026 #endif /* 0 */ |
1989 | 2027 |
1990 void | 2028 void |
1991 syms_of_process (void) | 2029 syms_of_process (void) |
1992 { | 2030 { |
2031 INIT_LRECORD_IMPLEMENTATION (process); | |
2032 | |
1993 defsymbol (&Qprocessp, "processp"); | 2033 defsymbol (&Qprocessp, "processp"); |
1994 defsymbol (&Qprocess_live_p, "process-live-p"); | 2034 defsymbol (&Qprocess_live_p, "process-live-p"); |
1995 defsymbol (&Qrun, "run"); | 2035 defsymbol (&Qrun, "run"); |
1996 defsymbol (&Qstop, "stop"); | 2036 defsymbol (&Qstop, "stop"); |
1997 defsymbol (&Qopen, "open"); | 2037 defsymbol (&Qopen, "open"); |
2033 DEFSUBR (Fopen_multicast_group_internal); | 2073 DEFSUBR (Fopen_multicast_group_internal); |
2034 #endif /* HAVE_MULTICAST */ | 2074 #endif /* HAVE_MULTICAST */ |
2035 #endif /* HAVE_SOCKETS */ | 2075 #endif /* HAVE_SOCKETS */ |
2036 DEFSUBR (Fprocess_send_region); | 2076 DEFSUBR (Fprocess_send_region); |
2037 DEFSUBR (Fprocess_send_string); | 2077 DEFSUBR (Fprocess_send_string); |
2078 DEFSUBR (Fprocess_send_signal); | |
2038 DEFSUBR (Finterrupt_process); | 2079 DEFSUBR (Finterrupt_process); |
2039 DEFSUBR (Fkill_process); | 2080 DEFSUBR (Fkill_process); |
2040 DEFSUBR (Fquit_process); | 2081 DEFSUBR (Fquit_process); |
2041 DEFSUBR (Fstop_process); | 2082 DEFSUBR (Fstop_process); |
2042 DEFSUBR (Fcontinue_process); | 2083 DEFSUBR (Fcontinue_process); |
2070 nil means don't delete them until `list-processes' is run. | 2111 nil means don't delete them until `list-processes' is run. |
2071 */ ); | 2112 */ ); |
2072 | 2113 |
2073 delete_exited_processes = 1; | 2114 delete_exited_processes = 1; |
2074 | 2115 |
2116 DEFVAR_CONST_LISP ("null-device", &Vnull_device /* | |
2117 Name of the null device, which differs from system to system. | |
2118 The null device is a filename that acts as a sink for arbitrary amounts of | |
2119 data, which is discarded, or as a source for a zero-length file. | |
2120 It is available on all the systems that we currently support, but with | |
2121 different names (typically either `/dev/null' or `nul'). | |
2122 | |
2123 Note that there is also a /dev/zero on most modern Unix versions (including | |
2124 Cygwin), which acts like /dev/null when used as a sink, but as a source | |
2125 it sends a non-ending stream of zero bytes. It's used most often along | |
2126 with memory-mapping. We don't provide a Lisp variable for this because | |
2127 the operations needing this are lower level than what ELisp programs | |
2128 typically do, and in any case no equivalent exists under native MS Windows. | |
2129 */ ); | |
2130 Vnull_device = build_string (NULL_DEVICE); | |
2131 | |
2075 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /* | 2132 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /* |
2076 Control type of device used to communicate with subprocesses. | 2133 Control type of device used to communicate with subprocesses. |
2077 Values are nil to use a pipe, or t or `pty' to use a pty. | 2134 Values are nil to use a pipe, or t or `pty' to use a pty. |
2078 The value has no effect if the system has no ptys or if all ptys are busy: | 2135 The value has no effect if the system has no ptys or if all ptys are busy: |
2079 then a pipe is used in any case. | 2136 then a pipe is used in any case. |