Blame doc/libgtop2.info

Packit d37888
This is libgtop2.info, produced by makeinfo version 6.3 from
Packit d37888
libgtop2.texi.
Packit d37888
Packit d37888
INFO-DIR-SECTION Libraries:
Packit d37888
START-INFO-DIR-ENTRY
Packit d37888
* LibGTop2: (libgtop2).			Library to get system specific data
Packit d37888
					such as cpu and memory usage, active
Packit d37888
					processes
Packit d37888
END-INFO-DIR-ENTRY
Packit d37888
Packit d37888
This is the LibGTop Reference Manual version 2.38.0 (last modified 27
Packit d37888
November 2016).
Packit d37888
Packit d37888
   Copyright 1999 Free Software Foundation, Inc.
Packit d37888
Packit d37888
   Permission is granted to make and distribute verbatim copies of this
Packit d37888
manual provided the copyright notice and this permission notice are
Packit d37888
preserved on all copies.
Packit d37888
Packit d37888
   Permission is granted to copy and distribute modified versions of
Packit d37888
this manual under the conditions for verbatim copying, provided also
Packit d37888
that the sections entitled "Copying" and "GNU General Public License"
Packit d37888
are included exactly as in the original, and provided that the entire
Packit d37888
resulting derived work is distributed under the terms of a permission
Packit d37888
notice identical to this one.
Packit d37888
Packit d37888
   Permission is granted to copy and distribute translations of this
Packit d37888
manual into another language, under the above conditions for modified
Packit d37888
versions, except that this permission notice may be stated in a
Packit d37888
translation approved by the Free Software Foundation.
Packit d37888
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Top,  Next: About,  Prev: (dir),  Up: (dir)
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* About::                       About LibGTop
Packit d37888
* White Paper::                 LibGTop White Paper
Packit d37888
* Reference Manual::            LibGTop Reference Manual
Packit d37888
Packit d37888
 -- The Detailed Node Listing --
Packit d37888
Packit d37888
About LibGTop
Packit d37888
Packit d37888
* Availability::                Where to get LibGTop
Packit d37888
* Supported Platforms::         Supported Platforms
Packit d37888
* Mailing List::                Helping with LibGTop development
Packit d37888
* Thanks::                      People who contributed to LibGTop
Packit d37888
Packit d37888
LibGTop White Paper
Packit d37888
Packit d37888
* Introduction::                Introduction
Packit d37888
* Overview::                    Overview
Packit d37888
Packit d37888
Overview
Packit d37888
Packit d37888
* Interface Design::            Things that need to be considered
Packit d37888
* Server Implementation::       The LibGTop "server"
Packit d37888
Packit d37888
LibGTop Reference Manual
Packit d37888
Packit d37888
* System Dependent::            System Dependent Functions.
Packit d37888
* Common Functions::            Common Functions.
Packit d37888
* Library Functions::           Library Functions.
Packit d37888
Packit d37888
System Dependent Functions
Packit d37888
Packit d37888
* glibtop_cpu::                 CPU Usage.
Packit d37888
* glibtop_mem::                 Memory Usage.
Packit d37888
* glibtop_swap::                Swap Usage.
Packit d37888
* glibtop_uptime::              System Uptime.
Packit d37888
* glibtop_loadavg::             Load Average.
Packit d37888
* glibtop_proclist::            Process List.
Packit d37888
* glibtop_proc_state::          Process State.
Packit d37888
* glibtop_proc_uid::            Process UID and TTY Information.
Packit d37888
* glibtop_proc_mem::            Process Memory Information.
Packit d37888
* glibtop_proc_time::           Process Time Information.
Packit d37888
* glibtop_proc_signal::         Process Signal Information.
Packit d37888
* glibtop_proc_kernel::         Process Kernel Data Information.
Packit d37888
* glibtop_proc_segment::        Process Segment Information.
Packit d37888
* glibtop_proc_args::           Process Arguments.
Packit d37888
* glibtop_proc_map::            Process Memory Maps.
Packit d37888
* glibtop_netload::             Network Load.
Packit d37888
* glibtop_ppp::                 PPP Usage.
Packit d37888
Packit d37888
Common Functions
Packit d37888
Packit d37888
* glibtop_mountlist::           Mount List.
Packit d37888
* glibtop_fsusage::             File System Usage.
Packit d37888
Packit d37888
Library Functions
Packit d37888
Packit d37888
* glibtop_init::                Server Initialization.
Packit d37888
* glibtop_sysdeps::             Server Sysdeps.
Packit d37888
* Library Parameters::          Library Parameters.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: About,  Next: White Paper,  Prev: Top,  Up: Top
Packit d37888
Packit d37888
1 About LibGTop
Packit d37888
***************
Packit d37888
Packit d37888
LibGTop is a library to get system specific data such as CPU and Memory
Packit d37888
Usage and information about running Processes.
Packit d37888
Packit d37888
   On Systems like Solaris or Digital Unix where you need special
Packit d37888
privileges to get those data, it uses a setuid/setgid server to do so.
Packit d37888
Packit d37888
   Even if LibGTop is a part of the GNOME desktop environment
