| 21 |
|
* $Id$ |
| 22 |
|
*/ |
| 23 |
|
|
| 24 |
+ |
#ifndef STATGRAB_H |
| 25 |
+ |
#define STATGRAB_H |
| 26 |
+ |
|
| 27 |
+ |
#ifdef __cplusplus |
| 28 |
+ |
extern "C" { |
| 29 |
+ |
#endif |
| 30 |
+ |
|
| 31 |
|
#include <sys/types.h> |
| 32 |
|
|
| 33 |
|
/* FIXME typedefs for 32/64-bit types */ |
| 35 |
|
/* FIXME comments for less obvious fields */ |
| 36 |
|
|
| 37 |
|
int sg_init(void); |
| 38 |
+ |
int sg_snapshot(); |
| 39 |
+ |
int sg_shutdown(); |
| 40 |
|
int sg_drop_privileges(void); |
| 41 |
|
|
| 42 |
|
typedef enum { |
| 43 |
|
SG_ERROR_NONE = 0, |
| 44 |
|
SG_ERROR_ASPRINTF, |
| 45 |
+ |
SG_ERROR_DEVICES, |
| 46 |
|
SG_ERROR_DEVSTAT_GETDEVS, |
| 47 |
|
SG_ERROR_DEVSTAT_SELECTDEVS, |
| 48 |
+ |
SG_ERROR_DISKINFO, |
| 49 |
|
SG_ERROR_ENOENT, |
| 50 |
|
SG_ERROR_GETIFADDRS, |
| 51 |
|
SG_ERROR_GETMNTINFO, |
| 52 |
|
SG_ERROR_GETPAGESIZE, |
| 53 |
+ |
SG_ERROR_HOST, |
| 54 |
|
SG_ERROR_KSTAT_DATA_LOOKUP, |
| 55 |
|
SG_ERROR_KSTAT_LOOKUP, |
| 56 |
|
SG_ERROR_KSTAT_OPEN, |
| 58 |
|
SG_ERROR_KVM_GETSWAPINFO, |
| 59 |
|
SG_ERROR_KVM_OPENFILES, |
| 60 |
|
SG_ERROR_MALLOC, |
| 61 |
+ |
SG_ERROR_MEMSTATUS, |
| 62 |
|
SG_ERROR_OPEN, |
| 63 |
|
SG_ERROR_OPENDIR, |
| 64 |
|
SG_ERROR_PARSE, |
| 65 |
+ |
SG_ERROR_PDHADD, |
| 66 |
+ |
SG_ERROR_PDHCOLLECT, |
| 67 |
+ |
SG_ERROR_PDHOPEN, |
| 68 |
+ |
SG_ERROR_PDHREAD, |
| 69 |
+ |
SG_ERROR_PERMISSION, |
| 70 |
+ |
SG_ERROR_PSTAT, |
| 71 |
|
SG_ERROR_SETEGID, |
| 72 |
|
SG_ERROR_SETEUID, |
| 73 |
|
SG_ERROR_SETMNTENT, |
| 83 |
|
} sg_error; |
| 84 |
|
|
| 85 |
|
void sg_set_error(sg_error code, const char *arg); |
| 86 |
+ |
void sg_set_error_with_errno(sg_error code, const char *arg); |
| 87 |
|
sg_error sg_get_error(); |
| 88 |
|
const char *sg_get_error_arg(); |
| 89 |
+ |
int sg_get_error_errno(); |
| 90 |
|
const char *sg_str_error(sg_error code); |
| 91 |
|
|
| 92 |
|
typedef struct { |
| 168 |
|
long long total_inodes; |
| 169 |
|
long long used_inodes; |
| 170 |
|
long long free_inodes; |
| 171 |
+ |
long long avail_inodes; |
| 172 |
+ |
long long io_size; |
| 173 |
+ |
long long block_size; |
| 174 |
+ |
long long total_blocks; |
| 175 |
+ |
long long free_blocks; |
| 176 |
+ |
long long used_blocks; |
| 177 |
+ |
long long avail_blocks; |
| 178 |
|
} sg_fs_stats; |
| 179 |
|
|
| 180 |
|
sg_fs_stats *sg_get_fs_stats(int *entries); |
| 181 |
|
|
| 182 |
+ |
int sg_fs_compare_device_name(const void *va, const void *vb); |
| 183 |
+ |
int sg_fs_compare_mnt_point(const void *va, const void *vb); |
| 184 |
+ |
|
| 185 |
|
typedef struct { |
| 186 |
|
char *disk_name; |
| 187 |
|
long long read_bytes; |
| 192 |
|
sg_disk_io_stats *sg_get_disk_io_stats(int *entries); |
| 193 |
|
sg_disk_io_stats *sg_get_disk_io_stats_diff(int *entries); |
| 194 |
|
|
| 195 |
+ |
int sg_disk_io_compare_name(const void *va, const void *vb); |
| 196 |
+ |
|
| 197 |
|
typedef struct { |
| 198 |
|
char *interface_name; |
| 199 |
|
long long tx; |
| 209 |
|
sg_network_io_stats *sg_get_network_io_stats(int *entries); |
| 210 |
|
sg_network_io_stats *sg_get_network_io_stats_diff(int *entries); |
| 211 |
|
|
| 212 |
+ |
int sg_network_io_compare_name(const void *va, const void *vb); |
| 213 |
+ |
|
| 214 |
|
typedef enum { |
| 215 |
|
SG_IFACE_DUPLEX_FULL, |
| 216 |
|
SG_IFACE_DUPLEX_HALF, |
| 220 |
|
typedef struct { |
| 221 |
|
char *interface_name; |
| 222 |
|
int speed; /* In megabits/sec */ |
| 223 |
+ |
sg_iface_duplex duplex; |
| 224 |
+ |
#ifdef SG_ENABLE_DEPRECATED |
| 225 |
|
sg_iface_duplex dup; |
| 226 |
+ |
#endif |
| 227 |
|
int up; |
| 228 |
|
} sg_network_iface_stats; |
| 229 |
|
|
| 230 |
|
sg_network_iface_stats *sg_get_network_iface_stats(int *entries); |
| 231 |
|
|
| 232 |
+ |
int sg_network_iface_compare_name(const void *va, const void *vb); |
| 233 |
+ |
|
| 234 |
|
typedef struct { |
| 235 |
|
long long pages_pagein; |
| 236 |
|
long long pages_pageout; |
| 256 |
|
pid_t parent; /* Parent pid */ |
| 257 |
|
pid_t pgid; /* process id of process group leader */ |
| 258 |
|
|
| 259 |
+ |
/* Windows does not have uid_t or gid_t types */ |
| 260 |
+ |
#ifndef WIN32 |
| 261 |
|
uid_t uid; |
| 262 |
|
uid_t euid; |
| 263 |
|
gid_t gid; |
| 264 |
|
gid_t egid; |
| 265 |
+ |
#else |
| 266 |
+ |
int uid; |
| 267 |
+ |
int euid; |
| 268 |
+ |
int gid; |
| 269 |
+ |
int egid; |
| 270 |
+ |
#endif |
| 271 |
|
|
| 272 |
|
unsigned long long proc_size; /* in bytes */ |
| 273 |
|
unsigned long long proc_resident; /* in bytes */ |
| 279 |
|
|
| 280 |
|
sg_process_stats *sg_get_process_stats(int *entries); |
| 281 |
|
|
| 282 |
+ |
int sg_process_compare_name(const void *va, const void *vb); |
| 283 |
+ |
int sg_process_compare_pid(const void *va, const void *vb); |
| 284 |
+ |
int sg_process_compare_uid(const void *va, const void *vb); |
| 285 |
+ |
int sg_process_compare_gid(const void *va, const void *vb); |
| 286 |
+ |
int sg_process_compare_size(const void *va, const void *vb); |
| 287 |
+ |
int sg_process_compare_res(const void *va, const void *vb); |
| 288 |
+ |
int sg_process_compare_cpu(const void *va, const void *vb); |
| 289 |
+ |
int sg_process_compare_time(const void *va, const void *vb); |
| 290 |
+ |
|
| 291 |
|
typedef struct { |
| 292 |
|
int total; |
| 293 |
|
int running; |
| 302 |
|
#include <statgrab_deprecated.h> |
| 303 |
|
#endif |
| 304 |
|
|
| 305 |
+ |
#ifdef __cplusplus |
| 306 |
+ |
} |
| 307 |
+ |
#endif |
| 308 |
+ |
|
| 309 |
+ |
#endif |