[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interfac
Re: [coreutils] [PATCH] fadvise: new module providing a simpler interface to posix_fadvise
Thu, 15 Jul 2010 16:20:18 +0100
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:126.96.36.199) Gecko/20100227 Thunderbird/3.0.3
On 15/07/10 15:21, Jim Meyering wrote:
> Pádraig Brady wrote:
>> I'm going to start adding posix_fadvise() hints to various utils,
>> but first I decided to clean up the interface a bit in a new module,
>> and adjust the existing posix_fadvise() users to use it.
>> The main reason for the separate module is one doesn't
>> need ifdefs in each util, nor the ignore-value wrapper.
> Thanks. Making it a module seems like a good idea.
> Adding tests would be nice (though hardly urgent!), so that
> eventually when/if it makes it into gnulib, using gnulib-tool
> to run tests will exercise the interfaces.
>> Subject: [PATCH] fadvise: new module providing a simpler interface to
>> +fdadvise (int fd, off_t offset, off_t len, int advice)
>> +#if HAVE_POSIX_FADVISE
>> + ignore_value (posix_fadvise (fd, offset, len, advice));
>> +fadvise (FILE *fp, int advice)
>> + if (fp)
>> + fdadvise (fileno (fp), 0, 0, advice);
> Should these new functions fail with EINVAL when ADVICE is unrecognized?
Well we don't check for that at the moment.
Also EINVAL is returned on linux when a pipe or fifo is passed,
and it might be nice to use these functions unconditionally.
There is the chance that one might mess up the advice
and thus introduce noops, but given the simplicity of
the interface, this is unlikely.
I'll just leave them as void for the moment.