Packit d37888
(<http://www.gnome.org>), the main interface of LibGTop is totally
Packit d37888
independent from any particular desktop environment, so you can also use
Packit d37888
it as a standalone library in any piece of GPLed software.
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* Availability::                Where to get LibGTop
Packit d37888
* Supported Platforms::         Supported Platforms
Packit d37888
* Mailing List::                Helping with LibGTop development
Packit d37888
* Thanks::                      People who contributed to LibGTop
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Availability,  Next: Supported Platforms,  Prev: About,  Up: About
Packit d37888
Packit d37888
1.1 Availability
Packit d37888
================
Packit d37888
Packit d37888
The master source of LibGTop is the GNOME CVS tree (see
Packit d37888
<http://www.gnome.org> for details), but you can also get the latest
Packit d37888
release tarballs from
Packit d37888
Packit d37888
     <ftp://ftp.gnome.org/pub/GNOME/sources/libgtop/>
Packit d37888
Packit d37888
or any of its mirror sites.
Packit d37888
Packit d37888
   The latest stable version of LibGTop is 1.0.12 which is also the one
Packit d37888
that comes together with GNOME 1.0.  It belongs to 'LIBGTOP_STABLE_1_0'
Packit d37888
branch in CVS. Actual development occurs in the 'libgtop-GNOME-2-0-port'
Packit d37888
which is currently versioned 1.90.0.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Supported Platforms,  Next: Mailing List,  Prev: Availability,  Up: About
Packit d37888
Packit d37888
1.2 Supported Platforms
Packit d37888
=======================
Packit d37888
Packit d37888
The stable branch currently supports the following platforms:
Packit d37888
Packit d37888
   * All versions of Linux
Packit d37888
Packit d37888
     LibGTop was tested under Linux 2.0.x and 2.2.x on the ix86 and the
Packit d37888
     alpha, but it should also work without problems on SparcLinux or
Packit d37888
     Linux 2.4.x.
Packit d37888
Packit d37888
     Note: I'm speaking of the Linux kernel here, not the GNU/Linux
Packit d37888
     operating system.
Packit d37888
Packit d37888
   * FreeBSD, NetBSD and OpenBSD
Packit d37888
Packit d37888
     LibGTop was tested under FreeBSD 2.2.6 and 3.0, NetBSD 1.3.2 and
Packit d37888
     OpenBSD 2.4.  Support for NetBSD 1.4 was added in LibGTop 1.0.2.
Packit d37888
Packit d37888
   The platforms listed above are known to be stable and working.
Packit d37888
However, if you're using the latest development version, you can use it
Packit d37888
on the following platforms as well:
Packit d37888
Packit d37888
   * BSD/OS
Packit d37888
Packit d37888
     There is a port for BSD/OS (aka BSDI) 2.x and 3.x from Timur
Packit d37888
     Bakeyev which should also work with 4.x.  This isn't tested very
Packit d37888
     well, but it should be working.
Packit d37888
Packit d37888
   * Digital Unix
Packit d37888
Packit d37888
     There is some basic support for Digital Unix (formerly DEC OSF/1)
Packit d37888
     V3.2C, but this may still be a bit unstable.  I'm currently working
Packit d37888
     on this port as time permits so it should be fully supported soon.
Packit d37888
Packit d37888
   * Solaris
Packit d37888
Packit d37888
     The Solaris port currently works on Solaris 7 and maybe also on
Packit d37888
     other releases.  Thanks a lot to Drazen Kacar and everyone who
Packit d37888
     helped working on this port.  They have really done excellent work
Packit d37888
     here and I'm pretty sure that this port will be fully functional on
Packit d37888
     most Solaris versions in near future.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Mailing List,  Next: Thanks,  Prev: Supported Platforms,  Up: About
Packit d37888
Packit d37888
1.3 Mailing List
Packit d37888
================
Packit d37888
Packit d37888
There is a <libgtop-devel-list@egroups.com> mailing list for people who
Packit d37888
want to help with the development of LibGTop.
Packit d37888
Packit d37888
   It is meant as a low-traffic, but high content-list where we can
Packit d37888
discuss technical details such as adding new sysdeps ports etc.
Packit d37888
Packit d37888
   Especially, I'd like to see people with a deeper knowledge of
Packit d37888
operating systems internals joining my list so we can discuss technical
Packit d37888
details of the sysdeps code.
Packit d37888
Packit d37888
   It is *not* for users that want to know how to compile LibGTop etc.
Packit d37888
Packit d37888
   You can subscribe to this mailing list and view the mailing list
Packit d37888
archives on the LibGTop Page at
Packit d37888
<http://www.home-of-linux.org/gnome/libgtop>.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Thanks,  Prev: Mailing List,  Up: About
Packit d37888
Packit d37888
1.4 Thanks
Packit d37888
==========
Packit d37888
Packit d37888
At the place I'd like to thank the following people who contributed to
Packit d37888
LibGTop (listed in chronological order):
Packit d37888
Packit d37888
   * Sebastian Wilhelmi who had the initial idea of LibGTop and helped
Packit d37888
     me a lot in the early beginning.
Packit d37888
   * Josh Sled for the initial FreeBSD port.
Packit d37888
   * Jeremy Lea for his BSD patches.
Packit d37888
   * Timur Bakeyev for the BSDI port.
Packit d37888
   * Drazen Kacar and the other people on the LibGTop development
Packit d37888
     mailing list for the Solaris port.
Packit d37888
   * Kevin Vandersloot for the effort to port to GNOME 2.0.
Packit d37888
   * All people sending me patches, having good ideas, ...
Packit d37888
   * Everyone I have forgotten in this list ...
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: White Paper,  Next: Reference Manual,  Prev: About,  Up: Top
Packit d37888
Packit d37888
2 LibGTop White Paper
Packit d37888
*********************
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* Introduction::                Introduction
Packit d37888
* Overview::                    Overview
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Introduction,  Next: Overview,  Prev: White Paper,  Up: White Paper
Packit d37888
Packit d37888
2.1 Introduction
Packit d37888
================
Packit d37888
Packit d37888
Many modern UNIX systems like Solaris, BSD or Digitial Unix only allow
Packit d37888
priviledged processes to read information like CPU and Memory Usage or
Packit d37888
information about running processes.
Packit d37888
Packit d37888
   * BSD, for instance, doesn't have any other way to get those data
Packit d37888
     than reading directly from '/dev/kmem' and you need to be in the
Packit d37888
     'kmem' group to be able to read this.
Packit d37888
Packit d37888
   * Other systems, like Digital Unix, allow all users to get things
Packit d37888
     like CPU and Memory statistics, but only root may read information
Packit d37888
     about any process other than the current one (you may not even get
Packit d37888
     information about your own processes if you're not root).
Packit d37888
Packit d37888
   * Linux has a very nice '/proc' filesystem, but reading and parsing
Packit d37888
     '/proc' is very slow and inefficient.
Packit d37888
Packit d37888
   * Solaris is a bit better, but you still need to be in the 'sys'
Packit d37888
     group or even root to get some data.
Packit d37888
Packit d37888
   Because of this system utilities like 'ps', 'uptime' or 'top' often
Packit d37888
are setgid kmem or setuid root.  Usually, they're also very specific to
Packit d37888
the system they're written for and not easily portable to other systems
Packit d37888
without a lot of work.
Packit d37888
Packit d37888
   This, of cause, becomes a problem for graphical tools like 'gtop' -
Packit d37888
making a GTK+ program setgid or even setuid would be a security hole as
Packit d37888
big as you can drive the entire X11 source code through.  For the GNOME
Packit d37888
project, we also needed some kind of library which provides all the
Packit d37888
required information in a portable since there's more than just one
Packit d37888
single program that wants to use them - for instance 'gtop' and the
Packit d37888
'multiload', 'cpumemusage' and 'netload' panel applets.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Overview,  Prev: Introduction,  Up: White Paper
Packit d37888
Packit d37888
2.2 Overview
Packit d37888
============
Packit d37888
Packit d37888
This section should give you a short overview on how LibGTop was
Packit d37888
developed, which things needed to be considered and how it works.
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* Interface Design::            Things that need to be considered
Packit d37888
* Server Implementation::       The LibGTop "server"
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Interface Design,  Next: Server Implementation,  Prev: Overview,  Up: Overview
Packit d37888
Packit d37888
2.2.1 Interface Design
Packit d37888
----------------------
Packit d37888
Packit d37888
At the very beginning, it was necessary to collect all the data the
Packit d37888
library part should provide and put them into some C structures.  This
Packit d37888
was not that easiy as it might sound since LibGTop should be portable to
Packit d37888
any modern UNIX system with a common library part on all those systems,
Packit d37888
but the data that should be returned vary from system to system.  For
Packit d37888
instance some systems support shared memory, but some others may not.
Packit d37888
Packit d37888
   The header files where we define these C structures (which are
Packit d37888
system-independent) are shared between client and server.  This way we
Packit d37888
can call the system dependent code directly where we do not need any
Packit d37888
special privileges to do so.
Packit d37888
Packit d37888
   All of those structures contain a 'flags' member which is interpreted
Packit d37888
as a bit mask and tells the caller of the library functions which of the
Packit d37888
fields in the returned structure are valid and which are not.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Server Implementation,  Prev: Interface Design,  Up: Overview
Packit d37888
Packit d37888
2.2.2 Server Implementation
Packit d37888
---------------------------
Packit d37888
Packit d37888
The LibGTop "server" is a setgid/setuid binary which contains all the
Packit d37888
system dependent code which needs special privileges.  It is only build
Packit d37888
if it's required on the current system (for instance, the Linux kernel
Packit d37888
provides all the required data via its '/proc' filesystem so we do not
Packit d37888
need the server at all) and it only contains the "features" which need
Packit d37888
privileges.
Packit d37888
Packit d37888
   Whenever we do not need any privileges to get all the data for some
Packit d37888
of the requested structures (here called "features") the library calls
Packit d37888
the sysdeps code directly rather than using the server.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Reference Manual,  Prev: White Paper,  Up: Top
Packit d37888
Packit d37888
3 LibGTop Reference Manual
Packit d37888
**************************
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* System Dependent::            System Dependent Functions.
Packit d37888
* Common Functions::            Common Functions.
Packit d37888
* Library Functions::           Library Functions.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: System Dependent,  Next: Common Functions,  Prev: Reference Manual,  Up: Reference Manual
Packit d37888
Packit d37888
3.1 System Dependent Functions
Packit d37888
==============================
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* glibtop_cpu::                 CPU Usage.
Packit d37888
* glibtop_mem::                 Memory Usage.
Packit d37888
* glibtop_swap::                Swap Usage.
Packit d37888
* glibtop_uptime::              System Uptime.
Packit d37888
* glibtop_loadavg::             Load Average.
Packit d37888
* glibtop_proclist::            Process List.
Packit d37888
* glibtop_proc_state::          Process State.
Packit d37888
* glibtop_proc_uid::            Process UID and TTY Information.
Packit d37888
* glibtop_proc_mem::            Process Memory Information.
Packit d37888
* glibtop_proc_time::           Process Time Information.
Packit d37888
* glibtop_proc_signal::         Process Signal Information.
Packit d37888
* glibtop_proc_kernel::         Process Kernel Data Information.
Packit d37888
* glibtop_proc_segment::        Process Segment Information.
Packit d37888
* glibtop_proc_args::           Process Arguments.
Packit d37888
* glibtop_proc_map::            Process Memory Maps.
Packit d37888
* glibtop_netload::             Network Load.
Packit d37888
* glibtop_ppp::                 PPP Usage.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_cpu,  Next: glibtop_mem,  Prev: System Dependent,  Up: System Dependent
Packit d37888
Packit d37888
3.1.1 CPU Usage
Packit d37888
---------------
Packit d37888
Packit d37888
Library function 'glibtop_get_cpu':
Packit d37888
Packit d37888
     void glibtop_get_cpu (glibtop_cpu *buf);
Packit d37888
     void glibtop_get_cpu_l (glibtop *server, glibtop_cpu *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_cpu' in '<glibtop/cpu.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_cpu     glibtop_cpu;
Packit d37888
Packit d37888
     struct _glibtop_cpu
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             total,
Packit d37888
             user,
Packit d37888
             nice,
Packit d37888
             sys,
Packit d37888
             idle,
Packit d37888
             iowait,
Packit d37888
             irq,
Packit d37888
             softirq,
Packit d37888
             frequency,
Packit d37888
             xcpu_total [GLIBTOP_NCPU],
Packit d37888
             xcpu_user [GLIBTOP_NCPU],
Packit d37888
             xcpu_nice [GLIBTOP_NCPU],
Packit d37888
             xcpu_sys  [GLIBTOP_NCPU],
Packit d37888
             xcpu_idle [GLIBTOP_NCPU],
Packit d37888
             xcpu_iowait [GLIBTOP_NCPU],
Packit d37888
             xcpu_irq [GLIBTOP_NCPU],
Packit d37888
             xcpu_softirq [GLIBTOP_NCPU],
Packit d37888
             xcpu_flags;
Packit d37888
     };
Packit d37888
Packit d37888
   All CPU units are measured in "jiffies" which are normally 1/100th of
Packit d37888
a second (in which case 'frequency' equals 100), but can also be in any
Packit d37888
other unit.  To get seconds, divide them by 'frequency'.
Packit d37888
Packit d37888
'total'
Packit d37888
     Number of clock ticks since system boot.
Packit d37888
Packit d37888
'user'
Packit d37888
     Number of clock ticks the system spent in user mode.
Packit d37888
Packit d37888
'nice'
Packit d37888
     Number of clock ticks the system spent in user mode (nice).
Packit d37888
Packit d37888
'sys'
Packit d37888
     Number of clock ticks the system spent in system mode.
Packit d37888
Packit d37888
'idle'
Packit d37888
     Number of clock ticks the system spent in the idle task.
Packit d37888
Packit d37888
'iowait'
Packit d37888
     Number of clock ticks the system spent waiting for I/O to complete.
Packit d37888
Packit d37888
'irq'
Packit d37888
     Number of clock ticks the system spent servicing interrupts.
Packit d37888
Packit d37888
'softirq'
Packit d37888
     Number of clock ticks the system spent servicing softirqs.
Packit d37888
Packit d37888
'frequency'
Packit d37888
     Tick frequency (default is 100).
Packit d37888
Packit d37888
   The 'xcpu_' values are for SMP systems - they are the same than
Packit d37888
'total', 'user', 'nice', 'sys', 'idle', 'iowait', 'irq' and 'softirq'
Packit d37888
except that they are arrays of 'GLIBTOP_NCPU' (defined in
Packit d37888
'<glibtop/cpu.h>') elements and contain one value for each CPU in the
Packit d37888
system.
Packit d37888
Packit d37888
'xcpu_flags'
Packit d37888
     This is interpreted as a bit-field: on systems like Solaris, not
Packit d37888
     all CPUs need to be running all the time, so we set the
Packit d37888
     corresponding bit for each CPU that is currently running.
Packit d37888
Packit d37888
   Please note that all of the cpu values are absolute values measured
Packit d37888
in certain units (to get seconds, divide them by 'frequency') since
Packit d37888
system boot.  To get percentual values, you need to call 'glibtop_cpu',
Packit d37888
save the result, wait some time and then call it again and divide the
Packit d37888
differences of the two values by the time you have waited.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_mem,  Next: glibtop_swap,  Prev: glibtop_cpu,  Up: System Dependent
Packit d37888
Packit d37888
3.1.2 Memory Usage
Packit d37888
------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_mem':
Packit d37888
Packit d37888
     void glibtop_get_mem (glibtop_mem *buf);
Packit d37888
     void glibtop_get_mem_l (glibtop *server, glibtop_mem *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_mem' in '<glibtop/mem.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_mem     glibtop_mem;
Packit d37888
Packit d37888
     struct _glibtop_mem
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             total,
Packit d37888
             used,
Packit d37888
             free,
Packit d37888
             shared,
Packit d37888
             buffer,
Packit d37888
             cached,
Packit d37888
             user,
Packit d37888
             locked;
Packit d37888
     };
Packit d37888
Packit d37888
   Unless explicitly stated otherwise, all memory units are in bytes.
Packit d37888
Packit d37888
'total'
Packit d37888
     Total physical memory.
Packit d37888
Packit d37888
'used'
Packit d37888
     Used memory size.
Packit d37888
Packit d37888
'free'
Packit d37888
     Free memory size.
Packit d37888
Packit d37888
'shared'
Packit d37888
     Shared memory size.
Packit d37888
Packit d37888
     This are both segments that are 'mmap()'ed with 'MAP_SHARED' and
Packit d37888
     IPC Shared Memory segments.
Packit d37888
Packit d37888
'buffer'
Packit d37888
     Size of buffers.
Packit d37888
Packit d37888
'cached'
Packit d37888
     Size of cached memory.
Packit d37888
Packit d37888
'user'
Packit d37888
     Memory used from user processes.
Packit d37888
Packit d37888
     This is normally 'total - free - shared - buffer - cached'.
Packit d37888
Packit d37888
'locked'
Packit d37888
     Memory in locked segments.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_swap,  Next: glibtop_uptime,  Prev: glibtop_mem,  Up: System Dependent
Packit d37888
Packit d37888
3.1.3 Swap Usage
Packit d37888
----------------
Packit d37888
Packit d37888
Library function 'glibtop_get_swap':
Packit d37888
Packit d37888
     void glibtop_get_swap (glibtop_swap *buf);
Packit d37888
     void glibtop_get_swap_l (glibtop *server, glibtop_swap *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_swap' in '<glibtop/swap.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_swap    glibtop_swap;
Packit d37888
Packit d37888
     struct _glibtop_swap
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             total,
Packit d37888
             used,
Packit d37888
             free,
Packit d37888
             pagein,
Packit d37888
             pageout;
Packit d37888
     };
Packit d37888
Packit d37888
   The following units are in bytes.
Packit d37888
Packit d37888
'total'
Packit d37888
     Total swap space in the system.
Packit d37888
Packit d37888
'used'
Packit d37888
     Used swap space.
Packit d37888
Packit d37888
'free'
Packit d37888
     Free swap space.
Packit d37888
Packit d37888
   You can use 'pagein' and 'pageout' to get some measure about how much
Packit d37888
the system is swapping at the moment.  They're increased each time a
Packit d37888
page is swapped in or out, so you need to save this values, wait a
Packit d37888
little bit, get them again and then compare the two results to find out
Packit d37888
how much the system swapped in the meantime.
Packit d37888
Packit d37888
'pagein'
Packit d37888
     Total number of swap pages that have been brought in since system
Packit d37888
     boot
Packit d37888
Packit d37888
'pageout'
Packit d37888
     Total number of swap pages that have been brought out since system
Packit d37888
     boot
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_uptime,  Next: glibtop_loadavg,  Prev: glibtop_swap,  Up: System Dependent
Packit d37888
Packit d37888
3.1.4 Uptime
Packit d37888
------------
Packit d37888
Packit d37888
Library function 'glibtop_get_uptime':
Packit d37888
Packit d37888
     void glibtop_get_uptime (glibtop_uptime *buf);
Packit d37888
     void glibtop_get_uptime_l (glibtop *server, glibtop_uptime *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_uptime' in '<glibtop/uptime.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_uptime  glibtop_uptime;
Packit d37888
Packit d37888
     struct _glibtop_uptime
Packit d37888
     {
Packit d37888
         guint64 flags;
Packit d37888
         double uptime,
Packit d37888
             idletime;
Packit d37888
         guint64 boot_time;
Packit d37888
     };
Packit d37888
Packit d37888
   When porting LibGTop to a new system, you only need to implement
Packit d37888
'uptime' and 'idletime' if there's a faster or better way to obtain them
Packit d37888
as using 'glibtop_cpu' for it.  Look at 'sysdeps/freebsd/uptime.c' for
Packit d37888
an example on how to obtain them using 'glibtop_cpu'.
Packit d37888
Packit d37888
'uptime'
Packit d37888
     Time in seconds since system boot.
Packit d37888
Packit d37888
'idletime'
Packit d37888
     Time in seconds the system spent in the idle task since system
Packit d37888
     boot.
Packit d37888
Packit d37888
   The following one was from a request on the 'linux-kernel' mailing
Packit d37888
list; on a laptop with advanced power management 'glibtop_cpu.total' may
Packit d37888
not reflect the correct boot time of the system if the power was turned
Packit d37888
off by means of APM in the meantime.
Packit d37888
Packit d37888
'boot_time'
Packit d37888
     Time of last system boot in seconds since the epoch.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_loadavg,  Next: glibtop_proclist,  Prev: glibtop_uptime,  Up: System Dependent
Packit d37888
Packit d37888
3.1.5 Load Average
Packit d37888
------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_loadavg':
Packit d37888
Packit d37888
     void glibtop_get_loadavg (glibtop_loadavg *buf);
Packit d37888
     void glibtop_get_loadavg_l (glibtop *server, glibtop_loadavg *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_loadavg' in '<glibtop/loadavg.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_loadavg glibtop_loadavg;
Packit d37888
Packit d37888
     struct _glibtop_loadavg
Packit d37888
     {
Packit d37888
         guint64 flags;
Packit d37888
         double loadavg [3];
Packit d37888
         guint64 nr_running,
Packit d37888
             nr_tasks,
Packit d37888
             last_pid;
Packit d37888
     };
Packit d37888
Packit d37888
'loadavg'
Packit d37888
Packit d37888
     Number of jobs running simultaneously averaged over 1, 5 and 15
Packit d37888
     minutes.
Packit d37888
Packit d37888
   The following fields are Linux specific and deprecated.  You don't
Packit d37888
need to implement them when porting LibGTop to a new system as they may
Packit d37888
be removed in a future version.
Packit d37888
Packit d37888
'nr_running'
Packit d37888
     Number of tasks currently running.
Packit d37888
Packit d37888
'nr_tasks'
Packit d37888
     Total number of tasks.
Packit d37888
Packit d37888
'last_pid'
Packit d37888
     Last PID.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proclist,  Next: glibtop_proc_state,  Prev: glibtop_loadavg,  Up: System Dependent
Packit d37888
Packit d37888
3.1.6 Process List
Packit d37888
------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proclist':
Packit d37888
Packit d37888
     unsigned *
Packit d37888
     glibtop_get_proclist (glibtop_proclist *buf,
Packit d37888
                           gint64 which, gint64 arg);
Packit d37888
Packit d37888
     unsigned *
Packit d37888
     glibtop_get_proclist_l (glibtop *server, glibtop_proclist *buf,
Packit d37888
                             gint64 which, gint64 arg);
Packit d37888
Packit d37888
   Constants for the 'which' argument:
Packit d37888
Packit d37888
     #define GLIBTOP_KERN_PROC_ALL           0
Packit d37888
     #define GLIBTOP_KERN_PROC_PID           1
Packit d37888
     #define GLIBTOP_KERN_PROC_PGRP          2
Packit d37888
     #define GLIBTOP_KERN_PROC_SESSION       3
Packit d37888
     #define GLIBTOP_KERN_PROC_TTY           4
Packit d37888
     #define GLIBTOP_KERN_PROC_UID           5
Packit d37888
     #define GLIBTOP_KERN_PROC_RUID          6
Packit d37888
Packit d37888
     #define GLIBTOP_KERN_PROC_MASK          15
Packit d37888
Packit d37888
     #define GLIBTOP_EXCLUDE_IDLE            0x1000
Packit d37888
     #define GLIBTOP_EXCLUDE_SYSTEM          0x2000
Packit d37888
     #define GLIBTOP_EXCLUDE_NOTTY           0x4000
Packit d37888
Packit d37888
   Declaration of 'glibtop_proclist' in '<glibtop/proclist.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proclist        glibtop_proclist;
Packit d37888
Packit d37888
     struct _glibtop_proclist
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             number,
Packit d37888
             total,
Packit d37888
             size;
Packit d37888
     };
Packit d37888
Packit d37888
   This function returns a list of all or a selected subset of all
Packit d37888
running processes.  You can use the 'which' and 'arg' arguments to
Packit d37888
specify which processes should be returned.
Packit d37888
Packit d37888
   You can use the following values for the 'which' argument:
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_ALL'
Packit d37888
     Return information about all processes (the 'arg' argument is
Packit d37888
     ignored).
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_PID'
Packit d37888
     Return information about all process with the pid PID which is
Packit d37888
     passed in 'arg'.  You can use this to find out whether some process
Packit d37888
     still exists.
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_PGRP'
Packit d37888
     Return all processes in process group PGRP which is passed in
Packit d37888
     'arg'.
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_SESSION'
Packit d37888
     Return all processes in session SESSION which is passed in 'arg'.
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_TTY'
Packit d37888
     Return all processes which have the controlling tty TTY which is
Packit d37888
     passed in 'arg' (TTY is interpreted as device number).
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_UID'
Packit d37888
     Return all processes with effective uid UID which is passed in
Packit d37888
     'arg'.
Packit d37888
Packit d37888
'GLIBTOP_KERN_PROC_RUID'
Packit d37888
     Return all processes with real uid RUID which is passed in 'arg'.
Packit d37888
Packit d37888
   You can alter the list of returned processes by using a binary OR of
Packit d37888
'which' and the following constants:
Packit d37888
Packit d37888
'GLIBTOP_EXCLUDE_IDLE'
Packit d37888
     Exclude idle processes.
Packit d37888
'GLIBTOP_EXCLUDE_SYSTEM'
Packit d37888
     Exclude system processes.
Packit d37888
'GLIBTOP_EXCLUDE_NOTTY'
Packit d37888
     Exclude processes without a controlling terminal.
Packit d37888
Packit d37888
   The return value of 'glibtop_get_proclist' is either 'NULL' on error
Packit d37888
or a 'unsigned *' list of pids.  Additionally, the following fields of
Packit d37888
'glibtop_proclist' are set:
Packit d37888
Packit d37888
'number'
Packit d37888
     Number of entries in the returned list.
Packit d37888
Packit d37888
'total'
Packit d37888
     Total size of the returned list (this equals 'number * size').
Packit d37888
Packit d37888
'size'
Packit d37888
     Size of a single entry in the returned list (this equals 'sizeof
Packit d37888
     (unsigned)').
Packit d37888
Packit d37888
   The returned list is allocated using 'g_malloc' and must be freed
Packit d37888
using 'g_free' to avoid a memory leak.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_state,  Next: glibtop_proc_uid,  Prev: glibtop_proclist,  Up: System Dependent
Packit d37888
Packit d37888
3.1.7 Process State
Packit d37888
-------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_state':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_state (glibtop_proc_state *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_state_l (glibtop *server, glibtop_proc_state *buf,
Packit d37888
                               pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_state' in '<glibtop/procstate.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_state      glibtop_proc_state;
Packit d37888
Packit d37888
     struct _glibtop_proc_state
Packit d37888
     {
Packit d37888
         guint64 flags;
Packit d37888
         char cmd[40];
Packit d37888
         char state;
Packit d37888
         int uid,
Packit d37888
             gid,
Packit d37888
             ruid,
Packit d37888
             rgid;
Packit d37888
         int has_cpu,
Packit d37888
             processor,
Packit d37888
             last_processor;
Packit d37888
Packit d37888
     };
Packit d37888
Packit d37888
'cmd'
Packit d37888
     Basename of the executable file in the call to 'exec'.
Packit d37888
'state'
Packit d37888
     Process state ('R' = running, 'S' = sleeping, 'D' =
Packit d37888
     uninterruptible, 'Z' = zombie, 'T' = stopped, 'I' = idle).
Packit d37888
Packit d37888
     This was changed to an 'unsigned' bitfield in LibGTop 1.1.x where
Packit d37888
     there are also some constants for it.
Packit d37888
Packit d37888
   When porting LibGTop, please _try hard_ to implement the following
Packit d37888
fields.  For security reasons, it is *very important* that you *only*
Packit d37888
set the 'flags' bits for those fields if their *values are correct*.
Packit d37888
Packit d37888
'uid'
Packit d37888
     Effective UID of the process.
Packit d37888
'gid'
Packit d37888
     Effective GID of the process.
Packit d37888
'ruid'
Packit d37888
     Real UID of the process.
Packit d37888
'rgid'
Packit d37888
     Read GID of the process.
Packit d37888
Packit d37888
   The following fields are for SMP systems:
Packit d37888
Packit d37888
'has_cpu'
Packit d37888
     This is either 0 or 1 depending on whether the process currently
Packit d37888
     has a CPU or not.
Packit d37888
Packit d37888
'processor'
Packit d37888
     This is the processor id of the CPU this process is currently
Packit d37888
     running on (which can be used as index in the 'xcpu_' fields of
Packit d37888
     'glibtop_cpu' for instance; since zero is a valid processor id, you
Packit d37888
     must check 'has_cpu' in this case to find out whether the process
Packit d37888
     really has a CPU).
Packit d37888
Packit d37888
'last_processor'
Packit d37888
     The is the processor id of the CPU the process was last running on.
Packit d37888
Packit d37888
'GLIBTOP_PROCESS_RUNNING'
Packit d37888
     The process is currently running.
Packit d37888
'GLIBTOP_PROCESS_INTERRUPTIBLE'
Packit d37888
     The process is currently in an interruptible sleep.
Packit d37888
'GLIBTOP_PROCESS_UNINTERRUPTIBLE'
Packit d37888
     The process is currently in uninterruptible sleep (the so-called
Packit d37888
     "disk sleep").
Packit d37888
'GLIBTOP_PROCESS_ZOMBIE'
Packit d37888
     The process is a zombie.
Packit d37888
'GLIBTOP_PROCESS_STOPPED'
Packit d37888
     The process is currently stopped (received 'SIGSTOP' or attached to
Packit d37888
     a debugger).
Packit d37888
'GLIBTOP_PROCESS_SWAPPING'
Packit d37888
     The process is currently swapping.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_uid,  Next: glibtop_proc_mem,  Prev: glibtop_proc_state,  Up: System Dependent
Packit d37888
Packit d37888
3.1.8 Process UID and TTY information
Packit d37888
-------------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_uid':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_uid (glibtop_proc_uid *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_uid_l (glibtop *server, glibtop_proc_uid *buf,
Packit d37888
                             pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_uid' in '<glibtop/procuid.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_uid        glibtop_proc_uid;
Packit d37888
Packit d37888
     struct _glibtop_proc_uid
Packit d37888
     {
Packit d37888
         guint64 flags;
Packit d37888
         int uid,
Packit d37888
             euid,
Packit d37888
             gid,
Packit d37888
             egid,
Packit d37888
             suid,
Packit d37888
             sgid,
Packit d37888
             fsuid,
Packit d37888
             fsgid,
Packit d37888
             pid,
Packit d37888
             ppid,
Packit d37888
             pgrp,
Packit d37888
             session,
Packit d37888
             tty,
Packit d37888
             tpgid,
Packit d37888
             priority,
Packit d37888
             nice,
Packit d37888
             ngroups,
Packit d37888
             groups [GLIBTOP_MAX_GROUPS];
Packit d37888
     };
Packit d37888
Packit d37888
'uid'
Packit d37888
     User ID
Packit d37888
'euid'
Packit d37888
     Effective User ID
Packit d37888
'gid'
Packit d37888
     Group ID
Packit d37888
'egid'
Packit d37888
     Effective Group ID
Packit d37888
'pid'
Packit d37888
     Process ID
Packit d37888
'ppid'
Packit d37888
     PID of parent process
Packit d37888
'pgrp'
Packit d37888
     Process group ID
Packit d37888
'session'
Packit d37888
     Session ID
Packit d37888
'tty'
Packit d37888
     Full device number of controlling terminal
Packit d37888
'tpgid'
Packit d37888
     Terminal process group ID
Packit d37888
'priority'
Packit d37888
     Kernel scheduling priority.
Packit d37888
'nice'
Packit d37888
     Standard unix nice level of process.
Packit d37888
'ngroups'
Packit d37888
     Number of additional process groups.
Packit d37888
'groups'
Packit d37888
     Array of additional process groups
Packit d37888
     ('GLIBTOP_MAX_GROUPS' is defined in '<glibtop/procuid.h>').
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_mem,  Next: glibtop_proc_time,  Prev: glibtop_proc_uid,  Up: System Dependent
Packit d37888
Packit d37888
3.1.9 Process Memory information
Packit d37888
--------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_mem':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_mem (glibtop_proc_mem *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_mem_l (glibtop *server, glibtop_proc_mem *buf,
Packit d37888
                             pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_mem' in '<glibtop/procmem.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_mem        glibtop_proc_mem;
Packit d37888
Packit d37888
     struct _glibtop_proc_mem
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             size,
Packit d37888
             vsize,
Packit d37888
             resident,
Packit d37888
             share,
Packit d37888
             rss,
Packit d37888
             rss_rlim;
Packit d37888
     };
Packit d37888
Packit d37888
'size'
Packit d37888
     Total number of pages of memory.
Packit d37888
'vsize'
Packit d37888
     Number of pages of virtual memory.
Packit d37888
'resident'
Packit d37888
     Number of residnet set (non-swapped) pages.
Packit d37888
'share'
Packit d37888
     Number of pages of shared (mmap\'d) memory.
Packit d37888
'rss'
Packit d37888
     Number of pages the process has in real memory, minus 3 for
Packit d37888
     administrative purposes.
Packit d37888
Packit d37888
     This is just the pages which count towards text, data, or stack
Packit d37888
     space.  This does not include pages which have not been
Packit d37888
     demand-loaded in, or which are swapped out.
Packit d37888
'rss_rlim'
Packit d37888
     Current limit in bytes on the rss of the process (usually
Packit d37888
     2,147,483,647).
Packit d37888
Packit d37888
   The description above is taken from the manual page of the '/proc'
Packit d37888
filesystem under Linux and is a little bit confusing, so I make this
Packit d37888
clear here.
Packit d37888
Packit d37888
   *A word for people porting LibGTop to other systems:* Every operating
Packit d37888
system has its own idea about the memory usage of a process and also
Packit d37888
system utilities like 'ps' show different things on different systems.
Packit d37888
Packit d37888
   Nevertheless, we should try to make LibGTop as system independent as
Packit d37888
possible, so I give you some hints here how 'glibtop_get_proc_mem'
Packit d37888
should work.
Packit d37888
Packit d37888
   * When you use 'mmap' with either 'MAP_SHARED' or 'MAP_PRIVATE', this
Packit d37888
     should only affect the 'vsize' of the process and none of its
Packit d37888
     'size', 'resident', 'shared' and 'rss' sizes.
Packit d37888
Packit d37888
   * As soon as you read some of the 'mmap()'ed pages, they will be
Packit d37888
     demand- oaded and thus count towards the 'size' of the process.
Packit d37888
Packit d37888
     Also - we assume there is enough free memory - they are resident in
Packit d37888
     memory until they get stolen or swapped out and thus increase the
Packit d37888
     'resident' and 'rss' sizes of the process.
Packit d37888
Packit d37888
   * If the process has used 'MAP_SHARED' and another process attaches
Packit d37888
     the same file also 'MAP_SHARED', some of the pages are shared with
Packit d37888
     this process and thus increase the 'shared' sizes of both
Packit d37888
     processes.
Packit d37888
Packit d37888
   * If the process has used 'MAP_PRIVATE' and writes to the 'mmap()'ed
Packit d37888
     pages, the only difference to reading from them is that they get
Packit d37888
     dirty and cannot be stolen any longer but will get swapped out.
Packit d37888
Packit d37888
   * When memory gets rare, clean pages are normally stolen, which
Packit d37888
     decreases the 'size', 'resident', 'shared' and 'rss' sizes of the
Packit d37888
     process.
Packit d37888
Packit d37888
   * When dirty pages are swapped out, this will not decrease the 'size'
Packit d37888
     of the process but only its 'resident' and 'rss' sizes (dirty pages
Packit d37888
     cannot be shared).
Packit d37888
Packit d37888
   * The 'vsize' of a process can _only_ be changed by the process
Packit d37888
     itself when it requests or frees memory but _never_ due to swapping
Packit d37888
     activity of the system.
Packit d37888
Packit d37888
   * If the 'shared' size changes, this _only_ means that the number of
Packit d37888
     pages that are currently shared with other processes has changed;
Packit d37888
     if this happens, this will _never_ affect any of the other sizes of
Packit d37888
     the process.
Packit d37888
Packit d37888
   The hints above describe how it works under Linux - but we should try
Packit d37888
to make 'glibtop_get_proc_mem' show the same behavior under every other
Packit d37888
system.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_time,  Next: glibtop_proc_signal,  Prev: glibtop_proc_mem,  Up: System Dependent
Packit d37888
Packit d37888
3.1.10 Process Time information
Packit d37888
-------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_time':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_time (glibtop_proc_time *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_time_l (glibtop *server, glibtop_proc_time *buf,
Packit d37888
                              pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_time' in '<glibtop/proctime.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_time       glibtop_proc_time;
Packit d37888
Packit d37888
     struct _glibtop_proc_time
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             start_time,
Packit d37888
             rtime,
Packit d37888
             utime,
Packit d37888
             stime,
Packit d37888
             cutime,
Packit d37888
             cstime,
Packit d37888
             timeout,
Packit d37888
             it_real_value,
Packit d37888
             frequency,
Packit d37888
             xcpu_utime [GLIBTOP_NCPU],
Packit d37888
             xcpu_stime [GLIBTOP_NCPU],
Packit d37888
             xcpu_flags;
Packit d37888
     };
Packit d37888
Packit d37888
'start_time'
Packit d37888
     Start time of process in seconds since the epoch
Packit d37888
'rtime'
Packit d37888
     Real time accumulated by process (should be 'utime' + 'stime')
Packit d37888
'utime'
Packit d37888
     User-mode CPU time accumulated by process
Packit d37888
'stime'
Packit d37888
     Kernel-mode CPU time accumulated by process
Packit d37888
'cutime'
Packit d37888
     Cumulative utime of process and reaped children
Packit d37888
'cstime'
Packit d37888
     Cumulative stime of process and reaped children
Packit d37888
'timeout'
Packit d37888
     The time (in jiffies) of the process's next timeout
Packit d37888
'it_real_value'
Packit d37888
     The time (in jiffies) before the next SIGALRM is sent to the
Packit d37888
     process due to an interval timer.
Packit d37888
'frequency'
Packit d37888
     Tick frequency
Packit d37888
'xcpu_utime'
Packit d37888
     SMP user-mode CPU time accumulated by process
Packit d37888
'xcpu_stime'
Packit d37888
     SMP kernel-mode CPU time accumulated by process
Packit d37888
Packit d37888
   Please note that under Linux, 'start_time' value may be strange.
Packit d37888
Linux kernel defines 'INITIAL_JIFFIES' which implies a time shift.
Packit d37888
Because 'INITIAL_JIFFIES' is not user-space defined, we cannot use it to
Packit d37888
compute accurate 'start_time'.  On Linux2.6, 'INITIAL_JIFFIES' is 300 so
Packit d37888
'start_time' is always 3s different from real start time of the given
Packit d37888
process.  You may also get shift results if your system clock is not
Packit d37888
synchronised with your hardware clock.  See 'man hwclock'.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_signal,  Next: glibtop_proc_kernel,  Prev: glibtop_proc_time,  Up: System Dependent
Packit d37888
Packit d37888
3.1.11 Process Signal information
Packit d37888
---------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_signal':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_signal (glibtop_proc_signal *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_signal_l (glibtop *server, glibtop_proc_signal *buf,
Packit d37888
                                pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_signal' in '<glibtop/procsignal.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_signal     glibtop_proc_signal;
Packit d37888
Packit d37888
     struct _glibtop_proc_signal
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             signal [2],
Packit d37888
             blocked [2],
Packit d37888
             sigignore [2],
Packit d37888
             sigcatch [2];
Packit d37888
     };
Packit d37888
Packit d37888
'signal'
Packit d37888
     Mask of pending signals
Packit d37888
'blocked'
Packit d37888
     Mask of blocked signals
Packit d37888
'sigignore'
Packit d37888
     Mask of ignored signals
Packit d37888
'sigcatch'
Packit d37888
     Mask of caught signals
Packit d37888
Packit d37888
   All signal masks are interpreted as bit mask; it is an array of two
Packit d37888
'guint64''s so we can save 128 signals there.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_kernel,  Next: glibtop_proc_segment,  Prev: glibtop_proc_signal,  Up: System Dependent
Packit d37888
Packit d37888
3.1.12 Process Kernel Data information
Packit d37888
--------------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_kernel':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_kernel (glibtop_proc_kernel *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_kernel_l (glibtop *server, glibtop_proc_kernel *buf,
Packit d37888
                                pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_kernel' in '<glibtop/prockernel.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_kernel     glibtop_proc_kernel;
Packit d37888
Packit d37888
     struct _glibtop_proc_kernel
Packit d37888
     {
Packit d37888
         guint64 flags;
Packit d37888
         guint64 k_flags,
Packit d37888
             min_flt,
Packit d37888
             maj_flt,
Packit d37888
             cmin_flt,
Packit d37888
             cmaj_flt,
Packit d37888
             kstk_esp,
Packit d37888
             kstk_eip,
Packit d37888
             nwchan;
Packit d37888
         char wchan [40];
Packit d37888
     };
Packit d37888
Packit d37888
'k_flags'
Packit d37888
     Kernel flags of the process.  See the constants defined below.
Packit d37888
'min_flt'
Packit d37888
     The number of minor faults the process has made, those which have
Packit d37888
     not required loading a memory page from disk.
Packit d37888
'maj_flt'
Packit d37888
     The number of major faults the process has made, those which have
Packit d37888
     required loading a memory page from disk.
Packit d37888
'cmin_flt'
Packit d37888
     The number of minor faults that the process and its children have
Packit d37888
     made.
Packit d37888
'cmaj_flt'
Packit d37888
     The number of major faults that the process and its children have
Packit d37888
     made.
Packit d37888
'kstk_esp'
Packit d37888
     The current value of 'esp' (32-bit stack pointer), as found in the
Packit d37888
     kernel stack page for the process.
Packit d37888
'kstk_eip'
Packit d37888
     The current 'eip' (32-bit instruction pointer).
Packit d37888
'nwchan'
Packit d37888
     This is the "channel" in which the process is waiting.  This is the
Packit d37888
     address of a system call, and can be looked up in a namelist if you
Packit d37888
     need a textual name.  (If you have an up-to-date '/etc/psdatabase',
Packit d37888
     then try 'ps -l' to see the WCHAN field in action).
Packit d37888
'wchan'
Packit d37888
     This is the textual name of the 'nwchan' field.
Packit d37888
Packit d37888
   There are some constants for the 'k_flags' field:
Packit d37888
Packit d37888
     #define GLIBTOP_KFLAGS_STARTING         1
Packit d37888
     #define GLIBTOP_KFLAGS_EXITING          2
Packit d37888
     #define GLIBTOP_KFLAGS_PTRACED          4
Packit d37888
     #define GLIBTOP_KFLAGS_TRACESYS         8
Packit d37888
     #define GLIBTOP_KFLAGS_FORKNOEXEC       16
Packit d37888
     #define GLIBTOP_KFLAGS_SUPERPRIV        32
Packit d37888
     #define GLIBTOP_KFLAGS_DUMPEDCORE       64
Packit d37888
     #define GLIBTOP_KFLAGS_SIGNALED         128
Packit d37888
Packit d37888
'GLIBTOP_KFLAGS_STARTING'
Packit d37888
     Process is being created.
Packit d37888
'GLIBTOP_KFLAGS_EXITING'
Packit d37888
     Process is exiting.
Packit d37888
'GLIBTOP_KFLAGS_PTRACED'
Packit d37888
     Process is being traced (via 'ptrace ()').
Packit d37888
'GLIBTOP_KFLAGS_TRACESYS'
Packit d37888
     Process is tracing system calls.
Packit d37888
'GLIBTOP_KFLAGS_FORKNOEXEC'
Packit d37888
     Process 'fork()'ed, but didn't 'exec()' yet.
Packit d37888
'GLIBTOP_KFLAGS_SUPERPRIV'
Packit d37888
     Process used super-user privileges.
Packit d37888
'GLIBTOP_KFLAGS_DUMPEDCORE'
Packit d37888
     Process dumped core.
Packit d37888
'GLIBTOP_KFLAGS_SIGNALED'
Packit d37888
     Process was killed by a signal.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_segment,  Next: glibtop_proc_args,  Prev: glibtop_proc_kernel,  Up: System Dependent
Packit d37888
Packit d37888
3.1.13 Process Segment information
Packit d37888
----------------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_segment':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_segment (glibtop_proc_segment *buf, pid_t pid);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_proc_segment_l (glibtop *server, glibtop_proc_segment *buf,
Packit d37888
                                 pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_segment' in '<glibtop/procsegment.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_segment    glibtop_proc_segment;
Packit d37888
Packit d37888
     struct _glibtop_proc_segment
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             text_rss,
Packit d37888
             shlib_rss,
Packit d37888
             data_rss,
Packit d37888
             stack_rss,
Packit d37888
             dirty_size,
Packit d37888
             start_code,
Packit d37888
             end_code,
Packit d37888
             start_stack;
Packit d37888
     };
Packit d37888
Packit d37888
'text_rss'
Packit d37888
     Text resident set size
Packit d37888
'shlib_rss'
Packit d37888
     Shared-Lib resident set size
Packit d37888
'data_rss'
Packit d37888
     Data resident set size
Packit d37888
'stack_rss'
Packit d37888
     Stack resident set size
Packit d37888
'dirty_size'
Packit d37888
     Total size of dirty pages
Packit d37888
'start_code'
Packit d37888
     Address of beginning of code segment
Packit d37888
'end_code'
Packit d37888
     Address of end of code segment
Packit d37888
'start_stack'
Packit d37888
     Address of the bottom of stack segmen
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_args,  Next: glibtop_proc_map,  Prev: glibtop_proc_segment,  Up: System Dependent
Packit d37888
Packit d37888
3.1.14 Process Arguments
Packit d37888
------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_args':
Packit d37888
Packit d37888
     char *
Packit d37888
     glibtop_get_proc_args(glibtop_proc_args *buf, pid_t pid,
Packit d37888
                              unsigned max_len);
Packit d37888
Packit d37888
     char *
Packit d37888
     glibtop_get_proc_args_l (glibtop *server, glibtop_proc_args *buf,
Packit d37888
                              pid_t pid, unsigned max_len);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_args' in '<glibtop/procargs.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_args       glibtop_proc_args;
Packit d37888
Packit d37888
     struct _glibtop_proc_args
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             size;
Packit d37888
     };
