Commit 0b39d1a8 authored by Alexandre Julliard's avatar Alexandre Julliard

libwine: Added a function to enumerate the reserved mmap areas.

parent c0596e0a
......@@ -75,6 +75,8 @@ extern void *wine_anon_mmap( void *start, size_t size, int prot, int flags );
extern void wine_mmap_add_reserved_area( void *addr, size_t size );
extern void wine_mmap_remove_reserved_area( void *addr, size_t size, int unmap );
extern int wine_mmap_is_in_reserved_area( void *addr, size_t size );
extern int wine_mmap_enum_reserved_areas( int (*enum_func)(void *base, size_t size, void *arg),
void *arg, int top_down );
/* LDT management */
......
......@@ -539,3 +539,38 @@ int wine_mmap_is_in_reserved_area( void *addr, size_t size )
}
return 0;
}
/***********************************************************************
* wine_mmap_enum_reserved_areas
*
* Enumerate the list of reserved areas, sorted by addresses.
* If enum_func returns a non-zero value, enumeration is stopped and the value is returned.
*
* Note: the reserved areas functions are not reentrant, caller is
* responsible for proper locking.
*/
int wine_mmap_enum_reserved_areas( int (*enum_func)(void *base, size_t size, void *arg), void *arg,
int top_down )
{
int ret = 0;
struct list *ptr;
if (top_down)
{
for (ptr = reserved_areas.prev; ptr != &reserved_areas; ptr = ptr->prev)
{
struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry );
if ((ret = enum_func( area->base, area->size, arg ))) break;
}
}
else
{
for (ptr = reserved_areas.next; ptr != &reserved_areas; ptr = ptr->next)
{
struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry );
if ((ret = enum_func( area->base, area->size, arg ))) break;
}
}
return ret;
}
......@@ -103,6 +103,7 @@ EXPORTS
wine_ldt_realloc_entries
wine_ldt_set_entry
wine_mmap_add_reserved_area
wine_mmap_enum_reserved_areas
wine_mmap_is_in_reserved_area
wine_mmap_remove_reserved_area
wine_pthread_get_functions
......
......@@ -103,6 +103,7 @@ WINE_1.0
wine_ldt_realloc_entries;
wine_ldt_set_entry;
wine_mmap_add_reserved_area;
wine_mmap_enum_reserved_areas;
wine_mmap_is_in_reserved_area;
wine_mmap_remove_reserved_area;
wine_pthread_get_functions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment