aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-14 15:36:55 +0000
committerEli Zaretskii2008-10-14 15:36:55 +0000
commit23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87 (patch)
tree6dd3cae9d27404d8569a5dffa40605196a20316a
parentb1bad9f3d6bcc725d9727c2dc4282c6080447cbf (diff)
downloademacs-23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87.tar.gz
emacs-23dd4ecdbc2e8ec047f8eaf7b66af85e2480df87.zip
(System Processes): New section.
(Processes, Signals to Processes): Add xrefs to it.
-rw-r--r--doc/lispref/processes.texi190
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
29send input to it. 29send input to it.
30 30
31@defun processp object 31@defun processp object
32This function returns @code{t} if @var{object} is a process, 32This function returns @code{t} if @var{object} represents an Emacs
33@code{nil} otherwise. 33subprocess, @code{nil} otherwise.
34@end defun 34@end defun
35 35
36 In addition to subprocesses of the current Emacs session, you can
37also access other processes running on your machine. @xref{System
38Processes}.
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
1029The @var{process} argument can be a system process @acronym{ID}; that 1034The @var{process} argument can be a system process @acronym{ID}; that
1030allows you to send signals to processes that are not children of 1035allows you to send signals to processes that are not children of
1031Emacs. 1036Emacs. @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
1579subprocesses of the current Emacs session, Emacs Lisp programs can
1580also access other processes running on the same machine. We call
1581these @dfn{system processes}, to distinguish between them and Emacs
1582subprocesses.
1583
1584 Emacs provides several primitives for accessing system processes.
1585Not all platforms support these primitives; on those which don't,
1586these primitives return @code{nil}.
1587
1588@defun list-system-processes
1589This function returns a list of all the processes running on the
1590system. Each process is identified by its @acronym{PID}, a numerical
1591process ID that is assigned by the OS and distinguishes the process
1592from all the other processes running on the same machine at the same
1593time.
1594@end defun
1595
1596@defun system-process-attributes pid
1597This function returns an alist of attributes for the process specified
1598by its process ID @var{pid}. Each association in the alist is of the
1599form @code{(@var{key} . @var{value})}, where @var{key} designates the
1600attribute and @var{value} is the value of that attribute. The various
1601attribute @var{key}'s that this function can return are listed below.
1602Not all platforms support all of these attributes; if an attribute is
1603not supported, its association will not appear in the returned alist.
1604Values that are numbers can be either integer or floating-point,
1605depending on the magnitude of the value.
1606
1607@table @code
1608@item euid
1609The effective user ID of the user who invoked the process. The
1610corresponding @var{value} is a number. If the process was invoked by
1611the same user who runs the current Emacs session, the value is
1612identical to what @code{user-uid} returns (@pxref{User
1613Identification}).
1614
1615@item user
1616User name corresponding to the process's effective user ID, a string.
1617
1618@item egid
1619The group ID of the effective user ID, a number.
1620
1621@item group
1622Group name corresponding to the effective user's group ID, a string.
1623
1624@item comm
1625The name of the command that runs in the process. This is a string
1626that usually specifies the name of the executable file of the process,
1627without the leading directories. However, some special system
1628processes can report strings that do not correspond to an executable
1629file of a program.
1630
1631@item state
1632The state code of the process. This is a short string that encodes
1633the scheduling state of the process. Here's a list of the most
1634frequently seen codes:
1635
1636@table @code
1637@item ``D''
1638uninterruptible sleep (usually I/O)
1639@item ``R''
1640running
1641@item ``S''
1642interruptible sleep (waiting for some event)
1643@item ``T''
1644stopped, 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
1650For the full list of the possible states, see the manual page of the
1651@command{ps} command.
1652
1653@item ppid
1654The process ID of the parent process, a number.
1655
1656@item pgrp
1657The process group ID of the process, a number.
1658
1659@item sess
1660The session ID of the process. This is a number that is the process
1661ID of the process's @dfn{session leader}.
1662
1663@item ttname
1664A string that is the name of the process's controlling terminal. On
1665Unix and GNU systems, this is normally the file name of the
1666corresponding terminal device, such as @file{/dev/pts65}.
1667
1668@item tpgid
1669The numerical process group ID of the foreground process group that
1670uses the process's terminal.
1671
1672@item minflt
1673The number of minor page faults caused by the process since its
1674beginning. (Minor page faults are those that don't involve reading
1675from disk.)
1676
1677@item majflt
1678The number of major page faults caused by the process since its
1679beginning. (Major page faults require a disk to be read, and are thus
1680more expensive than minor page faults.)
1681
1682@item cminflt
1683@itemx cmajflt
1684Like @code{minflt} and @code{majflt}, but include the number of page
1685faults for all the child processes of the given process.
1686
1687@item utime
1688Time spent by the process in the user context, for running the
1689application's code. The corresponding @var{value} is in the
1690@w{@code{(@var{high} @var{low} @var{microsec})}} format, the same
1691format used by functions @code{current-time} (@pxref{Time of Day,
1692current-time}) and @code{file-attributes} (@pxref{File Attributes}).
1693
1694@item stime
1695Time spent by the process in the system (kernel) context, for
1696processing system calls. The corresponding @var{value} is in the same
1697format as for @code{utime}.
1698
1699@item cutime
1700@itemx cstime
1701Like @code{utime} and @code{stime}, but includes the times of all the
1702child processes of the given process.
1703
1704@item pri
1705The numerical priority of the process.
1706
1707@item nice
1708The @dfn{nice value} of the process, a number. Processes with smaller
1709nice value get scheduled more favorably.
1710
1711@item thcount
1712The number of threads in the process.
1713
1714@item start
1715The 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
1720The time elapsed since the process started, in the @w{@code{(@var{high}
1721@var{low} @var{microsec})}} format.
1722
1723@item vsize
1724The virtual memory size of the process, measured in kilobytes.
1725
1726@item rss
1727The size of the process's @dfn{resident set}, the number of kilobytes
1728occupied by the process in the machine's physical memory.
1729
1730@item pcpu
1731The percentage of the CPU time used by the process since it started.
1732The corresponding @var{value} is a floating-point number between 0 and
1733100.
1734
1735@item pmem
1736The percentage of the total physical memory installed on the machine
1737used by the process's resident set. The value is a floating-point
1738number between 0 and 100.
1739
1740@item args
1741The command-line with which the process was invoked. This is a string
1742in which individual command-line arguments are separated by blanks;
1743whitespace characters that are embedded in the arguments are quoted as
1744appropriate for the system's shell: escaped by backslash characters on
1745GNU and Unix, and enclosed in double quote characters on Windows.
1746Thus, this command-line string can be directly used in primitives such
1747as @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