Packit d37888
Packit d37888
   Returns a string with all command line arguments of process 'pid' (up
Packit d37888
to 'max_len' characters, use zero to get all arguments).
Packit d37888
Packit d37888
   The command line arguments in the returned string are separated by
Packit d37888
zero bytes; the lenght of this string is returned in the 'size' field.
Packit d37888
Packit d37888
   Remember to 'g_free' the returned string to avoid a memory leak.
Packit d37888
Packit d37888
   *New functions*
Packit d37888
Packit d37888
     char **
Packit d37888
     glibtop_get_proc_argv(glibtop_proc_args *buf, pid_t pid,
Packit d37888
                              unsigned max_len);
Packit d37888
Packit d37888
     char **
Packit d37888
     glibtop_get_proc_argv_l (glibtop *server, glibtop_proc_args *buf,
Packit d37888
                              pid_t pid, unsigned max_len);
Packit d37888
Packit d37888
   Returns a NULL-terminated array of strings with all arguments of
Packit d37888
process 'pid' (up to 'max_len' characters, use zero to get all
Packit d37888
arguments).  'glibtop_get_proc_argv()' and 'glibtop_get_proc_argv_l()'
Packit d37888
are wrappers to 'glibtop_get_proc_args()' and
Packit d37888
'glibtop_get_proc_args_l()' that return process' arguments like the C
Packit d37888
'argv'.
Packit d37888
Packit d37888
   Remember to 'g_strfreev' the returned array to avoid a memory leak.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_proc_map,  Next: glibtop_netload,  Prev: glibtop_proc_args,  Up: System Dependent
