2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
4 * Distributed under the terms of the MIT License.
6 #ifndef _KERNEL_LOW_RESOURCE_MANAGER_H
7 #define _KERNEL_LOW_RESOURCE_MANAGER_H
10 #include <SupportDefs.h>
13 /* warning levels for low resource handlers */
15 B_NO_LOW_RESOURCE
= 0,
17 B_LOW_RESOURCE_WARNING
,
18 B_LOW_RESOURCE_CRITICAL
,
22 B_KERNEL_RESOURCE_PAGES
= 0x01, /* physical pages */
23 B_KERNEL_RESOURCE_MEMORY
= 0x02, /* reservable memory */
24 B_KERNEL_RESOURCE_SEMAPHORES
= 0x04, /* semaphores */
25 B_KERNEL_RESOURCE_ADDRESS_SPACE
= 0x08, /* address space */
27 B_ALL_KERNEL_RESOURCES
= B_KERNEL_RESOURCE_PAGES
28 | B_KERNEL_RESOURCE_MEMORY
29 | B_KERNEL_RESOURCE_SEMAPHORES
30 | B_KERNEL_RESOURCE_ADDRESS_SPACE
33 typedef void (*low_resource_func
)(void *data
, uint32 resources
, int32 level
);
39 status_t
low_resource_manager_init(void);
40 status_t
low_resource_manager_init_post_thread(void);
41 int32
low_resource_state(uint32 resources
);
42 void low_resource(uint32 resource
, uint64 requirements
, uint32 flags
,
45 // these calls might get public some day
46 status_t
register_low_resource_handler(low_resource_func function
, void *data
,
47 uint32 resources
, int32 priority
);
48 status_t
unregister_low_resource_handler(low_resource_func function
,
55 #endif /* _KERNEL_LOW_RESOURCE_MANAGER_H */