.. _program_listing_file_umap_Uffd.hpp: Program Listing for File Uffd.hpp ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``umap/Uffd.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp ////////////////////////////////////////////////////////////////////////////// // Copyright 2017-2020 Lawrence Livermore National Security, LLC and other // UMAP Project Developers. See the top-level LICENSE file for details. // // SPDX-License-Identifier: LGPL-2.1-only ////////////////////////////////////////////////////////////////////////////// #ifndef _UMAP_Uffd_HPP #define _UMAP_Uffd_HPP #include // sort() #include // assert() #include // uint64_t #include #include #include // We all have lists to manage #include // strerror() #include // O_CLOEXEC #include // ioctl(UFFDIO_*) #include // poll() #include // strerror() #include // ioctl() #include // syscall() #include // syscall() #include "umap/config.h" // // The UFFDIO_COPY_MODE_WP is only defined in later versions of Linux (>5.0) // #ifndef UFFDIO_COPY_MODE_WP #define UMAP_RO_MODE #endif #include "umap/RegionDescriptor.hpp" #include "umap/RegionManager.hpp" #include "umap/WorkerPool.hpp" namespace Umap { class RegionManager; class PageEvent { public: PageEvent(void* paddr, bool iswrite); }; class Uffd : public WorkerPool { public: Uffd( void ); ~Uffd( void); void process_page(bool iswrite, char* addr ); void register_region( RegionDescriptor* region ); void unregister_region( RegionDescriptor* region ); void enable_write_protect( void* ); void disable_write_protect( void* ); void copy_in_page(char* data, void* page_address); void copy_in_page_and_write_protect(char* data, void* page_address); private: RegionManager& m_rm; uint64_t m_max_fault_events; uint64_t m_page_size; Buffer* m_buffer; int m_uffd_fd; int m_pipe[2]; std::vector m_events; void uffd_handler( void ); void ThreadEntry( void ); void check_uffd_compatibility( void ); }; } // end of namespace Umap #endif // _UMAP_Uffd_HPP