Packit d37888
Packit d37888
3.1.15 Process Memory Maps
Packit d37888
--------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_proc_map':
Packit d37888
Packit d37888
     glibtop_map_entry *
Packit d37888
     glibtop_get_proc_map (glibtop_proc_map *buf, pid_t pid);
Packit d37888
Packit d37888
     glibtop_map_entry *
Packit d37888
     glibtop_get_proc_map_l (glibtop *server, glibtop_proc_map *buf,
Packit d37888
                             pid_t pid);
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_map' in '<glibtop/procmap.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_proc_map        glibtop_proc_map;
Packit d37888
Packit d37888
     struct _glibtop_proc_map
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             number,
Packit d37888
             total,
Packit d37888
             size;
Packit d37888
     };
Packit d37888
Packit d37888
   Returns a 'glibtop_map_entry *' list (which needs to be freed with
Packit d37888
'g_free') of memory maps of process 'pid'.
Packit d37888
Packit d37888
'number'
Packit d37888
     Number of entries in the returned list.
Packit d37888
Packit d37888
'total'
Packit d37888
     Total size of the returned list (this equals 'number * size').
Packit d37888
Packit d37888
'size'
Packit d37888
     Size of a single entry in the returned list (this equals 'sizeof
Packit d37888
     (glibtop_map_entry)').
Packit d37888
Packit d37888
     typedef struct _glibtop_map_entry       glibtop_map_entry;
Packit d37888
Packit d37888
     struct _glibtop_map_entry
Packit d37888
     {
Packit d37888
         guint64 flags, start, end, offset, perm, inode, device;
Packit d37888
         char filename [GLIBTOP_MAP_FILENAME_LEN+1];
Packit d37888
     };
Packit d37888
Packit d37888
   The 'flags' member is a bit field and specifies which of the other
Packit d37888
fields are valid:
Packit d37888
Packit d37888
     #define GLIBTOP_MAP_ENTRY_START         0
Packit d37888
     #define GLIBTOP_MAP_ENTRY_END           1
Packit d37888
     #define GLIBTOP_MAP_ENTRY_OFFSET        2
Packit d37888
     #define GLIBTOP_MAP_ENTRY_PERM          3
Packit d37888
     #define GLIBTOP_MAP_ENTRY_INODE         4
Packit d37888
     #define GLIBTOP_MAP_ENTRY_DEVICE        5
Packit d37888
     #define GLIBTOP_MAP_ENTRY_FILENAME      6
Packit d37888
Packit d37888
   Constants for the 'perm' member:
Packit d37888
Packit d37888
     #define GLIBTOP_MAP_PERM_READ           1
Packit d37888
     #define GLIBTOP_MAP_PERM_WRITE          2
Packit d37888
     #define GLIBTOP_MAP_PERM_EXECUTE        4
Packit d37888
     #define GLIBTOP_MAP_PERM_SHARED         8
Packit d37888
     #define GLIBTOP_MAP_PERM_PRIVATE        16
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_netload,  Next: glibtop_ppp,  Prev: glibtop_proc_map,  Up: System Dependent
Packit d37888
Packit d37888
3.1.16 Network Load
Packit d37888
-------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_netload':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_netload (glibtop_netload *buf, const char *interface);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_netload_l (glibtop *server, glibtop_netload *buf,
Packit d37888
                            const char *interface);
