coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] [PATCH] fadvise: new module providing a simpler interfac


From: Jim Meyering
Subject: Re: [coreutils] [PATCH] fadvise: new module providing a simpler interface to posix_fadvise
Date: Thu, 15 Jul 2010 16:21:45 +0200

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 
> posix_fadvise
>
> +
> +void
> +fdadvise (int fd, off_t offset, off_t len, int advice)
> +{
> +#if HAVE_POSIX_FADVISE
> +  ignore_value (posix_fadvise (fd, offset, len, advice));
> +#endif
> +}
> +
> +void
> +fadvise (FILE *fp, int advice)
> +{
> +  if (fp)
> +    fdadvise (fileno (fp), 0, 0, advice);

Should these new functions fail with EINVAL when ADVICE is unrecognized?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]