]> granicus.if.org Git - sysstat/commitdiff
sar/sadc: Add support for several types of extra records
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 15 Sep 2019 07:45:00 +0000 (09:45 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 15 Sep 2019 07:45:00 +0000 (09:45 +0200)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa.h
sa_common.c

diff --git a/sa.h b/sa.h
index 51e2a6cd595c1a7d99f84d3144a0aa83a97b735f..d2efd670040c8fa38d42e082330dbf2021bf12ad 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -435,7 +435,7 @@ struct svg_hdr_parm {
  * Of course we display the real number of CPU (e.g. "1" for 1 CPU and SMP
  * kernel) with the LINUX RESTART message.
  *
- * If the record_header's type is R_EXTRA then we find only a list of extra
+ * If the record_header's type is R_EXTRA* then we find only a list of extra
  * structures following the record_header structure but no statistics ones.
  * Note that extra structures may exist for all record_header types
  * (R_STATS, R_COMMENT, R_RESTART...). For R_COMMENT and R_RESTART records,
@@ -699,10 +699,11 @@ struct extra_desc {
  */
 #define R_COMMENT      4
 /*
- * R_EXTRA means that extra structures are following current
+ * R_EXTRA* records means that extra structures are following current
  * record_header structure, but no statistics structures.
  */
-#define R_EXTRA                5
+#define R_EXTRA_MIN    5
+#define R_EXTRA_MAX    15
 
 /* Maximum length of a comment */
 #define MAX_COMMENT_LEN        64
index c60d302cd512598c8df67ef97c0a7b8f4bd9ac51..b26851bb43d9be3477df9bf2406b030dcdb836d7 100644 (file)
@@ -1559,7 +1559,7 @@ int read_record_hdr(int ifd, void *buffer, struct record_header *record_hdr,
                    record_hdr->extra_next && (skip_extra_struct(ifd, endian_mismatch, arch_64) < 0))
                        return 2;
        }
-       while (record_hdr->record_type == R_EXTRA);
+       while ((record_hdr->record_type >= R_EXTRA_MIN) && (record_hdr->record_type <= R_EXTRA_MAX)) ;
 
        return 0;
 }