Does FreeBSD have replacement for posix_fadvice() or fcntl(F_RDADVISE)?

Jilles Tjoelker jilles at stack.nl
Thu May 12 23:03:28 UTC 2011


On Thu, May 12, 2011 at 11:38:12AM +0400, Lev Serebryakov wrote:
>    Does FreeBSD have some custom call, which can be used where Linux
>  programs uses posix_fadvice() and DARWIN ones fcntl(F_RDADVISE)?

>    It is like madvise(2) but for file descriptors.

An effect like POSIX_FADV_SEQUENTIAL can be obtained with the
F_READAHEAD or F_RDAHEAD fcntl(2) requests. The implementation is
divided between the generic VFS layer and various filesystems (cd9660,
ext2fs, msdosfs, nfs, xfs and ufs appear to use the information to some
degree).

Setting readahead to 0 with the fcntl requests has little effect: it
resets the state of the sequential access detection heuristic but does
not disable it.

The O_DIRECT open(2) flag has an effect similar to what
POSIX_FADV_NOREUSE should do, except that it changes semantics by adding
alignment restrictions.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list