UNISTDX_IO_MEMORY_MAPPING
enum no_init
    enum sync_flag

    Memory mapping synchronisation flags.

    • blocking = MS_SYNC
    • non_blocking = MS_ASYNC
    • invalidate = MS_INVALIDATE
    enum map_flag: int

    Memory mapping flags.

    • shared = MAP_SHARED
    • priv = MAP_PRIVATE
    • fixed = MAP_FIXED
    • anonymous = MAP_ANONYMOUS
    • bit32 = MAP_32BIT
    • grows_down = MAP_GROWSDOWN
    • huge_page = MAP_HUGETLB
    • huge_page_2mb = MAP_HUGE_2MB
    • huge_page_1gb = MAP_HUGE_1GB
    • locked = MAP_LOCKED
    • non_blocking = MAP_NONBLOCK
    • no_reserve = MAP_NORESERVE
    • populate = MAP_POPULATE
    • stack = MAP_STACK
    • uninitilalised = MAP_UNINITIALIZED
    enum remap_flags: int
      enum page_flag: int

      Memory page access control flags.

      • none = PROT_NONE
      • read = PROT_READ
      • write = PROT_WRITE
      • execute = PROT_EXEC
      enum advise_type

      Memory mapping advices.

      • normal = MADV_NORMAL
      • random = MADV_RANDOM
      • sequential = MADV_SEQUENTIAL
      • will_need = MADV_WILLNEED
      • do_not_need = MADV_DONTNEED
      • nullify = MADV_REMOVE
      • inaccessible_on_fork = MADV_DONTFORK
      • accessible_on_fork = MADV_DOFORK
      • poison = MADV_HWPOISON
      • mergeable = MADV_MERGEABLE
      • unmergeable = MADV_UNMERGEABLE
      • soft_offline = MADV_SOFT_OFFLINE
      • huge_page = MADV_HUGEPAGE
      • no_huge_page = MADV_NOHUGEPAGE
      • do_not_dump = MADV_DONTDUMP
      • dump = MADV_DODUMP
      • free = MADV_FREE
      • wipe_on_fork = MADV_WIPEONFORK
      • keep_on_fork = MADV_KEEPONFORK
      template <class T>
      class sys::memory_ptr
      Types
      • using size_type = std::size_t
      • using value_type = T
      Methods
      template <class T>
      class sys::memory_mapping

      Memory mapping for files.

      Types
      • using const_reverse_iterator = std::reverse_iterator< const_iterator >

        Constant reverse iterator.

      • using reverse_iterator = std::reverse_iterator< iterator >

        Reverse iterator.

      • using size_type = std::size_t

        Alias to std::size_t.

      • using iterator = value_type *

        Pointer to T.

      • using value_type = T

        Alias to T.

      Fields
      • const typedef value_type * const_iterator

        Constant pointer to T.

      Methods
      • swap(memory_mapping & rhs) -> void

        Swap with rhs.

      • max_size() const -> size_type

        Maximum mapping size supported by the library.

      • max_size() -> size_type

        Maximum mapping size supported by the library.

      • operator[](size_type i) const -> const value_type &

        Get reference to the specified element.

      • operator[](size_type i) -> value_type &

        Get reference to the specified element.

      • data() const -> const value_type *

        Get pointer to the first element.

      • data() -> value_type *

        Get pointer to the first element.

      • back() const -> const value_type &

        Get last element.

      • back() -> value_type &

        Get last element.

      • front() const -> const value_type &

        Get first element.

      • front() -> value_type &

        Get first element.

      • empty() const -> bool

        Check if the container is empty.

      • size() const -> size_type

        Get the number of elements in the container.

      • crend() const -> const_iterator

        Get reversed iterator to the end of the container.

      • rend() const -> const_iterator

        Get reversed iterator to the end of the container.

      • cend() const -> const_iterator

        Get iterator to the end of the container.

      • end() const -> const_iterator

        Get iterator to the end of the container.

      • end() -> iterator

        Get iterator to the end of the container.

      • crbegin() const -> const_iterator

        Get iterator to the beginning of the container.

      • rbegin() const -> const_iterator

        Get iterator to the beginning of the container.

      • cbegin() const -> const_iterator

        Get iterator to the beginning of the container.

      • begin() const -> const_iterator

        Get iterator to the beginning of the container.

      • begin() -> iterator

        Get iterator to the beginning of the container.

      • nullify() -> void

        Fill memory mapping with noughts.

        bad_call

        See
        madvise(2)
      • mark_free() -> void

        Mark memory mapping as free. Kernel may free it any time, unless the programme writes to it.

        bad_call

        See
        madvise(2)
      • advise(advise_type adv) -> void

        Set memory mapping options and perform actions.

        bad_call

        See
        madvise(2)
      • unlock() -> void

        Unlock memory pages to allow swapping.

        bad_call

        See
        mlock(2)
      • lock() -> void

        Lock memory pages to prevent swapping.

        bad_call

        See
        mlock(2)
      • sync(sync_flag flags = sync_flag::blocking) -> void

        Flush dirty pages to disk.

        bad_call

        See
        msync(2)
      • resize(size_type new_size, remap_flags flags = {}) -> void
      • unmap() -> void
      • ~memory_mapping()

        Destructor.

      • operator=(const memory_mapping &) -> memory_mapping &
      • memory_mapping(const memory_mapping &)
      • operator=(memory_mapping && rhs) -> memory_mapping &

        Move-assignment.

      • memory_mapping(memory_mapping && rhs)

        Move-constuctor.

      • memory_mapping(size_type count, page_flag page_flags = page_flag::read|page_flag::write, map_flag map_flags = map_flag::anonymous|map_flag::priv)explicit

        Construct anonymous memory mapping (not backed by any file).

        count
        the number of elements in the mapping

        page_flags
        access permissions for memory pages being mapped

        map_flags
        mapping options

        Date
        2018-10-21
      • memory_mapping(const char * filename, page_flag page_flags = page_flag::read|page_flag::write, map_flag map_flags = map_flag::priv)explicit

        Construct memory mapping for the whole file filename.

        filename
        the name of the file being mapped

        page_flags
        access permissions for memory pages being mapped

        map_flags
        mapping options

        Date
        2018-10-21
      • memory_mapping(fd_type fd, page_flag page_flags = page_flag::read|page_flag::write, map_flag map_flags = map_flag::priv)explicit

        Construct memory mapping for file descriptor fd.

        fd
        file descriptor

        page_flags
        access permissions for memory pages being mapped

        map_flags
        mapping options

        Date
        2018-10-21
      • memory_mapping(const char * filename, offset_type offset, size_type count, page_flag page_flags = page_flag::read|page_flag::write, map_flag map_flags = map_flag::priv)explicit

        Construct memory mapping for file filename.

        filename
        the name of the file being mapped

        offset
        offset (in the number of elements) within the file from which the mapping starts

        count
        the number of elements to map from the file

        page_flags
        access permissions for memory pages being mapped

        map_flags
        mapping options

        Date
        2018-10-21
      • memory_mapping(fd_type fd, offset_type offset, size_type count, page_flag page_flags = page_flag::read|page_flag::write, map_flag map_flags = map_flag::priv)

        Construct memory mapping for file descriptor fd.

        fd
        file descriptor

        offset
        offset (in the number of elements) within the file from which the mapping starts

        count
        the number of elements to map from the file

        page_flags
        access permissions for memory pages being mapped

        map_flags
        mapping options

        Date
        2018-10-21
      • memory_mapping(T * data, size_type size)
      • memory_mapping()
      struct sys::is_flag< map_flag >
      Base classes
      • public std::true_type
      struct sys::is_flag< sync_flag >
      Base classes
      • public std::true_type
      template <class T>
      struct sys::memory_view
      Types
      • using size_type = std::size_t
      • using value_type = T
      Fields
      • size_type size
      • value_type * data
      Methods
      • operator!() const -> bool
      • operator bool() const
      • operator*() const -> const T &
      • operator*() -> T &
      • operator->() const -> const T *
      • operator->() -> T *
      • operator&() const -> const T *
      • operator&() -> T *
      • get() const -> const T *
      • get() -> T *
      • size_in_bytes() const -> size_type
      • address() const -> uintptr_t
      struct sys::is_flag< page_flag >
      Base classes
      • public std::true_type
      template <class T>
      operator<=(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool
      template <class T>
      swap(memory_mapping< T > & lhs, memory_mapping< T > & rhs) -> void

      Overload of std::swap for byte_buffer.

      template <class T>
      operator==(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool
      template <class T>
      operator!=(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool
      template <class T>
      operator<(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool
      template <class T>
      operator>=(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool
      template <class T>
      swap(memory_ptr< T > & a, memory_ptr< T > & b) -> void
      UNISTDX_FLAGS(remap_flags)
      template <class T>
      operator>(const memory_mapping< T > & lhs, const memory_mapping< T > & rhs) -> bool