Packit d37888
Packit d37888
   Declaration of 'glibtop_netload' in '<glibtop/netload.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_netload glibtop_netload;
Packit d37888
Packit d37888
     struct _glibtop_netload
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             if_flags,
Packit d37888
             mtu,
Packit d37888
             subnet,
Packit d37888
             address,
Packit d37888
             packets_in,
Packit d37888
             packets_out,
Packit d37888
             packets_total,
Packit d37888
             bytes_in,
Packit d37888
             bytes_out,
Packit d37888
             bytes_total,
Packit d37888
             errors_in,
Packit d37888
             errors_out,
Packit d37888
             errors_total,
Packit d37888
             collisions;
Packit d37888
     };
Packit d37888
Packit d37888
   Returns network statistics for interface 'interface' (which is the
Packit d37888
same than in 'ifconfig').
Packit d37888
Packit d37888
'if_flags'
Packit d37888
     Interface flags.  See the contants defined below.
Packit d37888
'mtu'
Packit d37888
     Maximum Transfer Unit (MTU)
Packit d37888
'subnet'
Packit d37888
     Subnet Address
Packit d37888
'address'
Packit d37888
     Interface Address
Packit d37888
'packets_in'
Packit d37888
     Total number of incoming packets
Packit d37888
'packets_out'
Packit d37888
     Total number of outgoing packets
