From: Sebastien GODARD Date: Sun, 15 Sep 2019 07:45:00 +0000 (+0200) Subject: sar/sadc: Add support for several types of extra records X-Git-Tag: v12.1.7~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2cc99c30e26914e0b6622a37a30209cdf5363e2;p=sysstat sar/sadc: Add support for several types of extra records Signed-off-by: Sebastien GODARD --- diff --git a/sa.h b/sa.h index 51e2a6c..d2efd67 100644 --- 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 diff --git a/sa_common.c b/sa_common.c index c60d302..b26851b 100644 --- a/sa_common.c +++ b/sa_common.c @@ -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; }