/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef FOLLY_MEMORYMAPPING_H_
-#define FOLLY_MEMORYMAPPING_H_
+#pragma once
#include <folly/FBString.h>
#include <folly/File.h>
* likely become inaccessible) when the MemoryMapping object is destroyed.
*/
struct Options {
- Options() { }
+ Options() {}
// Convenience methods; return *this for chaining.
Options& setPageSize(off_t v) { pageSize = v; return *this; }
off_t length=-1,
Options options=Options());
- MemoryMapping(MemoryMapping&&);
+ MemoryMapping(MemoryMapping&&) noexcept;
~MemoryMapping();
MemoryMapping& operator=(MemoryMapping);
- void swap(MemoryMapping& other);
+ void swap(MemoryMapping& other) noexcept;
/**
* Lock the pages in memory
* Advise the kernel about memory access.
*/
void advise(int advice) const;
+ void advise(int advice, size_t offset, size_t length) const;
/**
* A bitwise cast of the mapped bytes as range of values. Only intended for
MutableByteRange data_;
};
-void swap(MemoryMapping&, MemoryMapping&);
+void swap(MemoryMapping&, MemoryMapping&) noexcept;
/**
* A special case of memcpy() that always copies memory forwards.
void mmapFileCopy(const char* src, const char* dest, mode_t mode = 0666);
} // namespace folly
-
-#endif /* FOLLY_MEMORYMAPPING_H_ */