- close the file descriptor in a special situation in read_uoptime function

- fix the number on open files in cifsiostat output
This commit is contained in:
Ivana Hutarova Varekova 2011-05-04 08:29:58 +02:00
parent 7c18c5e27a
commit 3acb6bc7f6
3 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,43 @@
diff -up sysstat-10.0.0/cifsiostat.c.pom sysstat-10.0.0/cifsiostat.c
--- sysstat-10.0.0/cifsiostat.c.pom 2011-03-11 18:09:57.000000000 +0100
+++ sysstat-10.0.0/cifsiostat.c 2011-05-04 08:09:45.000000000 +0200
@@ -319,6 +319,8 @@ void read_cifs_stat(int curr)
char line[256];
char aux[32];
int start = 0;
+ long long unsigned aux_open;
+ long long unsigned all_open = 0;
char cifs_name[MAX_NAME_LEN];
char name_tmp[MAX_NAME_LEN];
struct cifs_stats scifs;
@@ -337,7 +339,9 @@ void read_cifs_stat(int curr)
/* Read CIFS directory name */
if (isdigit((unsigned char) line[0]) && sscanf(line, aux , name_tmp) == 1) {
if (start) {
+ scifs.fopens = all_open;
save_stats(cifs_name, curr, &scifs);
+ all_open = 0;
}
else {
start = 1;
@@ -353,12 +357,19 @@ void read_cifs_stat(int curr)
}
if (!strncmp(line, "Opens:", 6)) {
sscanf(line, "Opens: %llu Closes:%llu Deletes: %llu",
- &scifs.fopens, &scifs.fcloses, &scifs.fdeletes);
+ &aux_open, &scifs.fcloses, &scifs.fdeletes);
+ all_open += aux_open;
+ }
+ if (!strncmp(line, "Posix Opens:", 12)) {
+ sscanf(line, "Posix Opens: %llu Posix Mkdirs: %*llu",
+ &aux_open);
+ all_open += aux_open;
}
}
}
if (start) {
+ scifs.fopens = all_open;
save_stats(cifs_name, curr, &scifs);
}

15
sysstat-10.0.0-ru.patch Normal file
View File

@ -0,0 +1,15 @@
diff -up sysstat-10.0.0/rd_stats.c.pom sysstat-10.0.0/rd_stats.c
--- sysstat-10.0.0/rd_stats.c.pom 2011-03-11 18:09:57.000000000 +0100
+++ sysstat-10.0.0/rd_stats.c 2011-05-04 07:59:28.000000000 +0200
@@ -1759,8 +1759,10 @@ void read_uptime(unsigned long long *upt
if ((fp = fopen(UPTIME, "r")) == NULL)
return;
- if (fgets(line, 128, fp) == NULL)
+ if (fgets(line, 128, fp) == NULL) {
+ close(fp);
return;
+ }
sscanf(line, "%lu.%lu", &up_sec, &up_cent);
*uptime = (unsigned long long) up_sec * HZ +

View File

@ -1,6 +1,6 @@
Name: sysstat
Version: 10.0.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The sar and iostat system monitoring commands
License: GPLv2+
Group: Applications/System
@ -10,6 +10,8 @@ Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
Patch11: sysstat-10.0.0-cpu.patch
Patch12: sysstat-10.0.0-makefile.patch
Patch13: sysstat-10.0.0-iostat_hr.patch
Patch14: sysstat-10.0.0-ru.patch
Patch15: sysstat-10.0.0-cifs_fopen.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: /sbin/chkconfig
@ -29,6 +31,8 @@ activity.
%patch11 -p1 -b .cpu
%patch12 -p1 -b .ls
%patch13 -p1 -b .hr
%patch14 -p1 -b .ru
%patch15 -p1 -b .fo
iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux
mv CREDITS.aux CREDITS
@ -77,6 +81,10 @@ rm -rf %{buildroot}
%{_localstatedir}/log/sa
%changelog
* Wed May 4 2011 Ivana Hutarova Varekova <varekova@redhat.com> - 10.0.0-4
- close the file descriptor in a special situation in read_uoptime function
- fix the number on open files in cifsiostat output
* Mon May 2 2011 Ivana Hutarova Varekova <varekova@redhat.com> - 10.0.0-3
- add -h optioon to iostat tool
(-h Make the disk stats report easier to read by a human.)