On 03/30/2017 09:30 AM, Pádraig Brady wrote:
Yes maybe, though the low level meanings of these flags are
a bit confusing and I'm not sure how consistent they are over kernel versions
Nor I. Still, 'dd' to some extent is supposed to be a low-level program
that lets one directly access syscall flags, so following that design
philosophy we should just pass the flags through and let users
experiment with them.
Dumb question: why does dd iflag=nocache check the return value of
posix_fadvise? The fadvise function ignores the return value and says
why; do these reasons not apply to 'dd'?
Well for dd it's a request, which for other utils it's a performance advisement.
As stated in the info docs, for dd it's only significant in the special case
of dropping cache for the whole file:
$ : | dd iflag=nocache count=0 status=none
dd: failed to discard cache for: 'standard input': Illegal seek
Yes, and that was what I was asking about. iflag=nocache is just advice
which the kernel is not obliged to follow even when the syscall succeeds
(and conversely, it's advice which the kernel might decided to follow
even when the syscall fails!). So why bother to report the syscall
failure in this particular case?
It's no big deal. More of a philosophical question, really.