Packit d37888
'packets_total'
Packit d37888
     Total number of packets
Packit d37888
'bytes_in'
Packit d37888
     Total number of incoming bytes
Packit d37888
'bytes_out'
Packit d37888
     Total number of outgoing bytes
Packit d37888
'bytes_total'
Packit d37888
     Total number of bytes
Packit d37888
'errors_in'
Packit d37888
     Total number of errors in incoming direction
Packit d37888
'errors_out'
Packit d37888
     Total number of errors in outgoing direction
Packit d37888
'errors_total'
Packit d37888
     Total number of errors
Packit d37888
'collisions'
Packit d37888
     Total number of collisions
Packit d37888
Packit d37888
   Please note that not all operating systems distinguish between
Packit d37888
incoming/outgoing bytes/packets/errors - in this case only the '_total'
Packit d37888
fields are valid.  Otherwise, they're just '_in' plus '_out'.
Packit d37888
Packit d37888
   Constants for 'if_flags':
Packit d37888
Packit d37888
     enum {
Packit d37888
         GLIBTOP_IF_FLAGS_UP = 1,
Packit d37888
         GLIBTOP_IF_FLAGS_BROADCAST,
Packit d37888
         GLIBTOP_IF_FLAGS_DEBUG,
Packit d37888
         GLIBTOP_IF_FLAGS_LOOPBACK,
Packit d37888
         GLIBTOP_IF_FLAGS_POINTOPOINT,
Packit d37888
         GLIBTOP_IF_FLAGS_RUNNING,
Packit d37888
         GLIBTOP_IF_FLAGS_NOARP,
Packit d37888
         GLIBTOP_IF_FLAGS_PROMISC,
Packit d37888
         GLIBTOP_IF_FLAGS_ALLMULTI,
Packit d37888
         GLIBTOP_IF_FLAGS_OACTIVE,
Packit d37888
         GLIBTOP_IF_FLAGS_SIMPLEX,
Packit d37888
         GLIBTOP_IF_FLAGS_LINK0,
Packit d37888
         GLIBTOP_IF_FLAGS_LINK1,
Packit d37888
         GLIBTOP_IF_FLAGS_LINK2,
Packit d37888
         GLIBTOP_IF_FLAGS_ALTPHYS,
Packit d37888
         GLIBTOP_IF_FLAGS_MULTICAST
Packit d37888
     };
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_ppp,  Prev: glibtop_netload,  Up: System Dependent
Packit d37888
Packit d37888
3.1.17 PPP Statistics
Packit d37888
---------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_ppp':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_ppp_l (glibtop *server, glibtop_ppp *buf,
Packit d37888
                        unsigned short device);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_ppp (glibtop_ppp *buf, unsigned short device);
