Code

Merge branch 'collectd-4.10' into collectd-5.0
authorFlorian Forster <octo@collectd.org>
Fri, 2 Sep 2011 01:28:05 +0000 (21:28 -0400)
committerFlorian Forster <octo@collectd.org>
Fri, 2 Sep 2011 01:28:05 +0000 (21:28 -0400)
Conflicts:
src/irq.c

Change-Id: Ie6c78234f07cc5b7bac7e6914813e9545ce1b1af

1  2 
.gitignore
src/irq.c
src/plugin.c
src/processes.c
src/utils_rrdcreate.c

diff --cc .gitignore
Simple merge
diff --cc src/irq.c
index 94e425371dfed11dc68a8fdd27dc912d6187d12a,70d6b5abe41dfd353ff1574a3035194f9e45654d..7e738291c58af7c851907f477e7386fc5e3fd561
+++ b/src/irq.c
@@@ -116,16 -106,15 +106,15 @@@ static int check_ignore_irq (const cha
        return (1 - irq_list_action);
  }
  
- static void irq_submit (unsigned int irq, derive_t value)
 -static void irq_submit (const char *irq_name, counter_t value)
++static void irq_submit (const char *irq_name, derive_t value)
  {
        value_t values[1];
        value_list_t vl = VALUE_LIST_INIT;
-       int status;
  
-       if (check_ignore_irq (irq))
+       if (check_ignore_irq (irq_name))
                return;
  
 -      values[0].counter = value;
 +      values[0].derive = value;
  
        vl.values = values;
        vl.values_len = 1;
@@@ -154,16 -145,10 +139,16 @@@ static int irq_read (void
                                sstrerror (errno, errbuf, sizeof (errbuf)));
                return (-1);
        }
-       while (fgets (buffer, BUFSIZE, fh) != NULL)
 +
+       while (fgets (buffer, sizeof (buffer), fh) != NULL)
        {
-               unsigned int irq;
+               char *irq_name;
+               size_t irq_name_len;
 +              derive_t irq_value;
-               char *endptr;
 +              int i;
 +
 +              char *fields[64];
 +              int fields_num;
  
                fields_num = strsplit (buffer, fields, 64);
                if (fields_num < 2)
                irq_value = 0;
                for (i = 1; i < fields_num; i++)
                {
 -                      errno = 0;
 -                      endptr = NULL;
 -                      value = strtoull (fields[i], &endptr, 10);
 +                      /* Per-CPU value */
 +                      value_t v;
 +                      int status;
  
 -                      /* Ignore all fields following a non-numeric field. */
 -                      if ((errno != 0) || (endptr == NULL) || (*endptr != 0))
 +                      status = parse_value (fields[i], &v, DS_TYPE_DERIVE);
 +                      if (status != 0)
                                break;
  
 -                      irq_value += value;
 +                      irq_value += v.derive;
                } /* for (i) */
  
-               if (i < fields_num)
+               /* No valid fields -> do not submit anything. */
+               if (i <= 1)
                        continue;
  
-               irq_submit (irq, irq_value);
 -              /* Force 32bit wrap-around */
 -              irq_submit (irq_name, irq_value % 4294967296ULL);
++              irq_submit (irq_name, irq_value);
        }
  
        fclose (fh);
diff --cc src/plugin.c
Simple merge
diff --cc src/processes.c
Simple merge
Simple merge