map_view.hpp 389 B

1234567891011121314151617181920
  1. #pragma once
  2. #include <errno.h>
  3. #include <unistd.h>
  4. #include <sys/mman.h>
  5. namespace nkg::resource_traits::unix_os {
  6. struct map_view {
  7. using handle_t = void*;
  8. static inline const handle_t invalid_value = MAP_FAILED;
  9. [[nodiscard]]
  10. static bool is_valid(const handle_t& handle) noexcept {
  11. return handle != invalid_value;
  12. }
  13. };
  14. }