]> granicus.if.org Git - sysstat/commitdiff
sadc/sar: New format (part 2): Remap statistics structures
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 22 Sep 2017 06:40:38 +0000 (08:40 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 22 Sep 2017 06:40:38 +0000 (08:40 +0200)
Remap structures containing statistics from an older (or newer)
sysstat version to current format (from current sysstat version).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
sa.h
sa_common.c
sadc.c
sar.c

index 751de4db3a7e765fbbf77e4a7f2c88799aafc237..b6f3a89ef16bb08112bf0c02c940e7657b640cd4 100644 (file)
@@ -89,6 +89,7 @@ struct activity cpu_act = {
                          "CPU;%usr;%nice;%sys;%iowait;%steal;%irq;%soft;%guest;%gnice;%idle",
 #endif
        .gtypes_nr      = {10, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_cpu_stats,
        .f_xml_print    = xml_print_cpu_stats,
@@ -127,6 +128,7 @@ struct activity pcsw_act = {
        .hdr_line       = "proc/s;cswch/s",
 #endif
        .gtypes_nr      = {1, 1, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pcsw_stats,
        .f_xml_print    = xml_print_pcsw_stats,
@@ -165,6 +167,7 @@ struct activity irq_act = {
        .hdr_line       = "INTR;intr/s",
 #endif
        .gtypes_nr      = {1, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_irq_stats,
        .f_xml_print    = xml_print_irq_stats,
@@ -203,6 +206,7 @@ struct activity swap_act = {
        .hdr_line       = "pswpin/s;pswpout/s",
 #endif
        .gtypes_nr      = {0, 2, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_swap_stats,
        .f_xml_print    = xml_print_swap_stats,
@@ -242,6 +246,7 @@ struct activity paging_act = {
                          "pgfree/s;pgscank/s;pgscand/s;pgsteal/s;%vmeff",
 #endif
        .gtypes_nr      = {0, 8, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_paging_stats,
        .f_xml_print    = xml_print_paging_stats,
@@ -280,6 +285,7 @@ struct activity io_act = {
        .hdr_line       = "tps;rtps;wtps;bread/s;bwrtn/s",
 #endif
        .gtypes_nr      = {5, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_io_stats,
        .f_xml_print    = xml_print_io_stats,
@@ -319,6 +325,7 @@ struct activity memory_act = {
                          "kbswpfree;kbswpused;%swpused;kbswpcad;%swpcad",
 #endif
        .gtypes_nr      = {0, 17, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_memory_stats,
        .f_xml_print    = xml_print_memory_stats,
@@ -357,6 +364,7 @@ struct activity ktables_act = {
        .hdr_line       = "dentunusd;file-nr;inode-nr;pty-nr",
 #endif
        .gtypes_nr      = {0, 0, 4},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_ktables_stats,
        .f_xml_print    = xml_print_ktables_stats,
@@ -395,6 +403,7 @@ struct activity queue_act = {
        .hdr_line       = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15;blocked",
 #endif
        .gtypes_nr      = {0, 2, 4},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_queue_stats,
        .f_xml_print    = xml_print_queue_stats,
@@ -433,6 +442,7 @@ struct activity serial_act = {
        .hdr_line       = "TTY;rcvin/s;txmtin/s;framerr/s;prtyerr/s;brk/s;ovrun/s",
 #endif
        .gtypes_nr      = {0, 0, 7},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_serial_stats,
        .f_xml_print    = xml_print_serial_stats,
@@ -471,6 +481,7 @@ struct activity disk_act = {
        .hdr_line       = "DEV;tps;rkB/s;wkB/s;areq-sz;aqu-sz;await;svctm;%util",
 #endif
        .gtypes_nr      = {1, 2, 6},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_disk_stats,
        .f_xml_print    = xml_print_disk_stats,
@@ -509,6 +520,7 @@ struct activity net_dev_act = {
        .hdr_line       = "IFACE;rxpck/s;txpck/s;rxkB/s;txkB/s;rxcmp/s;txcmp/s;rxmcst/s;%ifutil",
 #endif
        .gtypes_nr      = {7, 0, 1},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_dev_stats,
        .f_xml_print    = xml_print_net_dev_stats,
@@ -548,6 +560,7 @@ struct activity net_edev_act = {
                          "txcarr/s;rxfram/s;rxfifo/s;txfifo/s",
 #endif
        .gtypes_nr      = {9, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_edev_stats,
        .f_xml_print    = xml_print_net_edev_stats,
@@ -586,6 +599,7 @@ struct activity net_nfs_act = {
        .hdr_line       = "call/s;retrans/s;read/s;write/s;access/s;getatt/s",
 #endif
        .gtypes_nr      = {0, 0, 6},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_nfs_stats,
        .f_xml_print    = xml_print_net_nfs_stats,
@@ -625,6 +639,7 @@ struct activity net_nfsd_act = {
                          "sread/s;swrite/s;saccess/s;sgetatt/s",
 #endif
        .gtypes_nr      = {0, 0, 11},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_nfsd_stats,
        .f_xml_print    = xml_print_net_nfsd_stats,
@@ -663,6 +678,7 @@ struct activity net_sock_act = {
        .hdr_line       = "totsck;tcpsck;udpsck;rawsck;ip-frag;tcp-tw",
 #endif
        .gtypes_nr      = {0, 0, 6},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_sock_stats,
        .f_xml_print    = xml_print_net_sock_stats,
@@ -701,6 +717,7 @@ struct activity net_ip_act = {
        .hdr_line       = "irec/s;fwddgm/s;idel/s;orq/s;asmrq/s;asmok/s;fragok/s;fragcrt/s",
 #endif
        .gtypes_nr      = {8, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_ip_stats,
        .f_xml_print    = xml_print_net_ip_stats,
@@ -739,6 +756,7 @@ struct activity net_eip_act = {
        .hdr_line       = "ihdrerr/s;iadrerr/s;iukwnpr/s;idisc/s;odisc/s;onort/s;asmf/s;fragf/s",
 #endif
        .gtypes_nr      = {8, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_eip_stats,
        .f_xml_print    = xml_print_net_eip_stats,
@@ -778,6 +796,7 @@ struct activity net_icmp_act = {
                          "otmr/s;iadrmk/s;iadrmkr/s;oadrmk/s;oadrmkr/s",
 #endif
        .gtypes_nr      = {0, 14, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_icmp_stats,
        .f_xml_print    = xml_print_net_icmp_stats,
@@ -817,6 +836,7 @@ struct activity net_eicmp_act = {
                          "iparmpb/s;oparmpb/s;isrcq/s;osrcq/s;iredir/s;oredir/s",
 #endif
        .gtypes_nr      = {0, 12, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_eicmp_stats,
        .f_xml_print    = xml_print_net_eicmp_stats,
@@ -855,6 +875,7 @@ struct activity net_tcp_act = {
        .hdr_line       = "active/s;passive/s;iseg/s;oseg/s",
 #endif
        .gtypes_nr      = {0, 4, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_tcp_stats,
        .f_xml_print    = xml_print_net_tcp_stats,
@@ -893,6 +914,7 @@ struct activity net_etcp_act = {
        .hdr_line       = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s",
 #endif
        .gtypes_nr      = {0, 5, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_etcp_stats,
        .f_xml_print    = xml_print_net_etcp_stats,
@@ -931,6 +953,7 @@ struct activity net_udp_act = {
        .hdr_line       = "idgm/s;odgm/s;noport/s;idgmerr/s",
 #endif
        .gtypes_nr      = {0, 4, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_udp_stats,
        .f_xml_print    = xml_print_net_udp_stats,
@@ -969,6 +992,7 @@ struct activity net_sock6_act = {
        .hdr_line       = "tcp6sck;udp6sck;raw6sck;ip6-frag",
 #endif
        .gtypes_nr      = {0, 0, 4},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_sock6_stats,
        .f_xml_print    = xml_print_net_sock6_stats,
@@ -1008,6 +1032,7 @@ struct activity net_ip6_act = {
                          "imcpck6/s;omcpck6/s;fragok6/s;fragcr6/s",
 #endif
        .gtypes_nr      = {10, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_ip6_stats,
        .f_xml_print    = xml_print_net_ip6_stats,
@@ -1047,6 +1072,7 @@ struct activity net_eip6_act = {
                          "inort6/s;onort6/s;asmf6/s;fragf6/s;itrpck6/s",
 #endif
        .gtypes_nr      = {11, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_eip6_stats,
        .f_xml_print    = xml_print_net_eip6_stats,
@@ -1087,6 +1113,7 @@ struct activity net_icmp6_act = {
                          "inbad6/s;onbad6/s",
 #endif
        .gtypes_nr      = {0, 17, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_icmp6_stats,
        .f_xml_print    = xml_print_net_icmp6_stats,
@@ -1126,6 +1153,7 @@ struct activity net_eicmp6_act = {
                          "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s",
 #endif
        .gtypes_nr      = {0, 11, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_eicmp6_stats,
        .f_xml_print    = xml_print_net_eicmp6_stats,
@@ -1164,6 +1192,7 @@ struct activity net_udp6_act = {
        .hdr_line       = "idgm6/s;odgm6/s;noport6/s;idgmer6/s",
 #endif
        .gtypes_nr      = {0, 4, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_net_udp6_stats,
        .f_xml_print    = xml_print_net_udp6_stats,
@@ -1202,6 +1231,7 @@ struct activity pwr_cpufreq_act = {
        .hdr_line       = "CPU;MHz",
 #endif
        .gtypes_nr      = {0, 1, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_cpufreq_stats,
        .f_xml_print    = xml_print_pwr_cpufreq_stats,
@@ -1240,6 +1270,7 @@ struct activity pwr_fan_act = {
        .hdr_line       = "FAN;DEVICE;rpm;drpm",
 #endif
        .gtypes_nr      = {2, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_fan_stats,
        .f_xml_print    = xml_print_pwr_fan_stats,
@@ -1278,6 +1309,7 @@ struct activity pwr_temp_act = {
        .hdr_line       = "TEMP;DEVICE;degC;%temp",
 #endif
        .gtypes_nr      = {3, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_temp_stats,
        .f_xml_print    = xml_print_pwr_temp_stats,
@@ -1316,6 +1348,7 @@ struct activity pwr_in_act = {
        .hdr_line       = "IN;DEVICE;inV;%in",
 #endif
        .gtypes_nr      = {3, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_in_stats,
        .f_xml_print    = xml_print_pwr_in_stats,
@@ -1354,6 +1387,7 @@ struct activity huge_act = {
        .hdr_line       = "kbhugfree;kbhugused;%hugused",
 #endif
        .gtypes_nr      = {0, 2, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_huge_stats,
        .f_xml_print    = xml_print_huge_stats,
@@ -1392,6 +1426,7 @@ struct activity pwr_wghfreq_act = {
        .hdr_line       = "CPU;wghMHz",
 #endif
        .gtypes_nr      = {1, 1, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_wghfreq_stats,
        .f_xml_print    = xml_print_pwr_wghfreq_stats,
@@ -1430,6 +1465,7 @@ struct activity pwr_usb_act = {
        .hdr_line       = "manufact;product;BUS;idvendor;idprod;maxpower",
 #endif
        .gtypes_nr      = {0, 0, 4},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_pwr_usb_stats,
        .f_xml_print    = xml_print_pwr_usb_stats,
@@ -1469,6 +1505,7 @@ struct activity filesystem_act = {
                          "MOUNTPOINT;MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused",
 #endif
        .gtypes_nr      = {5, 0, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_filesystem_stats,
        .f_xml_print    = xml_print_filesystem_stats,
@@ -1507,6 +1544,7 @@ struct activity fchost_act = {
        .hdr_line       = "FCHOST;fch_rxf/s;fch_txf/s;fch_rxw/s;fch_txw/s",
 #endif
        .gtypes_nr      = {0, 4, 0},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_fchost_stats,
        .f_xml_print    = xml_print_fchost_stats,
@@ -1545,6 +1583,7 @@ struct activity softnet_act = {
        .hdr_line       = "CPU;total/s;dropd/s;squeezd/s;rx_rps/s;flw_lim/s",
 #endif
        .gtypes_nr      = {0, 0, 5},
+       .ftypes_nr      = {0, 0, 0},
 #ifdef SOURCE_SADF
        .f_render       = render_softnet_stats,
        .f_xml_print    = xml_print_softnet_stats,
diff --git a/sa.h b/sa.h
index 50f4c45ce315c527778468eec351ae6f0d464962..20eea8e3077d0994a38ebf83d6dd0836edf2d847 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -496,12 +496,17 @@ struct file_activity {
         * Size of an item structure.
         */
        int size;
+       /*
+        * Description of the structure containing statistics for the
+        * given activity (nr of "long long", nr of "long" and nr of "int").
+        */
+       int types_nr[3];
 };
 
 #define FILE_ACTIVITY_SIZE     (sizeof(struct file_activity))
 #define FILE_ACTIVITY_ULL_NR   0       /* Nr of unsigned long long in file_activity structure */
 #define FILE_ACTIVITY_UL_NR    0       /* Nr of unsigned long in file_activity structure */
-#define FILE_ACTIVITY_U_NR     5       /* Nr of [unsigned] int in file_activity structure */
+#define FILE_ACTIVITY_U_NR     8       /* Nr of [unsigned] int in file_activity structure */
 
 
 /* Record type */
@@ -743,6 +748,12 @@ struct activity {
         * of "long" fields, then the number of "int" fields.
         */
        int gtypes_nr[3];
+       /*
+        * This array has the same meaning as @gtypes_nr[] above, but the values are those
+        * read from current data file. They may be different from those of @gtypes_nr[]
+        * because we can read data from a different sysstat version (older or newer).
+        */
+       int ftypes_nr[3];
        /*
         * Number of SVG graphs for this activity. The total number of graphs for
         * the activity can be greater though if flag AO_GRAPH_PER_ITEM is set, in
index 2fe29f328a716298d69417e973367173407d8dac..aeb20dd111a12f4250c0fec8ebaa7ca3f04dd37a 100644 (file)
@@ -1282,6 +1282,10 @@ void read_file_stat_bunch(struct activity *act[], int curr, int ifd, int act_nr,
                        }
                }
                else if (act[p]->nr > 0) {
+                       /*
+                        * Note: If msize was smaller than fsize,
+                        * then it has been set to fsize in check_file_actlst().
+                        */
                        sa_fread(ifd, act[p]->buf[curr], act[p]->fsize * act[p]->nr * act[p]->nr2, HARD_SIZE);
                }
                else {
@@ -1291,10 +1295,16 @@ void read_file_stat_bunch(struct activity *act[], int curr, int ifd, int act_nr,
                /* Normalize endianness for current activity's structures */
                if (endian_mismatch) {
                        for (j = 0; j < (act[p]->nr * act[p]->nr2); j++) {
-                               swap_struct(act[p]->gtypes_nr, (char *) act[p]->buf[curr] + j * act[p]->msize,
+                               swap_struct(act[p]->ftypes_nr, (char *) act[p]->buf[curr] + j * act[p]->msize,
                                            arch_64);
                        }
                }
+
+               /* Remap structure's fields to those known by current sysstat version */
+               for (j = 0; j < (act[p]->nr * act[p]->nr2); j++) {
+                       remap_struct(act[p]->gtypes_nr, act[p]->ftypes_nr,
+                                    (char *) act[p]->buf[curr] + j * act[p]->msize, act[p]->fsize);
+               }
        }
 }
 
@@ -1400,7 +1410,7 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[],
                       struct file_activity **file_actlst, unsigned int id_seq[],
                       int ignore, int *endian_mismatch, int *arch_64)
 {
-       int i, j, p;
+       int i, j, k, p;
        unsigned int a_cpu = FALSE;
        struct file_activity *fal;
        void *buffer = NULL;
@@ -1420,8 +1430,10 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[],
        memcpy(file_hdr, buffer, FILE_HEADER_SIZE);
        free(buffer);
 
-       /* Normalize endianness for file_hdr structure */
+       /* Tell that data come from a 64 bit machine */
        *arch_64 = (file_hdr->sa_sizeof_long == SIZEOF_LONG_64BIT);
+
+       /* Normalize endianness for file_hdr structure */
        if (*endian_mismatch) {
                swap_struct(hdr_types_nr, file_hdr, *arch_64);
        }
@@ -1488,6 +1500,25 @@ void check_file_actlst(int *ifd, char *dfile, struct activity *act[],
                if (fal->nr > act[p]->nr_max) {
                        handle_invalid_sa_file(ifd, file_magic, dfile, 0);
                }
+               /*
+                * Number of fields of each type ("long long", or "long"
+                * or "int") composing the structure with statistics may
+                * only increase with new sysstat versions. Here, we may
+                * be reading a file created by current sysstat version,
+                * or by an older or a newer version.
+                */
+               if (!(((fal->types_nr[0] >= act[p]->gtypes_nr[0]) &&
+                    (fal->types_nr[1] >= act[p]->gtypes_nr[1]) &&
+                    (fal->types_nr[2] >= act[p]->gtypes_nr[2]))
+                    ||
+                    ((fal->types_nr[0] <= act[p]->gtypes_nr[0]) &&
+                    (fal->types_nr[1] <= act[p]->gtypes_nr[1]) &&
+                    (fal->types_nr[2] <= act[p]->gtypes_nr[2])))) {
+                       handle_invalid_sa_file(ifd, file_magic, dfile, 0);
+               }
+               for (k = 0; k < 3; k++) {
+                       act[p]->ftypes_nr[k] = fal->types_nr[k];
+               }
 
                if (fal->id == A_CPU) {
                        a_cpu = TRUE;
diff --git a/sadc.c b/sadc.c
index 47765b06df8801b854ca355964aaa1b08ac0b0da..c6ea98e3735cff8b7be5a2cf5e0fe5da9ea80411 100644 (file)
--- a/sadc.c
+++ b/sadc.c
@@ -478,7 +478,7 @@ void fill_magic_header(struct file_magic *file_magic)
  */
 void setup_file_hdr(int fd)
 {
-       int i, p;
+       int i, j, p;
        struct tm rectime;
        struct utsname header;
        struct file_magic file_magic;
@@ -546,6 +546,9 @@ void setup_file_hdr(int fd)
                        file_act.nr    = act[p]->nr;
                        file_act.nr2   = act[p]->nr2;
                        file_act.size  = act[p]->fsize;
+                       for (j = 0; j < 3; j++) {
+                               file_act.types_nr[j] = act[p]->gtypes_nr[j];
+                       }
 
                        if (write_all(fd, &file_act, FILE_ACTIVITY_SIZE)
                            != FILE_ACTIVITY_SIZE)
@@ -929,13 +932,21 @@ void open_ofile(int *ofd, char ofile[], int restart_mark)
 
                if ((file_act[i].nr <= 0) || (file_act[i].nr2 <= 0) ||
                    (file_act[i].nr > act[p]->nr_max) ||
-                   (file_act[i].nr2 > NR2_MAX)) {
+                   (file_act[i].nr2 > NR2_MAX))
                        /*
                         * Number of items and subitems should never be zero (or negative)
                         * or greater than their upper limit.
                         */
                        goto append_error;
-               }
+
+               if ((file_act[i].types_nr[0] != act[p]->gtypes_nr[0]) ||
+                   (file_act[i].types_nr[1] != act[p]->gtypes_nr[1]) ||
+                   (file_act[i].types_nr[2] != act[p]->gtypes_nr[2]))
+                       /*
+                        * Composition of structure containing statsitics cannot
+                        * be different from that known by current version.
+                        */
+                       goto append_error;
        }
 
        /*
diff --git a/sar.c b/sar.c
index a72e0f468994c6e52f9d9716bba7f71dc8093884..fb42b0fbbd6abdca71ccb950e280a5351e4e9f20 100644 (file)
--- a/sar.c
+++ b/sar.c
@@ -857,6 +857,9 @@ void read_header_data(void)
                p = get_activity_position(act, file_act.id, RESUME_IF_NOT_FOUND);
 
                if ((p < 0) || (act[p]->fsize != file_act.size)
+                           || (act[p]->gtypes_nr[0] != file_act.types_nr[0])
+                           || (act[p]->gtypes_nr[1] != file_act.types_nr[1])
+                           || (act[p]->gtypes_nr[2] != file_act.types_nr[2])
                            || (file_act.nr <= 0)
                            || (file_act.nr2 <= 0)
                            || (act[p]->magic != file_act.magic))