patch to add a wrapper around the syscall posix_fadvise

Filipe David Manana <>
Sun Apr 25 22:20:36 CEST 2010


The following patch adds a new function - file:advise/4
It's a wrapper around the POSIX syscall posix_fadvise, and does nothing
(always returns 'ok') on Windows.

This syscall allows one to declare the access pattern for a file's data.
Useful for many disk IO bound tasks, as it allows the underlying OS to adopt
a better caching strategy for the specified access pattern.

Man page:

I assigned the value 31 to the FILE_ADVISE constant because I assigned the
value 30 to a previously submitted patch (which adds a wrapper around the
syscall fdatasync).

Branch posix_fadvise in my github account:

git fetch git:// posix_fadvise

Documentation and tests are included. Let me know if all is fine.


Filipe David Manana,

"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."

More information about the erlang-patches mailing list