comparison src/process.c @ 280:7df0dd720c89 r21-0b38

Import from CVS: tag r21-0b38
author cvs
date Mon, 13 Aug 2007 10:32:22 +0200
parents 90d73dddcdc4
children c42ec1d1cded
comparison
equal deleted inserted replaced
279:c20b2fb5bb0a 280:7df0dd720c89
1146 (XLSTREAM (XPROCESS (process)->coding_instream)), 1146 (XLSTREAM (XPROCESS (process)->coding_instream)),
1147 encoding_stream_coding_system 1147 encoding_stream_coding_system
1148 (XLSTREAM (XPROCESS (process)->coding_outstream))); 1148 (XLSTREAM (XPROCESS (process)->coding_outstream)));
1149 } 1149 }
1150 1150
1151 DEFUN ("set-process-input-coding-system", 1151 DEFUN ("set-process-input-coding-system", Fset_process_input_coding_system,
1152 Fset_process_input_coding_system, 2, 2, 0, /* 1152 2, 2, 0, /*
1153 Set PROCESS's input coding system to CODESYS. 1153 Set PROCESS's input coding system to CODESYS.
1154 */ 1154 */
1155 (process, codesys)) 1155 (process, codesys))
1156 { 1156 {
1157 codesys = Fget_coding_system (codesys); 1157 codesys = Fget_coding_system (codesys);
1158 process = get_process (process); 1158 process = get_process (process);
1159 set_decoding_stream_coding_system ( XLSTREAM ( XPROCESS (process)->coding_instream ), codesys); 1159 set_decoding_stream_coding_system
1160 (XLSTREAM (XPROCESS (process)->coding_instream), codesys);
1160 return Qnil; 1161 return Qnil;
1161 } 1162 }
1162 1163
1163 DEFUN ("set-process-output-coding-system", 1164 DEFUN ("set-process-output-coding-system", Fset_process_output_coding_system,
1164 Fset_process_output_coding_system, 2, 2, 0, /* 1165 2, 2, 0, /*
1165 Set PROCESS's output coding system to CODESYS. 1166 Set PROCESS's output coding system to CODESYS.
1166 */ 1167 */
1167 (process, codesys)) 1168 (process, codesys))
1168 { 1169 {
1169 codesys = Fget_coding_system (codesys); 1170 codesys = Fget_coding_system (codesys);
1170 process = get_process (process); 1171 process = get_process (process);
1171 set_encoding_stream_coding_system 1172 set_encoding_stream_coding_system
1172 ( XLSTREAM ( XPROCESS (process)->coding_outstream), codesys); 1173 (XLSTREAM (XPROCESS (process)->coding_outstream), codesys);
1173 return Qnil; 1174 return Qnil;
1174 } 1175 }
1175 1176
1176 DEFUN ("set-process-coding-system", 1177 DEFUN ("set-process-coding-system", Fset_process_coding_system,
1177 Fset_process_coding_system, 1, 3, 0, /* 1178 1, 3, 0, /*
1178 Set coding-systems of PROCESS to DECODING and ENCODING. 1179 Set coding-systems of PROCESS to DECODING and ENCODING.
1179 */ 1180 */
1180 (process, decoding, encoding)) 1181 (process, decoding, encoding))
1181 { 1182 {
1182 if(!NILP(decoding)){ 1183 if (!NILP (decoding))
1183 Fset_process_input_coding_system(process, decoding); 1184 Fset_process_input_coding_system (process, decoding);
1184 } 1185
1185 if(!NILP(encoding)){ 1186 if (!NILP (encoding))
1186 Fset_process_output_coding_system(process, encoding); 1187 Fset_process_output_coding_system (process, encoding);
1187 } 1188
1188 return Qnil; 1189 return Qnil;
1189 } 1190 }
1190 1191
1191 #endif /* FILE_CODING */ 1192 #endif /* FILE_CODING */
1192 1193
1557 See function `interrupt-process' for more details on usage. 1558 See function `interrupt-process' for more details on usage.
1558 */ 1559 */
1559 (process, current_group)) 1560 (process, current_group))
1560 { 1561 {
1561 /* This function can GC */ 1562 /* This function can GC */
1563 #ifdef SIGKILL
1562 process_send_signal (process, SIGKILL, !NILP (current_group), 0); 1564 process_send_signal (process, SIGKILL, !NILP (current_group), 0);
1565 #else
1566 error ("kill-process: Not supported on this system");
1567 #endif
1563 return process; 1568 return process;
1564 } 1569 }
1565 1570
1566 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /* 1571 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /*
1567 Send QUIT signal to process PROCESS. May be process or name of one. 1572 Send QUIT signal to process PROCESS. May be process or name of one.
1568 See function `interrupt-process' for more details on usage. 1573 See function `interrupt-process' for more details on usage.
1569 */ 1574 */
1570 (process, current_group)) 1575 (process, current_group))
1571 { 1576 {
1572 /* This function can GC */ 1577 /* This function can GC */
1578 #ifdef SIGQUIT
1573 process_send_signal (process, SIGQUIT, !NILP (current_group), 0); 1579 process_send_signal (process, SIGQUIT, !NILP (current_group), 0);
1580 #else
1581 error ("quit-process: Not supported on this system");
1582 #endif
1574 return process; 1583 return process;
1575 } 1584 }
1576 1585
1577 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /* 1586 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /*
1578 Stop process PROCESS. May be process or name of one. 1587 Stop process PROCESS. May be process or name of one.
1612 */ 1621 */
1613 (pid, sigcode)) 1622 (pid, sigcode))
1614 { 1623 {
1615 CHECK_INT (pid); 1624 CHECK_INT (pid);
1616 1625
1617 #define handle_signal(NAME, VALUE) \
1618 else if (!strcmp ((CONST char *) name, NAME)) \
1619 XSETINT (sigcode, VALUE)
1620
1621 if (INTP (sigcode)) 1626 if (INTP (sigcode))
1622 ; 1627 ;
1623 else 1628 else
1624 { 1629 {
1625 Bufbyte *name; 1630 Bufbyte *name;
1626 1631
1627 CHECK_SYMBOL (sigcode); 1632 CHECK_SYMBOL (sigcode);
1628 name = string_data (XSYMBOL (sigcode)->name); 1633 name = string_data (XSYMBOL (sigcode)->name);
1629 1634
1635 #define handle_signal(signal) \
1636 else if (!strcmp ((CONST char *) name, #signal)) \
1637 XSETINT (sigcode, signal)
1638
1630 if (0) 1639 if (0)
1631 ; 1640 ;
1641 handle_signal (SIGINT); /* ANSI */
1642 handle_signal (SIGILL); /* ANSI */
1643 handle_signal (SIGABRT); /* ANSI */
1644 handle_signal (SIGFPE); /* ANSI */
1645 handle_signal (SIGSEGV); /* ANSI */
1646 handle_signal (SIGTERM); /* ANSI */
1647
1632 #ifdef SIGHUP 1648 #ifdef SIGHUP
1633 handle_signal ("SIGHUP", SIGHUP); 1649 handle_signal (SIGHUP); /* POSIX */
1634 #endif
1635 #ifdef SIGINT
1636 handle_signal ("SIGINT", SIGINT);
1637 #endif 1650 #endif
1638 #ifdef SIGQUIT 1651 #ifdef SIGQUIT
1639 handle_signal ("SIGQUIT", SIGQUIT); 1652 handle_signal (SIGQUIT); /* POSIX */
1640 #endif 1653 #endif
1641 #ifdef SIGILL 1654 #ifdef SIGTRAP
1642 handle_signal ("SIGILL", SIGILL); 1655 handle_signal (SIGTRAP); /* POSIX */
1643 #endif 1656 #endif
1644 #ifdef SIGABRT 1657 #ifdef SIGKILL
1645 handle_signal ("SIGABRT", SIGABRT); 1658 handle_signal (SIGKILL); /* POSIX */
1646 #endif 1659 #endif
1660 #ifdef SIGUSR1
1661 handle_signal (SIGUSR1); /* POSIX */
1662 #endif
1663 #ifdef SIGUSR2
1664 handle_signal (SIGUSR2); /* POSIX */
1665 #endif
1666 #ifdef SIGPIPE
1667 handle_signal (SIGPIPE); /* POSIX */
1668 #endif
1669 #ifdef SIGALRM
1670 handle_signal (SIGALRM); /* POSIX */
1671 #endif
1672 #ifdef SIGCHLD
1673 handle_signal (SIGCHLD); /* POSIX */
1674 #endif
1675 #ifdef SIGCONT
1676 handle_signal (SIGCONT); /* POSIX */
1677 #endif
1678 #ifdef SIGSTOP
1679 handle_signal (SIGSTOP); /* POSIX */
1680 #endif
1681 #ifdef SIGTSTP
1682 handle_signal (SIGTSTP); /* POSIX */
1683 #endif
1684 #ifdef SIGTTIN
1685 handle_signal (SIGTTIN); /* POSIX */
1686 #endif
1687 #ifdef SIGTTOU
1688 handle_signal (SIGTTOU); /* POSIX */
1689 #endif
1690
1691 #ifdef SIGBUS
1692 handle_signal (SIGBUS); /* XPG5 */
1693 #endif
1694 #ifdef SIGPOLL
1695 handle_signal (SIGPOLL); /* XPG5 */
1696 #endif
1697 #ifdef SIGPROF
1698 handle_signal (SIGPROF); /* XPG5 */
1699 #endif
1700 #ifdef SIGSYS
1701 handle_signal (SIGSYS); /* XPG5 */
1702 #endif
1703 #ifdef SIGURG
1704 handle_signal (SIGURG); /* XPG5 */
1705 #endif
1706 #ifdef SIGXCPU
1707 handle_signal (SIGXCPU); /* XPG5 */
1708 #endif
1709 #ifdef SIGXFSZ
1710 handle_signal (SIGXFSZ); /* XPG5 */
1711 #endif
1712 #ifdef SIGVTALRM
1713 handle_signal (SIGVTALRM); /* XPG5 */
1714 #endif
1715
1716 #ifdef SIGIO
1717 handle_signal (SIGIO); /* BSD 4.2 */
1718 #endif
1719 #ifdef SIGWINCH
1720 handle_signal (SIGWINCH); /* BSD 4.3 */
1721 #endif
1722
1647 #ifdef SIGEMT 1723 #ifdef SIGEMT
1648 handle_signal ("SIGEMT", SIGEMT); 1724 handle_signal (SIGEMT);
1649 #endif
1650 #ifdef SIGKILL
1651 handle_signal ("SIGKILL", SIGKILL);
1652 #endif
1653 #ifdef SIGFPE
1654 handle_signal ("SIGFPE", SIGFPE);
1655 #endif
1656 #ifdef SIGBUS
1657 handle_signal ("SIGBUS", SIGBUS);
1658 #endif
1659 #ifdef SIGSEGV
1660 handle_signal ("SIGSEGV", SIGSEGV);
1661 #endif
1662 #ifdef SIGSYS
1663 handle_signal ("SIGSYS", SIGSYS);
1664 #endif
1665 #ifdef SIGPIPE
1666 handle_signal ("SIGPIPE", SIGPIPE);
1667 #endif
1668 #ifdef SIGALRM
1669 handle_signal ("SIGALRM", SIGALRM);
1670 #endif
1671 #ifdef SIGTERM
1672 handle_signal ("SIGTERM", SIGTERM);
1673 #endif
1674 #ifdef SIGURG
1675 handle_signal ("SIGURG", SIGURG);
1676 #endif
1677 #ifdef SIGSTOP
1678 handle_signal ("SIGSTOP", SIGSTOP);
1679 #endif
1680 #ifdef SIGTSTP
1681 handle_signal ("SIGTSTP", SIGTSTP);
1682 #endif
1683 #ifdef SIGCONT
1684 handle_signal ("SIGCONT", SIGCONT);
1685 #endif
1686 #ifdef SIGCHLD
1687 handle_signal ("SIGCHLD", SIGCHLD);
1688 #endif
1689 #ifdef SIGTTIN
1690 handle_signal ("SIGTTIN", SIGTTIN);
1691 #endif
1692 #ifdef SIGTTOU
1693 handle_signal ("SIGTTOU", SIGTTOU);
1694 #endif
1695 #ifdef SIGIO
1696 handle_signal ("SIGIO", SIGIO);
1697 #endif
1698 #ifdef SIGXCPU
1699 handle_signal ("SIGXCPU", SIGXCPU);
1700 #endif
1701 #ifdef SIGXFSZ
1702 handle_signal ("SIGXFSZ", SIGXFSZ);
1703 #endif
1704 #ifdef SIGVTALRM
1705 handle_signal ("SIGVTALRM", SIGVTALRM);
1706 #endif
1707 #ifdef SIGPROF
1708 handle_signal ("SIGPROF", SIGPROF);
1709 #endif
1710 #ifdef SIGWINCH
1711 handle_signal ("SIGWINCH", SIGWINCH);
1712 #endif 1725 #endif
1713 #ifdef SIGINFO 1726 #ifdef SIGINFO
1714 handle_signal ("SIGINFO", SIGINFO); 1727 handle_signal (SIGINFO);
1715 #endif 1728 #endif
1716 #ifdef SIGUSR1 1729 #ifdef SIGHWE
1717 handle_signal ("SIGUSR1", SIGUSR1); 1730 handle_signal (SIGHWE);
1718 #endif 1731 #endif
1719 #ifdef SIGUSR2 1732 #ifdef SIGPRE
1720 handle_signal ("SIGUSR2", SIGUSR2); 1733 handle_signal (SIGPRE);
1734 #endif
1735 #ifdef SIGUME
1736 handle_signal (SIGUME);
1737 #endif
1738 #ifdef SIGDLK
1739 handle_signal (SIGDLK);
1740 #endif
1741 #ifdef SIGCPULIM
1742 handle_signal (SIGCPULIM);
1743 #endif
1744 #ifdef SIGIOT
1745 handle_signal (SIGIOT);
1746 #endif
1747 #ifdef SIGLOST
1748 handle_signal (SIGLOST);
1749 #endif
1750 #ifdef SIGSTKFLT
1751 handle_signal (SIGSTKFLT);
1752 #endif
1753 #ifdef SIGUNUSED
1754 handle_signal (SIGUNUSED);
1755 #endif
1756 #ifdef SIGDANGER
1757 handle_signal (SIGDANGER);
1758 #endif
1759 #ifdef SIGMSG
1760 handle_signal (SIGMSG);
1761 #endif
1762 #ifdef SIGSOUND
1763 handle_signal (SIGSOUND);
1764 #endif
1765 #ifdef SIGRETRACT
1766 handle_signal (SIGRETRACT);
1767 #endif
1768 #ifdef SIGGRANT
1769 handle_signal (SIGGRANT);
1770 #endif
1771 #ifdef SIGPWR
1772 handle_signal (SIGPWR);
1721 #endif 1773 #endif
1722 else 1774 else
1723 error ("Undefined signal name %s", name); 1775 error ("Undefined signal name %s", name);
1724 } 1776 }
1725 1777
1738 text to PROCESS after you call this function. 1790 text to PROCESS after you call this function.
1739 */ 1791 */
1740 (process)) 1792 (process))
1741 { 1793 {
1742 /* This function can GC */ 1794 /* This function can GC */
1743 Lisp_Object proc; 1795 Lisp_Object proc = get_process (process);
1744
1745 proc = get_process (process);
1746 1796
1747 /* Make sure the process is really alive. */ 1797 /* Make sure the process is really alive. */
1748 if (! EQ (XPROCESS (proc)->status_symbol, Qrun)) 1798 if (! EQ (XPROCESS (proc)->status_symbol, Qrun))
1749 error ("Process %s not running", XSTRING_DATA (XPROCESS (proc)->name)); 1799 error ("Process %s not running", XSTRING_DATA (XPROCESS (proc)->name));
1750 1800