mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
heap: interface for obtaining backing-store info
The new 'Heap::for_each_region' method provides information about the heap's used virtual-memory regions. This method allows for the mirroring of the heap state as needed by 'fork'. Issue #3478
This commit is contained in:
parent
2cff12e1fb
commit
354e310c87
@ -89,7 +89,7 @@ class Genode::Heap : public Allocator
|
||||
ram_alloc = ram, region_map = rm; }
|
||||
};
|
||||
|
||||
Lock _lock { };
|
||||
Lock mutable _lock { };
|
||||
Reconstructible<Allocator_avl> _alloc; /* local allocator */
|
||||
Dataspace_pool _ds_pool; /* list of dataspaces */
|
||||
size_t _quota_limit { 0 };
|
||||
@ -151,6 +151,17 @@ class Genode::Heap : public Allocator
|
||||
void reassign_resources(Ram_allocator *ram, Region_map *rm) {
|
||||
_ds_pool.reassign_resources(ram, rm); }
|
||||
|
||||
/**
|
||||
* Call 'fn' with the start and size of each backing-store region
|
||||
*/
|
||||
template <typename FN>
|
||||
void for_each_region(FN const &fn) const
|
||||
{
|
||||
Lock::Guard guard(_lock);
|
||||
for (Dataspace const *ds = _ds_pool.first(); ds; ds = ds->next())
|
||||
fn(ds->local_addr, ds->size);
|
||||
}
|
||||
|
||||
|
||||
/*************************
|
||||
** Allocator interface **
|
||||
|
Loading…
Reference in New Issue
Block a user