On 03/29/2015 03:13 AM, Alexander Sverdlin wrote: > Fix it by zeroing all the closed descriptors immediately, this would repair > existing caching of open files and clean-up strategy. > > The fix is important even with CONFIG_SCHED_DEBUG option enabled, because very > first failure to open /proc/<pid>/* because process exited will result in some > other victim descriptor being closed later and will therefore disturb the > whole > collected statistics. > --- > src/bootchart/store.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/src/bootchart/store.c b/src/bootchart/store.c > index dfa681f..8525f62 100644 > --- a/src/bootchart/store.c > +++ b/src/bootchart/store.c > @@ -152,6 +152,7 @@ void log_sample(int sample, struct list_sample_data > **ptr) { > n = pread(vmstat, buf, sizeof(buf) - 1, 0); > if (n <= 0) { > close(vmstat); > + vmstat = 0; > return; > } > buf[n] = '\0'; > @@ -184,6 +185,7 @@ vmstat_next: > n = pread(schedstat, buf, sizeof(buf) - 1, 0); > if (n <= 0) { > close(schedstat); > + schedstat = 0;
Note that 0 is a valid file descriptor number. You should really rather reset the variables to -1 and check for '>= 0'. This applies to all hunks of this patch, which also needs a rebase onto the current git HEAD. Thanks, Daniel _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel