diff options
author | sb <sb@openoffice.org> | 2009-08-26 15:44:54 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2009-08-26 15:44:54 +0200 |
commit | 88e7a277f1eec17efdad45ce59cdb9a9329a693c (patch) | |
tree | 7c0ba210e5312cbddce64fccff2205fa27dd33a9 /sal/osl/unx/file.cxx | |
parent | a19da7e430625dd6b2db50d6d62ab72dd113e984 (diff) |
#i101955# new osl_File_MapFlag_WillNeed (honored on MACOSX and SOLARIS for now)
Diffstat (limited to 'sal/osl/unx/file.cxx')
-rw-r--r-- | sal/osl/unx/file.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index bd5b54a6d8c3..ef6dc601b53d 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -1297,6 +1297,29 @@ SAL_CALL osl_mapFile ( } } } + if (uFlags & osl_File_MapFlag_WillNeed) + { + // On Linux, madvise(..., MADV_WILLNEED) appears to have the undesirable + // effect of not returning until the data has actually been paged in, so + // that its net effect would typically be to slow down the process + // (which could start processing at the beginning of the data while the + // OS simultaneously pages in the rest); on other platforms, it remains + // to be evaluated whether madvise or equivalent is available and + // actually useful: +#if defined MACOSX + int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED); + if (e != 0) + { + OSL_TRACE( + "posix_madvise(..., POSIX_MADV_WILLNEED) failed with %d", e); + } +#elif defined SOLARIS + if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0) + { + OSL_TRACE("madvise(..., MADV_WILLNEED) failed with %d", errno); + } +#endif + } return osl_File_E_None; } |