xref: /haiku/src/system/libroot/os/area.c (revision 9d010ea47db677131e385b5e7855d38fd0c8103f)
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;
20 	if (__gAPIVersion < B_HAIKU_VERSION_1_PRE_BETA_2)
21 		protection |= B_CLONEABLE_AREA;
22 	return _kern_create_area(name, address, addressSpec, size, lock, protection);
23 }
24 
25 
26 area_id
27 clone_area(const char *name, void **address, uint32 addressSpec,
28 	uint32 protection, area_id sourceArea)
29 {
30 	if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
31 		protection |= B_EXECUTE_AREA | B_CLONEABLE_AREA;
32 	return _kern_clone_area(name, address, addressSpec, protection, sourceArea);
33 }
34 
35 
36 area_id
37 find_area(const char *name)
38 {
39 	return _kern_find_area(name);
40 }
41 
42 
43 area_id
44 area_for(void *address)
45 {
46 	return _kern_area_for(address);
47 }
48 
49 
50 status_t
51 delete_area(area_id id)
52 {
53 	return _kern_delete_area(id);
54 }
55 
56 
57 status_t
58 resize_area(area_id id, size_t newSize)
59 {
60 	return _kern_resize_area(id, newSize);
61 }
62 
63 
64 status_t
65 set_area_protection(area_id id, uint32 protection)
66 {
67 	if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
68 		protection |= B_EXECUTE_AREA;
69 	return _kern_set_area_protection(id, protection);
70 }
71 
72 
73 status_t
74 _get_area_info(area_id id, area_info *areaInfo, size_t size)
75 {
76 	// size is not yet used, but may, if area_info changes
77 	(void)size;
78 
79 	return _kern_get_area_info(id, areaInfo);
80 }
81 
82 
83 status_t
84 _get_next_area_info(team_id team, ssize_t *cookie, area_info *areaInfo, size_t size)
85 {
86 	// size is not yet used, but may, if area_info changes
87 	(void)size;
88 
89 	return _kern_get_next_area_info(team, cookie, areaInfo);
90 }
91 
92