GNU bug report logs -
#67490
[PATCH v2] tail: fix tailing sysfs files on large page kernels
Previous Next
Full log
View this message in rfc822 format
Much clearer thanks.
On my system:
$ stat /sys/kernel/profiling
File: /sys/kernel/profiling
Size: 4096 Blocks: 0 IO Block: 4096 regular file
I can easily repro by setting the buffer size < PAGE_SIZE.
So this patch handles the case where sysfs reports a file is a certain size,
but it isn't really. In that case seeking to anywhere other than the start
doesn't give an error, but reading returns nothing. So we use a buffer size
large enough (>= PAGE_SIZE as inferred from st_blksize) so that we'll be
reading from the start of the file in this case.
Note st_blksize can have unusual values, so it might be better
to use the io_blksize() wrapper to sanitize the values.
Though that will generally give 128K, which is good when processing all of a file,
but perhaps overkill when processing just the last part of a file.
So perhaps it's better to use buffer_size = MAX (BUFSIZ, getpagesize ())
and avoid all the st_blksize edge cases.
I'll think about it a little, and make the adjustments.
thanks!
Pádraig.
This bug report was last modified 1 year and 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.