diff options
| author | Eli Zaretskii | 2008-10-14 15:36:55 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-10-14 15:36:55 +0000 |
| commit | 23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87 (patch) | |
| tree | 6dd3cae9d27404d8569a5dffa40605196a20316a | |
| parent | b1bad9f3d6bcc725d9727c2dc4282c6080447cbf (diff) | |
| download | emacs-23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87.tar.gz emacs-23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87.zip | |
(System Processes): New section.
(Processes, Signals to Processes): Add xrefs to it.
| -rw-r--r-- | doc/lispref/processes.texi | 190 |
1 files changed, 187 insertions, 3 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index b3455dc9414..fb2561ea6d9 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -29,10 +29,14 @@ signals, obtain status information, receive output from the process, or | |||
| 29 | send input to it. | 29 | send input to it. |
| 30 | 30 | ||
| 31 | @defun processp object | 31 | @defun processp object |
| 32 | This function returns @code{t} if @var{object} is a process, | 32 | This function returns @code{t} if @var{object} represents an Emacs |
| 33 | @code{nil} otherwise. | 33 | subprocess, @code{nil} otherwise. |
| 34 | @end defun | 34 | @end defun |
| 35 | 35 | ||
| 36 | In addition to subprocesses of the current Emacs session, you can | ||
| 37 | also access other processes running on your machine. @xref{System | ||
| 38 | Processes}. | ||
| 39 | |||
| 36 | @menu | 40 | @menu |
| 37 | * Subprocess Creation:: Functions that start subprocesses. | 41 | * Subprocess Creation:: Functions that start subprocesses. |
| 38 | * Shell Arguments:: Quoting an argument to pass it to a shell. | 42 | * Shell Arguments:: Quoting an argument to pass it to a shell. |
| @@ -46,6 +50,7 @@ This function returns @code{t} if @var{object} is a process, | |||
| 46 | * Output from Processes:: Collecting output from an asynchronous subprocess. | 50 | * Output from Processes:: Collecting output from an asynchronous subprocess. |
| 47 | * Sentinels:: Sentinels run when process run-status changes. | 51 | * Sentinels:: Sentinels run when process run-status changes. |
| 48 | * Query Before Exit:: Whether to query if exiting will kill a process. | 52 | * Query Before Exit:: Whether to query if exiting will kill a process. |
| 53 | * System Processes:: Accessing other processes running on your system. | ||
| 49 | * Transaction Queues:: Transaction-based communication with subprocesses. | 54 | * Transaction Queues:: Transaction-based communication with subprocesses. |
| 50 | * Network:: Opening network connections. | 55 | * Network:: Opening network connections. |
| 51 | * Network Servers:: Network servers let Emacs accept net connections. | 56 | * Network Servers:: Network servers let Emacs accept net connections. |
| @@ -1028,7 +1033,7 @@ This function sends a signal to process @var{process}. The argument | |||
| 1028 | 1033 | ||
| 1029 | The @var{process} argument can be a system process @acronym{ID}; that | 1034 | The @var{process} argument can be a system process @acronym{ID}; that |
| 1030 | allows you to send signals to processes that are not children of | 1035 | allows you to send signals to processes that are not children of |
| 1031 | Emacs. | 1036 | Emacs. @xref{System Processes}. |
| 1032 | @end defun | 1037 | @end defun |
| 1033 | 1038 | ||
| 1034 | @node Output from Processes | 1039 | @node Output from Processes |
| @@ -1566,6 +1571,185 @@ is like this: | |||
| 1566 | @end smallexample | 1571 | @end smallexample |
| 1567 | @end defun | 1572 | @end defun |
| 1568 | 1573 | ||
| 1574 | @node System Processes | ||
| 1575 | @section Accessing Other Processes | ||
| 1576 | @cindex system processes | ||
| 1577 | |||
| 1578 | In addition to accessing and manipulating processes that are | ||
| 1579 | subprocesses of the current Emacs session, Emacs Lisp programs can | ||
| 1580 | also access other processes running on the same machine. We call | ||
| 1581 | these @dfn{system processes}, to distinguish between them and Emacs | ||
| 1582 | subprocesses. | ||
| 1583 | |||
| 1584 | Emacs provides several primitives for accessing system processes. | ||
| 1585 | Not all platforms support these primitives; on those which don't, | ||
| 1586 | these primitives return @code{nil}. | ||
| 1587 | |||
| 1588 | @defun list-system-processes | ||
| 1589 | This function returns a list of all the processes running on the | ||
| 1590 | system. Each process is identified by its @acronym{PID}, a numerical | ||
| 1591 | process ID that is assigned by the OS and distinguishes the process | ||
| 1592 | from all the other processes running on the same machine at the same | ||
| 1593 | time. | ||
| 1594 | @end defun | ||
| 1595 | |||
| 1596 | @defun system-process-attributes pid | ||
| 1597 | This function returns an alist of attributes for the process specified | ||
| 1598 | by its process ID @var{pid}. Each association in the alist is of the | ||
| 1599 | form @code{(@var{key} . @var{value})}, where @var{key} designates the | ||
| 1600 | attribute and @var{value} is the value of that attribute. The various | ||
| 1601 | attribute @var{key}'s that this function can return are listed below. | ||
| 1602 | Not all platforms support all of these attributes; if an attribute is | ||
| 1603 | not supported, its association will not appear in the returned alist. | ||
| 1604 | Values that are numbers can be either integer or floating-point, | ||
| 1605 | depending on the magnitude of the value. | ||
| 1606 | |||
| 1607 | @table @code | ||
| 1608 | @item euid | ||
| 1609 | The effective user ID of the user who invoked the process. The | ||
| 1610 | corresponding @var{value} is a number. If the process was invoked by | ||
| 1611 | the same user who runs the current Emacs session, the value is | ||
| 1612 | identical to what @code{user-uid} returns (@pxref{User | ||
| 1613 | Identification}). | ||
| 1614 | |||
| 1615 | @item user | ||
| 1616 | User name corresponding to the process's effective user ID, a string. | ||
| 1617 | |||
| 1618 | @item egid | ||
| 1619 | The group ID of the effective user ID, a number. | ||
| 1620 | |||
| 1621 | @item group | ||
| 1622 | Group name corresponding to the effective user's group ID, a string. | ||
| 1623 | |||
| 1624 | @item comm | ||
| 1625 | The name of the command that runs in the process. This is a string | ||
| 1626 | that usually specifies the name of the executable file of the process, | ||
| 1627 | without the leading directories. However, some special system | ||
| 1628 | processes can report strings that do not correspond to an executable | ||
| 1629 | file of a program. | ||
| 1630 | |||
| 1631 | @item state | ||
| 1632 | The state code of the process. This is a short string that encodes | ||
| 1633 | the scheduling state of the process. Here's a list of the most | ||
| 1634 | frequently seen codes: | ||
| 1635 | |||
| 1636 | @table @code | ||
| 1637 | @item ``D'' | ||
| 1638 | uninterruptible sleep (usually I/O) | ||
| 1639 | @item ``R'' | ||
| 1640 | running | ||
| 1641 | @item ``S'' | ||
| 1642 | interruptible sleep (waiting for some event) | ||
| 1643 | @item ``T'' | ||
| 1644 | stopped, e.g., by a job control signal | ||
| 1645 | @item ``Z'' | ||
| 1646 | ``zombie'': a process that terminated, but not reaped by its parent | ||
| 1647 | @end table | ||
| 1648 | |||
| 1649 | @noindent | ||
| 1650 | For the full list of the possible states, see the manual page of the | ||
| 1651 | @command{ps} command. | ||
| 1652 | |||
| 1653 | @item ppid | ||
| 1654 | The process ID of the parent process, a number. | ||
| 1655 | |||
| 1656 | @item pgrp | ||
| 1657 | The process group ID of the process, a number. | ||
| 1658 | |||
| 1659 | @item sess | ||
| 1660 | The session ID of the process. This is a number that is the process | ||
| 1661 | ID of the process's @dfn{session leader}. | ||
| 1662 | |||
| 1663 | @item ttname | ||
| 1664 | A string that is the name of the process's controlling terminal. On | ||
| 1665 | Unix and GNU systems, this is normally the file name of the | ||
| 1666 | corresponding terminal device, such as @file{/dev/pts65}. | ||
| 1667 | |||
| 1668 | @item tpgid | ||
| 1669 | The numerical process group ID of the foreground process group that | ||
| 1670 | uses the process's terminal. | ||
| 1671 | |||
| 1672 | @item minflt | ||
| 1673 | The number of minor page faults caused by the process since its | ||
| 1674 | beginning. (Minor page faults are those that don't involve reading | ||
| 1675 | from disk.) | ||
| 1676 | |||
| 1677 | @item majflt | ||
| 1678 | The number of major page faults caused by the process since its | ||
| 1679 | beginning. (Major page faults require a disk to be read, and are thus | ||
| 1680 | more expensive than minor page faults.) | ||
| 1681 | |||
| 1682 | @item cminflt | ||
| 1683 | @itemx cmajflt | ||
| 1684 | Like @code{minflt} and @code{majflt}, but include the number of page | ||
| 1685 | faults for all the child processes of the given process. | ||
| 1686 | |||
| 1687 | @item utime | ||
| 1688 | Time spent by the process in the user context, for running the | ||
| 1689 | application's code. The corresponding @var{value} is in the | ||
| 1690 | @w{@code{(@var{high} @var{low} @var{microsec})}} format, the same | ||
| 1691 | format used by functions @code{current-time} (@pxref{Time of Day, | ||
| 1692 | current-time}) and @code{file-attributes} (@pxref{File Attributes}). | ||
| 1693 | |||
| 1694 | @item stime | ||
| 1695 | Time spent by the process in the system (kernel) context, for | ||
| 1696 | processing system calls. The corresponding @var{value} is in the same | ||
| 1697 | format as for @code{utime}. | ||
| 1698 | |||
| 1699 | @item cutime | ||
| 1700 | @itemx cstime | ||
| 1701 | Like @code{utime} and @code{stime}, but includes the times of all the | ||
| 1702 | child processes of the given process. | ||
| 1703 | |||
| 1704 | @item pri | ||
| 1705 | The numerical priority of the process. | ||
| 1706 | |||
| 1707 | @item nice | ||
| 1708 | The @dfn{nice value} of the process, a number. Processes with smaller | ||
| 1709 | nice value get scheduled more favorably. | ||
| 1710 | |||
| 1711 | @item thcount | ||
| 1712 | The number of threads in the process. | ||
| 1713 | |||
| 1714 | @item start | ||
| 1715 | The time the process was started, in the @w{@code{(@var{high} | ||
| 1716 | @var{low} @var{microsec})}} format used by @code{current-time} and | ||
| 1717 | @code{file-attributes}. | ||
| 1718 | |||
| 1719 | @item etime | ||
| 1720 | The time elapsed since the process started, in the @w{@code{(@var{high} | ||
| 1721 | @var{low} @var{microsec})}} format. | ||
| 1722 | |||
| 1723 | @item vsize | ||
| 1724 | The virtual memory size of the process, measured in kilobytes. | ||
| 1725 | |||
| 1726 | @item rss | ||
| 1727 | The size of the process's @dfn{resident set}, the number of kilobytes | ||
| 1728 | occupied by the process in the machine's physical memory. | ||
| 1729 | |||
| 1730 | @item pcpu | ||
| 1731 | The percentage of the CPU time used by the process since it started. | ||
| 1732 | The corresponding @var{value} is a floating-point number between 0 and | ||
| 1733 | 100. | ||
| 1734 | |||
| 1735 | @item pmem | ||
| 1736 | The percentage of the total physical memory installed on the machine | ||
| 1737 | used by the process's resident set. The value is a floating-point | ||
| 1738 | number between 0 and 100. | ||
| 1739 | |||
| 1740 | @item args | ||
| 1741 | The command-line with which the process was invoked. This is a string | ||
| 1742 | in which individual command-line arguments are separated by blanks; | ||
| 1743 | whitespace characters that are embedded in the arguments are quoted as | ||
| 1744 | appropriate for the system's shell: escaped by backslash characters on | ||
| 1745 | GNU and Unix, and enclosed in double quote characters on Windows. | ||
| 1746 | Thus, this command-line string can be directly used in primitives such | ||
| 1747 | as @code{shell-command}. | ||
| 1748 | @end table | ||
| 1749 | |||
| 1750 | @end defun | ||
| 1751 | |||
| 1752 | |||
| 1569 | @node Transaction Queues | 1753 | @node Transaction Queues |
| 1570 | @section Transaction Queues | 1754 | @section Transaction Queues |
| 1571 | @cindex transaction queue | 1755 | @cindex transaction queue |