1#ifndef _memory_entry_user_
2#define _memory_entry_user_
3
4/* Module memory_entry */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
29#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
30#endif
31 extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
32#ifdef __cplusplus
33}
34#endif
35#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
36#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
37#endif /* __has_include */
38
39/* END MIG_STRNCPY_ZEROFILL CODE */
40
41
42#ifdef AUTOTEST
43#ifndef FUNCTION_PTR_T
44#define FUNCTION_PTR_T
45typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
46typedef struct {
47 char * name;
48 function_ptr_t function;
49} function_table_entry;
50typedef function_table_entry *function_table_t;
51#endif /* FUNCTION_PTR_T */
52#endif /* AUTOTEST */
53
54#ifndef memory_entry_MSG_COUNT
55#define memory_entry_MSG_COUNT 3
56#endif /* memory_entry_MSG_COUNT */
57
58#include <Availability.h>
59#include <mach/std_types.h>
60#include <mach/mig.h>
61#include <mach/mig.h>
62#include <mach/mach_types.h>
63#include <mach_debug/mach_debug_types.h>
64
65#ifdef __BeforeMigUserHeader
66__BeforeMigUserHeader
67#endif /* __BeforeMigUserHeader */
68
69#include <sys/cdefs.h>
70__BEGIN_DECLS
71
72
73/* Routine mach_memory_entry_purgable_control */
74#ifdef mig_external
75mig_external
76#else
77extern
78#endif /* mig_external */
79kern_return_t mach_memory_entry_purgable_control
80(
81 mem_entry_name_port_t mem_entry,
82 vm_purgable_t control,
83 int *state
84);
85
86/* Routine mach_memory_entry_access_tracking */
87#ifdef mig_external
88mig_external
89#else
90extern
91#endif /* mig_external */
92kern_return_t mach_memory_entry_access_tracking
93(
94 mem_entry_name_port_t mem_entry,
95 int *access_tracking,
96 uint32_t *access_tracking_reads,
97 uint32_t *access_tracking_writes
98);
99
100/* Routine mach_memory_entry_ownership */
101#ifdef mig_external
102mig_external
103#else
104extern
105#endif /* mig_external */
106kern_return_t mach_memory_entry_ownership
107(
108 mem_entry_name_port_t mem_entry,
109 task_t owner,
110 int ledger_tag,
111 int ledger_flags
112);
113
114__END_DECLS
115
116/********************** Caution **************************/
117/* The following data types should be used to calculate */
118/* maximum message sizes only. The actual message may be */
119/* smaller, and the position of the arguments within the */
120/* message layout may vary from what is presented here. */
121/* For example, if any of the arguments are variable- */
122/* sized, and less than the maximum is sent, the data */
123/* will be packed tight in the actual message to reduce */
124/* the presence of holes. */
125/********************** Caution **************************/
126
127/* typedefs for all requests */
128
129#ifndef __Request__memory_entry_subsystem__defined
130#define __Request__memory_entry_subsystem__defined
131
132#ifdef __MigPackStructs
133#pragma pack(push, 4)
134#endif
135 typedef struct {
136 mach_msg_header_t Head;
137 NDR_record_t NDR;
138 vm_purgable_t control;
139 int state;
140 } __Request__mach_memory_entry_purgable_control_t __attribute__((unused));
141#ifdef __MigPackStructs
142#pragma pack(pop)
143#endif
144
145#ifdef __MigPackStructs
146#pragma pack(push, 4)
147#endif
148 typedef struct {
149 mach_msg_header_t Head;
150 NDR_record_t NDR;
151 int access_tracking;
152 } __Request__mach_memory_entry_access_tracking_t __attribute__((unused));
153#ifdef __MigPackStructs
154#pragma pack(pop)
155#endif
156
157#ifdef __MigPackStructs
158#pragma pack(push, 4)
159#endif
160 typedef struct {
161 mach_msg_header_t Head;
162 /* start of the kernel processed data */
163 mach_msg_body_t msgh_body;
164 mach_msg_port_descriptor_t owner;
165 /* end of the kernel processed data */
166 NDR_record_t NDR;
167 int ledger_tag;
168 int ledger_flags;
169 } __Request__mach_memory_entry_ownership_t __attribute__((unused));
170#ifdef __MigPackStructs
171#pragma pack(pop)
172#endif
173#endif /* !__Request__memory_entry_subsystem__defined */
174
175/* union of all requests */
176
177#ifndef __RequestUnion__memory_entry_subsystem__defined
178#define __RequestUnion__memory_entry_subsystem__defined
179union __RequestUnion__memory_entry_subsystem {
180 __Request__mach_memory_entry_purgable_control_t Request_mach_memory_entry_purgable_control;
181 __Request__mach_memory_entry_access_tracking_t Request_mach_memory_entry_access_tracking;
182 __Request__mach_memory_entry_ownership_t Request_mach_memory_entry_ownership;
183};
184#endif /* !__RequestUnion__memory_entry_subsystem__defined */
185/* typedefs for all replies */
186
187#ifndef __Reply__memory_entry_subsystem__defined
188#define __Reply__memory_entry_subsystem__defined
189
190#ifdef __MigPackStructs
191#pragma pack(push, 4)
192#endif
193 typedef struct {
194 mach_msg_header_t Head;
195 NDR_record_t NDR;
196 kern_return_t RetCode;
197 int state;
198 } __Reply__mach_memory_entry_purgable_control_t __attribute__((unused));
199#ifdef __MigPackStructs
200#pragma pack(pop)
201#endif
202
203#ifdef __MigPackStructs
204#pragma pack(push, 4)
205#endif
206 typedef struct {
207 mach_msg_header_t Head;
208 NDR_record_t NDR;
209 kern_return_t RetCode;
210 int access_tracking;
211 uint32_t access_tracking_reads;
212 uint32_t access_tracking_writes;
213 } __Reply__mach_memory_entry_access_tracking_t __attribute__((unused));
214#ifdef __MigPackStructs
215#pragma pack(pop)
216#endif
217
218#ifdef __MigPackStructs
219#pragma pack(push, 4)
220#endif
221 typedef struct {
222 mach_msg_header_t Head;
223 NDR_record_t NDR;
224 kern_return_t RetCode;
225 } __Reply__mach_memory_entry_ownership_t __attribute__((unused));
226#ifdef __MigPackStructs
227#pragma pack(pop)
228#endif
229#endif /* !__Reply__memory_entry_subsystem__defined */
230
231/* union of all replies */
232
233#ifndef __ReplyUnion__memory_entry_subsystem__defined
234#define __ReplyUnion__memory_entry_subsystem__defined
235union __ReplyUnion__memory_entry_subsystem {
236 __Reply__mach_memory_entry_purgable_control_t Reply_mach_memory_entry_purgable_control;
237 __Reply__mach_memory_entry_access_tracking_t Reply_mach_memory_entry_access_tracking;
238 __Reply__mach_memory_entry_ownership_t Reply_mach_memory_entry_ownership;
239};
240#endif /* !__RequestUnion__memory_entry_subsystem__defined */
241
242#ifndef subsystem_to_name_map_memory_entry
243#define subsystem_to_name_map_memory_entry \
244 { "mach_memory_entry_purgable_control", 4900 },\
245 { "mach_memory_entry_access_tracking", 4901 },\
246 { "mach_memory_entry_ownership", 4902 }
247#endif
248
249#ifdef __AfterMigUserHeader
250__AfterMigUserHeader
251#endif /* __AfterMigUserHeader */
252
253#endif /* _memory_entry_user_ */
254