xref: /haiku/src/system/libroot/os/area.c (revision 7b3e89c0944ae1efa9a8fc66c7303874b7a344b2)
1 /*
2  * Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <OS.h>
8 
9 #include <libroot_private.h>
10 
11 #include "syscalls.h"
12 
13 
14 area_id
15 create_area(const char *name, void **address, uint32 addressSpec, size_t size,
16 	uint32 lock, uint32 protection)
17 {
18 	if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
19 		protection |= B_EXECUTE_AREA | B_CLONEABLE_AREA;
20 	return _kern_create_area(name, address, addressSpec, size, lock, protection);
21 }
22 
23 
24 area_id
25 clone_area(const char *name, void **address, uint32 addressSpec,
26 	uint32 protection, area_id sourceArea)
27 {
28 	if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
29 		protection |= B_EXECUTE_AREA | B_CLONEABLE_AREA;
30 	return _kern_clone_area(name, address, addressSpec, protection, sourceArea);
31 }
32 
33 
34 area_id
35 find_area(const char *name)
36 {
37 	return _kern_find_area(name);
38 }
39 
40 
41 area_id
42 area_for(void *address)
43 {
44 	return _kern_area_for(address);
45 }
46 
47 
48 status_t
49 delete_area(area_id id)
50 {
51 	return _kern_delete_area(id);
52 }
53 
54 
55 status_t
56 resize_area(area_id id, size_t newSize)
57 {
58 	return _kern_resize_area(id, newSize);
59 }
60 
61 
62 status_t
63 set_area_protection(area_id id, uint32 protection)
64 {
65 	if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
66 		protection |= B_EXECUTE_AREA;
67 	return _kern_set_area_protection(id, protection);
68 }
69 
70 
71 status_t
72 _get_area_info(area_id id, area_info *areaInfo, size_t size)
73 {
74 	// size is not yet used, but may, if area_info changes
75 	(void)size;
76 
77 	return _kern_get_area_info(id, areaInfo);
78 }
79 
80 
81 status_t
82 _get_next_area_info(team_id team, ssize_t *cookie, area_info *areaInfo, size_t size)
83 {
84 	// size is not yet used, but may, if area_info changes
85 	(void)size;
86 
87 	return _kern_get_next_area_info(team, cookie, areaInfo);
88 }
89 
90