+ numfields = strsplit (buffer, fields, STATIC_ARRAY_SIZE (fields));
+ if (numfields != 5)
+ continue;
+
+ sstrncpy (path, fields[0], sizeof (path));
+ escape_slashes (path, sizeof (path));
+
+ errno = 0;
+ endptr = NULL;
+ size = strtod (fields[2], &endptr);
+ if ((endptr == fields[2]) || (errno != 0))
+ continue;
+
+ errno = 0;
+ endptr = NULL;
+ used = strtod (fields[3], &endptr);
+ if ((endptr == fields[3]) || (errno != 0))
+ continue;
+
+ if (size < used)
+ continue;
+
+ free = size - used;
+
+ swap_submit_gauge (path, "used", used);
+ swap_submit_gauge (path, "free", free);
+ }
+
+ fclose (fh);
+
+ return (0);
+} /* }}} int swap_read_separate */
+
+static int swap_read_combined (void) /* {{{ */
+{
+ FILE *fh;
+ char buffer[1024];
+
+ uint8_t have_data = 0;
+ gauge_t swap_used = 0.0;
+ gauge_t swap_cached = 0.0;
+ gauge_t swap_free = 0.0;
+ gauge_t swap_total = 0.0;
+
+ fh = fopen ("/proc/meminfo", "r");
+ if (fh == NULL)