| 1 | #ifndef _memory_object_user_ |
| 2 | #define _memory_object_user_ |
| 3 | |
| 4 | /* Module memory_object */ |
| 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 |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
| 29 | #ifdef __cplusplus |
| 30 | } |
| 31 | #endif |
| 32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
| 33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
| 34 | #endif /* __has_include */ |
| 35 | |
| 36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
| 37 | |
| 38 | #if (__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_) |
| 39 | #include <kern/ipc_mig.h> |
| 40 | #endif /* __MigKernelSpecificCode */ |
| 41 | |
| 42 | #ifdef AUTOTEST |
| 43 | #ifndef FUNCTION_PTR_T |
| 44 | #define FUNCTION_PTR_T |
| 45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
| 46 | typedef struct { |
| 47 | char *name; |
| 48 | function_ptr_t function; |
| 49 | } function_table_entry; |
| 50 | typedef function_table_entry *function_table_t; |
| 51 | #endif /* FUNCTION_PTR_T */ |
| 52 | #endif /* AUTOTEST */ |
| 53 | |
| 54 | #ifndef memory_object_MSG_COUNT |
| 55 | #define memory_object_MSG_COUNT 10 |
| 56 | #endif /* memory_object_MSG_COUNT */ |
| 57 | |
| 58 | #include <mach/std_types.h> |
| 59 | #include <mach/mig.h> |
| 60 | #include <mach/mig.h> |
| 61 | #include <mach/mach_types.h> |
| 62 | |
| 63 | #ifdef __BeforeMigUserHeader |
| 64 | __BeforeMigUserHeader |
| 65 | #endif /* __BeforeMigUserHeader */ |
| 66 | |
| 67 | #include <sys/cdefs.h> |
| 68 | __BEGIN_DECLS |
| 69 | |
| 70 | |
| 71 | /* Routine memory_object_init */ |
| 72 | #ifdef mig_external |
| 73 | mig_external |
| 74 | #else |
| 75 | extern |
| 76 | #endif /* mig_external */ |
| 77 | kern_return_t memory_object_init |
| 78 | ( |
| 79 | memory_object_t memory_object, |
| 80 | memory_object_control_t memory_control, |
| 81 | memory_object_cluster_size_t memory_object_page_size |
| 82 | ); |
| 83 | |
| 84 | /* Routine memory_object_terminate */ |
| 85 | #ifdef mig_external |
| 86 | mig_external |
| 87 | #else |
| 88 | extern |
| 89 | #endif /* mig_external */ |
| 90 | kern_return_t memory_object_terminate |
| 91 | ( |
| 92 | memory_object_t memory_object |
| 93 | ); |
| 94 | |
| 95 | /* Routine memory_object_data_request */ |
| 96 | #ifdef mig_external |
| 97 | mig_external |
| 98 | #else |
| 99 | extern |
| 100 | #endif /* mig_external */ |
| 101 | kern_return_t memory_object_data_request |
| 102 | ( |
| 103 | memory_object_t memory_object, |
| 104 | memory_object_offset_t offset, |
| 105 | memory_object_cluster_size_t length, |
| 106 | vm_prot_t desired_access, |
| 107 | memory_object_fault_info_t fault_info |
| 108 | ); |
| 109 | |
| 110 | /* Routine memory_object_data_return */ |
| 111 | #ifdef mig_external |
| 112 | mig_external |
| 113 | #else |
| 114 | extern |
| 115 | #endif /* mig_external */ |
| 116 | kern_return_t memory_object_data_return |
| 117 | ( |
| 118 | memory_object_t memory_object, |
| 119 | memory_object_offset_t offset, |
| 120 | memory_object_cluster_size_t size, |
| 121 | memory_object_offset_t *resid_offset, |
| 122 | int *io_error, |
| 123 | boolean_t dirty, |
| 124 | boolean_t kernel_copy, |
| 125 | int upl_flags |
| 126 | ); |
| 127 | |
| 128 | /* Routine memory_object_data_initialize */ |
| 129 | #ifdef mig_external |
| 130 | mig_external |
| 131 | #else |
| 132 | extern |
| 133 | #endif /* mig_external */ |
| 134 | kern_return_t memory_object_data_initialize |
| 135 | ( |
| 136 | memory_object_t memory_object, |
| 137 | memory_object_offset_t offset, |
| 138 | memory_object_cluster_size_t size |
| 139 | ); |
| 140 | |
| 141 | /* Routine memory_object_data_unlock */ |
| 142 | #ifdef mig_external |
| 143 | mig_external |
| 144 | #else |
| 145 | extern |
| 146 | #endif /* mig_external */ |
| 147 | kern_return_t memory_object_data_unlock |
| 148 | ( |
| 149 | memory_object_t memory_object, |
| 150 | memory_object_offset_t offset, |
| 151 | memory_object_size_t size, |
| 152 | vm_prot_t desired_access |
| 153 | ); |
| 154 | |
| 155 | /* Routine memory_object_synchronize */ |
| 156 | #ifdef mig_external |
| 157 | mig_external |
| 158 | #else |
| 159 | extern |
| 160 | #endif /* mig_external */ |
| 161 | kern_return_t memory_object_synchronize |
| 162 | ( |
| 163 | memory_object_t memory_object, |
| 164 | memory_object_offset_t offset, |
| 165 | memory_object_size_t size, |
| 166 | vm_sync_t sync_flags |
| 167 | ); |
| 168 | |
| 169 | /* Routine memory_object_map */ |
| 170 | #ifdef mig_external |
| 171 | mig_external |
| 172 | #else |
| 173 | extern |
| 174 | #endif /* mig_external */ |
| 175 | kern_return_t memory_object_map |
| 176 | ( |
| 177 | memory_object_t memory_object, |
| 178 | vm_prot_t prot |
| 179 | ); |
| 180 | |
| 181 | /* Routine memory_object_last_unmap */ |
| 182 | #ifdef mig_external |
| 183 | mig_external |
| 184 | #else |
| 185 | extern |
| 186 | #endif /* mig_external */ |
| 187 | kern_return_t memory_object_last_unmap |
| 188 | ( |
| 189 | memory_object_t memory_object |
| 190 | ); |
| 191 | |
| 192 | /* Routine memory_object_data_reclaim */ |
| 193 | #ifdef mig_external |
| 194 | mig_external |
| 195 | #else |
| 196 | extern |
| 197 | #endif /* mig_external */ |
| 198 | kern_return_t memory_object_data_reclaim |
| 199 | ( |
| 200 | memory_object_t memory_object, |
| 201 | boolean_t reclaim_backing_store |
| 202 | ); |
| 203 | |
| 204 | __END_DECLS |
| 205 | |
| 206 | /********************** Caution **************************/ |
| 207 | /* The following data types should be used to calculate */ |
| 208 | /* maximum message sizes only. The actual message may be */ |
| 209 | /* smaller, and the position of the arguments within the */ |
| 210 | /* message layout may vary from what is presented here. */ |
| 211 | /* For example, if any of the arguments are variable- */ |
| 212 | /* sized, and less than the maximum is sent, the data */ |
| 213 | /* will be packed tight in the actual message to reduce */ |
| 214 | /* the presence of holes. */ |
| 215 | /********************** Caution **************************/ |
| 216 | |
| 217 | /* typedefs for all requests */ |
| 218 | |
| 219 | #ifndef __Request__memory_object_subsystem__defined |
| 220 | #define __Request__memory_object_subsystem__defined |
| 221 | |
| 222 | #ifdef __MigPackStructs |
| 223 | #pragma pack(4) |
| 224 | #endif |
| 225 | typedef struct { |
| 226 | mach_msg_header_t Head; |
| 227 | /* start of the kernel processed data */ |
| 228 | mach_msg_body_t msgh_body; |
| 229 | mach_msg_port_descriptor_t memory_control; |
| 230 | /* end of the kernel processed data */ |
| 231 | NDR_record_t NDR; |
| 232 | memory_object_cluster_size_t memory_object_page_size; |
| 233 | } __Request__memory_object_init_t __attribute__((unused)); |
| 234 | #ifdef __MigPackStructs |
| 235 | #pragma pack() |
| 236 | #endif |
| 237 | |
| 238 | #ifdef __MigPackStructs |
| 239 | #pragma pack(4) |
| 240 | #endif |
| 241 | typedef struct { |
| 242 | mach_msg_header_t Head; |
| 243 | } __Request__memory_object_terminate_t __attribute__((unused)); |
| 244 | #ifdef __MigPackStructs |
| 245 | #pragma pack() |
| 246 | #endif |
| 247 | |
| 248 | #ifdef __MigPackStructs |
| 249 | #pragma pack(4) |
| 250 | #endif |
| 251 | typedef struct { |
| 252 | mach_msg_header_t Head; |
| 253 | NDR_record_t NDR; |
| 254 | memory_object_offset_t offset; |
| 255 | memory_object_cluster_size_t length; |
| 256 | vm_prot_t desired_access; |
| 257 | memory_object_fault_info_t fault_info; |
| 258 | } __Request__memory_object_data_request_t __attribute__((unused)); |
| 259 | #ifdef __MigPackStructs |
| 260 | #pragma pack() |
| 261 | #endif |
| 262 | |
| 263 | #ifdef __MigPackStructs |
| 264 | #pragma pack(4) |
| 265 | #endif |
| 266 | typedef struct { |
| 267 | mach_msg_header_t Head; |
| 268 | NDR_record_t NDR; |
| 269 | memory_object_offset_t offset; |
| 270 | memory_object_cluster_size_t size; |
| 271 | boolean_t dirty; |
| 272 | boolean_t kernel_copy; |
| 273 | int upl_flags; |
| 274 | } __Request__memory_object_data_return_t __attribute__((unused)); |
| 275 | #ifdef __MigPackStructs |
| 276 | #pragma pack() |
| 277 | #endif |
| 278 | |
| 279 | #ifdef __MigPackStructs |
| 280 | #pragma pack(4) |
| 281 | #endif |
| 282 | typedef struct { |
| 283 | mach_msg_header_t Head; |
| 284 | NDR_record_t NDR; |
| 285 | memory_object_offset_t offset; |
| 286 | memory_object_cluster_size_t size; |
| 287 | } __Request__memory_object_data_initialize_t __attribute__((unused)); |
| 288 | #ifdef __MigPackStructs |
| 289 | #pragma pack() |
| 290 | #endif |
| 291 | |
| 292 | #ifdef __MigPackStructs |
| 293 | #pragma pack(4) |
| 294 | #endif |
| 295 | typedef struct { |
| 296 | mach_msg_header_t Head; |
| 297 | NDR_record_t NDR; |
| 298 | memory_object_offset_t offset; |
| 299 | memory_object_size_t size; |
| 300 | vm_prot_t desired_access; |
| 301 | } __Request__memory_object_data_unlock_t __attribute__((unused)); |
| 302 | #ifdef __MigPackStructs |
| 303 | #pragma pack() |
| 304 | #endif |
| 305 | |
| 306 | #ifdef __MigPackStructs |
| 307 | #pragma pack(4) |
| 308 | #endif |
| 309 | typedef struct { |
| 310 | mach_msg_header_t Head; |
| 311 | NDR_record_t NDR; |
| 312 | memory_object_offset_t offset; |
| 313 | memory_object_size_t size; |
| 314 | vm_sync_t sync_flags; |
| 315 | } __Request__memory_object_synchronize_t __attribute__((unused)); |
| 316 | #ifdef __MigPackStructs |
| 317 | #pragma pack() |
| 318 | #endif |
| 319 | |
| 320 | #ifdef __MigPackStructs |
| 321 | #pragma pack(4) |
| 322 | #endif |
| 323 | typedef struct { |
| 324 | mach_msg_header_t Head; |
| 325 | NDR_record_t NDR; |
| 326 | vm_prot_t prot; |
| 327 | } __Request__memory_object_map_t __attribute__((unused)); |
| 328 | #ifdef __MigPackStructs |
| 329 | #pragma pack() |
| 330 | #endif |
| 331 | |
| 332 | #ifdef __MigPackStructs |
| 333 | #pragma pack(4) |
| 334 | #endif |
| 335 | typedef struct { |
| 336 | mach_msg_header_t Head; |
| 337 | } __Request__memory_object_last_unmap_t __attribute__((unused)); |
| 338 | #ifdef __MigPackStructs |
| 339 | #pragma pack() |
| 340 | #endif |
| 341 | |
| 342 | #ifdef __MigPackStructs |
| 343 | #pragma pack(4) |
| 344 | #endif |
| 345 | typedef struct { |
| 346 | mach_msg_header_t Head; |
| 347 | NDR_record_t NDR; |
| 348 | boolean_t reclaim_backing_store; |
| 349 | } __Request__memory_object_data_reclaim_t __attribute__((unused)); |
| 350 | #ifdef __MigPackStructs |
| 351 | #pragma pack() |
| 352 | #endif |
| 353 | #endif /* !__Request__memory_object_subsystem__defined */ |
| 354 | |
| 355 | /* union of all requests */ |
| 356 | |
| 357 | #ifndef __RequestUnion__memory_object_subsystem__defined |
| 358 | #define __RequestUnion__memory_object_subsystem__defined |
| 359 | union __RequestUnion__memory_object_subsystem { |
| 360 | __Request__memory_object_init_t Request_memory_object_init; |
| 361 | __Request__memory_object_terminate_t Request_memory_object_terminate; |
| 362 | __Request__memory_object_data_request_t Request_memory_object_data_request; |
| 363 | __Request__memory_object_data_return_t Request_memory_object_data_return; |
| 364 | __Request__memory_object_data_initialize_t Request_memory_object_data_initialize; |
| 365 | __Request__memory_object_data_unlock_t Request_memory_object_data_unlock; |
| 366 | __Request__memory_object_synchronize_t Request_memory_object_synchronize; |
| 367 | __Request__memory_object_map_t Request_memory_object_map; |
| 368 | __Request__memory_object_last_unmap_t Request_memory_object_last_unmap; |
| 369 | __Request__memory_object_data_reclaim_t Request_memory_object_data_reclaim; |
| 370 | }; |
| 371 | #endif /* !__RequestUnion__memory_object_subsystem__defined */ |
| 372 | /* typedefs for all replies */ |
| 373 | |
| 374 | #ifndef __Reply__memory_object_subsystem__defined |
| 375 | #define __Reply__memory_object_subsystem__defined |
| 376 | |
| 377 | #ifdef __MigPackStructs |
| 378 | #pragma pack(4) |
| 379 | #endif |
| 380 | typedef struct { |
| 381 | mach_msg_header_t Head; |
| 382 | NDR_record_t NDR; |
| 383 | kern_return_t RetCode; |
| 384 | } __Reply__memory_object_init_t __attribute__((unused)); |
| 385 | #ifdef __MigPackStructs |
| 386 | #pragma pack() |
| 387 | #endif |
| 388 | |
| 389 | #ifdef __MigPackStructs |
| 390 | #pragma pack(4) |
| 391 | #endif |
| 392 | typedef struct { |
| 393 | mach_msg_header_t Head; |
| 394 | NDR_record_t NDR; |
| 395 | kern_return_t RetCode; |
| 396 | } __Reply__memory_object_terminate_t __attribute__((unused)); |
| 397 | #ifdef __MigPackStructs |
| 398 | #pragma pack() |
| 399 | #endif |
| 400 | |
| 401 | #ifdef __MigPackStructs |
| 402 | #pragma pack(4) |
| 403 | #endif |
| 404 | typedef struct { |
| 405 | mach_msg_header_t Head; |
| 406 | NDR_record_t NDR; |
| 407 | kern_return_t RetCode; |
| 408 | } __Reply__memory_object_data_request_t __attribute__((unused)); |
| 409 | #ifdef __MigPackStructs |
| 410 | #pragma pack() |
| 411 | #endif |
| 412 | |
| 413 | #ifdef __MigPackStructs |
| 414 | #pragma pack(4) |
| 415 | #endif |
| 416 | typedef struct { |
| 417 | mach_msg_header_t Head; |
| 418 | NDR_record_t NDR; |
| 419 | kern_return_t RetCode; |
| 420 | memory_object_offset_t resid_offset; |
| 421 | int io_error; |
| 422 | } __Reply__memory_object_data_return_t __attribute__((unused)); |
| 423 | #ifdef __MigPackStructs |
| 424 | #pragma pack() |
| 425 | #endif |
| 426 | |
| 427 | #ifdef __MigPackStructs |
| 428 | #pragma pack(4) |
| 429 | #endif |
| 430 | typedef struct { |
| 431 | mach_msg_header_t Head; |
| 432 | NDR_record_t NDR; |
| 433 | kern_return_t RetCode; |
| 434 | } __Reply__memory_object_data_initialize_t __attribute__((unused)); |
| 435 | #ifdef __MigPackStructs |
| 436 | #pragma pack() |
| 437 | #endif |
| 438 | |
| 439 | #ifdef __MigPackStructs |
| 440 | #pragma pack(4) |
| 441 | #endif |
| 442 | typedef struct { |
| 443 | mach_msg_header_t Head; |
| 444 | NDR_record_t NDR; |
| 445 | kern_return_t RetCode; |
| 446 | } __Reply__memory_object_data_unlock_t __attribute__((unused)); |
| 447 | #ifdef __MigPackStructs |
| 448 | #pragma pack() |
| 449 | #endif |
| 450 | |
| 451 | #ifdef __MigPackStructs |
| 452 | #pragma pack(4) |
| 453 | #endif |
| 454 | typedef struct { |
| 455 | mach_msg_header_t Head; |
| 456 | NDR_record_t NDR; |
| 457 | kern_return_t RetCode; |
| 458 | } __Reply__memory_object_synchronize_t __attribute__((unused)); |
| 459 | #ifdef __MigPackStructs |
| 460 | #pragma pack() |
| 461 | #endif |
| 462 | |
| 463 | #ifdef __MigPackStructs |
| 464 | #pragma pack(4) |
| 465 | #endif |
| 466 | typedef struct { |
| 467 | mach_msg_header_t Head; |
| 468 | NDR_record_t NDR; |
| 469 | kern_return_t RetCode; |
| 470 | } __Reply__memory_object_map_t __attribute__((unused)); |
| 471 | #ifdef __MigPackStructs |
| 472 | #pragma pack() |
| 473 | #endif |
| 474 | |
| 475 | #ifdef __MigPackStructs |
| 476 | #pragma pack(4) |
| 477 | #endif |
| 478 | typedef struct { |
| 479 | mach_msg_header_t Head; |
| 480 | NDR_record_t NDR; |
| 481 | kern_return_t RetCode; |
| 482 | } __Reply__memory_object_last_unmap_t __attribute__((unused)); |
| 483 | #ifdef __MigPackStructs |
| 484 | #pragma pack() |
| 485 | #endif |
| 486 | |
| 487 | #ifdef __MigPackStructs |
| 488 | #pragma pack(4) |
| 489 | #endif |
| 490 | typedef struct { |
| 491 | mach_msg_header_t Head; |
| 492 | NDR_record_t NDR; |
| 493 | kern_return_t RetCode; |
| 494 | } __Reply__memory_object_data_reclaim_t __attribute__((unused)); |
| 495 | #ifdef __MigPackStructs |
| 496 | #pragma pack() |
| 497 | #endif |
| 498 | #endif /* !__Reply__memory_object_subsystem__defined */ |
| 499 | |
| 500 | /* union of all replies */ |
| 501 | |
| 502 | #ifndef __ReplyUnion__memory_object_subsystem__defined |
| 503 | #define __ReplyUnion__memory_object_subsystem__defined |
| 504 | union __ReplyUnion__memory_object_subsystem { |
| 505 | __Reply__memory_object_init_t Reply_memory_object_init; |
| 506 | __Reply__memory_object_terminate_t Reply_memory_object_terminate; |
| 507 | __Reply__memory_object_data_request_t Reply_memory_object_data_request; |
| 508 | __Reply__memory_object_data_return_t Reply_memory_object_data_return; |
| 509 | __Reply__memory_object_data_initialize_t Reply_memory_object_data_initialize; |
| 510 | __Reply__memory_object_data_unlock_t Reply_memory_object_data_unlock; |
| 511 | __Reply__memory_object_synchronize_t Reply_memory_object_synchronize; |
| 512 | __Reply__memory_object_map_t Reply_memory_object_map; |
| 513 | __Reply__memory_object_last_unmap_t Reply_memory_object_last_unmap; |
| 514 | __Reply__memory_object_data_reclaim_t Reply_memory_object_data_reclaim; |
| 515 | }; |
| 516 | #endif /* !__RequestUnion__memory_object_subsystem__defined */ |
| 517 | |
| 518 | #ifndef subsystem_to_name_map_memory_object |
| 519 | #define subsystem_to_name_map_memory_object \ |
| 520 | { "memory_object_init", 2200 },\ |
| 521 | { "memory_object_terminate", 2201 },\ |
| 522 | { "memory_object_data_request", 2202 },\ |
| 523 | { "memory_object_data_return", 2203 },\ |
| 524 | { "memory_object_data_initialize", 2204 },\ |
| 525 | { "memory_object_data_unlock", 2205 },\ |
| 526 | { "memory_object_synchronize", 2206 },\ |
| 527 | { "memory_object_map", 2207 },\ |
| 528 | { "memory_object_last_unmap", 2208 },\ |
| 529 | { "memory_object_data_reclaim", 2209 } |
| 530 | #endif |
| 531 | |
| 532 | #ifdef __AfterMigUserHeader |
| 533 | __AfterMigUserHeader |
| 534 | #endif /* __AfterMigUserHeader */ |
| 535 | |
| 536 | #endif /* _memory_object_user_ */ |
| 537 | |