diff options
author | skotti <skotti@wintermute> | 2009-10-27 14:57:42 +0100 |
---|---|---|
committer | skotti <skotti@wintermute> | 2009-10-27 14:57:42 +0100 |
commit | e05bf6d61038d45f281994c6ba2fff290d4e1236 (patch) | |
tree | d721de583112c17e8a93e20f1e57ca9d0d387b99 /sal/osl/unx | |
parent | 40ab64211cc89ec112e5baf8c7ff78ad4680b7a3 (diff) | |
parent | 3a50a41f57f97293d533b3e5e136fedc01447d46 (diff) |
Merge latest DEV300 and CWS sb111
Diffstat (limited to 'sal/osl/unx')
-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 8e7d76cda614..dc68767ea430 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -1080,6 +1080,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; } |