Packit d37888
Packit d37888
   Declaration of 'glibtop_ppp' in '<glibtop/ppp.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_ppp     glibtop_ppp;
Packit d37888
Packit d37888
     struct _glibtop_ppp
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             state,
Packit d37888
             bytes_in,
Packit d37888
             bytes_out;
Packit d37888
     };
Packit d37888
Packit d37888
'bytes_in'
Packit d37888
     Number of input bytes
Packit d37888
'bytes_out'
Packit d37888
     Number of output bytes
Packit d37888
Packit d37888
   There are some constants for 'state':
Packit d37888
Packit d37888
     enum {
Packit d37888
         GLIBTOP_PPP_STATE_UNKNOWN = 0,
Packit d37888
         GLIBTOP_PPP_STATE_HANGUP,
Packit d37888
         GLIBTOP_PPP_STATE_ONLINE
Packit d37888
     };
Packit d37888
Packit d37888
'GLIBTOP_PPP_STATE_UNKNOWN'
Packit d37888
     LibGTop was unable to determine the current ppp state.
Packit d37888
'GLIBTOP_PPP_STATE_HANGUP'
Packit d37888
     We're currently offline.
Packit d37888
'GLIBTOP_PPP_STATE_ONLINE'
Packit d37888
     We're currently online.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Common Functions,  Next: Library Functions,  Prev: System Dependent,  Up: Reference Manual
Packit d37888
Packit d37888
3.2 Common Functions
Packit d37888
====================
Packit d37888
Packit d37888
This are functions which a common implementation for all systems; we
Packit d37888
never use the server for them.
Packit d37888
Packit d37888
   The file system code is taken from GNU Fileutils.
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* glibtop_mountlist::           Mount List.
Packit d37888
* glibtop_fsusage::             File System Usage.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_mountlist,  Next: glibtop_fsusage,  Prev: Common Functions,  Up: Common Functions
Packit d37888
Packit d37888
3.2.1 Mount List
Packit d37888
----------------
Packit d37888
Packit d37888
Library function 'glibtop_get_mountlist':
Packit d37888
Packit d37888
     glibtop_mountentry *
Packit d37888
     glibtop_get_mountlist_l (glibtop *server, glibtop_mountlist *buf,
Packit d37888
                              int all_fs);
Packit d37888
Packit d37888
     glibtop_mountentry *
Packit d37888
     glibtop_get_mountlist (glibtop_mountlist *buf, int all_fs);
Packit d37888
Packit d37888
   The 'all_fs' parameter specifies whether information about all
Packit d37888
filesystems should be returned; this will include filesystem types like
Packit d37888
'autofs' and 'procfs'.  You should not use this in disk usage programs,
Packit d37888
but it can be useful to get a list of all currently mounted filesystems.
Packit d37888
Packit d37888
   Declaration of 'glibtop_proc_map' in '<glibtop/procmap.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_mountlist       glibtop_mountlist;
Packit d37888
Packit d37888
     struct _glibtop_mountlist
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             number,
Packit d37888
             total,
Packit d37888
             size;
Packit d37888
     };
Packit d37888
Packit d37888
   Returns a 'glibtop_mountentry *' list (which needs to be freed with
Packit d37888
'g_free') of mounted filesystems.
Packit d37888
Packit d37888
'number'
Packit d37888
     Number of entries in the returned list.
Packit d37888
Packit d37888
'total'
Packit d37888
     Total size of the returned list (this equals 'number * size').
Packit d37888
Packit d37888
'size'
Packit d37888
     Size of a single entry in the returned list (this equals 'sizeof
Packit d37888
     (glibtop_mountentry)').
Packit d37888
Packit d37888
     typedef struct _glibtop_mountentry      glibtop_mountentry;
Packit d37888
Packit d37888
     struct _glibtop_mountentry
Packit d37888
     {
Packit d37888
         guint64 dev;
Packit d37888
         char devname [GLIBTOP_MOUNTENTRY_LEN+1];
Packit d37888
         char mountdir [GLIBTOP_MOUNTENTRY_LEN+1];
Packit d37888
         char type [GLIBTOP_MOUNTENTRY_LEN+1];
Packit d37888
     };
Packit d37888
Packit d37888
   'GLIBTOP_MOUNTENTRY_LEN' is defined in '<glibtop.h>'.
Packit d37888
Packit d37888
'devname'
Packit d37888
     Full pathname (such as '/dev/sdb1' for instance) to the mounted
Packit d37888
     device.
Packit d37888
'mountdir'
Packit d37888
     Full pathname of the mountpoint (such as '/usr/local' for
Packit d37888
     instance).
Packit d37888
'type'
Packit d37888
     Filesystem type as a textual string (such as 'ext2fs').
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_fsusage,  Prev: glibtop_mountlist,  Up: Common Functions
Packit d37888
Packit d37888
3.2.2 File System Usage
Packit d37888
-----------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_fsusage':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_fsusage_l (glibtop *server, glibtop_fsusage *buf,
Packit d37888
                            const char *mount_dir);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_fsusage (glibtop_fsusage *buf, const char *mount_dir);
Packit d37888
Packit d37888
   Declaration of 'glibtop_fsusage' in '<glibtop/fsusage.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_fsusage         glibtop_fsusage;
Packit d37888
Packit d37888
     struct _glibtop_fsusage
Packit d37888
     {
Packit d37888
         guint64   flags,
Packit d37888
             blocks,
Packit d37888
             bfree,
Packit d37888
             bavail,
Packit d37888
             files,
Packit d37888
             ffree;
Packit d37888
         guint32   block_size;
Packit d37888
         guint64 read,
Packit d37888
             write;
Packit d37888
     };
Packit d37888
Packit d37888
'blocks'
Packit d37888
     Total blocks in the filesystem.
Packit d37888
'bfree'
Packit d37888
     Free blocks available to the superuser.
Packit d37888
'bavail'
Packit d37888
     Free blocks available to ordinary users.
Packit d37888
'files'
Packit d37888
     Total file nodes.
Packit d37888
'ffree'
Packit d37888
     Free file nodes.
Packit d37888
'block_size'
Packit d37888
     Block size in bytes.
Packit d37888
'read'
Packit d37888
     Total blocks read.
Packit d37888
'write'
Packit d37888
     Total blocks written.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Library Functions,  Prev: Common Functions,  Up: Reference Manual
Packit d37888
Packit d37888
3.3 Library Functions
Packit d37888
=====================
Packit d37888
Packit d37888
This are general library functions which can be used to get information
Packit d37888
about the library and to control its behavior.
Packit d37888
Packit d37888
* Menu:
Packit d37888
Packit d37888
* glibtop_init::                Server Initialization.
Packit d37888
* glibtop_sysdeps::             Server Sysdeps.
Packit d37888
* Library Parameters::          Library Parameters.
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_init,  Next: glibtop_sysdeps,  Prev: Library Functions,  Up: Library Functions
Packit d37888
Packit d37888
3.3.1 Server Initialization
Packit d37888
---------------------------
Packit d37888
Packit d37888
You do not need to worry about the 'glibtop *' server structure if you
Packit d37888
don't need - the library exports a 'glibtop_global_server' which you can
Packit d37888
use everywhere a 'glibtop *' is expected.
Packit d37888
Packit d37888
   Most of the library and all of the sysdeps function also have an
Packit d37888
alias (which is the function name without the '_l', '_s' or '_r' suffix)
Packit d37888
which don't take a 'glibtop *' as argument but uses the
Packit d37888
'glibtop_global_server' instead.
Packit d37888
Packit d37888
     extern glibtop *glibtop_global_server;
Packit d37888
Packit d37888
   Library function 'glibtop_init':
Packit d37888
Packit d37888
     glibtop *
Packit d37888
     glibtop_init_r (glibtop **server_ptr, unsigned long features,
Packit d37888
                     unsigned flags);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_init (void);
Packit d37888
Packit d37888
   This function initializes a LibGTop server.  It is automatically
Packit d37888
called when you use any of the LibGTop functions and will use the global
Packit d37888
server in this case.
Packit d37888
Packit d37888
   However, it's appreciated to call 'glibtop_init' during the
Packit d37888
initialization of your application.
Packit d37888
Packit d37888
   You can for instance use
Packit d37888
Packit d37888
     glibtop_init ();
Packit d37888
Packit d37888
which is equivalent to
Packit d37888
Packit d37888
     glibtop_init_r (&glibtop_global_server, 0, 0);
Packit d37888
Packit d37888
   Please note that the 'server_ptr' argument is a pointer to a pointer
Packit d37888
(and thus is of type 'glibtop **').
Packit d37888
Packit d37888
   To control what 'glibtop_init' should actually do, you can use the
Packit d37888
'features' and 'flags' arguments.
Packit d37888
Packit d37888
   The 'features' argument is a bit-mask (interpreted in the same way
Packit d37888
than 'sysdeps.features') and tells the library which features you're
Packit d37888
interested in.  The library will only start the server if this is
Packit d37888
required for any of those features.
Packit d37888
Packit d37888
   You can use the following constants for the 'flags' parameter to
Packit d37888
control the behavior of the library:
Packit d37888
Packit d37888
'GLIBTOP_INIT_NO_INIT'
Packit d37888
     Tells the library to do nothing.  If the value pointed to by the
Packit d37888
     'server_ptr' argument is 'NULL', it will set it to the
Packit d37888
     'glibtop_global_server' and then return.
Packit d37888
'GLIBTOP_INIT_NO_OPEN'
Packit d37888
     Do the initialization, but do not start the server.
Packit d37888
Packit d37888
   To modify the way the 'features' are interpretet, you can use the
Packit d37888
following constants for 'flags' (as a bit mask):
Packit d37888
Packit d37888
'GLIBTOP_FEATURES_NO_SERVER'
Packit d37888
     Never use the server, always call the sysdeps code directly.  If
Packit d37888
     you require any privileges to get them and you don't have those
Packit d37888
     privileges, the this will obviously not work and the library will
Packit d37888
     fail to return some or all of the requested values.
