--- projects/libstatgrab/src/libstatgrab/cpu_stats.c 2004/04/07 14:53:40 1.23 +++ projects/libstatgrab/src/libstatgrab/cpu_stats.c 2004/07/18 21:30:11 1.24 @@ -17,7 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: cpu_stats.c,v 1.23 2004/04/07 14:53:40 tdb Exp $ + * $Id: cpu_stats.c,v 1.24 2004/07/18 21:30:11 ats Exp $ */ #ifdef HAVE_CONFIG_H @@ -110,7 +110,7 @@ sg_cpu_stats *sg_get_cpu_stats(){ #endif #if defined(LINUX) || defined(CYGWIN) if ((f=fopen("/proc/stat", "r" ))==NULL) { - sg_set_error(SG_ERROR_OPEN, "/proc/stat"); + sg_set_error_with_errno(SG_ERROR_OPEN, "/proc/stat"); return NULL; } /* The very first line should be cpu */ @@ -132,7 +132,7 @@ sg_cpu_stats *sg_get_cpu_stats(){ #if defined(FREEBSD) || defined(DFBSD) size = sizeof cp_time; if (sysctlbyname("kern.cp_time", &cp_time, &size, NULL, 0) < 0){ - sg_set_error(SG_ERROR_SYSCTLBYNAME, "kern.cp_time"); + sg_set_error_with_errno(SG_ERROR_SYSCTLBYNAME, "kern.cp_time"); return NULL; } #else @@ -145,9 +145,11 @@ sg_cpu_stats *sg_get_cpu_stats(){ size = sizeof cp_time; if (sysctl(mib, 2, &cp_time, &size, NULL, 0) < 0) { #ifdef NETBSD - sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_CP_TIME"); + sg_set_error_with_errno(SG_ERROR_SYSCTL, + "CTL_KERN.KERN_CP_TIME"); #else - sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_CPTIME"); + sg_set_error_with_errno(SG_ERROR_SYSCTL, + "CTL_KERN.KERN_CPTIME"); #endif return NULL; }