diff --git a/SOURCES/0001-Added-filesystems-statistics-to-sar-part-1-Basic-def.patch b/SOURCES/0001-Added-filesystems-statistics-to-sar-part-1-Basic-def.patch new file mode 100644 index 0000000..ac89702 --- /dev/null +++ b/SOURCES/0001-Added-filesystems-statistics-to-sar-part-1-Basic-def.patch @@ -0,0 +1,452 @@ +From a0e0995fec1286374ffe260843fdb9b7b01f98fa Mon Sep 17 00:00:00 2001 +From: seb +Date: Mon, 29 Apr 2013 22:04:43 +0200 +Subject: [PATCH] Added filesystems statistics to sar (part 1): Basic + definitions and structures + +A new option (-F) has been added to sar. This option tells sar to display +filesystems statistics. +This first patch adds the corresponding structures, constants and the new +functions prototypes. +sar's help and usage messages have also been updated. + +(cherry picked from commit fe061c6377d8b4550b794f4bf7d6d0ca6d4de34b) +--- + activity.c | 34 +++++++++++++++++++++++++++++++++- + json_stats.c | 17 +++++++++++++++++ + json_stats.h | 2 ++ + pr_stats.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + pr_stats.h | 4 ++++ + rd_stats.h | 12 ++++++++++++ + rndr_stats.c | 18 ++++++++++++++++++ + rndr_stats.h | 2 ++ + sa.h | 8 +++++++- + sa_common.c | 4 ++++ + sa_wrap.c | 43 +++++++++++++++++++++++++++++++++++++++++++ + sar.c | 3 ++- + xml_stats.c | 19 ++++++++++++++++++- + xml_stats.h | 2 ++ + 14 files changed, 217 insertions(+), 4 deletions(-) + +diff --git a/activity.c b/activity.c +index 103df7a..b1aba37 100644 +--- a/activity.c ++++ b/activity.c +@@ -1195,6 +1195,37 @@ struct activity pwr_usb_act = { + .bitmap = NULL + }; + ++/* Filesystem usage activity */ ++struct activity filesystem_act = { ++ .id = A_FILESYSTEM, ++ .options = AO_NULL, ++ .magic = ACTIVITY_MAGIC_BASE, ++ .group = G_DISK, ++#ifdef SOURCE_SADC ++ .f_count = wrap_get_filesystem_nr, ++ .f_count2 = NULL, ++ .f_read = wrap_read_filesystem, ++#endif ++#ifdef SOURCE_SAR ++ .f_print = print_filesystem_stats, ++ .f_print_avg = print_avg_filesystem_stats, ++#endif ++#ifdef SOURCE_SADF ++ .f_render = render_filesystem_stats, ++ .f_xml_print = xml_print_filesystem_stats, ++ .f_json_print = json_print_filesystem_stats, ++ .hdr_line = "Mbfsfree;Mbfsused;%fsused;%ufsused;Ifree;Iused;%Iused;FILESYSTEM", ++ .name = "A_FILESYSTEM", ++#endif ++ .nr = -1, ++ .nr2 = 1, ++ .fsize = STATS_FILESYSTEM_SIZE, ++ .msize = STATS_FILESYSTEM_SIZE, ++ .opt_flags = 0, ++ .buf = {NULL, NULL, NULL}, ++ .bitmap = NULL ++}; ++ + + /* + * Array of activities. +@@ -1239,6 +1270,7 @@ struct activity *act[NR_ACT] = { + &pwr_temp_act, + &pwr_in_act, + &pwr_wghfreq_act, +- &pwr_usb_act /* AO_CLOSE_MARKUP */ ++ &pwr_usb_act, /* AO_CLOSE_MARKUP */ + /* */ ++ &filesystem_act + }; +diff --git a/json_stats.c b/json_stats.c +index a75b422..10d88e9 100644 +--- a/json_stats.c ++++ b/json_stats.c +@@ -2085,3 +2085,20 @@ close_json_markup: + json_markup_power_management(tab, CLOSE_JSON_MARKUP); + } + } ++ ++/* ++ *************************************************************************** ++ * Display filesystems statistics in JSON. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @curr Index in array for current sample statistics. ++ * @tab Indentation in output. ++ * @itv Interval of time in jiffies. ++ *************************************************************************** ++ */ ++__print_funct_t json_print_filesystem_stats(struct activity *a, int curr, int tab, ++ unsigned long long itv) ++{ ++ /* FIXME */ ++} +diff --git a/json_stats.h b/json_stats.h +index 9f80445..9244931 100644 +--- a/json_stats.h ++++ b/json_stats.h +@@ -87,5 +87,7 @@ extern __print_funct_t json_print_pwr_wghfreq_stats + (struct activity *, int, int, unsigned long long); + extern __print_funct_t json_print_pwr_usb_stats + (struct activity *, int, int, unsigned long long); ++extern __print_funct_t json_print_filesystem_stats ++ (struct activity *, int, int, unsigned long long); + + #endif /* _XML_STATS_H */ +diff --git a/pr_stats.c b/pr_stats.c +index ab1b841..332b10e 100644 +--- a/pr_stats.c ++++ b/pr_stats.c +@@ -2437,3 +2437,56 @@ __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr, + { + stub_print_pwr_usb_stats(a, 2, TRUE); + } ++ ++/* ++ *************************************************************************** ++ * Display filesystems statistics. This function is used to ++ * display instantaneous and average statistics. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @prev Index in array where stats used as reference are. ++ * @curr Index in array for current sample statistics. ++ * @itv Interval of time in jiffies. ++ * @dispavg TRUE if displaying average statistics. ++ *************************************************************************** ++ */ ++__print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr, ++ unsigned long long itv, int dispavg) ++{ ++ /* FIXME */ ++} ++ ++/* ++ *************************************************************************** ++ * Display filesystems statistics. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @prev Index in array where stats used as reference are. ++ * @curr Index in array for current sample statistics. ++ * @itv Interval of time in jiffies. ++ *************************************************************************** ++ */ ++__print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr, ++ unsigned long long itv) ++{ ++ stub_print_filesystem_stats(a, prev, curr, itv, FALSE); ++} ++ ++/* ++ *************************************************************************** ++ * Display average filesystems statistics. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @prev Index in array where stats used as reference are. ++ * @curr Index in array for current sample statistics. ++ * @itv Interval of time in jiffies. ++ *************************************************************************** ++ */ ++__print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int curr, ++ unsigned long long itv) ++{ ++ stub_print_filesystem_stats(a, prev, curr, itv, TRUE); ++} +diff --git a/pr_stats.h b/pr_stats.h +index 0f54aab..52007f8 100644 +--- a/pr_stats.h ++++ b/pr_stats.h +@@ -88,6 +88,8 @@ extern __print_funct_t print_pwr_wghfreq_stats + (struct activity *, int, int, unsigned long long); + extern __print_funct_t print_pwr_usb_stats + (struct activity *, int, int, unsigned long long); ++extern __print_funct_t print_filesystem_stats ++ (struct activity *, int, int, unsigned long long); + + /* Functions used to display average statistics */ + extern __print_funct_t print_avg_memory_stats +@@ -112,5 +114,7 @@ extern __print_funct_t print_avg_huge_stats + (struct activity *, int, int, unsigned long long); + extern __print_funct_t print_avg_pwr_usb_stats + (struct activity *, int, int, unsigned long long); ++extern __print_funct_t print_avg_filesystem_stats ++ (struct activity *, int, int, unsigned long long); + + #endif /* _PR_STATS_H */ +diff --git a/rd_stats.h b/rd_stats.h +index 967f584..f941426 100644 +--- a/rd_stats.h ++++ b/rd_stats.h +@@ -56,6 +56,7 @@ + #define NET_SNMP "/proc/net/snmp" + #define NET_SNMP6 "/proc/net/snmp6" + #define CPUINFO "/proc/cpuinfo" ++#define MTAB "/etc/mtab" + + + /* +@@ -520,6 +521,17 @@ struct stats_pwr_usb { + + #define STATS_PWR_USB_SIZE (sizeof(struct stats_pwr_usb)) + ++/* Structure for filesystems statistics */ ++struct stats_filesystem { ++ unsigned long long f_blocks __attribute__ ((aligned (16))); ++ unsigned long long f_bfree __attribute__ ((aligned (16))); ++ unsigned long long f_bavail __attribute__ ((aligned (16))); ++ unsigned long long f_files __attribute__ ((aligned (16))); ++ unsigned long long f_ffree __attribute__ ((aligned (16))); ++}; ++ ++#define STATS_FILESYSTEM_SIZE (sizeof(struct stats_filesystem)) ++ + /* + *************************************************************************** + * Prototypes for functions used to read system statistics +diff --git a/rndr_stats.c b/rndr_stats.c +index 4195103..8349e9a 100644 +--- a/rndr_stats.c ++++ b/rndr_stats.c +@@ -2792,3 +2792,21 @@ __print_funct_t render_pwr_usb_stats(struct activity *a, int isdb, char *pre, + suc->product); + } + } ++ ++/* ++ *************************************************************************** ++ * Display filesystems statistics in selected format. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @isdb Flag, true if db printing, false if ppc printing. ++ * @pre Prefix string for output entries ++ * @curr Index in array for current sample statistics. ++ * @itv Interval of time in jiffies. ++ *************************************************************************** ++ */ ++__print_funct_t render_filesystem_stats(struct activity *a, int isdb, char *pre, ++ int curr, unsigned long long itv) ++{ ++ /* FIXME */ ++} +diff --git a/rndr_stats.h b/rndr_stats.h +index dbced25..ff6452a 100644 +--- a/rndr_stats.h ++++ b/rndr_stats.h +@@ -117,5 +117,7 @@ extern __print_funct_t render_pwr_wghfreq_stats + (struct activity *, int, char *, int, unsigned long long); + extern __print_funct_t render_pwr_usb_stats + (struct activity *, int, char *, int, unsigned long long); ++extern __print_funct_t render_filesystem_stats ++ (struct activity *, int, char *, int, unsigned long long); + + #endif /* _RNDR_STATS_H */ +diff --git a/sa.h b/sa.h +index c11dbe9..50349c8 100644 +--- a/sa.h ++++ b/sa.h +@@ -19,7 +19,7 @@ + */ + + /* Number of activities */ +-#define NR_ACT 36 ++#define NR_ACT 37 + + /* Activities */ + #define A_CPU 1 +@@ -58,6 +58,7 @@ + #define A_HUGE 34 + #define A_PWR_WGHFREQ 35 + #define A_PWR_USB 36 ++#define A_FILESYSTEM 37 + + + /* Macro used to flag an activity that should be collected */ +@@ -197,6 +198,7 @@ + #define NR_DISK_PREALLOC 3 + #define NR_FREQ_PREALLOC 0 + #define NR_USB_PREALLOC 5 ++#define NR_FILESYSTEM_PREALLOC 3 + + #define UTSNAME_LEN 65 + #define TIMESTAMP_LEN 64 +@@ -706,6 +708,8 @@ extern __nr_t + wrap_get_freq_nr(struct activity *); + extern __nr_t + wrap_get_usb_nr(struct activity *); ++extern __nr_t ++ wrap_get_filesystem_nr(struct activity *); + + /* Functions used to read activities statistics */ + extern __read_funct_t +@@ -780,6 +784,8 @@ extern __read_funct_t + wrap_read_time_in_state(struct activity *); + extern __read_funct_t + wrap_read_bus_usb_dev(struct activity *); ++extern __read_funct_t ++ wrap_read_filesystem(struct activity *); + + /* Other functions */ + extern void +diff --git a/sa_common.c b/sa_common.c +index 67c55db..3ccf24b 100644 +--- a/sa_common.c ++++ b/sa_common.c +@@ -1282,6 +1282,10 @@ int parse_sar_opt(char *argv[], int *opt, struct activity *act[], + SELECT_ACTIVITY(A_DISK); + break; + ++ case 'F': ++ SELECT_ACTIVITY(A_FILESYSTEM); ++ break; ++ + case 'H': + p = get_activity_position(act, A_HUGE); + act[p]->options |= AO_SELECTED; +diff --git a/sa_wrap.c b/sa_wrap.c +index 321b227..298f889 100644 +--- a/sa_wrap.c ++++ b/sa_wrap.c +@@ -847,6 +847,28 @@ __read_funct_t wrap_read_bus_usb_dev(struct activity *a) + return; + } + ++/* ++ *************************************************************************** ++ * Read filesystem statistics. ++ * ++ * IN: ++ * @a Activity structure. ++ * ++ * OUT: ++ * @a Activity structure with statistics. ++ *************************************************************************** ++ */ ++__read_funct_t wrap_read_filesystem(struct activity *a) ++{ ++ struct stats_filesystem *st_filesystem ++ = (struct stats_filesystem *) a->_buf0; ++ ++ /* Read filesystems from /etc/mtab */ ++ /* FIXME */ ++ ++ return; ++} ++ + /* + *************************************************************************** + * Count number of interrupts that are in /proc/stat file. +@@ -1049,3 +1071,24 @@ __nr_t wrap_get_usb_nr(struct activity *a) + + return 0; + } ++ ++/* ++ *************************************************************************** ++ * Get number of mounted filesystems from /etc/mtab. Don't take into account ++ * pseudo-filesystems. ++ * ++ * IN: ++ * @a Activity structure. ++ * ++ * RETURNS: ++ * Number of filesystems + a pre-allocation constant. ++ *************************************************************************** ++ */ ++__nr_t wrap_get_filesystem_nr(struct activity *a) ++{ ++ __nr_t n = 0; ++ ++ /* FIXME */ ++ ++ return 0; ++} +diff --git a/sar.c b/sar.c +index 8dd998b..2674810 100644 +--- a/sar.c ++++ b/sar.c +@@ -107,7 +107,7 @@ void usage(char *progname) + { + print_usage_title(stderr, progname); + fprintf(stderr, _("Options are:\n" +- "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" ++ "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" + "[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]\n" + "[ -I { [,...] | SUM | ALL | XALL } ] [ -P { [,...] | ALL } ]\n" + "[ -m { [,...] | ALL } ] [ -n { [,...] | ALL } ]\n" +@@ -132,6 +132,7 @@ void display_help(char *progname) + printf(_("\t-b\tI/O and transfer rate statistics\n")); + printf(_("\t-B\tPaging statistics\n")); + printf(_("\t-d\tBlock device statistics\n")); ++ printf(_("\t-F\tFilesystems statistics\n")); + printf(_("\t-H\tHugepages utilization statistics\n")); + printf(_("\t-I { | SUM | ALL | XALL }\n" + "\t\tInterrupts statistics\n")); +diff --git a/xml_stats.c b/xml_stats.c +index 66a6850..0a15f98 100644 +--- a/xml_stats.c ++++ b/xml_stats.c +@@ -1989,4 +1989,21 @@ close_xml_markup: + if (CLOSE_MARKUP(a->options)) { + xml_markup_power_management(tab, CLOSE_XML_MARKUP); + } +-} +\ No newline at end of file ++} ++ ++/* ++ *************************************************************************** ++ * Display filesystems statistics in XML. ++ * ++ * IN: ++ * @a Activity structure with statistics. ++ * @curr Index in array for current sample statistics. ++ * @tab Indentation in XML output. ++ * @itv Interval of time in jiffies. ++ *************************************************************************** ++ */ ++__print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab, ++ unsigned long long itv) ++{ ++ /* FIXME */ ++} +diff --git a/xml_stats.h b/xml_stats.h +index 3009860..6258703 100644 +--- a/xml_stats.h ++++ b/xml_stats.h +@@ -87,5 +87,7 @@ extern __print_funct_t xml_print_pwr_wghfreq_stats + (struct activity *, int, int, unsigned long long); + extern __print_funct_t xml_print_pwr_usb_stats + (struct activity *, int, int, unsigned long long); ++extern __print_funct_t xml_print_filesystem_stats ++ (struct activity *, int, int, unsigned long long); + + #endif /* _XML_STATS_H */ +-- +2.14.3 + diff --git a/SOURCES/0002-Filesystems-statistics-for-sar-part-2-Read-statistic.patch b/SOURCES/0002-Filesystems-statistics-for-sar-part-2-Read-statistic.patch new file mode 100644 index 0000000..da6ae03 --- /dev/null +++ b/SOURCES/0002-Filesystems-statistics-for-sar-part-2-Read-statistic.patch @@ -0,0 +1,202 @@ +From cea93dc1db568312987814b3cae0a6f837cfaa4e Mon Sep 17 00:00:00 2001 +From: seb +Date: Sun, 5 May 2013 17:42:03 +0200 +Subject: [PATCH] Filesystems statistics for sar (part 2): Read statistics + +This patch reads statistics for mounted filesystems except for +pseudo-filesystems which are ignored. +It also determines the number of filesystems for which stats will be +read. +Oh, and it adds another field to the stats_filesystem structure so that +filesystem name can be saved ;-) + +(cherry picked from commit 512bf2e7ebfa5e5fec757d96820b0b3f94341797) +--- + rd_stats.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + rd_stats.h | 17 ++++++++---- + sa_wrap.c | 5 ++-- + 3 files changed, 102 insertions(+), 7 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index d8c337a..829dae5 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + + #include "common.h" +@@ -1863,6 +1864,51 @@ void read_bus_usb_dev(struct stats_pwr_usb *st_pwr_usb, int nbr) + closedir(dir); + } + ++/* ++ *************************************************************************** ++ * Read filesystems statistics. ++ * ++ * IN: ++ * @st_filesystem Structure where stats will be saved. ++ * @nbr Total number of filesystems. ++ * ++ * OUT: ++ * @st_filesystem Structure with statistics. ++ *************************************************************************** ++ */ ++void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) ++{ ++ FILE *fp; ++ char line[256], fs_name[MAX_FS_LEN], mountp[128]; ++ int fs = 0; ++ struct stats_filesystem *st_filesystem_i; ++ struct statfs buf; ++ ++ if ((fp = fopen(MTAB, "r")) == NULL) ++ return; ++ ++ while ((fgets(line, 256, fp) != NULL) && (fs < nbr)) { ++ if (line[0] == '/') { ++ ++ /* Read current filesystem name and mount point */ ++ sscanf(line, "%71s %127s", fs_name, mountp); ++ ++ if ((statfs(mountp, &buf) < 0) || (!buf.f_blocks)) ++ continue; ++ ++ st_filesystem_i = st_filesystem + fs++; ++ st_filesystem_i->f_blocks = buf.f_blocks * buf.f_bsize; ++ st_filesystem_i->f_bfree = buf.f_bfree * buf.f_bsize; ++ st_filesystem_i->f_bavail = buf.f_bavail * buf.f_bsize; ++ st_filesystem_i->f_files = buf.f_files; ++ st_filesystem_i->f_ffree = buf.f_ffree; ++ strcpy(st_filesystem_i->fs_name, fs_name); ++ } ++ } ++ ++ fclose(fp); ++} ++ + /* + *************************************************************************** + * Read machine uptime, independently of the number of processors. +@@ -2282,3 +2328,44 @@ int get_usb_nr(void) + + return usb; + } ++ ++/* ++ *************************************************************************** ++ * Find number of filesystems in /etc/mtab. Pseudo-filesystems are ignored. ++ * ++ * RETURNS: ++ * Number of filesystems. ++ *************************************************************************** ++ */ ++int get_filesystem_nr(void) ++{ ++ FILE *fp; ++ char line[256], fs_name[MAX_FS_LEN], mountp[128]; ++ int fs = 0; ++ struct statfs buf; ++ ++ if ((fp = fopen(MTAB, "r")) == NULL) ++ /* File non-existent */ ++ return 0; ++ ++ /* Get current filesystem */ ++ while (fgets(line, 256, fp) != NULL) { ++ if (line[0] == '/') { ++ ++ /* Read filesystem name and mount point */ ++ sscanf(line, "%71s %127s", fs_name, mountp); ++ ++ /* Check that total size is not null */ ++ if (statfs(mountp, &buf) < 0) ++ continue; ++ ++ if (buf.f_blocks) { ++ fs++; ++ } ++ } ++ } ++ ++ fclose(fp); ++ ++ return fs; ++} +diff --git a/rd_stats.h b/rd_stats.h +index f941426..3f1edde 100644 +--- a/rd_stats.h ++++ b/rd_stats.h +@@ -27,6 +27,8 @@ + #define MAX_MANUF_LEN 24 + /* Maximum length of USB product string */ + #define MAX_PROD_LEN 48 ++/* Maximum length of filesystem name */ ++#define MAX_FS_LEN 72 + + #define CNT_DEV 0 + #define CNT_PART 1 +@@ -523,11 +525,12 @@ struct stats_pwr_usb { + + /* Structure for filesystems statistics */ + struct stats_filesystem { +- unsigned long long f_blocks __attribute__ ((aligned (16))); +- unsigned long long f_bfree __attribute__ ((aligned (16))); +- unsigned long long f_bavail __attribute__ ((aligned (16))); +- unsigned long long f_files __attribute__ ((aligned (16))); +- unsigned long long f_ffree __attribute__ ((aligned (16))); ++ unsigned long long f_blocks __attribute__ ((aligned (16))); ++ unsigned long long f_bfree __attribute__ ((aligned (16))); ++ unsigned long long f_bavail __attribute__ ((aligned (16))); ++ unsigned long long f_files __attribute__ ((aligned (16))); ++ unsigned long long f_ffree __attribute__ ((aligned (16))); ++ char fs_name[MAX_FS_LEN] __attribute__ ((aligned (16))); + }; + + #define STATS_FILESYSTEM_SIZE (sizeof(struct stats_filesystem)) +@@ -607,6 +610,8 @@ extern void + read_time_in_state(struct stats_pwr_wghfreq *, int, int); + extern void + read_bus_usb_dev(struct stats_pwr_usb *, int); ++extern void ++ read_filesystem(struct stats_filesystem *, int); + + /* + *************************************************************************** +@@ -632,5 +637,7 @@ extern int + get_freq_nr(void); + extern int + get_usb_nr(void); ++extern int ++ get_filesystem_nr(void); + + #endif /* _RD_STATS_H */ +diff --git a/sa_wrap.c b/sa_wrap.c +index 298f889..6a829d7 100644 +--- a/sa_wrap.c ++++ b/sa_wrap.c +@@ -864,7 +864,7 @@ __read_funct_t wrap_read_filesystem(struct activity *a) + = (struct stats_filesystem *) a->_buf0; + + /* Read filesystems from /etc/mtab */ +- /* FIXME */ ++ read_filesystem(st_filesystem, a->nr); + + return; + } +@@ -1088,7 +1088,8 @@ __nr_t wrap_get_filesystem_nr(struct activity *a) + { + __nr_t n = 0; + +- /* FIXME */ ++ if ((n = get_filesystem_nr()) > 0) ++ return n + NR_FILESYSTEM_PREALLOC; + + return 0; + } +-- +2.14.3 + diff --git a/SOURCES/0003-Filesystems-statistics-for-sar-part-3-Display-statis.patch b/SOURCES/0003-Filesystems-statistics-for-sar-part-3-Display-statis.patch new file mode 100644 index 0000000..73425af --- /dev/null +++ b/SOURCES/0003-Filesystems-statistics-for-sar-part-3-Display-statis.patch @@ -0,0 +1,63 @@ +From 5c63cabf526ee93dec1aef7da6e17a46cbd5c562 Mon Sep 17 00:00:00 2001 +From: seb +Date: Mon, 6 May 2013 21:55:04 +0200 +Subject: [PATCH] Filesystems statistics for sar (part 3): Display statistics + +This patch makes sar display filesystems statistics collected by sadc. +No average statistics are calculated here (filesystems can be unmounted, +then mounted again, making average values meaningless). Instead, sar displays again +the list of filesystems. + +(cherry picked from commit c8afab03c6a6a28e303613b203bf6c186c168524) +--- + pr_stats.c | 34 +++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/pr_stats.c b/pr_stats.c +index 332b10e..85a3a20 100644 +--- a/pr_stats.c ++++ b/pr_stats.c +@@ -2454,7 +2454,39 @@ __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr, + __print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr, + unsigned long long itv, int dispavg) + { +- /* FIXME */ ++ int i; ++ struct stats_filesystem *sfc; ++ ++ ++ if (dis) { ++ printf("\n%-11s MBfsfree MBfsused %%fsused %%ufsused" ++ " Ifree Iused %%Iused FILESYSTEM\n", ++ (dispavg ? _("Summary") : timestamp[!curr])); ++ } ++ ++ for (i = 0; i < a->nr; i++) { ++ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize); ++ ++ if (!sfc->f_blocks) ++ /* Size of filesystem is null: We are at the end of the list */ ++ break; ++ ++ printf("%-11s %9.0f %9.0f %6.2f %6.2f" ++ " %9llu %9llu %6.2f %s\n", ++ (dispavg ? _("Summary") : timestamp[curr]), ++ (double) sfc->f_bfree / 1024 / 1024, ++ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024, ++ /* f_blocks is not null. But test it anyway ;-) */ ++ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_ffree, ++ sfc->f_files - sfc->f_ffree, ++ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) ++ : 0.0, ++ sfc->fs_name); ++ } + } + + /* +-- +2.14.3 + diff --git a/SOURCES/0004-Filesystems-statistics-part-4-ppc-and-db-output-form.patch b/SOURCES/0004-Filesystems-statistics-part-4-ppc-and-db-output-form.patch new file mode 100644 index 0000000..f47b47a --- /dev/null +++ b/SOURCES/0004-Filesystems-statistics-part-4-ppc-and-db-output-form.patch @@ -0,0 +1,136 @@ +From b6905bafa7fc82ba22afaeb26ff46c900738e9d4 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sun, 12 May 2013 15:17:01 +0200 +Subject: [PATCH] Filesystems statistics (part 4): ppc and db output formats + +This patch adds ppc and database (CSV) output formats for filesystems +statistics. These formats can be displayed with sadf options -p and -d. + +Also add a new flag (PT_USERND) to the render() function so that +a statistic value can be rounded to the nearest integer value. + +(cherry picked from commit 37e6da76fd59dcdff84e216e2c8ef10c439d9f84) +--- + activity.c | 2 +- + rndr_stats.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + rndr_stats.h | 1 + + 3 files changed, 75 insertions(+), 2 deletions(-) + +diff --git a/activity.c b/activity.c +index b1aba37..734df4a 100644 +--- a/activity.c ++++ b/activity.c +@@ -1214,7 +1214,7 @@ struct activity filesystem_act = { + .f_render = render_filesystem_stats, + .f_xml_print = xml_print_filesystem_stats, + .f_json_print = json_print_filesystem_stats, +- .hdr_line = "Mbfsfree;Mbfsused;%fsused;%ufsused;Ifree;Iused;%Iused;FILESYSTEM", ++ .hdr_line = "FILESYSTEM,MBfsfree;MBfsused;%fsused;%ufsused;Ifree;Iused;%Iused", + .name = "A_FILESYSTEM", + #endif + .nr = -1, +diff --git a/rndr_stats.c b/rndr_stats.c +index 8349e9a..a3dcb22 100644 +--- a/rndr_stats.c ++++ b/rndr_stats.c +@@ -147,6 +147,9 @@ static void render(int isdb, char *pre, int rflags, const char *pptxt, + else if (rflags & PT_USESTR) { + printf("%s%s", seps[isdb], sval); + } ++ else if (rflags & PT_USERND) { ++ printf("%s%.0f", seps[isdb], dval); ++ } + else { + printf("%s%.2f", seps[isdb], dval); + } +@@ -2808,5 +2811,74 @@ __print_funct_t render_pwr_usb_stats(struct activity *a, int isdb, char *pre, + __print_funct_t render_filesystem_stats(struct activity *a, int isdb, char *pre, + int curr, unsigned long long itv) + { +- /* FIXME */ ++ int i; ++ struct stats_filesystem *sfc; ++ ++ for (i = 0; i < a->nr; i++) { ++ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize); ++ ++ if (!sfc->f_blocks) ++ /* Size of filesystem is null: We are at the end of the list */ ++ break; ++ ++ render(isdb, pre, PT_USERND, ++ "%s\tMBfsfree", ++ "%s", ++ cons(sv, sfc->fs_name, NOVAL), ++ NOVAL, ++ (double) sfc->f_bfree / 1024 / 1024, ++ NULL); ++ ++ render(isdb, pre, PT_USERND, ++ "%s\tMBfsused", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ NOVAL, ++ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024, ++ NULL); ++ ++ render(isdb, pre, PT_NOFLAG, ++ "%s\t%%fsused", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ NOVAL, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ NULL); ++ ++ render(isdb, pre, PT_NOFLAG, ++ "%s\t%%ufsused", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ NOVAL, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ NULL); ++ ++ render(isdb, pre, PT_USEINT, ++ "%s\tIfree", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ sfc->f_ffree, ++ NOVAL, ++ NULL); ++ ++ render(isdb, pre, PT_USEINT, ++ "%s\tIused", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ sfc->f_files - sfc->f_ffree, ++ NOVAL, ++ NULL); ++ ++ render(isdb, pre, ++ (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN), ++ "%s\t%%Iused", ++ NULL, ++ cons(sv, sfc->fs_name, NOVAL), ++ NOVAL, ++ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) ++ : 0.0, ++ NULL); ++ } + } +diff --git a/rndr_stats.h b/rndr_stats.h +index ff6452a..9de51b2 100644 +--- a/rndr_stats.h ++++ b/rndr_stats.h +@@ -18,6 +18,7 @@ + #define PT_USEINT 0x0001 /* Use the integer arg, not double nor string */ + #define PT_NEWLIN 0x0002 /* Terminate the current output line */ + #define PT_USESTR 0x0004 /* Use the string arg */ ++#define PT_USERND 0x0008 /* Double value, format %.0f */ + + #define NOVAL 0 /* For placeholder zeros */ + #define DNOVAL 0.0 /* Wilma! */ +-- +2.14.3 + diff --git a/SOURCES/0005-Filesystems-statistics-part-5-JSON-output-format.patch b/SOURCES/0005-Filesystems-statistics-part-5-JSON-output-format.patch new file mode 100644 index 0000000..bfb61f0 --- /dev/null +++ b/SOURCES/0005-Filesystems-statistics-part-5-JSON-output-format.patch @@ -0,0 +1,67 @@ +From 653c316533bbadd6e5f75abb69b3953dd43232d9 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sun, 12 May 2013 16:07:55 +0200 +Subject: [PATCH] Filesystems statistics (part 5): JSON output format + +This patch adds JSON output format for filesystems statistics. This +format can be displayed with sadf option -j. + +(cherry picked from commit 9a5447d081141289de2736f7f31f25b3b340ace9) +--- + json_stats.c | 42 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 41 insertions(+), 1 deletion(-) + +diff --git a/json_stats.c b/json_stats.c +index 10d88e9..a5b4dcd 100644 +--- a/json_stats.c ++++ b/json_stats.c +@@ -2100,5 +2100,45 @@ close_json_markup: + __print_funct_t json_print_filesystem_stats(struct activity *a, int curr, int tab, + unsigned long long itv) + { +- /* FIXME */ ++ int i; ++ struct stats_filesystem *sfc; ++ int sep = FALSE; ++ ++ xprintf(tab++, "\"filesystems\": ["); ++ ++ for (i = 0; i < a->nr; i++) { ++ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize); ++ ++ if (!sfc->f_blocks) ++ /* Size of filesystem is null: We are at the end of the list */ ++ break; ++ ++ if (sep) { ++ printf(",\n"); ++ } ++ sep = TRUE; ++ ++ xprintf0(tab, "{\"filesystem\": \"%s\", " ++ "\"MBfsfree\": %.0f, " ++ "\"MBfsused\": %.0f, " ++ "\"%%fsused\": %.2f, " ++ "\"%%ufsused\": %.2f, " ++ "\"Ifree\": %llu, " ++ "\"Iused\": %llu, " ++ "\"%%Iused\": %.2f}", ++ sfc->fs_name, ++ (double) sfc->f_bfree / 1024 / 1024, ++ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_ffree, ++ sfc->f_files - sfc->f_ffree, ++ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) ++ : 0.0); ++ } ++ ++ printf("\n"); ++ xprintf0(--tab, "]"); + } +-- +2.14.3 + diff --git a/SOURCES/0006-Filesystems-statistics-part-6-XML-output-format.patch b/SOURCES/0006-Filesystems-statistics-part-6-XML-output-format.patch new file mode 100644 index 0000000..9f794ed --- /dev/null +++ b/SOURCES/0006-Filesystems-statistics-part-6-XML-output-format.patch @@ -0,0 +1,165 @@ +From b3a0f481304e76b5fe3ec69025df20cea16e6f0e Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sat, 18 May 2013 22:04:27 +0200 +Subject: [PATCH] Filesystems statistics (part 6): XML output format + +This patch adds XML output format for filesystems statistics. This +format can be displayed with sadf option -x. +DTD and XML Schema (xsd) documents have also been updated. + +(cherry picked from commit 1eddc64a1db0efd5cdffd5d272adb9f8d4ccb589) +--- + sadf.h | 2 +- + xml/{sysstat-2.15.dtd => sysstat-2.16.dtd} | 18 ++++++++++++-- + xml/sysstat.xsd | 22 ++++++++++++++++- + xml_stats.c | 38 +++++++++++++++++++++++++++++- + 4 files changed, 75 insertions(+), 5 deletions(-) + rename xml/{sysstat-2.15.dtd => sysstat-2.16.dtd} (96%) + +diff --git a/sadf.h b/sadf.h +index 786d3b0..198568a 100644 +--- a/sadf.h ++++ b/sadf.h +@@ -9,7 +9,7 @@ + #include "sa.h" + + /* DTD version for XML output */ +-#define XML_DTD_VERSION "2.15" ++#define XML_DTD_VERSION "2.16" + + /* Possible actions for functions used to display reports */ + #define F_BEGIN 0x01 +diff --git a/xml/sysstat-2.15.dtd b/xml/sysstat-2.16.dtd +similarity index 96% +rename from xml/sysstat-2.15.dtd +rename to xml/sysstat-2.16.dtd +index e0b7bfb..06faed2 100644 +--- a/xml/sysstat-2.15.dtd ++++ b/xml/sysstat-2.16.dtd +@@ -1,11 +1,11 @@ + +- ++ + + + + + +- ++ + + + +@@ -551,3 +551,17 @@ + manufact CDATA #REQUIRED + product CDATA #REQUIRED + > ++ ++ ++ ++ ++ +diff --git a/xml/sysstat.xsd b/xml/sysstat.xsd +index 8304ac5..09818f6 100644 +--- a/xml/sysstat.xsd ++++ b/xml/sysstat.xsd +@@ -1,7 +1,7 @@ + + + +- -- XML Schema v2.15 for sysstat. See sadf.h -- ++ -- XML Schema v2.16 for sysstat. See sadf.h -- + + + +@@ -97,6 +97,7 @@ + + + ++ + + + +@@ -723,4 +724,23 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +diff --git a/xml_stats.c b/xml_stats.c +index 0a15f98..f41d520 100644 +--- a/xml_stats.c ++++ b/xml_stats.c +@@ -2005,5 +2005,41 @@ close_xml_markup: + __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab, + unsigned long long itv) + { +- /* FIXME */ ++ int i; ++ struct stats_filesystem *sfc; ++ ++ xprintf(tab, ""); ++ tab++; ++ ++ for (i = 0; i < a->nr; i++) { ++ ++ sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize); ++ ++ if (!sfc->f_blocks) ++ /* Size of filesystem is null: We are at the end of the list */ ++ break; ++ ++ xprintf(tab, "", ++ sfc->fs_name, ++ (double) sfc->f_bfree / 1024 / 1024, ++ (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024, ++ /* f_blocks is not null. But test it anyway ;-) */ ++ sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks) ++ : 0.0, ++ sfc->f_ffree, ++ sfc->f_files - sfc->f_ffree, ++ sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) ++ : 0.0); ++ } ++ ++ xprintf(--tab, ""); + } +-- +2.14.3 + diff --git a/SOURCES/0007-Filesystems-statistics-part-7-Documentation-updates.patch b/SOURCES/0007-Filesystems-statistics-part-7-Documentation-updates.patch new file mode 100644 index 0000000..f69c960 --- /dev/null +++ b/SOURCES/0007-Filesystems-statistics-part-7-Documentation-updates.patch @@ -0,0 +1,80 @@ +From 0df6019dfc15218785a7a684de06541d2bfa2449 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Mon, 20 May 2013 14:57:39 +0200 +Subject: [PATCH] Filesystems statistics (part 7): Documentation updates + +This patch updates sar manual page to describe option -F used to display +filesystems statistics. +CHANGES file is also updated. + +(cherry picked from commit a1999309158fa089e4399ca7b88d0c5fa4c8fef3) +--- + man/sar.in | 45 ++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 44 insertions(+), 1 deletion(-) + +diff --git a/man/sar.in b/man/sar.in +index 1ef4f89..65c89cb 100644 +--- a/man/sar.in ++++ b/man/sar.in +@@ -2,7 +2,7 @@ + .SH NAME + sar \- Collect, report, or save system activity information. + .SH SYNOPSIS +-.B sar [ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ] ++.B sar [ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ] + .B [ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ] + .B [ -I { + .I int +@@ -320,6 +320,49 @@ or written to a file (options + or + .B -o + ). ++.IP -F ++Display statistics for currently mounted filesystems. Pseudo-filesystems are ++ignored. At the end of the report, ++.B sar ++will display a summary of all those filesystems. The following values are ++displayed: ++ ++.B MBfsfree ++.RS ++.RS ++Total amount a free space in megabytes (including space available only to privileged user). ++.RE ++ ++.B MBfsused ++.RS ++Total amount of space used in megabytes. ++.RE ++ ++.B %fsused ++.RS ++Percentage of filesystem space used, as seen by a privileged user. ++.RE ++ ++.B %ufsused ++.RS ++Percentage of filesystem space used, as seen by an unprivileged user. ++.RE ++ ++.B Ifree ++.RS ++Total number of free file nodes in filesystem. ++.RE ++ ++.B Iused ++.RS ++Total number of file nodes used in filesystem. ++.RE ++ ++.B %Iused ++.RS ++Percentage of file nodes used in filesystem. ++.RE ++.RE + .IP "-f [ filename ]" + Extract records from + .I filename +-- +2.14.3 + diff --git a/SOURCES/0008-Filesystems-stats-Display-unmounted-filesystems-in-s.patch b/SOURCES/0008-Filesystems-stats-Display-unmounted-filesystems-in-s.patch new file mode 100644 index 0000000..f6b7472 --- /dev/null +++ b/SOURCES/0008-Filesystems-stats-Display-unmounted-filesystems-in-s.patch @@ -0,0 +1,83 @@ +From f9752adcd732441cc2d5604cb9b24ecfc29a6acb Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Mon, 20 May 2013 17:14:05 +0200 +Subject: [PATCH] Filesystems stats: Display unmounted filesystems in summary + list + +This patch enables sar -F to display filesystems in its summary list (the +last stats displayed by sar) even if those filesystems have been +unmounted before the end of the report. + +(cherry picked from commit c8b1f890f7fc242eceafc94ab3ba117247f3d577) +--- + pr_stats.c | 30 ++++++++++++++++++++++-------- + 1 file changed, 22 insertions(+), 8 deletions(-) + +diff --git a/pr_stats.c b/pr_stats.c +index 85a3a20..d1edb5b 100644 +--- a/pr_stats.c ++++ b/pr_stats.c +@@ -2445,17 +2445,14 @@ __print_funct_t print_avg_pwr_usb_stats(struct activity *a, int prev, int curr, + * + * IN: + * @a Activity structure with statistics. +- * @prev Index in array where stats used as reference are. + * @curr Index in array for current sample statistics. +- * @itv Interval of time in jiffies. + * @dispavg TRUE if displaying average statistics. + *************************************************************************** + */ +-__print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr, +- unsigned long long itv, int dispavg) ++__print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int dispavg) + { +- int i; +- struct stats_filesystem *sfc; ++ int i, j; ++ struct stats_filesystem *sfc, *sfm; + + + if (dis) { +@@ -2486,6 +2483,23 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int cu + sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) + : 0.0, + sfc->fs_name); ++ ++ if (!dispavg) { ++ /* Save current filesystem in summary list */ ++ for (j = 0; j < a->nr; j++) { ++ sfm = (struct stats_filesystem *) ((char *) a->buf[2] + j * a->msize); ++ ++ if (!strcmp(sfm->fs_name, sfc->fs_name) || ++ !sfm->f_blocks) { ++ /* ++ * Filesystem found in list (then save again its stats) ++ * or free slot (end of list). ++ */ ++ *sfm = *sfc; ++ break; ++ } ++ } ++ } + } + } + +@@ -2503,7 +2517,7 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int cu + __print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr, + unsigned long long itv) + { +- stub_print_filesystem_stats(a, prev, curr, itv, FALSE); ++ stub_print_filesystem_stats(a, curr, FALSE); + } + + /* +@@ -2520,5 +2534,5 @@ __print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr, + __print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int curr, + unsigned long long itv) + { +- stub_print_filesystem_stats(a, prev, curr, itv, TRUE); ++ stub_print_filesystem_stats(a, 2, TRUE); + } +-- +2.14.3 + diff --git a/SOURCES/0009-Handle-octal-codes-in-filesystems-mount-point-names.patch b/SOURCES/0009-Handle-octal-codes-in-filesystems-mount-point-names.patch new file mode 100644 index 0000000..f1db439 --- /dev/null +++ b/SOURCES/0009-Handle-octal-codes-in-filesystems-mount-point-names.patch @@ -0,0 +1,99 @@ +From 446f287e43f87b090c65bb17e397bd5e73101e34 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Thu, 30 May 2013 22:26:18 +0200 +Subject: [PATCH] Handle octal codes in filesystems mount point names + +sar -F was unable to get statistics about filesystems whose mount points +(as given by /etc/mtab file) had octal codes in their names. +So now sar replaces those octal codes with their corresponding +characters before trying to collect stats about them. + +(cherry picked from commit 919f10827b763d13427672515f18aa27c93c01bf) +--- + rd_stats.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + rd_stats.h | 2 ++ + 2 files changed, 44 insertions(+) + +diff --git a/rd_stats.c b/rd_stats.c +index 829dae5..c3ef70f 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -42,6 +42,42 @@ + #define _(string) (string) + #endif + ++/* ++ *************************************************************************** ++ * Replace octal codes in string with their corresponding characters. ++ * ++ * IN: ++ * str String to parse. ++ * ++ * OUT: ++ * @str String with octal codes replaced with characters. ++ *************************************************************************** ++ */ ++void oct2chr(char *str) ++{ ++ int i = 0; ++ int j, len; ++ ++ len = strlen(str); ++ ++ while (i < len - 3) { ++ if ((str[i] == '\\') && ++ (str[i + 1] >= '0') && (str[i + 1] <= '3') && ++ (str[i + 2] >= '0') && (str[i + 2] <= '7') && ++ (str[i + 3] >= '0') && (str[i + 3] <= '7')) { ++ /* Octal code found */ ++ str[i] = (str[i + 1] - 48) * 64 + ++ (str[i + 2] - 48) * 8 + ++ (str[i + 3] - 48); ++ for (j = i + 4; j <= len; j++) { ++ str[j - 3] = str[j]; ++ } ++ len -= 3; ++ } ++ i++; ++ } ++} ++ + /* + *************************************************************************** + * Read CPU statistics and machine uptime. +@@ -1893,6 +1929,9 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + /* Read current filesystem name and mount point */ + sscanf(line, "%71s %127s", fs_name, mountp); + ++ /* Replace octal codes */ ++ oct2chr(mountp); ++ + if ((statfs(mountp, &buf) < 0) || (!buf.f_blocks)) + continue; + +@@ -2354,6 +2393,9 @@ int get_filesystem_nr(void) + + /* Read filesystem name and mount point */ + sscanf(line, "%71s %127s", fs_name, mountp); ++ ++ /* Replace octal codes */ ++ oct2chr(mountp); + + /* Check that total size is not null */ + if (statfs(mountp, &buf) < 0) +diff --git a/rd_stats.h b/rd_stats.h +index 3f1edde..279178f 100644 +--- a/rd_stats.h ++++ b/rd_stats.h +@@ -541,6 +541,8 @@ struct stats_filesystem { + *************************************************************************** + */ + ++extern void ++ oct2chr(char *); + extern void + read_stat_cpu(struct stats_cpu *, int, + unsigned long long *, unsigned long long *); +-- +2.14.3 + diff --git a/SOURCES/0010-Collect-filesystems-stats-only-when-sadc-option-S-XD.patch b/SOURCES/0010-Collect-filesystems-stats-only-when-sadc-option-S-XD.patch new file mode 100644 index 0000000..c8fc6eb --- /dev/null +++ b/SOURCES/0010-Collect-filesystems-stats-only-when-sadc-option-S-XD.patch @@ -0,0 +1,121 @@ +From 3cba36331dd2ebd2fd6e34b63a1ed5036823c256 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Wed, 12 Jun 2013 21:39:19 +0200 +Subject: [PATCH] Collect filesystems stats only when sadc option "-S XDISK" is + used + +Make sadc collect filesystems statistics (those displayed by sar option +-F) only when option "-S XDISK" is used. +Filesystems are actually closer to partitions than to disks. So it makes +more sense for sadc to collect them when option "-S XDISK" is used +rather than option "-S DISK". +Update sadc and sar manual pages to reflect the change. + +(cherry picked from commit 7557dfebffc9e6de26ff7a6b715792dfa5a715c1) +--- + activity.c | 2 +- + man/sadc.in | 4 ++-- + man/sar.in | 5 +++-- + sa.h | 1 + + sadc.c | 14 +++++++++++--- + 5 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/activity.c b/activity.c +index 734df4a..5b0d4a0 100644 +--- a/activity.c ++++ b/activity.c +@@ -1200,7 +1200,7 @@ struct activity filesystem_act = { + .id = A_FILESYSTEM, + .options = AO_NULL, + .magic = ACTIVITY_MAGIC_BASE, +- .group = G_DISK, ++ .group = G_XDISK, + #ifdef SOURCE_SADC + .f_count = wrap_get_filesystem_nr, + .f_count2 = NULL, +diff --git a/man/sadc.in b/man/sadc.in +index 9b75754..2e18999 100644 +--- a/man/sadc.in ++++ b/man/sadc.in +@@ -1,4 +1,4 @@ +-.TH SADC 8 "JULY 2012" Linux "Linux User's Manual" -*- nroff -*- ++.TH SADC 8 "JUNE 2013" Linux "Linux User's Manual" -*- nroff -*- + .SH NAME + sadc \- System activity data collector. + .SH SYNOPSIS +@@ -138,7 +138,7 @@ The + .B XDISK + keyword is an extension to the + .B DISK +-one and indicates that partition statistics should be collected by ++one and indicates that partitions and filesystems statistics should be collected by + .B sadc + in addition to disk statistics. This option works only with kernels 2.6.25 + and later. +diff --git a/man/sar.in b/man/sar.in +index 65c89cb..6f96093 100644 +--- a/man/sar.in ++++ b/man/sar.in +@@ -324,8 +324,9 @@ or + Display statistics for currently mounted filesystems. Pseudo-filesystems are + ignored. At the end of the report, + .B sar +-will display a summary of all those filesystems. The following values are +-displayed: ++will display a summary of all those filesystems. ++Note that filesystems statistics depend on sadc option "-S XDISK" to be collected. ++The following values are displayed: + + .B MBfsfree + .RS +diff --git a/sa.h b/sa.h +index 50349c8..eb2a426 100644 +--- a/sa.h ++++ b/sa.h +@@ -177,6 +177,7 @@ + #define G_SNMP 0x04 + #define G_IPV6 0x08 + #define G_POWER 0x10 ++#define G_XDISK 0x20 + + /* sadc program */ + #define SADC "sadc" +diff --git a/sadc.c b/sadc.c +index 73c15fa..39c95ee 100644 +--- a/sadc.c ++++ b/sadc.c +@@ -137,8 +137,8 @@ void parse_sadc_S_option(char *argv[], int opt) + collect_group_activities(G_DISK, AO_F_NULL); + } + else if (!strcmp(p, K_XDISK)) { +- /* Select group of disk and partition activities */ +- collect_group_activities(G_DISK, AO_F_DISK_PART); ++ /* Select group of disk and partition/filesystem activities */ ++ collect_group_activities(G_DISK + G_XDISK, AO_F_DISK_PART); + } + else if (!strcmp(p, K_SNMP)) { + /* Select group of SNMP activities */ +@@ -155,11 +155,19 @@ void parse_sadc_S_option(char *argv[], int opt) + else if (!strcmp(p, K_ALL) || !strcmp(p, K_XALL)) { + /* Select all activities */ + for (i = 0; i < NR_ACT; i++) { ++ ++ if (!strcmp(p, K_ALL) && (act[i]->group & G_XDISK)) ++ /* ++ * Don't select G_XDISK activities ++ * when option -S ALL is used. ++ */ ++ continue; ++ + act[i]->options |= AO_COLLECTED; + } + if (!strcmp(p, K_XALL)) { + /* Tell sadc to also collect partition statistics */ +- collect_group_activities(G_DISK, AO_F_DISK_PART); ++ collect_group_activities(G_DISK + G_XDISK, AO_F_DISK_PART); + } + } + else if (strspn(argv[opt], DIGITS) == strlen(argv[opt])) { +-- +2.14.3 + diff --git a/SOURCES/0011-Small-fix-for-sar-A-in-sar-manual-page.patch b/SOURCES/0011-Small-fix-for-sar-A-in-sar-manual-page.patch new file mode 100644 index 0000000..dfb75b7 --- /dev/null +++ b/SOURCES/0011-Small-fix-for-sar-A-in-sar-manual-page.patch @@ -0,0 +1,30 @@ +From 1952d089631dae9bfdd158343a97346fca6fd034 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Wed, 26 Jun 2013 21:53:04 +0200 +Subject: [PATCH] Small fix for "sar -A" in sar manual page + +Indicate that filesystems statistics are also included in stats +displayed by sar -A (that is to say: option -F is also set when sar -A +is entered on the command line). + +(cherry picked from commit 43a66c5dfffd5e7e524a7c307da9078588f612eb) +--- + man/sar.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/sar.in b/man/sar.in +index 6f96093..6d964b3 100644 +--- a/man/sar.in ++++ b/man/sar.in +@@ -145,7 +145,7 @@ command only reports on local activities. + .SH OPTIONS + .IP -A + This is equivalent to specifying +-.BR "-bBdHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL". ++.BR "-bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL". + .IP -B + Report paging statistics. + The following values are displayed: +-- +2.14.3 + diff --git a/SOURCES/0012-Add-option-to-display-mountpoint-names-instead-of-fi.patch b/SOURCES/0012-Add-option-to-display-mountpoint-names-instead-of-fi.patch new file mode 100644 index 0000000..823fe61 --- /dev/null +++ b/SOURCES/0012-Add-option-to-display-mountpoint-names-instead-of-fi.patch @@ -0,0 +1,167 @@ +From b8eaf0cce7cbed0eb56e9fc509961269d718d096 Mon Sep 17 00:00:00 2001 +From: Steve Kay +Date: Fri, 13 Mar 2015 15:24:10 -0700 +Subject: [PATCH] Add option to display mountpoint names instead of filesystem + names. + +(cherry picked from commit d91ecce584d7dedf194714a4d189ecfba6276f6c) +--- + man/sar.in | 23 ++++++++++++++--------- + pr_stats.c | 11 ++++++----- + rd_stats.c | 1 + + rd_stats.h | 1 + + sa.h | 5 +++++ + sa_common.c | 6 ++++++ + sar.c | 5 +++-- + 7 files changed, 36 insertions(+), 16 deletions(-) + +diff --git a/man/sar.in b/man/sar.in +index 6d964b3..4ea6ca0 100644 +--- a/man/sar.in ++++ b/man/sar.in +@@ -315,17 +315,22 @@ value is close to 100%. + Set the ending time of the report. The default ending time is + 18:00:00. Hours must be given in 24-hour format. + This option can be used when data are read from +-or written to a file (options +-.B -f +-or +-.B -o +-). +-.IP -F ++or written to a file (options -f or -o). ++.IP "-F [ MOUNT ]" + Display statistics for currently mounted filesystems. Pseudo-filesystems are +-ignored. At the end of the report, +-.B sar ++ignored. At the end of the report, ++.B sar + will display a summary of all those filesystems. +-Note that filesystems statistics depend on sadc option "-S XDISK" to be collected. ++Note that filesystems statistics depend on ++.B sadc ++option ++.B "-S XDISK" ++to be collected. ++Use of the ++.B MOUNT ++parameter keyword indicates that mountpoint will be reported instead of ++filesystem device. ++ + The following values are displayed: + + .B MBfsfree +diff --git a/pr_stats.c b/pr_stats.c +index d1edb5b..5bee25f 100644 +--- a/pr_stats.c ++++ b/pr_stats.c +@@ -2454,11 +2454,11 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di + int i, j; + struct stats_filesystem *sfc, *sfm; + +- + if (dis) { + printf("\n%-11s MBfsfree MBfsused %%fsused %%ufsused" +- " Ifree Iused %%Iused FILESYSTEM\n", +- (dispavg ? _("Summary") : timestamp[!curr])); ++ " Ifree Iused %%Iused %s\n", ++ (dispavg ? _("Summary:") : timestamp[!curr]), ++ DISPLAY_MOUNT(a->opt_flags) ? _("MOUNTPOINT") : _("FILESYSTEM")); + } + + for (i = 0; i < a->nr; i++) { +@@ -2482,8 +2482,9 @@ __print_funct_t stub_print_filesystem_stats(struct activity *a, int curr, int di + sfc->f_files - sfc->f_ffree, + sfc->f_files ? SP_VALUE(sfc->f_ffree, sfc->f_files, sfc->f_files) + : 0.0, +- sfc->fs_name); +- ++ ++ DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name); ++ + if (!dispavg) { + /* Save current filesystem in summary list */ + for (j = 0; j < a->nr; j++) { +diff --git a/rd_stats.c b/rd_stats.c +index c3ef70f..24a98f7 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -1942,6 +1942,7 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + st_filesystem_i->f_files = buf.f_files; + st_filesystem_i->f_ffree = buf.f_ffree; + strcpy(st_filesystem_i->fs_name, fs_name); ++ strcpy(st_filesystem_i->mountp, mountp); + } + } + +diff --git a/rd_stats.h b/rd_stats.h +index 279178f..d958104 100644 +--- a/rd_stats.h ++++ b/rd_stats.h +@@ -531,6 +531,7 @@ struct stats_filesystem { + unsigned long long f_files __attribute__ ((aligned (16))); + unsigned long long f_ffree __attribute__ ((aligned (16))); + char fs_name[MAX_FS_LEN] __attribute__ ((aligned (16))); ++ char mountp[MAX_FS_LEN] __attribute__ ((aligned (16))); + }; + + #define STATS_FILESYSTEM_SIZE (sizeof(struct stats_filesystem)) +diff --git a/sa.h b/sa.h +index eb2a426..7d24f2d 100644 +--- a/sa.h ++++ b/sa.h +@@ -129,6 +129,11 @@ + + #define COLLECT_PARTITIONS(m) (((m) & AO_F_DISK_PART) == AO_F_DISK_PART) + ++/* Output flags for option -F */ ++#define AO_F_MOUNT 0x00000001 ++ ++#define DISPLAY_MOUNT(m) (((m) & AO_F_MOUNT) == AO_F_MOUNT) ++ + /* + *************************************************************************** + * Various keywords and constants. +diff --git a/sa_common.c b/sa_common.c +index 3ccf24b..2206e9f 100644 +--- a/sa_common.c ++++ b/sa_common.c +@@ -1284,6 +1284,12 @@ int parse_sar_opt(char *argv[], int *opt, struct activity *act[], + + case 'F': + SELECT_ACTIVITY(A_FILESYSTEM); ++ p = get_activity_position(act, A_FILESYSTEM); ++ if (!*(argv[*opt] + i + 1) && argv[*opt + 1] && !strcmp(argv[*opt + 1], "MOUNT")) { ++ (*opt)++; ++ act[p]->opt_flags |= AO_F_MOUNT; ++ return 0; ++ } + break; + + case 'H': +diff --git a/sar.c b/sar.c +index 2674810..5dfd915 100644 +--- a/sar.c ++++ b/sar.c +@@ -107,7 +107,7 @@ void usage(char *progname) + { + print_usage_title(stderr, progname); + fprintf(stderr, _("Options are:\n" +- "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" ++ "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F [ MOUNTS ] ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" + "[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]\n" + "[ -I { [,...] | SUM | ALL | XALL } ] [ -P { [,...] | ALL } ]\n" + "[ -m { [,...] | ALL } ] [ -n { [,...] | ALL } ]\n" +@@ -132,7 +132,8 @@ void display_help(char *progname) + printf(_("\t-b\tI/O and transfer rate statistics\n")); + printf(_("\t-B\tPaging statistics\n")); + printf(_("\t-d\tBlock device statistics\n")); +- printf(_("\t-F\tFilesystems statistics\n")); ++ printf(_("\t-F [ MOUNTS ]\n")); ++ printf(_("\t\tFilesystems statistics\n")); + printf(_("\t-H\tHugepages utilization statistics\n")); + printf(_("\t-I { | SUM | ALL | XALL }\n" + "\t\tInterrupts statistics\n")); +-- +2.14.3 + diff --git a/SOURCES/0013-Revise-sar-usage-messages-to-be-F-MOUNT-rather-than-.patch b/SOURCES/0013-Revise-sar-usage-messages-to-be-F-MOUNT-rather-than-.patch new file mode 100644 index 0000000..79d36c7 --- /dev/null +++ b/SOURCES/0013-Revise-sar-usage-messages-to-be-F-MOUNT-rather-than-.patch @@ -0,0 +1,36 @@ +From 403ee52b7908de615d0d8be955d9bdc00f419966 Mon Sep 17 00:00:00 2001 +From: Steve Kay +Date: Fri, 12 Jun 2015 14:45:36 -0700 +Subject: [PATCH] Revise sar usage messages to be -F MOUNT rather than -F + MOUNTS, in order to match man page and program functionality. + +(cherry picked from commit 7ebced008f9c067b0959944d6a97e789af905b7b) +--- + sar.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sar.c b/sar.c +index 5dfd915..a28b739 100644 +--- a/sar.c ++++ b/sar.c +@@ -107,7 +107,7 @@ void usage(char *progname) + { + print_usage_title(stderr, progname); + fprintf(stderr, _("Options are:\n" +- "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F [ MOUNTS ] ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" ++ "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F [ MOUNT ] ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n" + "[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]\n" + "[ -I { [,...] | SUM | ALL | XALL } ] [ -P { [,...] | ALL } ]\n" + "[ -m { [,...] | ALL } ] [ -n { [,...] | ALL } ]\n" +@@ -132,7 +132,7 @@ void display_help(char *progname) + printf(_("\t-b\tI/O and transfer rate statistics\n")); + printf(_("\t-B\tPaging statistics\n")); + printf(_("\t-d\tBlock device statistics\n")); +- printf(_("\t-F [ MOUNTS ]\n")); ++ printf(_("\t-F [ MOUNT ]\n")); + printf(_("\t\tFilesystems statistics\n")); + printf(_("\t-H\tHugepages utilization statistics\n")); + printf(_("\t-I { | SUM | ALL | XALL }\n" +-- +2.14.3 + diff --git a/SOURCES/0014-Use-statvfs-instead-of-statfs-system-call.patch b/SOURCES/0014-Use-statvfs-instead-of-statfs-system-call.patch new file mode 100644 index 0000000..e58e250 --- /dev/null +++ b/SOURCES/0014-Use-statvfs-instead-of-statfs-system-call.patch @@ -0,0 +1,80 @@ +From 9728faf84cdc4acc674cc862a99f57d4e6552beb Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sun, 22 Jun 2014 16:09:18 +0200 +Subject: [PATCH] Use statvfs() instead of statfs() system call + +Use statvfs() system call instead of statfs() to get filesystems +statistics with sar since: +1) statfs() has been deprecated by the LSB (useful only to get fs +type which is not needed here), +2) statvfs() better handles large file sizes. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 0936618a799918422012036aecbf7a2b0ee32354) +--- + rd_stats.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index 24a98f7..9f7fc37 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -27,7 +27,7 @@ + #include + #include + #include +-#include ++#include + #include + + #include "common.h" +@@ -1918,7 +1918,7 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + char line[256], fs_name[MAX_FS_LEN], mountp[128]; + int fs = 0; + struct stats_filesystem *st_filesystem_i; +- struct statfs buf; ++ struct statvfs buf; + + if ((fp = fopen(MTAB, "r")) == NULL) + return; +@@ -1931,14 +1931,14 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + + /* Replace octal codes */ + oct2chr(mountp); +- +- if ((statfs(mountp, &buf) < 0) || (!buf.f_blocks)) ++ ++ if ((statvfs(mountp, &buf) < 0) || (!buf.f_blocks)) + continue; + + st_filesystem_i = st_filesystem + fs++; +- st_filesystem_i->f_blocks = buf.f_blocks * buf.f_bsize; +- st_filesystem_i->f_bfree = buf.f_bfree * buf.f_bsize; +- st_filesystem_i->f_bavail = buf.f_bavail * buf.f_bsize; ++ st_filesystem_i->f_blocks = buf.f_blocks * buf.f_frsize; ++ st_filesystem_i->f_bfree = buf.f_bfree * buf.f_frsize; ++ st_filesystem_i->f_bavail = buf.f_bavail * buf.f_frsize; + st_filesystem_i->f_files = buf.f_files; + st_filesystem_i->f_ffree = buf.f_ffree; + strcpy(st_filesystem_i->fs_name, fs_name); +@@ -2382,7 +2382,7 @@ int get_filesystem_nr(void) + FILE *fp; + char line[256], fs_name[MAX_FS_LEN], mountp[128]; + int fs = 0; +- struct statfs buf; ++ struct statvfs buf; + + if ((fp = fopen(MTAB, "r")) == NULL) + /* File non-existent */ +@@ -2399,7 +2399,7 @@ int get_filesystem_nr(void) + oct2chr(mountp); + + /* Check that total size is not null */ +- if (statfs(mountp, &buf) < 0) ++ if (statvfs(mountp, &buf) < 0) + continue; + + if (buf.f_blocks) { +-- +2.14.3 + diff --git a/SOURCES/0015-Fix-issue-48-sar-skips-long-filesystem-names.patch b/SOURCES/0015-Fix-issue-48-sar-skips-long-filesystem-names.patch new file mode 100644 index 0000000..b535330 --- /dev/null +++ b/SOURCES/0015-Fix-issue-48-sar-skips-long-filesystem-names.patch @@ -0,0 +1,63 @@ +From f5b70d8a0a4439b9745680a2e4ab433e76f154d5 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Fri, 20 Mar 2015 18:23:11 +0100 +Subject: [PATCH] Fix issue #48: sar skips long filesystem names + +If a filesystem had more than MAX_FS_LEN characters in length, sar +didn't display it. +This patch fixes the problem. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit a82d6abce8ff35a5bf0d060456ca653f722a9f73) +--- + rd_stats.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index 9f7fc37..eff0348 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -1915,7 +1915,7 @@ void read_bus_usb_dev(struct stats_pwr_usb *st_pwr_usb, int nbr) + void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + { + FILE *fp; +- char line[256], fs_name[MAX_FS_LEN], mountp[128]; ++ char line[512], fs_name[MAX_FS_LEN], mountp[256]; + int fs = 0; + struct stats_filesystem *st_filesystem_i; + struct statvfs buf; +@@ -1925,13 +1925,27 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + + while ((fgets(line, 256, fp) != NULL) && (fs < nbr)) { + if (line[0] == '/') { +- +- /* Read current filesystem name and mount point */ +- sscanf(line, "%71s %127s", fs_name, mountp); +- ++ ++ /* Read current filesystem name */ ++ sscanf(line, "%127s", fs_name); ++ /* ++ * And now read the corresponding mount point. ++ * Read fs name and mount point in two distinct operations. ++ * Indeed, if fs name length is greater than 127 chars, ++ * previous scanf() will read only the first 127 chars, and ++ * mount point name will be read using the remaining chars ++ * from the fs name. This will result in a bogus name ++ * and following statvfs() function will always fail. ++ */ ++ sscanf(strchr(line, ' ') + 1, "%255s", mountp); ++ + /* Replace octal codes */ + oct2chr(mountp); + ++ /* ++ * It's important to have read the whole mount point name ++ * for statvfs() to work properly (see above). ++ */ + if ((statvfs(mountp, &buf) < 0) || (!buf.f_blocks)) + continue; + +-- +2.14.3 + diff --git a/SOURCES/0016-Fix-issue-48-for-good-sar-skips-long-filesystem-name.patch b/SOURCES/0016-Fix-issue-48-for-good-sar-skips-long-filesystem-name.patch new file mode 100644 index 0000000..7d7e00d --- /dev/null +++ b/SOURCES/0016-Fix-issue-48-for-good-sar-skips-long-filesystem-name.patch @@ -0,0 +1,40 @@ +From fca187ac9893a35f10d20b8d7cfbda00d79c20dd Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Tue, 24 Mar 2015 21:38:07 +0100 +Subject: [PATCH] Fix issue #48 for good: sar skips long filesystem names + +How the number of filesystems is counted should be consistent with +commit a82d6ab. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 1cf65800b12d015ed9add350a6e2b40e6bcd5267) +--- + rd_stats.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index eff0348..cb45d82 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -2394,7 +2394,7 @@ int get_usb_nr(void) + int get_filesystem_nr(void) + { + FILE *fp; +- char line[256], fs_name[MAX_FS_LEN], mountp[128]; ++ char line[512], fs_name[MAX_FS_LEN], mountp[256]; + int fs = 0; + struct statvfs buf; + +@@ -2407,7 +2407,8 @@ int get_filesystem_nr(void) + if (line[0] == '/') { + + /* Read filesystem name and mount point */ +- sscanf(line, "%71s %127s", fs_name, mountp); ++ sscanf(line, "%127s", fs_name); ++ sscanf(strchr(line, ' ') + 1, "%255s", mountp); + + /* Replace octal codes */ + oct2chr(mountp); +-- +2.14.3 + diff --git a/SOURCES/0017-Use-proper-length-for-mountp-string.patch b/SOURCES/0017-Use-proper-length-for-mountp-string.patch new file mode 100644 index 0000000..e8c1427 --- /dev/null +++ b/SOURCES/0017-Use-proper-length-for-mountp-string.patch @@ -0,0 +1,33 @@ +From 41683b8609f5dea3cb3ae791a8889c86c668d205 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Fri, 27 Mar 2015 16:52:27 +0100 +Subject: [PATCH] Use proper length for mountp string + +We read 256 chars for the mountpoint name to (try to) be sure to get it +all, and so ths statvfs() function won't fail in read_filesystem() +function. +Yet only MAX_FS_LEN chars should be saved in stats_filesystem structure. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 7d010b8b3646e1d87427aca13feb16ac890d7c4c) +--- + rd_stats.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/rd_stats.c b/rd_stats.c +index cb45d82..f288eb8 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -1956,7 +1956,8 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + st_filesystem_i->f_files = buf.f_files; + st_filesystem_i->f_ffree = buf.f_ffree; + strcpy(st_filesystem_i->fs_name, fs_name); +- strcpy(st_filesystem_i->mountp, mountp); ++ strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN); ++ st_filesystem_i->mountp[MAX_FS_LEN - 1] = '\0'; + } + } + +-- +2.14.3 + diff --git a/SOURCES/0018-Replace-strcpy-with-strncpy-to-avoid-buffer-overflow.patch b/SOURCES/0018-Replace-strcpy-with-strncpy-to-avoid-buffer-overflow.patch new file mode 100644 index 0000000..e094937 --- /dev/null +++ b/SOURCES/0018-Replace-strcpy-with-strncpy-to-avoid-buffer-overflow.patch @@ -0,0 +1,148 @@ +From cfaaf34550c5ea92ee9b74d969a0c56c826cd020 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Thu, 11 Aug 2016 09:13:57 +0200 +Subject: [PATCH] Replace strcpy() with strncpy() to avoid buffer overflows + +Using strcpy() is not safe since destination buffer may overflow, for +example if the string being copied doesn't contain a terminator. +This patch replaces strcpy() with strncpy() to make sure no buffer +overflows happen. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 5aa69b67f03c00eded746c819eaa5b74a021ca1b) +--- + cifsiostat.c | 3 ++- + ioconf.c | 6 ++++-- + iostat.c | 6 ++++-- + rd_stats.c | 5 +++-- + sa_common.c | 8 ++++---- + 5 files changed, 17 insertions(+), 11 deletions(-) + +diff --git a/cifsiostat.c b/cifsiostat.c +index 09b60b2..bca6576 100644 +--- a/cifsiostat.c ++++ b/cifsiostat.c +@@ -345,7 +345,8 @@ void read_cifs_stat(int curr) + else { + start = 1; + } +- strcpy(cifs_name, name_tmp); ++ strncpy(cifs_name, name_tmp, MAX_NAME_LEN); ++ cifs_name[MAX_NAME_LEN - 1] = '\0'; + } + else { + if (!strncmp(line, "Reads:", 6)) { +diff --git a/ioconf.c b/ioconf.c +index 0011320..83008b1 100644 +--- a/ioconf.c ++++ b/ioconf.c +@@ -282,7 +282,8 @@ int ioc_init(void) + * exception info + */ + xblkp->ext_minor = iocp->ctrlno; +- strcpy(xblkp->ext_name, blkp->name); ++ strncpy(xblkp->ext_name, blkp->name, IOC_NAMELEN + 1); ++ xblkp->ext_name[IOC_NAMELEN] = '\0'; + xblkp->ext = 1; + continue; + } +@@ -393,7 +394,8 @@ char *ioc_name(unsigned int major, unsigned int minor) + + /* Is this an extension record? */ + if (p->blkp->ext && (p->blkp->ext_minor == minor)) { +- strcpy(name, p->blkp->ext_name); ++ strncpy(name, p->blkp->ext_name, IOC_DEVLEN + 1); ++ name[IOC_DEVLEN] = '\0'; + return (name); + } + +diff --git a/iostat.c b/iostat.c +index 308a9af..e49daa0 100644 +--- a/iostat.c ++++ b/iostat.c +@@ -366,7 +366,8 @@ void presave_device_list(void) + + /* Now save devices and group names in the io_hdr_stats structures */ + for (i = 0; (i < dlist_idx) && (i < iodev_nr); i++, shi++, sdli++) { +- strcpy(shi->name, sdli->dev_name); ++ strncpy(shi->name, sdli->dev_name, MAX_NAME_LEN); ++ shi->name[MAX_NAME_LEN - 1] = '\0'; + shi->used = TRUE; + if (shi->name[0] == ' ') { + /* Current device name is in fact the name of a group */ +@@ -385,7 +386,8 @@ void presave_device_list(void) + * included in that group. + */ + shi += iodev_nr - 1; +- strcpy(shi->name, group_name); ++ strncpy(shi->name, group_name, MAX_NAME_LEN); ++ shi->name[MAX_NAME_LEN - 1] = '\0'; + shi->used = TRUE; + shi->status = DISK_GROUP; + } +diff --git a/rd_stats.c b/rd_stats.c +index f288eb8..6aa8698 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -1915,7 +1915,7 @@ void read_bus_usb_dev(struct stats_pwr_usb *st_pwr_usb, int nbr) + void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + { + FILE *fp; +- char line[512], fs_name[MAX_FS_LEN], mountp[256]; ++ char line[512], fs_name[128], mountp[256]; + int fs = 0; + struct stats_filesystem *st_filesystem_i; + struct statvfs buf; +@@ -1955,7 +1955,8 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + st_filesystem_i->f_bavail = buf.f_bavail * buf.f_frsize; + st_filesystem_i->f_files = buf.f_files; + st_filesystem_i->f_ffree = buf.f_ffree; +- strcpy(st_filesystem_i->fs_name, fs_name); ++ strncpy(st_filesystem_i->fs_name, fs_name, MAX_FS_LEN); ++ st_filesystem_i->fs_name[MAX_FS_LEN - 1] = '\0'; + strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN); + st_filesystem_i->mountp[MAX_FS_LEN - 1] = '\0'; + } +diff --git a/sa_common.c b/sa_common.c +index 2206e9f..df7d38d 100644 +--- a/sa_common.c ++++ b/sa_common.c +@@ -549,7 +549,7 @@ unsigned int check_net_dev_reg(struct activity *a, int curr, int ref, + * actually unregistered. + */ + memset(sndp, 0, STATS_NET_DEV_SIZE); +- strcpy(sndp->interface, sndc->interface); ++ strncpy(sndp->interface, sndc->interface, MAX_IFACE_LEN - 1); + } + } + return index; +@@ -574,7 +574,7 @@ unsigned int check_net_dev_reg(struct activity *a, int curr, int ref, + sndp = (struct stats_net_dev *) a->buf[ref] + index; + /* Since the name is not the same, reset all the structure */ + memset(sndp, 0, STATS_NET_DEV_SIZE); +- strcpy(sndp->interface, sndc->interface); ++ strncpy(sndp->interface, sndc->interface, MAX_IFACE_LEN - 1); + + return index; + } +@@ -625,7 +625,7 @@ unsigned int check_net_edev_reg(struct activity *a, int curr, int ref, + * actually unregistered. + */ + memset(snedp, 0, STATS_NET_EDEV_SIZE); +- strcpy(snedp->interface, snedc->interface); ++ strncpy(snedp->interface, snedc->interface, MAX_IFACE_LEN - 1); + } + return index; + } +@@ -649,7 +649,7 @@ unsigned int check_net_edev_reg(struct activity *a, int curr, int ref, + snedp = (struct stats_net_edev *) a->buf[ref] + index; + /* Since the name is not the same, reset all the structure */ + memset(snedp, 0, STATS_NET_EDEV_SIZE); +- strcpy(snedp->interface, snedc->interface); ++ strncpy(snedp->interface, snedc->interface, MAX_IFACE_LEN - 1); + + return index; + } +-- +2.14.3 + diff --git a/SOURCES/0019-Cast-variables-to-target-type-before-use.patch b/SOURCES/0019-Cast-variables-to-target-type-before-use.patch new file mode 100644 index 0000000..5413bd5 --- /dev/null +++ b/SOURCES/0019-Cast-variables-to-target-type-before-use.patch @@ -0,0 +1,58 @@ +From abc147f28e5310df4a4c2327f59c7eb65b611254 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Fri, 2 Jun 2017 09:38:40 +0200 +Subject: [PATCH] Cast variables to target type before use + +This patch casts some variables to target type before they are used. +Without this patch, problems may happen (like issue #150) notably on 32 +bit architectures where sizeof(long) is different from sizeof(long +long). + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 7a8306ad184cc2c2e9339c428a98773a7f818e3b) +--- + rd_stats.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index 6aa8698..01276b6 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -532,7 +532,7 @@ void read_diskstats_io(struct stats_io *st_io) + * OK: It's a (real) device and not a partition. + * Note: Structure should have been initialized first! + */ +- st_io->dk_drive += rd_ios + wr_ios; ++ st_io->dk_drive += (unsigned long long) rd_ios + (unsigned long long) wr_ios; + st_io->dk_drive_rio += rd_ios; + st_io->dk_drive_rblk += rd_sec; + st_io->dk_drive_wio += wr_ios; +@@ -586,7 +586,7 @@ void read_diskstats_disk(struct stats_disk *st_disk, int nbr, int read_part) + st_disk_i = st_disk + dsk++; + st_disk_i->major = major; + st_disk_i->minor = minor; +- st_disk_i->nr_ios = rd_ios + wr_ios; ++ st_disk_i->nr_ios = (unsigned long long) rd_ios + (unsigned long long) wr_ios; + st_disk_i->rd_sect = rd_sec; + st_disk_i->wr_sect = wr_sec; + st_disk_i->rd_ticks = rd_ticks; +@@ -1950,11 +1950,11 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + continue; + + st_filesystem_i = st_filesystem + fs++; +- st_filesystem_i->f_blocks = buf.f_blocks * buf.f_frsize; +- st_filesystem_i->f_bfree = buf.f_bfree * buf.f_frsize; +- st_filesystem_i->f_bavail = buf.f_bavail * buf.f_frsize; +- st_filesystem_i->f_files = buf.f_files; +- st_filesystem_i->f_ffree = buf.f_ffree; ++ st_filesystem_i->f_blocks = (unsigned long long) buf.f_blocks * (unsigned long long) buf.f_frsize; ++ st_filesystem_i->f_bfree = (unsigned long long) buf.f_bfree * (unsigned long long) buf.f_frsize; ++ st_filesystem_i->f_bavail = (unsigned long long) buf.f_bavail * (unsigned long long) buf.f_frsize; ++ st_filesystem_i->f_files = (unsigned long long) buf.f_files; ++ st_filesystem_i->f_ffree = (unsigned long long) buf.f_ffree; + strncpy(st_filesystem_i->fs_name, fs_name, MAX_FS_LEN); + st_filesystem_i->fs_name[MAX_FS_LEN - 1] = '\0'; + strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN); +-- +2.14.3 + diff --git a/SOURCES/0020-Fix-162-sadc-crashes-on-a-mtab-file-with-really-long.patch b/SOURCES/0020-Fix-162-sadc-crashes-on-a-mtab-file-with-really-long.patch new file mode 100644 index 0000000..3097ab4 --- /dev/null +++ b/SOURCES/0020-Fix-162-sadc-crashes-on-a-mtab-file-with-really-long.patch @@ -0,0 +1,139 @@ +From 01efeb144322c61e53cc4e21783ce0a69ec28922 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Sat, 26 Aug 2017 14:42:28 +0200 +Subject: [PATCH] Fix #162: sadc crashes on a mtab file with really long lines + +A segmentation fault may happen with "sadc -S DISK..." or +"sadc -S XDISK..." when lines longer than 512 bytes are read from +/etc/mtab. + +Such lines are possible for instance when overlay2 filesystem +with docker is used. In such a case a single mtab entry can look +like this (note that new line characters were added for readability, +the original entry contained only one '\n' at the end): + +overlay /var/lib/docker/overlay2/f23d2377a67b9ab1b49555ecd09b2ccdc03 +7e0ee5d9e54f87e59f07f4398e71f/merged overlay rw,relatime,lowerdir=/v +ar/lib/docker/overlay2/l/L6VKIYXWBQSJ5R7V35SS43R6Y6:/var/lib/docker/ +overlay2/l/UCCHKGXUJPWCMLHR36IZJNNIQP:/var/lib/docker/overlay2/l/RKV +YEXD2FH65FTMK76RDWPLESX:/var/lib/docker/overlay2/l/DX4JZRKTFP2GOO4V6 +OWQ6CPJFY:/var/lib/docker/overlay2/l/6CYNWDKADUPPDZJ5IHOH2R7Y5S:/var +/lib/docker/overlay2/l/JTPINUZIATXADL6XWFHG2OYGSF:/var/lib/docker/ov +erlay2/l/OTSTIV5TTRHF4IUD7BODQ2FUON:/var/lib/docker/overlay2/l/QFNH3 +EFS5EZGRTC4DPHU3PJ4TU:/var/lib/docker/overlay2/l/ZOOUKT2E5U4CSLP57Z7 +MXYX5CD:/var/lib/docker/overlay2/l/3LUU6IDR2HWPTVBARC5K6XSMRC:/var/l +ib/docker/overlay2/l/XOHYBP4RWXQKQZ43I7JKG24KE4:/var/lib/docker/over +lay2/l/MN5M5B7AY5LPXQQC6V2MBJWWBF:/var/lib/docker/overlay2/l/3DRMKQ3 +4AIZD2AROU3TVK3OCUT:/var/lib/docker/overlay2/l/73ZXDHBV6C53Q3SPXA57E +OLGHU:/var/lib/docker/overlay2/l/C2IZBQ55EUTGEAAORSLE73ZPNM:/var/lib +/docker/overlay2/l/ITHARNV7RPWN5S3BCZ2QDMZIMJ:/var/lib/docker/overla +y2/l/TQKUV4LEG4AFUUCMFHHRLDBHAH:/var/lib/docker/overlay2/l/N75JZWPPD +EKJ4DTN4GMEGTDIZL:/var/lib/docker/overlay2/l/QGUUYAETPMK643DG3AKWJAI +IZA,upperdir=/var/lib/docker/overlay2/f23d2377a67b9ab1b49555ecd09b2c +cdc037e0ee5d9e54f87e59f07f4398e71f/diff,workdir=/var/lib/docker/over +lay2/f23d2377a67b9ab1b49555ecd09b2ccdc037e0ee5d9e54f87e59f07f4398e71 +f/work 0 0 + +The crash occurs in the get_filesystem_nr() and read_filesystem() +functions which call strchr(line, ' ') but fail to check if the result +is not NULL. + +This patch adds this check, and when a single mtab entry requires more +that one call to fgets() (i.e. the entry is longer than 512 bytes), it +ignores outcome of the second and following calls. + +Bugs-Debian: https://bugs.debian.org/872926 +Signed-off-by: Robert Luberda +Signed-off-by: Sebastien GODARD +(cherry picked from commit d40c8ecc530303d7e802617f21a9ac85dbcd68bd) +--- + rd_stats.c | 41 ++++++++++++++++++++++++++++++++++++----- + 1 file changed, 36 insertions(+), 5 deletions(-) + +diff --git a/rd_stats.c b/rd_stats.c +index 01276b6..c054b58 100644 +--- a/rd_stats.c ++++ b/rd_stats.c +@@ -1916,15 +1916,30 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + { + FILE *fp; + char line[512], fs_name[128], mountp[256]; +- int fs = 0; ++ int fs = 0, skip = 0, skip_next = 0; ++ char *pos = 0; + struct stats_filesystem *st_filesystem_i; + struct statvfs buf; + + if ((fp = fopen(MTAB, "r")) == NULL) + return; + +- while ((fgets(line, 256, fp) != NULL) && (fs < nbr)) { ++ while ((fgets(line, sizeof(line), fp) != NULL) && (fs < nbr)) { ++ /* ++ * Ignore line if the preceding line did not contain '\n'. ++ * (Some very long lines may be found for instance when ++ * overlay2 filesystem with docker is used). ++ */ ++ skip = skip_next; ++ skip_next = (strchr(line, '\n') == NULL); ++ if (skip) ++ continue; ++ + if (line[0] == '/') { ++ /* Find field separator position */ ++ pos = strchr(line, ' '); ++ if (pos == NULL) ++ continue; + + /* Read current filesystem name */ + sscanf(line, "%127s", fs_name); +@@ -1937,7 +1952,7 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr) + * from the fs name. This will result in a bogus name + * and following statvfs() function will always fail. + */ +- sscanf(strchr(line, ' ') + 1, "%255s", mountp); ++ sscanf(pos + 1, "%255s", mountp); + + /* Replace octal codes */ + oct2chr(mountp); +@@ -2397,7 +2412,9 @@ int get_filesystem_nr(void) + { + FILE *fp; + char line[512], fs_name[MAX_FS_LEN], mountp[256]; +- int fs = 0; ++ int fs = 0, skip = 0, skip_next = 0; ++ char *pos = 0; ++ + struct statvfs buf; + + if ((fp = fopen(MTAB, "r")) == NULL) +@@ -2406,11 +2423,25 @@ int get_filesystem_nr(void) + + /* Get current filesystem */ + while (fgets(line, 256, fp) != NULL) { ++ /* ++ * Ignore line if the preceding line did not contain '\n'. ++ * (Some very long lines may be found for instance when ++ * overlay2 filesystem with docker is used). ++ */ ++ skip = skip_next; ++ skip_next = (strchr(line, '\n') == NULL); ++ if (skip) ++ continue; ++ + if (line[0] == '/') { ++ /* Find field separator position */ ++ pos = strchr(line, ' '); ++ if (pos == NULL) ++ continue; + + /* Read filesystem name and mount point */ + sscanf(line, "%127s", fs_name); +- sscanf(strchr(line, ' ') + 1, "%255s", mountp); ++ sscanf(pos + 1, "%255s", mountp); + + /* Replace octal codes */ + oct2chr(mountp); +-- +2.14.3 + diff --git a/SOURCES/0021-Increase-maximum-fs-name-length-to-128.patch b/SOURCES/0021-Increase-maximum-fs-name-length-to-128.patch new file mode 100644 index 0000000..fdb199f --- /dev/null +++ b/SOURCES/0021-Increase-maximum-fs-name-length-to-128.patch @@ -0,0 +1,29 @@ +From 781b16fc258de2d5f4e4fd6e096ce3d7b70caa51 Mon Sep 17 00:00:00 2001 +From: Sebastien GODARD +Date: Fri, 20 Mar 2015 17:10:16 +0100 +Subject: [PATCH] Increase maximum fs name length to 128 + +Previous value was 72 and was considered a bit too small. + +Signed-off-by: Sebastien GODARD +(cherry picked from commit 81d449c28e69ca4fce6009f32e3846bdc892ff64) +--- + rd_stats.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rd_stats.h b/rd_stats.h +index d958104..9519f13 100644 +--- a/rd_stats.h ++++ b/rd_stats.h +@@ -28,7 +28,7 @@ + /* Maximum length of USB product string */ + #define MAX_PROD_LEN 48 + /* Maximum length of filesystem name */ +-#define MAX_FS_LEN 72 ++#define MAX_FS_LEN 128 + + #define CNT_DEV 0 + #define CNT_PART 1 +-- +2.14.3 + diff --git a/SPECS/sysstat.spec b/SPECS/sysstat.spec index fe0d710..c333490 100644 --- a/SPECS/sysstat.spec +++ b/SPECS/sysstat.spec @@ -1,7 +1,7 @@ Summary: Collection of performance monitoring tools for Linux Name: sysstat Version: 10.1.5 -Release: 13%{?dist} +Release: 17%{?dist} License: GPLv2+ Group: Applications/System URL: http://sebastien.godard.pagesperso-orange.fr/ @@ -40,6 +40,28 @@ Patch14: 0001-sar-make-buffers-that-hold-timestamps-bigger.patch Patch15: 0001-pidstat-Display-stats-since-boot-time-for-a-list-of-.patch # fixes 1440000 Patch16: 0001-sar-Improve-cpuinfo-read-for-POWER-architecture.patch +# backport of -F flag +Patch17: 0001-Added-filesystems-statistics-to-sar-part-1-Basic-def.patch +Patch18: 0002-Filesystems-statistics-for-sar-part-2-Read-statistic.patch +Patch19: 0003-Filesystems-statistics-for-sar-part-3-Display-statis.patch +Patch20: 0004-Filesystems-statistics-part-4-ppc-and-db-output-form.patch +Patch21: 0005-Filesystems-statistics-part-5-JSON-output-format.patch +Patch22: 0006-Filesystems-statistics-part-6-XML-output-format.patch +Patch23: 0007-Filesystems-statistics-part-7-Documentation-updates.patch +Patch24: 0008-Filesystems-stats-Display-unmounted-filesystems-in-s.patch +Patch25: 0009-Handle-octal-codes-in-filesystems-mount-point-names.patch +Patch26: 0010-Collect-filesystems-stats-only-when-sadc-option-S-XD.patch +Patch27: 0011-Small-fix-for-sar-A-in-sar-manual-page.patch +Patch28: 0012-Add-option-to-display-mountpoint-names-instead-of-fi.patch +Patch29: 0013-Revise-sar-usage-messages-to-be-F-MOUNT-rather-than-.patch +Patch30: 0014-Use-statvfs-instead-of-statfs-system-call.patch +Patch31: 0015-Fix-issue-48-sar-skips-long-filesystem-names.patch +Patch32: 0016-Fix-issue-48-for-good-sar-skips-long-filesystem-name.patch +Patch33: 0017-Use-proper-length-for-mountp-string.patch +Patch34: 0018-Replace-strcpy-with-strncpy-to-avoid-buffer-overflow.patch +Patch35: 0019-Cast-variables-to-target-type-before-use.patch +Patch36: 0020-Fix-162-sadc-crashes-on-a-mtab-file-with-really-long.patch +Patch37: 0021-Increase-maximum-fs-name-length-to-128.patch Requires: /etc/cron.d, fileutils, grep, sh-utils, textutils Requires(post): systemd, systemd-sysv @@ -86,6 +108,27 @@ The cifsiostat command reports I/O statistics for CIFS file systems. %patch14 -p1 -b .korean %patch15 -p1 -b .pidstat %patch16 -p1 -b .power +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux mv CREDITS.aux CREDITS @@ -147,6 +190,18 @@ fi %{_localstatedir}/log/sa %changelog +* Mon Jun 25 2018 Michal Sekletar - 10.1.5-17 +- fix potential buffer overflow identified by cppcheck (#1543238) + +* Fri Jun 22 2018 Michal Sekletar - 10.1.5-16 +- apply previously added patches (#1543238) + +* Fri Jun 22 2018 Michal Sekletar - 10.1.5-15 +- backport some more follow-up bugfixes related to -F (#1543238) + +* Thu Jun 21 2018 Michal Sekletar - 10.1.5-14 +- backport -F switch for monitoring currently mounted filesystems (#1543238) + * Wed Nov 08 2017 Michal Sekletar - 10.1.5-13 - fix output of pidstat -p $PID (#1448489) - improve reading of /proc/cpuinfo on Power (#1440000)