samba-technical@lists.samba.org
[Top] [All Lists]

readahead() which is Linux-only vs. posix_fadvise()

Subject: readahead) which is Linux-only vs. posix_fadvise(
From:
Date: Wed, 09 May 2007 21:35:29 -0400
As I was working on a solution to the fact that my system provides the
readahead() function but not a declaration for that function, I discovered
that readahead() is documented as:

 CONFORMING TO
       The  readahead()  system  call is Linux specific, and its use should be
       avoided in portable applications.

Given this, it is possible that different Linux versions may conceivably use
slightly different prototypes for readahead(), so providing a declaration in
lib/replace is somewhat dangerous.

In researching this, I discovered what appears to be a POSIX replacement.  It
looks like readahead is equivalent to posix_fadvise(..., POSIX_FADV_WILLNEED).

The only place that readahead() is used, I think, is in vfs_readahead.c.
It might make sense for the maintainer of this module to look into using
posix_fadvise() instead of readahead().

Cheers,

Derrell

<Prev in Thread] Current Thread [Next in Thread>