34 |
|
|
35 |
|
typedef enum { |
36 |
|
SG_ERROR_NONE = 0, |
37 |
< |
SG_ERROR_MALLOC_FAILED |
37 |
> |
SG_ERROR_ASPRINTF, |
38 |
> |
SG_ERROR_DEVSTAT_GETDEVS, |
39 |
> |
SG_ERROR_DEVSTAT_SELECTDEVS, |
40 |
> |
SG_ERROR_ENOENT, |
41 |
> |
SG_ERROR_GETIFADDRS, |
42 |
> |
SG_ERROR_GETMNTINFO, |
43 |
> |
SG_ERROR_GETPAGESIZE, |
44 |
> |
SG_ERROR_KSTAT_DATA_LOOKUP, |
45 |
> |
SG_ERROR_KSTAT_LOOKUP, |
46 |
> |
SG_ERROR_KSTAT_OPEN, |
47 |
> |
SG_ERROR_KSTAT_READ, |
48 |
> |
SG_ERROR_KVM_GETSWAPINFO, |
49 |
> |
SG_ERROR_KVM_OPENFILES, |
50 |
> |
SG_ERROR_MALLOC, |
51 |
> |
SG_ERROR_OPEN, |
52 |
> |
SG_ERROR_OPENDIR, |
53 |
> |
SG_ERROR_PARSE, |
54 |
> |
SG_ERROR_SETEGID, |
55 |
> |
SG_ERROR_SETEUID, |
56 |
> |
SG_ERROR_SETMNTENT, |
57 |
> |
SG_ERROR_SOCKET, |
58 |
> |
SG_ERROR_SWAPCTL, |
59 |
> |
SG_ERROR_SYSCONF, |
60 |
> |
SG_ERROR_SYSCTL, |
61 |
> |
SG_ERROR_SYSCTLBYNAME, |
62 |
> |
SG_ERROR_SYSCTLNAMETOMIB, |
63 |
> |
SG_ERROR_UNAME, |
64 |
> |
SG_ERROR_UNSUPPORTED, |
65 |
> |
SG_ERROR_XSW_VER_MISMATCH |
66 |
|
} sg_error; |
67 |
|
|
68 |
|
void sg_set_error(sg_error code, const char *arg); |
69 |
|
sg_error sg_get_error(); |
70 |
+ |
const char *sg_get_error_arg(); |
71 |
|
const char *sg_str_error(sg_error code); |
72 |
|
|
73 |
|
typedef struct { |
82 |
|
sg_host_info *sg_get_host_info(); |
83 |
|
|
84 |
|
typedef struct { |
85 |
< |
long long user; |
86 |
< |
long long kernel; |
87 |
< |
long long idle; |
88 |
< |
long long iowait; |
89 |
< |
long long swap; |
90 |
< |
long long nice; |
91 |
< |
long long total; |
92 |
< |
time_t systime; |
85 |
> |
long long user; |
86 |
> |
long long kernel; |
87 |
> |
long long idle; |
88 |
> |
long long iowait; |
89 |
> |
long long swap; |
90 |
> |
long long nice; |
91 |
> |
long long total; |
92 |
> |
time_t systime; |
93 |
|
} sg_cpu_stats; |
94 |
|
|
95 |
|
sg_cpu_stats *sg_get_cpu_stats(); |
96 |
|
sg_cpu_stats *sg_get_cpu_stats_diff(); |
97 |
|
|
98 |
|
typedef struct { |
99 |
< |
float user; |
100 |
< |
float kernel; |
101 |
< |
float idle; |
102 |
< |
float iowait; |
103 |
< |
float swap; |
104 |
< |
float nice; |
99 |
> |
float user; |
100 |
> |
float kernel; |
101 |
> |
float idle; |
102 |
> |
float iowait; |
103 |
> |
float swap; |
104 |
> |
float nice; |
105 |
|
time_t time_taken; |
106 |
|
} sg_cpu_percents; |
107 |
|
|
140 |
|
sg_swap_stats *sg_get_swap_stats(); |
141 |
|
|
142 |
|
typedef struct { |
143 |
< |
char *device_name; |
143 |
> |
char *device_name; |
144 |
|
char *fs_type; |
145 |
< |
char *mnt_point; |
146 |
< |
long long size; |
147 |
< |
long long used; |
148 |
< |
long long avail; |
149 |
< |
long long total_inodes; |
145 |
> |
char *mnt_point; |
146 |
> |
long long size; |
147 |
> |
long long used; |
148 |
> |
long long avail; |
149 |
> |
long long total_inodes; |
150 |
|
long long used_inodes; |
151 |
< |
long long free_inodes; |
151 |
> |
long long free_inodes; |
152 |
|
} sg_fs_stats; |
153 |
|
|
154 |
|
sg_fs_stats *sg_get_fs_stats(int *entries); |