ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
Revision 1.59 - (view) (annotate) - [select for diffs]
Sun Oct 3 18:35:58 2010 UTC (13 years, 6 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.58: +5 -2 lines
Diff to previous 1.58
Add support for AIX 5.x - 9.x.

Many thanks to Jens Rehsack <rehsack@googlemail.com> for providing the
patch for this work. Thanks!

Revision 1.58 - (view) (annotate) - [select for diffs]
Sat Mar 11 13:11:21 2006 UTC (18 years, 1 month ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_13, LIBSTATGRAB_0_14, LIBSTATGRAB_0_15, LIBSTATGRAB_0_16, LIBSTATGRAB_0_17
Changes since 1.57: +9 -1 lines
Diff to previous 1.57
Nasty hack to make inclusion in C++ code easier. We seem to be getting
regular reports of problems with C++, and this should fix them.

Revision 1.57 - (view) (annotate) - [select for diffs]
Sat Sep 24 13:29:22 2005 UTC (18 years, 7 months ago) by tdb
Branch: MAIN
Changes since 1.56: +22 -3 lines
Diff to previous 1.56
Add WIN32 support via MINGW. We'll need to add stuff to the README file
about what this requires to build.

All the hard work done by: skel

Revision 1.56 - (view) (annotate) - [select for diffs]
Wed Jul 13 13:01:24 2005 UTC (18 years, 9 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_12
Changes since 1.55: +8 -1 lines
Diff to previous 1.55
Add more fs stats.

Patches provided by: Roman Neuhauser

Revision 1.55 - (view) (annotate) - [select for diffs]
Wed Jul 13 09:31:54 2005 UTC (18 years, 9 months ago) by tdb
Branch: MAIN
Changes since 1.54: +4 -1 lines
Diff to previous 1.54
Change the name of the duplex value from "dup" to "duplex". This will
break the ABI, but we're changing the fs stats anyway. The API change
is minimal, so hopefully won't affect too many people.

Revision 1.54 - (view) (annotate) - [select for diffs]
Mon Nov 1 18:30:17 2004 UTC (19 years, 6 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_11, LIBSTATGRAB_0_11_1
Changes since 1.53: +3 -2 lines
Diff to previous 1.53
Merge in patch to provide support for HP-UX 11.11.

Contributed by Roy Keene - thanks Roy!

Revision 1.53 - (view) (annotate) - [select for diffs]
Sun Jul 18 20:44:01 2004 UTC (19 years, 9 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_10_1, LIBSTATGRAB_0_10_2, LIBSTATGRAB_0_10_3
Changes since 1.52: +2 -2 lines
Diff to previous 1.52
Remove extraneous consts.

Revision 1.52 - (view) (annotate) - [select for diffs]
Fri Jul 16 15:28:02 2004 UTC (19 years, 9 months ago) by tdb
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51
Do the errno capturing in a nicer way.

Revision 1.51 - (view) (annotate) - [select for diffs]
Fri Jul 16 15:07:14 2004 UTC (19 years, 9 months ago) by tdb
Branch: MAIN
Changes since 1.50: +3 -1 lines
Diff to previous 1.50
Add function to allow grabbing of the current errno. Should we store errno
too maybe?

Revision 1.50 - (view) (annotate) - [select for diffs]
Fri Jul 2 11:21:30 2004 UTC (19 years, 10 months ago) by tdb
Branch: MAIN
Changes since 1.49: +5 -1 lines
Diff to previous 1.49
Make sure statgrab.h can't be included twice.

Revision 1.49 - (view) (annotate) - [select for diffs]
Thu Apr 8 13:44:44 2004 UTC (20 years ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_10
Changes since 1.48: +11 -1 lines
Diff to previous 1.48
Add comparison functions for names where that's likely to be useful.

Make the network_iface_stats example show how to use bsearch to find an
interface by name.

Revision 1.48 - (view) (annotate) - [select for diffs]
Thu Apr 8 13:16:05 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.47: +9 -22 lines
Diff to previous 1.47
Nuke sg_process_sort, and make the process stats example demonstrate how
to sort using the compare functions and qsort.

Revision 1.47 - (view) (annotate) - [select for diffs]
Thu Apr 8 13:03:23 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46
s/sg_sort_method/sg_process_sort_method/

Revision 1.46 - (view) (annotate) - [select for diffs]
Thu Apr 8 12:40:30 2004 UTC (20 years ago) by pajs
Branch: MAIN
Changes since 1.45: +9 -9 lines
Diff to previous 1.45
Name change for future friendlyness.

Revision 1.45 - (view) (annotate) - [select for diffs]
Thu Apr 8 11:26:42 2004 UTC (20 years ago) by pajs
Branch: MAIN
Changes since 1.44: +22 -1 lines
Diff to previous 1.44
Added some generic sorting methods for process_stats.

Revision 1.44 - (view) (annotate) - [select for diffs]
Wed Apr 7 21:20:28 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.43: +1 -3 lines
Diff to previous 1.43
Remove a couple of FIXMEs that have been dealt with.

Revision 1.43 - (view) (annotate) - [select for diffs]
Wed Apr 7 21:19:26 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.42: +2 -1 lines
Diff to previous 1.42
Add sg_get_error_arg. It uses a static buffer for storage rather than
sg_update_string because we can't do anything about a malloc failure at
that point.

Remove the default case in the switch, so GCC will give an "unhandled
enum value in switch" warning if we add a new error code without a
string.

Revision 1.42 - (view) (annotate) - [select for diffs]
Wed Apr 7 21:08:40 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.41: +26 -9 lines
Diff to previous 1.41
The rest of the error handling stuff (except the vector code).

I've been extremely unimaginative with the string names in error.c, but
they're all in one place so much easier to tidy up. I'm also beginning to
wonder if we actually needed an SG_ERROR_SYSTEM_CALL to indicate some call
into the system failed - because the majority of our errors are those :-)

Still to do, then:
 - vector code
 - better string names in error.c
 - deal with arg string in some way
 - make use of the error status in statgrab/saidar/examples

Revision 1.41 - (view) (annotate) - [select for diffs]
Wed Apr 7 19:26:16 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.40: +9 -2 lines
Diff to previous 1.40
Error reporting for disk_stats.

Revision 1.40 - (view) (annotate) - [select for diffs]
Wed Apr 7 14:53:40 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.39: +0 -0 lines
Diff to previous 1.39
Whitespace tidyup - change spaces to tabs.

Revision 1.39 - (view) (annotate) - [select for diffs]
Wed Apr 7 14:45:40 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.38: +27 -23 lines
Diff to previous 1.38
Add error reporting to cpu_stats.

Revision 1.38 - (view) (annotate) - [select for diffs]
Wed Apr 7 09:44:08 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.37: +3 -2 lines
Diff to previous 1.37
Add sg_realloc, and a macro fo sg_malloc.

Revision 1.37 - (view) (annotate) - [select for diffs]
Tue Apr 6 22:09:22 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.36: +3 -3 lines
Diff to previous 1.36
Add SG_ERROR_NONE.

Make sg_str_error return const char *.

Revision 1.36 - (view) (annotate) - [select for diffs]
Tue Apr 6 21:38:55 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.35: +9 -1 lines
Diff to previous 1.35
Some very basic startings of error handling stuff. I've not put much
thought into this yet, it's basically just the idea we've discussed.

Of course, this is the easy task. The hard job is creating a whole list of
different errors and using them across libstatgrab :-)

Revision 1.35 - (view) (annotate) - [select for diffs]
Tue Apr 6 16:37:34 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.34: +5 -1 lines
Diff to previous 1.34
Add compatibility code. This provides a working pre-0.10 API for old
applications. To use simply change the #include line to:

#define SG_ENABLE_DEPRECATED
#include <statgrab.h>

This can be disabled at build time completely using --disable-deprecated.

Revision 1.34 - (view) (annotate) - [select for diffs]
Tue Apr 6 14:52:58 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33
Update name of project at the top of all soure files. These files now exist
in their own right, rather than as part of the "CMS".

Revision 1.33 - (view) (annotate) - [select for diffs]
Mon Apr 5 15:40:15 2004 UTC (20 years ago) by ats
Branch: MAIN
Changes since 1.32: +91 -83 lines
Diff to previous 1.32
Rename all the functions, types and enums in the API to be consistent.
Types are now of the form "sg_mem_stats"; functions of the form
"sg_get_mem_stats"; enums of the form "SG_PROCESS_STATE_RUNNING".
(The old get_proc_snapshot follows the usual calling convention now.)

Make internal functions static where possible.

Rename non-static internal functions to have an sg_ prefix so they don't
collide with those from other libraries. In particular, strlcpy and
strlcat are now called sg_strlcpy and sg_strlcat and are always
included.

Fix saidar and statgrab to use the new API.

Revision 1.32 - (view) (annotate) - [select for diffs]
Sat Apr 3 22:59:30 2004 UTC (20 years ago) by tdb
Branch: MAIN
Changes since 1.31: +3 -2 lines
Diff to previous 1.31
Add support for FreeBSD 4. I suspect this may work on OpenBSD and NetBSD
too, although I'll need to verify that.

Also add an additional process state of UNKNOWN.

Revision 1.31 - (view) (annotate) - [select for diffs]
Tue Mar 30 22:10:04 2004 UTC (20 years, 1 month ago) by tdb
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30
The startings of the BSD code. Only works on FreeBSD 5 so far.

Doesn't yet do command line arguments, or CPU percentages correctly.

Revision 1.30 - (view) (annotate) - [select for diffs]
Sun Mar 28 18:07:30 2004 UTC (20 years, 1 month ago) by pajs
Branch: MAIN
Changes since 1.29: +9 -2 lines
Diff to previous 1.29
Modifying the type of process states to an enum. The names maybe a touch
unfriendly however..?

Revision 1.29 - (view) (annotate) - [select for diffs]
Sun Mar 28 18:04:14 2004 UTC (20 years, 1 month ago) by pajs
Branch: MAIN
Changes since 1.28: +24 -1 lines
Diff to previous 1.28
The start of the rework for process_stats to give more information, and
to become a standard proc interface.

Revision 1.28 - (view) (annotate) - [select for diffs]
Thu Mar 4 23:38:29 2004 UTC (20 years, 1 month ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_9
Changes since 1.27: +6 -1 lines
Diff to previous 1.27
An "idea" what the network stats might look like with extra stuff in. Pete,
please approve/fix then I'll do the BSD code :-)

Revision 1.27 - (view) (annotate) - [select for diffs]
Fri Feb 13 18:45:43 2004 UTC (20 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.26: +2 -1 lines
Diff to previous 1.26
Added up/down interface detection. Not tested (or even compiled) on any
os. So that really needs to be done :)

Revision 1.26 - (view) (annotate) - [select for diffs]
Fri Feb 13 14:39:34 2004 UTC (20 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25
Couple of name changes, and a tidy up.

Revision 1.25 - (view) (annotate) - [select for diffs]
Sun Jan 25 20:13:57 2004 UTC (20 years, 3 months ago) by pajs
Branch: MAIN
Changes since 1.24: +3 -1 lines
Diff to previous 1.24
Added code for freebsd to do the network interface speeds. I've put it
under the label ALLBSD however, as i suspect it will work on all the
BSD's of intrest.

Revision 1.24 - (view) (annotate) - [select for diffs]
Fri Jan 23 23:23:33 2004 UTC (20 years, 3 months ago) by pajs
Branch: MAIN
Changes since 1.23: +13 -1 lines
Diff to previous 1.23
Added the ability to get the interface speed/duplex for solaris.
Not really checked code, but it appears to work.

Revision 1.23 - (view) (annotate) - [select for diffs]
Mon Jan 19 16:49:21 2004 UTC (20 years, 3 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_8_1, LIBSTATGRAB_0_8_2
Changes since 1.22: +2 -0 lines
Diff to previous 1.22
A whole bunch of minor cosmetic changes.

Revision 1.22 - (view) (annotate) - [select for diffs]
Fri Jan 16 15:54:54 2004 UTC (20 years, 3 months ago) by tdb
Branch: MAIN
Changes since 1.21: +13 -12 lines
Diff to previous 1.21
Alter the licensing of libstatgrab. The library part is now under the
LGPL, whilst the tools/examples are under the GPL. Both licenses are
included in the distribution (and are both now in CVS). Also made a
minor alteration to the webpage where it said everything was licensed
under the GPL.

Revision 1.21 - (view) (annotate) - [select for diffs]
Fri Jan 9 22:06:47 2004 UTC (20 years, 3 months ago) by pajs
Branch: MAIN
Changes since 1.20: +2 -0 lines
Diff to previous 1.20
As pointed out by azz.... time_t will be needed, thus the #include of
sys/types.h

Revision 1.20 - (view) (annotate) - [select for diffs]
Fri Jan 9 16:31:55 2004 UTC (20 years, 3 months ago) by pajs
Branch: MAIN
Changes since 1.19: +0 -8 lines
Diff to previous 1.19
Removed #ifdef's as they should not be there.

Revision 1.19 - (view) (annotate) - [select for diffs]
Tue Jan 6 22:28:41 2004 UTC (20 years, 3 months ago) by pajs
Branch: MAIN
Changes since 1.18: +0 -13 lines
Diff to previous 1.18
Moving the MAX_LOGIN_NAME_SIZE to where it should be.

Revision 1.18 - (view) (annotate) - [select for diffs]
Mon Jan 5 17:20:29 2004 UTC (20 years, 3 months ago) by ats
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_8
Changes since 1.17: +2 -0 lines
Diff to previous 1.17
Replace duplicated code for dropping privileges with a library
function that always drops setuid/setgid privileges.

Revision 1.17 - (view) (annotate) - [select for diffs]
Tue Nov 11 10:27:04 2003 UTC (20 years, 5 months ago) by tdb
Branch: MAIN
Changes since 1.16: +3 -4 lines
Diff to previous 1.16
Fix a couple of Cygwin build issues. Not all the #ifdef LINUX's were
changed in a previous commit.

Revision 1.16 - (view) (annotate) - [select for diffs]
Mon Nov 10 21:07:04 2003 UTC (20 years, 5 months ago) by tdb
Branch: MAIN
Changes since 1.15: +7 -0 lines
Diff to previous 1.15
Add support for cygwin. This is a bit limited, there's a few things that
can't be retrieved on cygwin such as load averages, diskio, network io,
and process stats. The package compiles and runs, and both saidar and
statgrab work.

Taken from a patch submitted by Ron Arts <raarts@netland.nl>. Thanks Ron!

Revision 1.15 - (view) (annotate) - [select for diffs]
Fri Oct 24 17:00:26 2003 UTC (20 years, 6 months ago) by ats
Branch: MAIN
Changes since 1.14: +6 -0 lines
Diff to previous 1.14
Move MAX_LOGIN_NAME_SIZE definition to the right place.

Revision 1.14 - (view) (annotate) - [select for diffs]
Mon Oct 20 15:25:47 2003 UTC (20 years, 6 months ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_7
Changes since 1.13: +2 -0 lines
Diff to previous 1.13
Added statgrab_init()

This function just calls the get_kvm type functions so all special privilages
can be dropped after this function has been called. It currently only does
stuff on *bsd (and needs testing on netbsd). All other OS's will just have
a function that returns 0

Solaris at somepoint may need to do something here so we can do the drive mappings.

Revision 1.13 - (view) (annotate) - [select for diffs]
Sun Aug 24 20:24:09 2003 UTC (20 years, 8 months ago) by tdb
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_5, LIBSTATGRAB_0_5_1, LIBSTATGRAB_0_6, LIBSTATGRAB_0_6_1
Changes since 1.12: +2 -2 lines
Diff to previous 1.12
Tidy up of lots of little things. :)

Revision 1.12 - (view) (annotate) - [select for diffs]
Fri Apr 4 13:08:27 2003 UTC (21 years ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_4
Changes since 1.11: +1 -1 lines
Diff to previous 1.11
Ported to work onto freebsd.

Revision 1.11 - (view) (annotate) - [select for diffs]
Fri Mar 7 14:44:38 2003 UTC (21 years, 1 month ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_3, LIBSTATGRAB_0_3_1, LIBSTATGRAB_0_3_2, LIBSTATGRAB_0_3_3, LIBSTATGRAB_0_3_4
Changes since 1.10: +0 -2 lines
Diff to previous 1.10
Removed getting of some data we didn't really need or use.
Updated page_stats to work with linux.
Fixed tools.h to compile nicely :)

Revision 1.10 - (view) (annotate) - [select for diffs]
Mon Mar 3 15:26:23 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.9: +3 -0 lines
Diff to previous 1.9
Added linux support for cpu stats

Revision 1.9 - (view) (annotate) - [select for diffs]
Mon Mar 3 13:14:25 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
CVS Tags: LIBSTATGRAB_0_2
Changes since 1.8: +7 -7 lines
Diff to previous 1.8
Made cpu stats to a type a bit more cross platform :)

Revision 1.8 - (view) (annotate) - [select for diffs]
Sat Mar 1 15:01:01 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.7: +1 -3 lines
Diff to previous 1.7
changed user_stats to return something more useful for ihost, and prob
something more useful to everyone else too. Although, they can't just
itterate thru it now, they got to find ' ' :)

Revision 1.7 - (view) (annotate) - [select for diffs]
Sun Feb 23 23:28:19 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.6: +1 -1 lines
Diff to previous 1.6
Changed function name changed to be consistent.

Revision 1.6 - (view) (annotate) - [select for diffs]
Sun Feb 23 22:58:09 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.5: +1 -0 lines
Diff to previous 1.5
Added a diff diskio_stats and fixed a bug. This is the last thing needed
for the solaris version of the new libstatgrab, bar bug fixes.

Revision 1.5 - (view) (annotate) - [select for diffs]
Sun Feb 23 19:24:07 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.4: +1 -0 lines
Diff to previous 1.4
Added support for read/write stats on a per disk basis. This does not count metadisks as disks.
I will also add io transfer for mounted devices, and the ususal diff() function that gives you
the differences since last time you called it.

Revision 1.4 - (view) (annotate) - [select for diffs]
Wed Feb 19 17:13:24 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.3: +8 -0 lines
Diff to previous 1.3
network stats now returns a diff() style function, to make it easy to
show the exact average network traffic over a period of time.

Revision 1.3 - (view) (annotate) - [select for diffs]
Wed Feb 19 00:25:36 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.2: +1 -0 lines
Diff to previous 1.2
Added get_page_stats_diff() which returns the number of pages in/out etc since
last time it was called, and the time difference since last time it was called.
This makes it very easy for a host to know how many pages averaged over a period
of time.

Revision 1.2 - (view) (annotate) - [select for diffs]
Tue Feb 18 23:12:08 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
Changes since 1.1: +6 -2 lines
Diff to previous 1.1
Finished page stats. It returns 2 things. One, number of pages swapped in and
out, 2, the number of pageins and pageouts. As to if this is actually
correct or not, im not 100% sure, but tests seem to imply it is.

from:
http://www.sun.com/sun-on-net/itworld/UIR960901perf.html

        ulong   pgin;           /* pageins                              */
        ulong   pgpgin;         /* pages paged in                       */
        ulong   pgout;          /* pageouts                             */
        ulong   pgpgout;        /* pages paged out                      */
        ulong   swapin;         /* swapins                              */
        ulong   pgswapin;       /* pages swapped in                     */
        ulong   swapout;        /* swapouts

I am *not* using swapins and swapouts. I did this in the orginal libstatgrab,
and it didn't work. Looking at it more closely, it always seems to have 0 in
it, so my guess is its broke. :)

Revision 1.1 - (view) (annotate) - [select for diffs]
Tue Feb 18 19:28:30 2003 UTC (21 years, 2 months ago) by pajs
Branch: MAIN
The new revesion of libstatgrab, which is a complete rewrite essentially.

Firstly the data is now returned in structures rather than xml strings.
The structures returned are all static, so what ever calls the library doesn't
have to deal with the memory management of it.

Secondly the general efficency of the code is now significantly faster. It no
longer needs to fork a process, connect file descriptors and run ps, and then
parse the output like it used to. Now it walks /proc and reads it into the
correct data structures. This works without needing any special privilages, so
it can still run as a normal mortal without needing any special group. (Freebsd
will be an exception to this, but this commit only works with solaris, and that
requires nothing special)

Thridly it has more functionality than it used to. It not for instance is capable
of showing network traffic stats, (although its not completely finished yet). It
also in the near future be able to disk io stats as well. Several bug fixes have
been aplied over the original version. For example the cpu_stats used to only reply
the stats for the first processor. This now will report the total stats of all of
them. Paging stats will also be fixed, but haven't been done yet.

Convenience Links

Links to HEAD: (view) (annotate)

Compare Revisions

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a