X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fzfs_arc.c;h=41a89b16aef5348bb26a6d24a43fad50f316d5b7;hb=0532336600cf2abe1d25af8fbf5ad3cf3b6b31e0;hp=f0d23239a82ab158c03c669f9a96cf2fc7f8dd24;hpb=c4da209d3b3ef23d03617c15abc3c8365c0ffd2b;p=collectd.git diff --git a/src/zfs_arc.c b/src/zfs_arc.c index f0d23239..41a89b16 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,11 @@ static int za_read (void) { llentry_t *e; llvalues = malloc(sizeof(long long int) * i); + if (llvalues == NULL) + { + ERROR ("zfs_arc plugin: `malloc' failed."); + return (-1); + } int j = 0; pnl = file_contents; @@ -251,6 +256,9 @@ static int za_read (void) /* Sizes */ za_read_gauge (ksp, "size", "cache_size", "arc"); + za_read_gauge (ksp, "c", "cache_size", "c"); + za_read_gauge (ksp, "c_min", "cache_size", "c_min"); + za_read_gauge (ksp, "c_max", "cache_size", "c_max"); /* The "l2_size" value has disappeared from Solaris some time in * early 2013, and has only reappeared recently in Solaris 11.2.