132 |
|
#ifdef ALLBSD |
133 |
|
nummnt=getmntinfo(&mp , MNT_LOCAL); |
134 |
|
if (nummnt<=0){ |
135 |
< |
sg_set_error(SG_ERROR_GETMNTINFO, NULL); |
135 |
> |
sg_set_error_with_errno(SG_ERROR_GETMNTINFO, NULL); |
136 |
|
return NULL; |
137 |
|
} |
138 |
|
for(;nummnt--; mp++){ |
155 |
|
|
156 |
|
#ifdef SOLARIS |
157 |
|
if ((f=fopen("/etc/mnttab", "r" ))==NULL){ |
158 |
< |
sg_set_error(SG_ERROR_OPEN, "/etc/mnttab"); |
158 |
> |
sg_set_error_with_errno(SG_ERROR_OPEN, "/etc/mnttab"); |
159 |
|
return NULL; |
160 |
|
} |
161 |
|
while((getmntent(f, &mp)) == 0){ |
348 |
|
|
349 |
|
size = sizeof(diskcount); |
350 |
|
if (sysctl(mib, MIBSIZE, &diskcount, &size, NULL, 0) < 0) { |
351 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKCOUNT"); |
351 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKCOUNT"); |
352 |
|
return NULL; |
353 |
|
} |
354 |
|
|
356 |
|
mib[1] = HW_DISKNAMES; |
357 |
|
|
358 |
|
if (sysctl(mib, MIBSIZE, NULL, &size, NULL, 0) < 0) { |
359 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
359 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
360 |
|
return NULL; |
361 |
|
} |
362 |
|
|
366 |
|
} |
367 |
|
|
368 |
|
if (sysctl(mib, MIBSIZE, disknames, &size, NULL, 0) < 0) { |
369 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
369 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
370 |
|
return NULL; |
371 |
|
} |
372 |
|
|
385 |
|
#endif |
386 |
|
|
387 |
|
if (sysctl(mib, MIBSIZE, NULL, &size, NULL, 0) < 0) { |
388 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
388 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
389 |
|
return NULL; |
390 |
|
} |
391 |
|
|
401 |
|
} |
402 |
|
|
403 |
|
if (sysctl(mib, MIBSIZE, stats, &size, NULL, 0) < 0) { |
404 |
< |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
404 |
> |
sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
405 |
|
return NULL; |
406 |
|
} |
407 |
|
|
468 |
|
} |
469 |
|
#ifdef FREEBSD5 |
470 |
|
if ((devstat_getdevs(NULL, &stats)) < 0) { |
471 |
+ |
/* FIXME devstat functions return a string error in |
472 |
+ |
devstat_errbuf */ |
473 |
|
sg_set_error(SG_ERROR_DEVSTAT_GETDEVS, NULL); |
474 |
|
return NULL; |
475 |
|
} |
523 |
|
#endif |
524 |
|
if(diskio_stats_ptr->disk_name!=NULL) free(diskio_stats_ptr->disk_name); |
525 |
|
if (asprintf((&diskio_stats_ptr->disk_name), "%s%d", dev_ptr->device_name, dev_ptr->unit_number) == -1) { |
526 |
< |
sg_set_error(SG_ERROR_ASPRINTF, NULL); |
526 |
> |
sg_set_error_with_errno(SG_ERROR_ASPRINTF, NULL); |
527 |
|
return NULL; |
528 |
|
} |
529 |
|
diskio_stats_ptr->systime=time(NULL); |