69 |
|
#endif |
70 |
|
|
71 |
|
if((uname(&os)) < 0){ |
72 |
< |
sg_set_error(SG_ERROR_UNAME, NULL); |
72 |
> |
sg_set_error_with_errno(SG_ERROR_UNAME, NULL); |
73 |
|
return NULL; |
74 |
|
} |
75 |
|
|
106 |
|
#endif |
107 |
|
#if defined(LINUX) || defined(CYGWIN) |
108 |
|
if ((f=fopen("/proc/uptime", "r")) == NULL) { |
109 |
< |
sg_set_error(SG_ERROR_OPEN, "/proc/uptime"); |
109 |
> |
sg_set_error_with_errno(SG_ERROR_OPEN, "/proc/uptime"); |
110 |
|
return NULL; |
111 |
|
} |
112 |
|
if((fscanf(f,"%lu %*d",&general_stat.uptime)) != 1){ |
120 |
|
mib[1] = KERN_BOOTTIME; |
121 |
|
size = sizeof boottime; |
122 |
|
if (sysctl(mib, 2, &boottime, &size, NULL, 0) < 0){ |
123 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_BOOTTIME"); |
123 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, |
124 |
> |
"CTL_KERN.KERN_BOOTTIME"); |
125 |
|
return NULL; |
126 |
|
} |
127 |
|
time(&curtime); |