| 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, |
| 79 |
|
SG_ERROR_SYSCTLNAMETOMIB, |
| 80 |
|
SG_ERROR_UNAME, |
| 81 |
|
SG_ERROR_UNSUPPORTED, |
| 82 |
< |
SG_ERROR_XSW_VER_MISMATCH |
| 82 |
> |
SG_ERROR_XSW_VER_MISMATCH, |
| 83 |
> |
SG_ERROR_GETMSG, |
| 84 |
> |
SG_ERROR_PUTMSG |
| 85 |
|
} sg_error; |
| 86 |
|
|
| 87 |
|
void sg_set_error(sg_error code, const char *arg); |
| 88 |
+ |
void sg_set_error_with_errno(sg_error code, const char *arg); |
| 89 |
|
sg_error sg_get_error(); |
| 90 |
|
const char *sg_get_error_arg(); |
| 91 |
+ |
int sg_get_error_errno(); |
| 92 |
|
const char *sg_str_error(sg_error code); |
| 93 |
|
|
| 94 |
|
typedef struct { |
| 170 |
|
long long total_inodes; |
| 171 |
|
long long used_inodes; |
| 172 |
|
long long free_inodes; |
| 173 |
+ |
long long avail_inodes; |
| 174 |
+ |
long long io_size; |
| 175 |
+ |
long long block_size; |
| 176 |
+ |
long long total_blocks; |
| 177 |
+ |
long long free_blocks; |
| 178 |
+ |
long long used_blocks; |
| 179 |
+ |
long long avail_blocks; |
| 180 |
|
} sg_fs_stats; |
| 181 |
|
|
| 182 |
|
sg_fs_stats *sg_get_fs_stats(int *entries); |
| 222 |
|
typedef struct { |
| 223 |
|
char *interface_name; |
| 224 |
|
int speed; /* In megabits/sec */ |
| 225 |
+ |
sg_iface_duplex duplex; |
| 226 |
+ |
#ifdef SG_ENABLE_DEPRECATED |
| 227 |
|
sg_iface_duplex dup; |
| 228 |
+ |
#endif |
| 229 |
|
int up; |
| 230 |
|
} sg_network_iface_stats; |
| 231 |
|
|
| 242 |
|
sg_page_stats *sg_get_page_stats(); |
| 243 |
|
sg_page_stats *sg_get_page_stats_diff(); |
| 244 |
|
|
| 245 |
+ |
/* Recommend to add SG_PROCESS_STATE_IDLE */ |
| 246 |
|
typedef enum { |
| 247 |
|
SG_PROCESS_STATE_RUNNING, |
| 248 |
|
SG_PROCESS_STATE_SLEEPING, |
| 259 |
|
pid_t parent; /* Parent pid */ |
| 260 |
|
pid_t pgid; /* process id of process group leader */ |
| 261 |
|
|
| 262 |
+ |
/* Windows does not have uid_t or gid_t types */ |
| 263 |
+ |
#ifndef WIN32 |
| 264 |
|
uid_t uid; |
| 265 |
|
uid_t euid; |
| 266 |
|
gid_t gid; |
| 267 |
|
gid_t egid; |
| 268 |
+ |
#else |
| 269 |
+ |
int uid; |
| 270 |
+ |
int euid; |
| 271 |
+ |
int gid; |
| 272 |
+ |
int egid; |
| 273 |
+ |
#endif |
| 274 |
|
|
| 275 |
|
unsigned long long proc_size; /* in bytes */ |
| 276 |
|
unsigned long long proc_resident; /* in bytes */ |
| 303 |
|
|
| 304 |
|
#ifdef SG_ENABLE_DEPRECATED |
| 305 |
|
#include <statgrab_deprecated.h> |
| 306 |
+ |
#endif |
| 307 |
+ |
|
| 308 |
+ |
#ifdef __cplusplus |
| 309 |
+ |
} |
| 310 |
|
#endif |
| 311 |
|
|
| 312 |
|
#endif |