| 1 | #ifndef _processor_user_ |
| 2 | #define _processor_user_ |
| 3 | |
| 4 | /* Module processor */ |
| 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 | |
| 39 | #ifdef AUTOTEST |
| 40 | #ifndef FUNCTION_PTR_T |
| 41 | #define FUNCTION_PTR_T |
| 42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
| 43 | typedef struct { |
| 44 | char *name; |
| 45 | function_ptr_t function; |
| 46 | } function_table_entry; |
| 47 | typedef function_table_entry *function_table_t; |
| 48 | #endif /* FUNCTION_PTR_T */ |
| 49 | #endif /* AUTOTEST */ |
| 50 | |
| 51 | #ifndef processor_MSG_COUNT |
| 52 | #define processor_MSG_COUNT 6 |
| 53 | #endif /* processor_MSG_COUNT */ |
| 54 | |
| 55 | #include <mach/std_types.h> |
| 56 | #include <mach/mig.h> |
| 57 | #include <mach/mig.h> |
| 58 | #include <mach/mach_types.h> |
| 59 | |
| 60 | #ifdef __BeforeMigUserHeader |
| 61 | __BeforeMigUserHeader |
| 62 | #endif /* __BeforeMigUserHeader */ |
| 63 | |
| 64 | #include <sys/cdefs.h> |
| 65 | __BEGIN_DECLS |
| 66 | |
| 67 | |
| 68 | /* Routine processor_start */ |
| 69 | #ifdef mig_external |
| 70 | mig_external |
| 71 | #else |
| 72 | extern |
| 73 | #endif /* mig_external */ |
| 74 | kern_return_t processor_start |
| 75 | ( |
| 76 | processor_t processor |
| 77 | ); |
| 78 | |
| 79 | /* Routine processor_exit */ |
| 80 | #ifdef mig_external |
| 81 | mig_external |
| 82 | #else |
| 83 | extern |
| 84 | #endif /* mig_external */ |
| 85 | kern_return_t processor_exit |
| 86 | ( |
| 87 | processor_t processor |
| 88 | ); |
| 89 | |
| 90 | /* Routine processor_info */ |
| 91 | #ifdef mig_external |
| 92 | mig_external |
| 93 | #else |
| 94 | extern |
| 95 | #endif /* mig_external */ |
| 96 | kern_return_t processor_info |
| 97 | ( |
| 98 | processor_t processor, |
| 99 | processor_flavor_t flavor, |
| 100 | host_t *host, |
| 101 | processor_info_t processor_info_out, |
| 102 | mach_msg_type_number_t *processor_info_outCnt |
| 103 | ); |
| 104 | |
| 105 | /* Routine processor_control */ |
| 106 | #ifdef mig_external |
| 107 | mig_external |
| 108 | #else |
| 109 | extern |
| 110 | #endif /* mig_external */ |
| 111 | kern_return_t processor_control |
| 112 | ( |
| 113 | processor_t processor, |
| 114 | processor_info_t processor_cmd, |
| 115 | mach_msg_type_number_t processor_cmdCnt |
| 116 | ); |
| 117 | |
| 118 | /* Routine processor_assign */ |
| 119 | #ifdef mig_external |
| 120 | mig_external |
| 121 | #else |
| 122 | extern |
| 123 | #endif /* mig_external */ |
| 124 | kern_return_t processor_assign |
| 125 | ( |
| 126 | processor_t processor, |
| 127 | processor_set_t new_set, |
| 128 | boolean_t wait |
| 129 | ); |
| 130 | |
| 131 | /* Routine processor_get_assignment */ |
| 132 | #ifdef mig_external |
| 133 | mig_external |
| 134 | #else |
| 135 | extern |
| 136 | #endif /* mig_external */ |
| 137 | kern_return_t processor_get_assignment |
| 138 | ( |
| 139 | processor_t processor, |
| 140 | processor_set_name_t *assigned_set |
| 141 | ); |
| 142 | |
| 143 | __END_DECLS |
| 144 | |
| 145 | /********************** Caution **************************/ |
| 146 | /* The following data types should be used to calculate */ |
| 147 | /* maximum message sizes only. The actual message may be */ |
| 148 | /* smaller, and the position of the arguments within the */ |
| 149 | /* message layout may vary from what is presented here. */ |
| 150 | /* For example, if any of the arguments are variable- */ |
| 151 | /* sized, and less than the maximum is sent, the data */ |
| 152 | /* will be packed tight in the actual message to reduce */ |
| 153 | /* the presence of holes. */ |
| 154 | /********************** Caution **************************/ |
| 155 | |
| 156 | /* typedefs for all requests */ |
| 157 | |
| 158 | #ifndef __Request__processor_subsystem__defined |
| 159 | #define __Request__processor_subsystem__defined |
| 160 | |
| 161 | #ifdef __MigPackStructs |
| 162 | #pragma pack(4) |
| 163 | #endif |
| 164 | typedef struct { |
| 165 | mach_msg_header_t Head; |
| 166 | } __Request__processor_start_t __attribute__((unused)); |
| 167 | #ifdef __MigPackStructs |
| 168 | #pragma pack() |
| 169 | #endif |
| 170 | |
| 171 | #ifdef __MigPackStructs |
| 172 | #pragma pack(4) |
| 173 | #endif |
| 174 | typedef struct { |
| 175 | mach_msg_header_t Head; |
| 176 | } __Request__processor_exit_t __attribute__((unused)); |
| 177 | #ifdef __MigPackStructs |
| 178 | #pragma pack() |
| 179 | #endif |
| 180 | |
| 181 | #ifdef __MigPackStructs |
| 182 | #pragma pack(4) |
| 183 | #endif |
| 184 | typedef struct { |
| 185 | mach_msg_header_t Head; |
| 186 | NDR_record_t NDR; |
| 187 | processor_flavor_t flavor; |
| 188 | mach_msg_type_number_t processor_info_outCnt; |
| 189 | } __Request__processor_info_t __attribute__((unused)); |
| 190 | #ifdef __MigPackStructs |
| 191 | #pragma pack() |
| 192 | #endif |
| 193 | |
| 194 | #ifdef __MigPackStructs |
| 195 | #pragma pack(4) |
| 196 | #endif |
| 197 | typedef struct { |
| 198 | mach_msg_header_t Head; |
| 199 | NDR_record_t NDR; |
| 200 | mach_msg_type_number_t processor_cmdCnt; |
| 201 | integer_t processor_cmd[12]; |
| 202 | } __Request__processor_control_t __attribute__((unused)); |
| 203 | #ifdef __MigPackStructs |
| 204 | #pragma pack() |
| 205 | #endif |
| 206 | |
| 207 | #ifdef __MigPackStructs |
| 208 | #pragma pack(4) |
| 209 | #endif |
| 210 | typedef struct { |
| 211 | mach_msg_header_t Head; |
| 212 | /* start of the kernel processed data */ |
| 213 | mach_msg_body_t msgh_body; |
| 214 | mach_msg_port_descriptor_t new_set; |
| 215 | /* end of the kernel processed data */ |
| 216 | NDR_record_t NDR; |
| 217 | boolean_t wait; |
| 218 | } __Request__processor_assign_t __attribute__((unused)); |
| 219 | #ifdef __MigPackStructs |
| 220 | #pragma pack() |
| 221 | #endif |
| 222 | |
| 223 | #ifdef __MigPackStructs |
| 224 | #pragma pack(4) |
| 225 | #endif |
| 226 | typedef struct { |
| 227 | mach_msg_header_t Head; |
| 228 | } __Request__processor_get_assignment_t __attribute__((unused)); |
| 229 | #ifdef __MigPackStructs |
| 230 | #pragma pack() |
| 231 | #endif |
| 232 | #endif /* !__Request__processor_subsystem__defined */ |
| 233 | |
| 234 | /* union of all requests */ |
| 235 | |
| 236 | #ifndef __RequestUnion__processor_subsystem__defined |
| 237 | #define __RequestUnion__processor_subsystem__defined |
| 238 | union __RequestUnion__processor_subsystem { |
| 239 | __Request__processor_start_t Request_processor_start; |
| 240 | __Request__processor_exit_t Request_processor_exit; |
| 241 | __Request__processor_info_t Request_processor_info; |
| 242 | __Request__processor_control_t Request_processor_control; |
| 243 | __Request__processor_assign_t Request_processor_assign; |
| 244 | __Request__processor_get_assignment_t Request_processor_get_assignment; |
| 245 | }; |
| 246 | #endif /* !__RequestUnion__processor_subsystem__defined */ |
| 247 | /* typedefs for all replies */ |
| 248 | |
| 249 | #ifndef __Reply__processor_subsystem__defined |
| 250 | #define __Reply__processor_subsystem__defined |
| 251 | |
| 252 | #ifdef __MigPackStructs |
| 253 | #pragma pack(4) |
| 254 | #endif |
| 255 | typedef struct { |
| 256 | mach_msg_header_t Head; |
| 257 | NDR_record_t NDR; |
| 258 | kern_return_t RetCode; |
| 259 | } __Reply__processor_start_t __attribute__((unused)); |
| 260 | #ifdef __MigPackStructs |
| 261 | #pragma pack() |
| 262 | #endif |
| 263 | |
| 264 | #ifdef __MigPackStructs |
| 265 | #pragma pack(4) |
| 266 | #endif |
| 267 | typedef struct { |
| 268 | mach_msg_header_t Head; |
| 269 | NDR_record_t NDR; |
| 270 | kern_return_t RetCode; |
| 271 | } __Reply__processor_exit_t __attribute__((unused)); |
| 272 | #ifdef __MigPackStructs |
| 273 | #pragma pack() |
| 274 | #endif |
| 275 | |
| 276 | #ifdef __MigPackStructs |
| 277 | #pragma pack(4) |
| 278 | #endif |
| 279 | typedef struct { |
| 280 | mach_msg_header_t Head; |
| 281 | /* start of the kernel processed data */ |
| 282 | mach_msg_body_t msgh_body; |
| 283 | mach_msg_port_descriptor_t host; |
| 284 | /* end of the kernel processed data */ |
| 285 | NDR_record_t NDR; |
| 286 | mach_msg_type_number_t processor_info_outCnt; |
| 287 | integer_t processor_info_out[12]; |
| 288 | } __Reply__processor_info_t __attribute__((unused)); |
| 289 | #ifdef __MigPackStructs |
| 290 | #pragma pack() |
| 291 | #endif |
| 292 | |
| 293 | #ifdef __MigPackStructs |
| 294 | #pragma pack(4) |
| 295 | #endif |
| 296 | typedef struct { |
| 297 | mach_msg_header_t Head; |
| 298 | NDR_record_t NDR; |
| 299 | kern_return_t RetCode; |
| 300 | } __Reply__processor_control_t __attribute__((unused)); |
| 301 | #ifdef __MigPackStructs |
| 302 | #pragma pack() |
| 303 | #endif |
| 304 | |
| 305 | #ifdef __MigPackStructs |
| 306 | #pragma pack(4) |
| 307 | #endif |
| 308 | typedef struct { |
| 309 | mach_msg_header_t Head; |
| 310 | NDR_record_t NDR; |
| 311 | kern_return_t RetCode; |
| 312 | } __Reply__processor_assign_t __attribute__((unused)); |
| 313 | #ifdef __MigPackStructs |
| 314 | #pragma pack() |
| 315 | #endif |
| 316 | |
| 317 | #ifdef __MigPackStructs |
| 318 | #pragma pack(4) |
| 319 | #endif |
| 320 | typedef struct { |
| 321 | mach_msg_header_t Head; |
| 322 | /* start of the kernel processed data */ |
| 323 | mach_msg_body_t msgh_body; |
| 324 | mach_msg_port_descriptor_t assigned_set; |
| 325 | /* end of the kernel processed data */ |
| 326 | } __Reply__processor_get_assignment_t __attribute__((unused)); |
| 327 | #ifdef __MigPackStructs |
| 328 | #pragma pack() |
| 329 | #endif |
| 330 | #endif /* !__Reply__processor_subsystem__defined */ |
| 331 | |
| 332 | /* union of all replies */ |
| 333 | |
| 334 | #ifndef __ReplyUnion__processor_subsystem__defined |
| 335 | #define __ReplyUnion__processor_subsystem__defined |
| 336 | union __ReplyUnion__processor_subsystem { |
| 337 | __Reply__processor_start_t Reply_processor_start; |
| 338 | __Reply__processor_exit_t Reply_processor_exit; |
| 339 | __Reply__processor_info_t Reply_processor_info; |
| 340 | __Reply__processor_control_t Reply_processor_control; |
| 341 | __Reply__processor_assign_t Reply_processor_assign; |
| 342 | __Reply__processor_get_assignment_t Reply_processor_get_assignment; |
| 343 | }; |
| 344 | #endif /* !__RequestUnion__processor_subsystem__defined */ |
| 345 | |
| 346 | #ifndef subsystem_to_name_map_processor |
| 347 | #define subsystem_to_name_map_processor \ |
| 348 | { "processor_start", 3000 },\ |
| 349 | { "processor_exit", 3001 },\ |
| 350 | { "processor_info", 3002 },\ |
| 351 | { "processor_control", 3003 },\ |
| 352 | { "processor_assign", 3004 },\ |
| 353 | { "processor_get_assignment", 3005 } |
| 354 | #endif |
| 355 | |
| 356 | #ifdef __AfterMigUserHeader |
| 357 | __AfterMigUserHeader |
| 358 | #endif /* __AfterMigUserHeader */ |
| 359 | |
| 360 | #endif /* _processor_user_ */ |
| 361 | |