84 |
|
|
85 |
|
#ifdef SOLARIS |
86 |
|
if((pagesize=sysconf(_SC_PAGESIZE)) == -1){ |
87 |
< |
sg_set_error(SG_ERROR_SYSCONF, "_SC_PAGESIZE"); |
87 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCONF, "_SC_PAGESIZE"); |
88 |
|
return NULL; |
89 |
|
} |
90 |
|
if (swapctl(SC_AINFO, &ai) == -1) { |
91 |
< |
sg_set_error(SG_ERROR_SWAPCTL, NULL); |
91 |
> |
sg_set_error_with_errno(SG_ERROR_SWAPCTL, NULL); |
92 |
|
return NULL; |
93 |
|
} |
94 |
|
swap_stat.total = (long long)ai.ani_max * (long long)pagesize; |
97 |
|
#endif |
98 |
|
#if defined(LINUX) || defined(CYGWIN) |
99 |
|
if ((f = fopen("/proc/meminfo", "r")) == NULL) { |
100 |
< |
sg_set_error(SG_ERROR_OPEN, "/proc/meminfo"); |
100 |
> |
sg_set_error_with_errno(SG_ERROR_OPEN, "/proc/meminfo"); |
101 |
|
return NULL; |
102 |
|
} |
103 |
|
|
126 |
|
|
127 |
|
mibsize = sizeof mib / sizeof mib[0]; |
128 |
|
if (sysctlnametomib("vm.swap_info", mib, &mibsize) < 0) { |
129 |
< |
sg_set_error(SG_ERROR_SYSCTLNAMETOMIB, "vm.swap_info"); |
129 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTLNAMETOMIB, |
130 |
> |
"vm.swap_info"); |
131 |
|
return NULL; |
132 |
|
} |
133 |
|
for (n = 0; ; ++n) { |
144 |
|
swap_stat.used += (long long) xsw.xsw_used; |
145 |
|
} |
146 |
|
if (errno != ENOENT) { |
147 |
< |
sg_set_error(SG_ERROR_ENOENT, NULL); |
147 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "vm.swap_info"); |
148 |
|
return NULL; |
149 |
|
} |
150 |
|
#else |