X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fzfs_arc.c;h=8feb31d55c0bfc75f571e0398edfef965e8fcc78;hp=f0d23239a82ab158c03c669f9a96cf2fc7f8dd24;hb=2cf10557f58144e13793a3d69ae5d4b7c8d6c305;hpb=09c6a320f3cb36b5dbb2c2ce43858f33be7acf9b diff --git a/src/zfs_arc.c b/src/zfs_arc.c index f0d23239..8feb31d5 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -186,7 +186,7 @@ static int za_read (void) return (-1); } - len = read_file_contents (ZOL_ARCSTATS_FILE, file_contents, sizeof(file_contents)); + len = read_file_contents (ZOL_ARCSTATS_FILE, file_contents, sizeof(file_contents) - 1); if (len > 1) { @@ -208,6 +208,12 @@ static int za_read (void) { llentry_t *e; llvalues = malloc(sizeof(long long int) * i); + if (llvalues == NULL) + { + ERROR ("zfs_arc plugin: `malloc' failed."); + llist_destroy (ksp); + return (-1); + } int j = 0; pnl = file_contents; @@ -264,8 +270,11 @@ static int za_read (void) za_read_derive (ksp, "deleted", "cache_operation", "deleted"); #if __FreeBSD__ za_read_derive (ksp, "allocated","cache_operation", "allocated"); +#if defined(__FreeBSD_version) && (__FreeBSD_version < 1002501) + /* stolen removed from sysctl kstat.zfs.misc.arcstats on FreeBSD 10.2+ */ za_read_derive (ksp, "stolen", "cache_operation", "stolen"); #endif +#endif /* Issue indicators */ za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss");