- retry write functuon in sadc command - thanks Tomas Mraz
This commit is contained in:
parent
18a9aa54cb
commit
4e8f8382b0
94
sysstat-8.0.4-write.patch
Normal file
94
sysstat-8.0.4-write.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
diff -up sysstat-8.0.4/sadc.c.pom sysstat-8.0.4/sadc.c
|
||||||
|
--- sysstat-8.0.4/sadc.c.pom 2008-01-01 10:26:31.000000000 +0100
|
||||||
|
+++ sysstat-8.0.4/sadc.c 2008-02-28 10:25:20.000000000 +0100
|
||||||
|
@@ -99,6 +99,32 @@ void alarm_handler(int sig)
|
||||||
|
alarm(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ ***************************************************************************
|
||||||
|
+ * write 'count' bytes from buffer to file fd
|
||||||
|
+ ***************************************************************************
|
||||||
|
+ */
|
||||||
|
+int write_all(int fd, const char *buffer, int count)
|
||||||
|
+{
|
||||||
|
+ int block, offset = 0;
|
||||||
|
+
|
||||||
|
+ while (count > 0) {
|
||||||
|
+ block = write(fd, &buffer[offset], count);
|
||||||
|
+
|
||||||
|
+ if (block < 0) {
|
||||||
|
+ if (errno == EINTR) continue;
|
||||||
|
+ return block;
|
||||||
|
+ }
|
||||||
|
+ if (block == 0) return offset;
|
||||||
|
+
|
||||||
|
+ offset += block;
|
||||||
|
+ count -= block;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return offset;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
|
||||||
|
/*
|
||||||
|
***************************************************************************
|
||||||
|
@@ -357,7 +383,7 @@ void setup_file_hdr(int fd, size_t *file
|
||||||
|
file_hdr.sa_release[UTSNAME_LEN - 1] = '\0';
|
||||||
|
|
||||||
|
/* Write file header */
|
||||||
|
- if ((nb = write(fd, &file_hdr, FILE_HDR_SIZE)) != FILE_HDR_SIZE) {
|
||||||
|
+ if ((nb = write_all(fd, &file_hdr, FILE_HDR_SIZE)) != FILE_HDR_SIZE) {
|
||||||
|
fprintf(stderr, _("Cannot write system activity file header: %s\n"),
|
||||||
|
strerror(errno));
|
||||||
|
exit(2);
|
||||||
|
@@ -404,7 +430,7 @@ void write_special_record(int ofd, size_
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write record now */
|
||||||
|
- if ((nb = write(ofd, &file_stats, file_stats_size)) != file_stats_size)
|
||||||
|
+ if ((nb = write_all(ofd, &file_stats, file_stats_size)) != file_stats_size)
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -432,32 +458,32 @@ void write_stats(int ofd, size_t file_st
|
||||||
|
/* Unable to lock file: wait for next iteration to try again to save data */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
- if ((nb = write(ofd, &file_stats, file_stats_size)) != file_stats_size)
|
||||||
|
+ if ((nb = write_all(ofd, &file_stats, file_stats_size)) != file_stats_size)
|
||||||
|
p_write_error();
|
||||||
|
if (cpu_nr) {
|
||||||
|
- if ((nb = write(ofd, st_cpu, STATS_ONE_CPU_SIZE * cpu_nr)) != (STATS_ONE_CPU_SIZE * cpu_nr))
|
||||||
|
+ if ((nb = write_all(ofd, st_cpu, STATS_ONE_CPU_SIZE * cpu_nr)) != (STATS_ONE_CPU_SIZE * cpu_nr))
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
if (GET_ONE_IRQ(sadc_actflag)) {
|
||||||
|
- if ((nb = write(ofd, interrupts, STATS_ONE_IRQ_SIZE)) != STATS_ONE_IRQ_SIZE)
|
||||||
|
+ if ((nb = write_all(ofd, interrupts, STATS_ONE_IRQ_SIZE)) != STATS_ONE_IRQ_SIZE)
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
if (serial_nr) {
|
||||||
|
- if ((nb = write(ofd, st_serial, STATS_SERIAL_SIZE * serial_nr)) != (STATS_SERIAL_SIZE * serial_nr))
|
||||||
|
+ if ((nb = write_all(ofd, st_serial, STATS_SERIAL_SIZE * serial_nr)) != (STATS_SERIAL_SIZE * serial_nr))
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
if (irqcpu_nr) {
|
||||||
|
- if ((nb = write(ofd, st_irq_cpu, STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr))
|
||||||
|
+ if ((nb = write_all(ofd, st_irq_cpu, STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr))
|
||||||
|
!= (STATS_IRQ_CPU_SIZE * cpu_nr * irqcpu_nr))
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
if (iface_nr) {
|
||||||
|
- if ((nb = write(ofd, st_net_dev, STATS_NET_DEV_SIZE * iface_nr)) != (STATS_NET_DEV_SIZE * iface_nr))
|
||||||
|
+ if ((nb = write_all(ofd, st_net_dev, STATS_NET_DEV_SIZE * iface_nr)) != (STATS_NET_DEV_SIZE * iface_nr))
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
if (disk_nr && GET_DISK(sadc_actflag)) {
|
||||||
|
/* Disk stats written only if -d option used */
|
||||||
|
- if ((nb = write(ofd, st_disk, DISK_STATS_SIZE * disk_nr)) != (DISK_STATS_SIZE * disk_nr))
|
||||||
|
+ if ((nb = write_all(ofd, st_disk, DISK_STATS_SIZE * disk_nr)) != (DISK_STATS_SIZE * disk_nr))
|
||||||
|
p_write_error();
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
Name: sysstat
|
Name: sysstat
|
||||||
Version: 8.0.4
|
Version: 8.0.4
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: The sar and iostat system monitoring commands
|
Summary: The sar and iostat system monitoring commands
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://perso.orange.fr/sebastien.godard/
|
URL: http://perso.orange.fr/sebastien.godard/
|
||||||
Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
|
Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
|
||||||
|
Patch0: sysstat-8.0.4-write.patch
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ activity.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch -p1 -b .ret
|
||||||
iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux
|
iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux
|
||||||
mv CREDITS.aux CREDITS
|
mv CREDITS.aux CREDITS
|
||||||
|
|
||||||
@ -72,6 +74,9 @@ rm -rf %{buildroot}
|
|||||||
%{_localstatedir}/log/sa
|
%{_localstatedir}/log/sa
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 28 2008 Ivana Varekova <varekova@redhat.com> - 8.0.4-2
|
||||||
|
- retry write functuon in sadc command - thanks Tomas Mraz
|
||||||
|
|
||||||
* Fri Feb 8 2008 Ivana Varekova <varekova@redhat.com> - 8.0.4-1
|
* Fri Feb 8 2008 Ivana Varekova <varekova@redhat.com> - 8.0.4-1
|
||||||
- updated to 8.0.4
|
- updated to 8.0.4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user