+/* Enumeration of and access to system processes a-la ps(1). */
+
+DEFUN ("list-system-processes", Flist_system_processes, Slist_system_processes,
+ 0, 0, 0,
+ doc: /* Return a list of numerical process IDs of all running processes.
+If this functionality is unsupported, return nil.
+
+See `process-attributes' for getting attributes of a process given its ID. */)
+ ()
+{
+ return list_system_processes ();
+}
+
+DEFUN ("process-attributes", Fprocess_attributes,
+ Sprocess_attributes, 1, 1, 0,
+ doc: /* Return attributes of the process given by its PID, a number.
+
+Value is an alist where each element is a cons cell of the form
+
+ \(KEY . VALUE)
+
+If this functionality is unsupported, the value is nil.
+
+See `list-system-processes' for getting a list of all process IDs.
+
+The KEYs of the attributes that this function may return are listed
+below, together with the type of the associated VALUE (in parentheses).
+Not all platforms support all of these attributes; unsupported
+attributes will not appear in the returned alist.
+Unless explicitly indicated otherwise, numbers can have either
+integer or floating point values.
+
+ euid -- Effective user User ID of the process (number)
+ user -- User name corresponding to euid (string)
+ egid -- Effective user Group ID of the process (number)
+ group -- Group name corresponding to egid (string)
+ comm -- Command name (executable name only) (string)
+ state -- Process state code, such as "S", "R", or "T" (string)
+ ppid -- Parent process ID (number)
+ pgrp -- Process group ID (number)
+ sess -- Session ID, i.e. process ID of session leader (number)
+ ttname -- Controlling tty name (string)
+ tpgid -- ID of foreground process group on the process's tty (number)
+ minflt -- number of minor page faults (number)
+ majflt -- number of major page faults (number)
+ cminflt -- cumulative number of minor page faults (number)
+ cmajflt -- cumulative number of major page faults (number)
+ utime -- user time used by the process, in the (HIGH LOW USEC) format
+ stime -- system time used by the process, in the (HIGH LOW USEC) format
+ time -- sum of utime and stime, in the (HIGH LOW USEC) format
+ cutime -- user time used by the process and its children, (HIGH LOW USEC)
+ cstime -- system time used by the process and its children, (HIGH LOW USEC)
+ ctime -- sum of cutime and cstime, in the (HIGH LOW USEC) format
+ pri -- priority of the process (number)
+ nice -- nice value of the process (number)
+ thcount -- process thread count (number)
+ start -- time the process started, in the (HIGH LOW USEC) format
+ vsize -- virtual memory size of the process in KB's (number)
+ rss -- resident set size of the process in KB's (number)
+ etime -- elapsed time the process is running, in (HIGH LOW USEC) format
+ pcpu -- percents of CPU time used by the process (floating-point number)
+ pmem -- percents of total physical memory used by process's resident set
+ (floating-point number)
+ args -- command line which invoked the process (string). */)
+ (pid)
+
+ Lisp_Object pid;
+{
+ return system_process_attributes (pid);
+}
+\f