ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/docs/libstatgrab/statgrab.xml
Revision: 1.3
Committed: Mon Jan 5 17:20:29 2004 UTC (20 years, 5 months ago) by ats
Content type: text/xml
Branch: MAIN
Changes since 1.2: +13 -4 lines
Log Message:
Replace duplicated code for dropping privileges with a library
function that always drops setuid/setgid privileges.

File Contents

# User Rev Content
1 tdb 1.1 <?xml version="1.0"?>
2    
3     <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4     "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5    
6     <refentry id="statgrab">
7    
8     <refentryinfo>
9 ats 1.3 <date>$Date: 2003/10/21 15:48:55 $</date>
10     <releaseinfo>$Id: statgrab.xml,v 1.2 2003/10/21 15:48:55 pajs Exp $</releaseinfo>
11 tdb 1.1 </refentryinfo>
12    
13     <refmeta>
14     <refentrytitle>statgrab</refentrytitle>
15     <manvolnum>3</manvolnum>
16     <refmiscinfo>i-scream</refmiscinfo>
17     </refmeta>
18    
19     <refnamediv>
20     <refname>statgrab</refname>
21     <refpurpose>get system statistics</refpurpose>
22     </refnamediv>
23    
24     <refsynopsisdiv>
25     <funcsynopsis>
26     <funcsynopsisinfo>#include &lt;statgrab.h&gt;</funcsynopsisinfo>
27    
28     <funcprototype>
29 pajs 1.2 <funcdef>int <function>statgrab_init</function></funcdef>
30     <void/>
31     </funcprototype>
32 ats 1.3 <funcprototype>
33     <funcdef>int <function>statgrab_drop_privileges</function></funcdef>
34     <void/>
35     </funcprototype>
36 pajs 1.2
37     <funcprototype>
38 tdb 1.1 <funcdef>cpu_percent_t *<function>cpu_percent_usage</function></funcdef>
39     <void/>
40     </funcprototype>
41     <funcprototype>
42     <funcdef>cpu_states_t *<function>get_cpu_totals</function></funcdef>
43     <void/>
44     </funcprototype>
45     <funcprototype>
46     <funcdef>cpu_states_t *<function>get_cpu_diff</function></funcdef>
47     <void/>
48     </funcprototype>
49    
50     <funcprototype>
51     <funcdef>diskio_stat_t *<function>get_diskio_stats</function></funcdef>
52     <paramdef>int *<parameter>entries</parameter></paramdef>
53     </funcprototype>
54     <funcprototype>
55     <funcdef>diskio_stat_t *<function>get_diskio_stats_diff</function></funcdef>
56     <paramdef>int *<parameter>entries</parameter></paramdef>
57     </funcprototype>
58    
59     <funcprototype>
60     <funcdef>general_stat_t *<function>get_general_stats</function></funcdef>
61     <void/>
62     </funcprototype>
63    
64     <funcprototype>
65     <funcdef>load_stat_t *<function>get_load_stats</function></funcdef>
66     <void/>
67     </funcprototype>
68    
69     <funcprototype>
70     <funcdef>mem_stat_t *<function>get_memory_stats</function></funcdef>
71     <void/>
72     </funcprototype>
73     <funcprototype>
74     <funcdef>swap_stat_t *<function>get_swap_stats</function></funcdef>
75     <void/>
76     </funcprototype>
77    
78     <funcprototype>
79     <funcdef>network_stat_t *<function>get_network_stats</function></funcdef>
80     <paramdef>int *<parameter>entries</parameter></paramdef>
81     </funcprototype>
82     <funcprototype>
83     <funcdef>network_stat_t *<function>get_network_stats_diff</function></funcdef>
84     <paramdef>int *<parameter>entries</parameter></paramdef>
85     </funcprototype>
86    
87     <funcprototype>
88     <funcdef>page_stat_t *<function>get_page_stats</function></funcdef>
89     <void/>
90     </funcprototype>
91     <funcprototype>
92     <funcdef>page_stat_t *<function>get_page_stats_diff</function></funcdef>
93     <void/>
94     </funcprototype>
95    
96     <funcprototype>
97     <funcdef>process_stat_t *<function>get_process_stats</function></funcdef>
98     <void/>
99     </funcprototype>
100    
101     <funcprototype>
102     <funcdef>user_stat_t *<function>get_user_stats</function></funcdef>
103     <void/>
104     </funcprototype>
105    
106     </funcsynopsis>
107     </refsynopsisdiv>
108    
109     <refsect1>
110     <title>Description</title>
111     <para>
112     The statgrab library provides a cross platform interface to getting
113     system statistics. Each of the function calls returns a structure
114     containing statistics. See the manual page for each individual
115     function for more details on usage.
116 pajs 1.2 </para>
117     <para>
118     <function>statgrab_init(void)</function> should be the first
119     function you call before you start to use libstatgrab. This
120     function on *bsd systems opens up the kernel structures and
121     leaves them open for future use. Because of this, any special
122     privileges the program has (e.g. setgid kmem) can be dropped
123     after this call, and all the libstatgrab calls should continue to
124 ats 1.3 work. It is therefore a good idea to call
125     <function>statgrab_drop_privileges</function>, which discards
126     setuid and setgid privileges, immediately after you call
127     <function>statgrab_init</function>, unless your application has
128     another reason for needing setuid or setgid privileges.
129 pajs 1.2 </para>
130     <para>
131 ats 1.3 <function>statgrab_init</function> and
132     <function>statgrab_drop_privileges</function> return 0 on success, and
133 pajs 1.2 non-zero on failure.
134 tdb 1.1 </para>
135     <para>
136     The library was originally written to support the i-scream central
137     monitoring system, but has since become a standalone package. It
138     has been ported to work on Linux, FreeBSD, and Solaris.
139     </para>
140     </refsect1>
141    
142     <refsect1>
143     <title>See Also</title>
144    
145     <simplelist type="inline">
146     <member>
147     <citerefentry>
148     <refentrytitle>cpu_percent_usage</refentrytitle>
149     <manvolnum>3</manvolnum>
150     </citerefentry>
151     <citerefentry>
152     <refentrytitle>get_diskio_stats</refentrytitle>
153     <manvolnum>3</manvolnum>
154     </citerefentry>
155     <citerefentry>
156     <refentrytitle>get_general_stats</refentrytitle>
157     <manvolnum>3</manvolnum>
158     </citerefentry>
159     <citerefentry>
160     <refentrytitle>get_load_stats</refentrytitle>
161     <manvolnum>3</manvolnum>
162     </citerefentry>
163     <citerefentry>
164     <refentrytitle>get_memory_stats</refentrytitle>
165     <manvolnum>3</manvolnum>
166     </citerefentry>
167     <citerefentry>
168     <refentrytitle>get_network_stats</refentrytitle>
169     <manvolnum>3</manvolnum>
170     </citerefentry>
171     <citerefentry>
172     <refentrytitle>get_page_stats</refentrytitle>
173     <manvolnum>3</manvolnum>
174     </citerefentry>
175     <citerefentry>
176     <refentrytitle>get_process_stats</refentrytitle>
177     <manvolnum>3</manvolnum>
178     </citerefentry>
179     <citerefentry>
180     <refentrytitle>get_user_stats</refentrytitle>
181     <manvolnum>3</manvolnum>
182     </citerefentry>
183     </member>
184     </simplelist>
185     </refsect1>
186    
187     <refsect1>
188     <title>Website</title>
189    
190     <simplelist type="vert">
191     <member>
192     <ulink url="http://www.i-scream.org">http://www.i-scream.org</ulink>
193     </member>
194     </simplelist>
195     </refsect1>
196    
197     </refentry>