Packit d37888
'GLIBTOP_FEATURES_EXCEPT'
Packit d37888
     Inverts the matching of the 'features' parameter, i.e.  if you use
Packit d37888
     this flag this means that 'features' are all the features you are
Packit d37888
     _not_ interested in.  Might be useful to say something like "I want
Packit d37888
     everything but ppp".
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: glibtop_sysdeps,  Next: Library Parameters,  Prev: glibtop_init,  Up: Library Functions
Packit d37888
Packit d37888
3.3.2 Server Sysdeps
Packit d37888
--------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_sysdeps':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_get_sysdeps (glibtop_sysdeps *buf);
Packit d37888
Packit d37888
   Declaration of 'glibtop_sysdeps' in '<glibtop/sysdeps.h>':
Packit d37888
Packit d37888
     typedef struct _glibtop_sysdeps         glibtop_sysdeps;
Packit d37888
Packit d37888
     struct _glibtop_sysdeps
Packit d37888
     {
Packit d37888
         guint64 flags,
Packit d37888
             features,
Packit d37888
             pointer_size,
Packit d37888
             cpu,
Packit d37888
             mem,
Packit d37888
             swap,
Packit d37888
             uptime,
Packit d37888
             loadavg,
Packit d37888
             shm_limits,
Packit d37888
             msg_limits,
Packit d37888
             sem_limits,
Packit d37888
             proclist,
Packit d37888
             proc_state,
Packit d37888
             proc_uid,
Packit d37888
             proc_mem,
Packit d37888
             proc_time,
Packit d37888
             proc_signal,
Packit d37888
             proc_kernel,
Packit d37888
             proc_segment,
Packit d37888
             proc_args,
Packit d37888
             proc_map,
Packit d37888
             mountlist,
Packit d37888
             fsusage,
Packit d37888
             netload,
Packit d37888
             ppp;
Packit d37888
     };
Packit d37888
Packit d37888
'features'
Packit d37888
     This is a bit field (the so-called "server features") stating for
Packit d37888
     which features we need to use the server.
Packit d37888
'pointer_size'
Packit d37888
     This was added in LibGTop 1.1.0 and tells you the number of bits a
Packit d37888
     'void*' has in the server (this may be different from the size on
Packit d37888
     the client machine if we're talking over the daemon to a remove
Packit d37888
     machine).
Packit d37888
Packit d37888
   The following constants from '<glibtop/sysdeps.h>' serve as
Packit d37888
bit-indices for the 'features' field:
Packit d37888
Packit d37888
     #define GLIBTOP_SYSDEPS_CPU             0
Packit d37888
     #define GLIBTOP_SYSDEPS_MEM             1
Packit d37888
     #define GLIBTOP_SYSDEPS_SWAP            2
Packit d37888
     #define GLIBTOP_SYSDEPS_UPTIME          3
Packit d37888
     #define GLIBTOP_SYSDEPS_LOADAVG         4
Packit d37888
     #define GLIBTOP_SYSDEPS_SHM_LIMITS      5
Packit d37888
     #define GLIBTOP_SYSDEPS_MSG_LIMITS      6
Packit d37888
     #define GLIBTOP_SYSDEPS_SEM_LIMITS      7
Packit d37888
     #define GLIBTOP_SYSDEPS_PROCLIST        8
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_STATE      9
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_UID        10
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_MEM        11
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_TIME       12
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_SIGNAL     13
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_KERNEL     14
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_SEGMENT    15
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_ARGS       16
Packit d37888
     #define GLIBTOP_SYSDEPS_PROC_MAP        17
Packit d37888
     #define GLIBTOP_SYSDEPS_MOUNTLIST       18
Packit d37888
     #define GLIBTOP_SYSDEPS_FSUSAGE         19
Packit d37888
     #define GLIBTOP_SYSDEPS_NETLOAD         20
Packit d37888
     #define GLIBTOP_SYSDEPS_PPP             21
Packit d37888
Packit d37888
?
Packit d37888
File: libgtop2.info,  Node: Library Parameters,  Prev: glibtop_sysdeps,  Up: Library Functions
Packit d37888
Packit d37888
3.3.3 Library Parameters
Packit d37888
------------------------
Packit d37888
Packit d37888
Library function 'glibtop_get_parameter':
Packit d37888
Packit d37888
     size_t
Packit d37888
     glibtop_get_parameter_l (glibtop *server, const unsigned parameter,
Packit d37888
                              void *data_ptr, size_t data_size);
Packit d37888
Packit d37888
     size_t
Packit d37888
     glibtop_get_parameter (const unsigned parameter, void *data_ptr,
Packit d37888
                            size_t data_size);
Packit d37888
Packit d37888
   This function is used to retrieve a library parameter (see below for
Packit d37888
a more detailed description).  It returns the size of the retrieved
Packit d37888
parameter on success, zero on failure or minus the actual size of the
Packit d37888
parameter if 'data_size' was too small.
Packit d37888
Packit d37888
   You may call this function with 'data_ptr' set to 'NULL' to get the
Packit d37888
actual size of a parameter (as a negative value).
Packit d37888
Packit d37888
'parameter'
Packit d37888
     The parameter you want to retrieve (see below for constants).
Packit d37888
'data_ptr'
Packit d37888
     Pointer to a place where the parameter should be stored.
Packit d37888
'data_size'
Packit d37888
     Maximum size of the parameter.
Packit d37888
Packit d37888
   Library function 'glibtop_set_parameter':
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_set_parameter_l (glibtop *server, const unsigned parameter,
Packit d37888
                              const void *data_ptr, size_t data_size);
Packit d37888
Packit d37888
     void
Packit d37888
     glibtop_set_parameter (const unsigned parameter, const void *data_ptr,
Packit d37888
                            size_t data_size);
Packit d37888
Packit d37888
   This function is used to modify a library parameter.  Please not that
Packit d37888
you may not set all parameters since some of them are read-only.
Packit d37888
Packit d37888
'parameter'
Packit d37888
     The parameter you want to modify (see below for constants).
Packit d37888
'data_ptr'
Packit d37888
     Pointer to the value which should be set.
Packit d37888
'data_size'
Packit d37888
     Size of the new value.  For fixed-size parameters, this must match
Packit d37888
     the exact size of the parameter or you'll get an error.
Packit d37888
Packit d37888
   The following parameters are defined in '<glibtop/parameter.h>':
Packit d37888
Packit d37888
'GLIBTOP_PARAM_FEATURES'
Packit d37888
     This is a read-only 'unsigned long' representing the 'features'
Packit d37888
     field of 'glibtop_sysdeps'.
Packit d37888
'GLIBTOP_PARAM_REQUIRED'
Packit d37888
     This is a 'glibtop_sysdeps' structure specifying which features the
Packit d37888
     client requires the library return.  If it fails to get any of
Packit d37888
     them, you'll get an error.
Packit d37888
'GLIBTOP_PARAM_ERROR_METHOD'
Packit d37888
     This is an 'unsigned' telling the library what to do if it fails to
Packit d37888
     get any of the features that are marked as required via the
Packit d37888
     'GLIBTOP_PARAM_REQUIRED' parameter (see below for constants).
Packit d37888
Packit d37888
   You can use the following constants for 'GLIBTOP_PARAM_ERROR_METHOD'
Packit d37888
(defined in '<glibtop/open.h>'):
Packit d37888
Packit d37888
'GLIBTOP_ERROR_METHOD_IGNORE'
Packit d37888
     Ignore the error condition.
Packit d37888
'GLIBTOP_ERROR_METHOD_WARN_ONCE'
Packit d37888
     Warn once about the absense of some of the required features, then
Packit d37888
     modify 'GLIBTOP_PARAM_REQUIRED' so that the missing ones are no
Packit d37888
     longer required.  This is the prefered value for applications since
Packit d37888
     it'll only print out the warning message once and not each time the
Packit d37888
     library tries to get one of those features.
Packit d37888
'GLIBTOP_ERROR_METHOD_WARN'
Packit d37888
     Warn each time the library fails to get some of the required
Packit d37888
     features.
Packit d37888
'GLIBTOP_ERROR_METHOD_ABORT'
Packit d37888
     Abort if the library fails to get some of the required features.
Packit d37888
     This should not be used by applications.
Packit d37888
Packit d37888
Packit d37888
?
Packit d37888
Tag Table:
Packit d37888
Node: Top1206
Packit d37888
Node: About3357
Packit d37888
Node: Availability4235
Packit d37888
Node: Supported Platforms4855
Packit d37888
Node: Mailing List6466
Packit d37888
Node: Thanks7238
Packit d37888
Node: White Paper7948
Packit d37888
Node: Introduction8181
Packit d37888
Node: Overview9896
Packit d37888
Node: Interface Design10263
Packit d37888
Node: Server Implementation11290
Packit d37888
Node: Reference Manual12007
Packit d37888
Node: System Dependent12311
Packit d37888
Node: glibtop_cpu13386
Packit d37888
Node: glibtop_mem16013
Packit d37888
Node: glibtop_swap17175
Packit d37888
Node: glibtop_uptime18407
Packit d37888
Node: glibtop_loadavg19702
Packit d37888
Node: glibtop_proclist20710
Packit d37888
Node: glibtop_proc_state23917
Packit d37888
Node: glibtop_proc_uid26483
Packit d37888
Node: glibtop_proc_mem28055
Packit d37888
Node: glibtop_proc_time31750
Packit d37888
Node: glibtop_proc_signal33902
Packit d37888
Node: glibtop_proc_kernel34947
Packit d37888
Node: glibtop_proc_segment37832
Packit d37888
Node: glibtop_proc_args39070
Packit d37888
Node: glibtop_proc_map40812
Packit d37888
Node: glibtop_netload42789
Packit d37888
Node: glibtop_ppp45297
Packit d37888
Node: Common Functions46355
Packit d37888
Node: glibtop_mountlist46780
Packit d37888
Node: glibtop_fsusage48696
Packit d37888
Node: Library Functions49789
Packit d37888
Node: glibtop_init50216
Packit d37888
Node: glibtop_sysdeps52967
Packit d37888
Node: Library Parameters55578
Packit d37888
?
Packit d37888
End Tag Table