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