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 | 9a4d293268cdef4b3793ff880475c734efcb00ee (patch) | |
tree | f6b83e60263d6363366601a70a2ace26e8b6845a /sal/osl/unx/file.cxx | |
parent | 8c929c2dea4c2b62cbd8c892e0386bb3d7131466 (diff) | |
parent | 1b96eab7672b2505c7af57d487637dbabe90bea6 (diff) |
Merge latest DEV300 and CWS sb111
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 1250a14bd..ce427686c 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; } |