Commit 0b4e86c2 authored by Oded Horovitz's avatar Oded Horovitz Committed by Facebook Github Bot

make mlock2wrapper public

Summary: As title. Expose the useful portable mlock2() wrapper.

Reviewed By: alikhtarov

Differential Revision: D20239849

fbshipit-source-id: 0fa776faf29ad69e551dfbe6eb69369560800a0e
parent 043bf35f
...@@ -273,12 +273,8 @@ bool memOpInChunks( ...@@ -273,12 +273,8 @@ bool memOpInChunks(
return true; return true;
} }
/** } // namespace
* mlock2 is Linux-only and exists since Linux 4.4
* On Linux pre-4.4 and other platforms fail with ENOSYS.
* glibc added the mlock2 wrapper in 2.27
* https://lists.gnu.org/archive/html/info-gnu/2018-02/msg00000.html
*/
int mlock2wrapper( int mlock2wrapper(
const void* addr, const void* addr,
size_t len, size_t len,
...@@ -305,8 +301,6 @@ int mlock2wrapper( ...@@ -305,8 +301,6 @@ int mlock2wrapper(
#endif #endif
} }
} // namespace
bool MemoryMapping::mlock(LockMode mode, LockFlags flags) { bool MemoryMapping::mlock(LockMode mode, LockFlags flags) {
size_t amountSucceeded = 0; size_t amountSucceeded = 0;
locked_ = memOpInChunks( locked_ = memOpInChunks(
......
...@@ -285,4 +285,12 @@ void alignedForwardMemcpy(void* dst, const void* src, size_t size); ...@@ -285,4 +285,12 @@ void alignedForwardMemcpy(void* dst, const void* src, size_t size);
*/ */
void mmapFileCopy(const char* src, const char* dest, mode_t mode = 0666); void mmapFileCopy(const char* src, const char* dest, mode_t mode = 0666);
/**
* mlock2 is Linux-only and exists since Linux 4.4
* On Linux pre-4.4 and other platforms fail with ENOSYS.
* glibc added the mlock2 wrapper in 2.27
* https://lists.gnu.org/archive/html/info-gnu/2018-02/msg00000.html
*/
int mlock2wrapper(const void* addr, size_t len, MemoryMapping::LockFlags flags);
} // namespace folly } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment