ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/statgrab.h
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/statgrab.h (file contents):
Revision 1.33 by ats, Mon Apr 5 15:40:15 2004 UTC vs.
Revision 1.47 by tdb, Thu Apr 8 13:03:23 2004 UTC

# Line 1 | Line 1
1   /*
2 < * i-scream central monitoring system
2 > * i-scream libstatgrab
3   * http://www.i-scream.org
4   * Copyright (C) 2000-2004 i-scream
5   *
# Line 25 | Line 25
25  
26   /* FIXME typedefs for 32/64-bit types */
27   /* FIXME maybe tidy up field names? */
28 /* FIXME tab/space damage */
29 /* FIXME prefixes for util functions too */
28   /* FIXME comments for less obvious fields */
29  
30   int sg_init(void);
31   int sg_drop_privileges(void);
32  
33 + typedef enum {
34 +        SG_ERROR_NONE = 0,
35 +        SG_ERROR_ASPRINTF,
36 +        SG_ERROR_DEVSTAT_GETDEVS,
37 +        SG_ERROR_DEVSTAT_SELECTDEVS,
38 +        SG_ERROR_ENOENT,
39 +        SG_ERROR_GETIFADDRS,
40 +        SG_ERROR_GETMNTINFO,
41 +        SG_ERROR_GETPAGESIZE,
42 +        SG_ERROR_KSTAT_DATA_LOOKUP,
43 +        SG_ERROR_KSTAT_LOOKUP,
44 +        SG_ERROR_KSTAT_OPEN,
45 +        SG_ERROR_KSTAT_READ,
46 +        SG_ERROR_KVM_GETSWAPINFO,
47 +        SG_ERROR_KVM_OPENFILES,
48 +        SG_ERROR_MALLOC,
49 +        SG_ERROR_OPEN,
50 +        SG_ERROR_OPENDIR,
51 +        SG_ERROR_PARSE,
52 +        SG_ERROR_SETEGID,
53 +        SG_ERROR_SETEUID,
54 +        SG_ERROR_SETMNTENT,
55 +        SG_ERROR_SOCKET,
56 +        SG_ERROR_SWAPCTL,
57 +        SG_ERROR_SYSCONF,
58 +        SG_ERROR_SYSCTL,
59 +        SG_ERROR_SYSCTLBYNAME,
60 +        SG_ERROR_SYSCTLNAMETOMIB,
61 +        SG_ERROR_UNAME,
62 +        SG_ERROR_UNSUPPORTED,
63 +        SG_ERROR_XSW_VER_MISMATCH
64 + } sg_error;
65 +
66 + void sg_set_error(sg_error code, const char *arg);
67 + sg_error sg_get_error();
68 + const char *sg_get_error_arg();
69 + const char *sg_str_error(sg_error code);
70 +
71   typedef struct {
72          char *os_name;
73          char *os_release;
# Line 44 | Line 80 | typedef struct {
80   sg_host_info *sg_get_host_info();
81  
82   typedef struct {
83 <        long long user;
84 <        long long kernel;
85 <        long long idle;
86 <        long long iowait;
87 <        long long swap;
88 <        long long nice;
89 <        long long total;
90 <        time_t systime;
83 >        long long user;
84 >        long long kernel;
85 >        long long idle;
86 >        long long iowait;
87 >        long long swap;
88 >        long long nice;
89 >        long long total;
90 >        time_t systime;
91   } sg_cpu_stats;
92  
93   sg_cpu_stats *sg_get_cpu_stats();
94   sg_cpu_stats *sg_get_cpu_stats_diff();
95  
96   typedef struct {
97 <        float user;
98 <        float kernel;
99 <        float idle;
100 <        float iowait;
101 <        float swap;
102 <        float nice;
97 >        float user;
98 >        float kernel;
99 >        float idle;
100 >        float iowait;
101 >        float swap;
102 >        float nice;
103          time_t time_taken;
104   } sg_cpu_percents;
105  
# Line 102 | Line 138 | typedef struct {
138   sg_swap_stats *sg_get_swap_stats();
139  
140   typedef struct {
141 <        char *device_name;
141 >        char *device_name;
142          char *fs_type;
143 <        char *mnt_point;
144 <        long long size;
145 <        long long used;
146 <        long long avail;
147 <        long long total_inodes;
143 >        char *mnt_point;
144 >        long long size;
145 >        long long used;
146 >        long long avail;
147 >        long long total_inodes;
148          long long used_inodes;
149 <        long long free_inodes;
149 >        long long free_inodes;
150   } sg_fs_stats;
151  
152   sg_fs_stats *sg_get_fs_stats(int *entries);
# Line 204 | Line 240 | typedef struct {
240   } sg_process_count;
241  
242   sg_process_count *sg_get_process_count();
243 +
244 + typedef enum {
245 +        SG_PS_PID,
246 +        SG_PS_UID,
247 +        SG_PS_GID,
248 +        SG_PS_SIZE,
249 +        SG_PS_RES,
250 +        SG_PS_CPU,
251 +        SG_PS_TIME
252 + } sg_process_sort_method;
253 +
254 + void sg_process_sort(sg_process_stats *ps, int num_ps, sg_process_sort_method sm);
255 +
256 + int sg_process_compare_pid(const void *va, const void *vb);
257 + int sg_process_compare_uid(const void *va, const void *vb);
258 + int sg_process_compare_gid(const void *va, const void *vb);
259 + int sg_process_compare_size(const void *va, const void *vb);
260 + int sg_process_compare_res(const void *va, const void *vb);
261 + int sg_process_compare_cpu(const void *va, const void *vb);
262 + int sg_process_compare_time(const void *va, const void *vb);
263 +
264 +
265 + #ifdef SG_ENABLE_DEPRECATED
266 + #include <statgrab_deprecated.h>
267 + #endif
268  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines