Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Process List: Libgtop Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Libgtop Reference Manual">
<link rel="up" href="libgtop-lib.html" title="Libgtop Library Reference">
<link rel="prev" href="libgtop-version.html" title="version">
<link rel="next" href="libgtop-sem-limits.html" title="sem_limits">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libgtop-Process-List.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="libgtop-lib.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libgtop-version.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libgtop-sem-limits.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libgtop-Process-List"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libgtop-Process-List.top_of_page"></a>Process List</span></h2>
<p>Process List — List running processes</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libgtop-Process-List.stability-level"></a><h2>Stability Level</h2>
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="libgtop-Process-List.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody><tr>
<td class="function_type">
<span class="returnvalue">pid_t</span> *
</td>
<td class="function_name">
<a class="link" href="libgtop-Process-List.html#glibtop-get-proclist" title="glibtop_get_proclist ()">glibtop_get_proclist</a> <span class="c_punctuation">()</span>
</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgtop-Process-List.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-ALL:CAPS" title="GLIBTOP_KERN_PROC_ALL">GLIBTOP_KERN_PROC_ALL</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-PID:CAPS" title="GLIBTOP_KERN_PROC_PID">GLIBTOP_KERN_PROC_PID</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-PGRP:CAPS" title="GLIBTOP_KERN_PROC_PGRP">GLIBTOP_KERN_PROC_PGRP</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-SESSION:CAPS" title="GLIBTOP_KERN_PROC_SESSION">GLIBTOP_KERN_PROC_SESSION</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-TTY:CAPS" title="GLIBTOP_KERN_PROC_TTY">GLIBTOP_KERN_PROC_TTY</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-UID:CAPS" title="GLIBTOP_KERN_PROC_UID">GLIBTOP_KERN_PROC_UID</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-RUID:CAPS" title="GLIBTOP_KERN_PROC_RUID">GLIBTOP_KERN_PROC_RUID</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-KERN-PROC-MASK:CAPS" title="GLIBTOP_KERN_PROC_MASK">GLIBTOP_KERN_PROC_MASK</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-EXCLUDE-IDLE:CAPS" title="GLIBTOP_EXCLUDE_IDLE">GLIBTOP_EXCLUDE_IDLE</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-EXCLUDE-SYSTEM:CAPS" title="GLIBTOP_EXCLUDE_SYSTEM">GLIBTOP_EXCLUDE_SYSTEM</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#GLIBTOP-EXCLUDE-NOTTY:CAPS" title="GLIBTOP_EXCLUDE_NOTTY">GLIBTOP_EXCLUDE_NOTTY</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="libgtop-Process-List.html#glibtop-proclist" title="struct glibtop_proclist">glibtop_proclist</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libgtop-Process-List.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glibtop/proclist.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libgtop-Process-List.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="libgtop-Process-List.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="glibtop-get-proclist"></a><h3>glibtop_get_proclist ()</h3>
<pre class="programlisting"><span class="returnvalue">pid_t</span> *
glibtop_get_proclist (<em class="parameter"><code><a class="link" href="libgtop-Process-List.html#glibtop-proclist" title="struct glibtop_proclist"><span class="type">glibtop_proclist</span></a> *buf</code></em>,
                      <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gint64"><span class="type">gint64</span></a> which</code></em>,
                      <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#gint64"><span class="type">gint64</span></a> arg</code></em>);</pre>
<div class="refsect3">
<a name="glibtop-get-proclist.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>buf</p></td>
<td class="parameter_description"><p>Extra return information, see <a class="link" href="libgtop-Process-List.html#glibtop-proclist" title="struct glibtop_proclist"><span class="type">glibtop_proclist</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>which</p></td>
<td class="parameter_description"><p>Criteria for processes in returned list.  See the <span class="type">GLIBTOP_KERN_PROC_*</span> and <span class="type">GLIBTOP_EXCLUDE_*</span> constants.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>arg</p></td>
<td class="parameter_description"><p>Extra arguments applied to <em class="parameter"><code>which</code></em>
.  Only <span class="type">GLIBTOP_KERN_PROC_*</span> constants take arguments, see each constant definition for particular <em class="parameter"><code>arg</code></em>
description.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="glibtop-get-proclist.returns"></a><h4>Returns</h4>
<p> A list of running processes or <span class="type">NULL</span> on error.  The
returned list is allocated using <code class="function">g_malloc</code> and must be
freed using <code class="function">g_free</code> to avoid a memory leak.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="libgtop-Process-List.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-ALL:CAPS"></a><h3>GLIBTOP_KERN_PROC_ALL</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_ALL		0
</pre>
<p>Return information about all processes</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-PID:CAPS"></a><h3>GLIBTOP_KERN_PROC_PID</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_PID		1
</pre>
<p>Return all processes with the pid which is passed in <em class="parameter"><code>arg</code></em>
. You can use this to find out whether some process still exists.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-PGRP:CAPS"></a><h3>GLIBTOP_KERN_PROC_PGRP</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_PGRP		2
</pre>
<p>Return all processes in the process group passed in <em class="parameter"><code>arg</code></em>
.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-SESSION:CAPS"></a><h3>GLIBTOP_KERN_PROC_SESSION</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_SESSION 3
</pre>
<p>Return all processes in the session passed in <em class="parameter"><code>arg</code></em>
.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-TTY:CAPS"></a><h3>GLIBTOP_KERN_PROC_TTY</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_TTY		4
</pre>
<p>Return all processes which have the controlling tty passed in <em class="parameter"><code>arg</code></em>

(which is interpreted as the device number).</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-UID:CAPS"></a><h3>GLIBTOP_KERN_PROC_UID</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_UID		5
</pre>
<p>Return all processes with the effective uid passed in <em class="parameter"><code>arg</code></em>
.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-RUID:CAPS"></a><h3>GLIBTOP_KERN_PROC_RUID</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_RUID		6
</pre>
<p>Return all processes with the real uid passed in <em class="parameter"><code>arg</code></em>
.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-KERN-PROC-MASK:CAPS"></a><h3>GLIBTOP_KERN_PROC_MASK</h3>
<pre class="programlisting">#define GLIBTOP_KERN_PROC_MASK		15
</pre>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-EXCLUDE-IDLE:CAPS"></a><h3>GLIBTOP_EXCLUDE_IDLE</h3>
<pre class="programlisting">#define GLIBTOP_EXCLUDE_IDLE		0x1000
</pre>
<p>Exclude idle processes.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-EXCLUDE-SYSTEM:CAPS"></a><h3>GLIBTOP_EXCLUDE_SYSTEM</h3>
<pre class="programlisting">#define GLIBTOP_EXCLUDE_SYSTEM		0x2000
</pre>
<p>Exclude system (on most UNIXes root's) processes.</p>
</div>
<hr>
<div class="refsect2">
<a name="GLIBTOP-EXCLUDE-NOTTY:CAPS"></a><h3>GLIBTOP_EXCLUDE_NOTTY</h3>
<pre class="programlisting">#define GLIBTOP_EXCLUDE_NOTTY		0x4000
</pre>
<p>Exclude processes without a controlling terminal.</p>
</div>
<hr>
<div class="refsect2">
<a name="glibtop-proclist"></a><h3>struct glibtop_proclist</h3>
<pre class="programlisting">struct glibtop_proclist {
	guint64 flags;
	guint64 number;			/* GLIBTOP_PROCLIST_NUMBER */
	guint64 total;			/* GLIBTOP_PROCLIST_TOTAL */
	guint64 size;			/* GLIBTOP_PROCLIST_SIZE */
};
</pre>
<div class="refsect3">
<a name="glibtop-proclist.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proclist.flags"></a>flags</code></em>;</p></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proclist.number"></a>number</code></em>;</p></td>
<td class="struct_member_description"><p>Number of entries in the returned list.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proclist.total"></a>total</code></em>;</p></td>
<td class="struct_member_description"><p>Total size of the returned list (this equals <em class="parameter"><code>number</code></em>
* <em class="parameter"><code>size</code></em>
).</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="/usr/share/gtk-doc/html/glibglib-Basic-Types.html#guint64"><span class="type">guint64</span></a> <em class="structfield"><code><a name="glibtop-proclist.size"></a>size</code></em>;</p></td>
<td class="struct_member_description"><p>Size of a single entry in the returned list
(this equals <span class="type">sizeof(unsigned)</span>).</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>