On 01/12/2023 01:54, Paul Eggert wrote:
On 11/30/23 12:11, Pádraig Brady wrote:
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.
The 128 KiB number was computed as being better for apps like 's
On 11/30/23 12:11, Pádraig Brady wrote:
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.
The 128 KiB number was computed as being better for apps like 'sed' that
typically read all or most of
On Thu, Nov 30, 2023 at 08:11:52PM +, Pádraig Brady wrote:
> Much clearer thanks.
>
> On my system:
>
> $ stat /sys/kernel/profiling
> File: /sys/kernel/profiling
> Size: 4096Blocks: 0 IO Block: 4096 regular file
>
> I can easily repro by setting the buffer size
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 c
Changes from v1:
- Fallback to BUFSIZ if fstat fails instead of exiting.
- Add a comment block to explain why the blksize is used in file_lines()
(which I hope also clarifies why it is not needed elsewhere).
- Only use blksize if it is > BUFSIZ (I had regressed to 4K reads, oops).
- Update c