X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fnuma.c;h=56ea707ccf648cc5b433add6af85a3d5344945fd;hp=512520dfe44868c5807a5d9f8551a570e4024a20;hb=7111bb6df7628edce3a8e538b386fbe27633a191;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f diff --git a/src/numa.c b/src/numa.c index 512520df..56ea707c 100644 --- a/src/numa.c +++ b/src/numa.c @@ -46,9 +46,8 @@ static void numa_dispatch_value(int node, /* {{{ */ vl.values = &v; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "numa", sizeof(vl.plugin)); - ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "node%i", node); + snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "node%i", node); sstrncpy(vl.type, "vmpage_action", sizeof(vl.type)); sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); @@ -63,14 +62,14 @@ static int numa_read_node(int node) /* {{{ */ int status; int success; - ssnprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i/numastat", node); + snprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i/numastat", node); fh = fopen(path, "r"); if (fh == NULL) { char errbuf[1024]; ERROR("numa plugin: Reading node %i failed: open(%s): %s", node, path, sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } success = 0; @@ -96,7 +95,7 @@ static int numa_read_node(int node) /* {{{ */ } fclose(fh); - return (success ? 0 : -1); + return success ? 0 : -1; } /* }}} int numa_read_node */ static int numa_read(void) /* {{{ */ @@ -107,7 +106,7 @@ static int numa_read(void) /* {{{ */ if (max_node < 0) { WARNING("numa plugin: No NUMA nodes were detected."); - return (-1); + return -1; } success = 0; @@ -117,7 +116,7 @@ static int numa_read(void) /* {{{ */ success++; } - return (success ? 0 : -1); + return success ? 0 : -1; } /* }}} int numa_read */ static int numa_init(void) /* {{{ */ @@ -128,7 +127,7 @@ static int numa_init(void) /* {{{ */ struct stat statbuf = {0}; int status; - ssnprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i", max_node + 1); + snprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i", max_node + 1); status = stat(path, &statbuf); if (status == 0) { @@ -141,17 +140,15 @@ static int numa_init(void) /* {{{ */ char errbuf[1024]; ERROR("numa plugin: stat(%s) failed: %s", path, sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } } DEBUG("numa plugin: Found %i nodes.", max_node + 1); - return (0); + return 0; } /* }}} int numa_init */ void module_register(void) { plugin_register_init("numa", numa_init); plugin_register_read("numa", numa_read); } /* void module_register */ - -/* vim: set sw=2 sts=2 et : */