| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated Tue Apr 9 11:33:39 2019 |
| 4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
| 5 | * OPTIONS: |
| 6 | * KernelUser |
| 7 | */ |
| 8 | #define __MIG_check__Reply__atm_notification_subsystem__ 1 |
| 9 | |
| 10 | #include "atm_notification.h" |
| 11 | |
| 12 | |
| 13 | #ifndef mig_internal |
| 14 | #define mig_internal static __inline__ |
| 15 | #endif /* mig_internal */ |
| 16 | |
| 17 | #ifndef mig_external |
| 18 | #define mig_external |
| 19 | #endif /* mig_external */ |
| 20 | |
| 21 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
| 22 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
| 23 | #endif /* !defined(__MigTypeCheck) */ |
| 24 | |
| 25 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
| 26 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
| 27 | #endif /* !defined(__MigKernelSpecificCode) */ |
| 28 | |
| 29 | #ifndef LimitCheck |
| 30 | #define LimitCheck 0 |
| 31 | #endif /* LimitCheck */ |
| 32 | |
| 33 | #ifndef min |
| 34 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
| 35 | #endif /* min */ |
| 36 | |
| 37 | #if !defined(_WALIGN_) |
| 38 | #define _WALIGN_(x) (((x) + 3) & ~3) |
| 39 | #endif /* !defined(_WALIGN_) */ |
| 40 | |
| 41 | #if !defined(_WALIGNSZ_) |
| 42 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
| 43 | #endif /* !defined(_WALIGNSZ_) */ |
| 44 | |
| 45 | #ifndef UseStaticTemplates |
| 46 | #define UseStaticTemplates 0 |
| 47 | #endif /* UseStaticTemplates */ |
| 48 | |
| 49 | #ifndef __MachMsgErrorWithTimeout |
| 50 | #define __MachMsgErrorWithTimeout(_R_) { \ |
| 51 | switch (_R_) { \ |
| 52 | case MACH_SEND_INVALID_DATA: \ |
| 53 | case MACH_SEND_INVALID_DEST: \ |
| 54 | case MACH_SEND_INVALID_HEADER: \ |
| 55 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 56 | break; \ |
| 57 | case MACH_SEND_TIMED_OUT: \ |
| 58 | case MACH_RCV_TIMED_OUT: \ |
| 59 | default: \ |
| 60 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 61 | } \ |
| 62 | } |
| 63 | #endif /* __MachMsgErrorWithTimeout */ |
| 64 | |
| 65 | #ifndef __MachMsgErrorWithoutTimeout |
| 66 | #define __MachMsgErrorWithoutTimeout(_R_) { \ |
| 67 | switch (_R_) { \ |
| 68 | case MACH_SEND_INVALID_DATA: \ |
| 69 | case MACH_SEND_INVALID_DEST: \ |
| 70 | case MACH_SEND_INVALID_HEADER: \ |
| 71 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 72 | break; \ |
| 73 | default: \ |
| 74 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 75 | } \ |
| 76 | } |
| 77 | #endif /* __MachMsgErrorWithoutTimeout */ |
| 78 | |
| 79 | #ifndef __DeclareSendRpc |
| 80 | #define __DeclareSendRpc(_NUM_, _NAME_) |
| 81 | #endif /* __DeclareSendRpc */ |
| 82 | |
| 83 | #ifndef __BeforeSendRpc |
| 84 | #define __BeforeSendRpc(_NUM_, _NAME_) |
| 85 | #endif /* __BeforeSendRpc */ |
| 86 | |
| 87 | #ifndef __AfterSendRpc |
| 88 | #define __AfterSendRpc(_NUM_, _NAME_) |
| 89 | #endif /* __AfterSendRpc */ |
| 90 | |
| 91 | #ifndef __DeclareSendSimple |
| 92 | #define __DeclareSendSimple(_NUM_, _NAME_) |
| 93 | #endif /* __DeclareSendSimple */ |
| 94 | |
| 95 | #ifndef __BeforeSendSimple |
| 96 | #define __BeforeSendSimple(_NUM_, _NAME_) |
| 97 | #endif /* __BeforeSendSimple */ |
| 98 | |
| 99 | #ifndef __AfterSendSimple |
| 100 | #define __AfterSendSimple(_NUM_, _NAME_) |
| 101 | #endif /* __AfterSendSimple */ |
| 102 | |
| 103 | #define msgh_request_port msgh_remote_port |
| 104 | #define msgh_reply_port msgh_local_port |
| 105 | |
| 106 | |
| 107 | |
| 108 | /* SimpleRoutine atm_collect_trace_info */ |
| 109 | mig_external kern_return_t atm_collect_trace_info |
| 110 | ( |
| 111 | mach_port_t atm_port, |
| 112 | atm_aid_t activity_trace_id, |
| 113 | mach_atm_subaid_t sub_activity_id, |
| 114 | uint32_t flags, |
| 115 | atm_memory_descriptor_array_t memory_buffers, |
| 116 | mach_msg_type_number_t memory_buffersCnt, |
| 117 | atm_memory_size_array_t buffer_sizes, |
| 118 | mach_msg_type_number_t buffer_sizesCnt |
| 119 | ) |
| 120 | { |
| 121 | |
| 122 | #ifdef __MigPackStructs |
| 123 | #pragma pack(4) |
| 124 | #endif |
| 125 | typedef struct { |
| 126 | mach_msg_header_t Head; |
| 127 | /* start of the kernel processed data */ |
| 128 | mach_msg_body_t msgh_body; |
| 129 | mach_msg_port_descriptor_t memory_buffers[512]; |
| 130 | /* end of the kernel processed data */ |
| 131 | NDR_record_t NDR; |
| 132 | atm_aid_t activity_trace_id; |
| 133 | mach_atm_subaid_t sub_activity_id; |
| 134 | uint32_t flags; |
| 135 | mach_msg_type_number_t memory_buffersCnt; |
| 136 | mach_msg_type_number_t buffer_sizesCnt; |
| 137 | uint64_t buffer_sizes[512]; |
| 138 | } Request __attribute__((unused)); |
| 139 | #ifdef __MigPackStructs |
| 140 | #pragma pack() |
| 141 | #endif |
| 142 | /* |
| 143 | * typedef struct { |
| 144 | * mach_msg_header_t Head; |
| 145 | * NDR_record_t NDR; |
| 146 | * kern_return_t RetCode; |
| 147 | * } mig_reply_error_t; |
| 148 | */ |
| 149 | |
| 150 | union atm_collect_trace_infoMessU { |
| 151 | Request In; |
| 152 | } *Mess = (union atm_collect_trace_infoMessU *) mig_user_allocate(sizeof(*Mess)); |
| 153 | |
| 154 | Request *InP = &Mess->In; |
| 155 | |
| 156 | mach_msg_return_t msg_result; |
| 157 | unsigned int msgh_size; |
| 158 | |
| 159 | #ifdef __MIG_check__Reply__atm_collect_trace_info_t__defined |
| 160 | kern_return_t check_result; |
| 161 | #endif /* __MIG_check__Reply__atm_collect_trace_info_t__defined */ |
| 162 | |
| 163 | __DeclareSendSimple(11500, "atm_collect_trace_info" ) |
| 164 | |
| 165 | #if UseStaticTemplates |
| 166 | const static mach_msg_port_descriptor_t memory_buffersTemplate = { |
| 167 | /* name = */ MACH_PORT_NULL, |
| 168 | /* pad1 = */ 0, |
| 169 | /* pad2 = */ 0, |
| 170 | /* disp = */ 19, |
| 171 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 172 | }; |
| 173 | #endif /* UseStaticTemplates */ |
| 174 | |
| 175 | InP->msgh_body.msgh_descriptor_count = 512; |
| 176 | { |
| 177 | register mach_msg_port_descriptor_t *ptr; |
| 178 | register int i; |
| 179 | |
| 180 | ptr = &InP->memory_buffers[0]; |
| 181 | if (memory_buffersCnt > 512) |
| 182 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 183 | for (i = 0; i < memory_buffersCnt; ptr++, i++) { |
| 184 | #if UseStaticTemplates |
| 185 | *ptr = memory_buffersTemplate; |
| 186 | ptr->name = memory_buffers[i]; |
| 187 | #else /* UseStaticTemplates */ |
| 188 | ptr->name = memory_buffers[i]; |
| 189 | ptr->disposition = 19; |
| 190 | ptr->type = MACH_MSG_PORT_DESCRIPTOR; |
| 191 | #endif /* UseStaticTemplates */ |
| 192 | } |
| 193 | for (i = memory_buffersCnt; i < 512; ptr++, i++) { |
| 194 | #if UseStaticTemplates |
| 195 | *ptr = memory_buffersTemplate; |
| 196 | #else /* UseStaticTemplates */ |
| 197 | ptr->name = MACH_PORT_NULL; |
| 198 | ptr->type = MACH_MSG_PORT_DESCRIPTOR; |
| 199 | #endif /* UseStaticTemplates */ |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | InP->NDR = NDR_record; |
| 204 | |
| 205 | InP->activity_trace_id = activity_trace_id; |
| 206 | |
| 207 | InP->sub_activity_id = sub_activity_id; |
| 208 | |
| 209 | InP->flags = flags; |
| 210 | |
| 211 | InP->memory_buffersCnt = memory_buffersCnt; |
| 212 | |
| 213 | if (buffer_sizesCnt > 512) { |
| 214 | { mig_user_deallocate((char *) Mess, (mach_msg_size_t)sizeof(*Mess)); return MIG_ARRAY_TOO_LARGE; } |
| 215 | } |
| 216 | (void)memcpy((char *) InP->buffer_sizes, (const char *) buffer_sizes, 8 * buffer_sizesCnt); |
| 217 | |
| 218 | InP->buffer_sizesCnt = buffer_sizesCnt; |
| 219 | |
| 220 | msgh_size = (mach_msg_size_t)(sizeof(Request) - 4096) + ((8 * buffer_sizesCnt)); |
| 221 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 222 | MACH_MSGH_BITS(17, 0); |
| 223 | /* msgh_size passed as argument */ |
| 224 | InP->Head.msgh_request_port = atm_port; |
| 225 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 226 | InP->Head.msgh_id = 11500; |
| 227 | InP->Head.msgh_reserved = 0; |
| 228 | |
| 229 | __BeforeSendSimple(11500, "atm_collect_trace_info" ) |
| 230 | #if __MigKernelSpecificCode |
| 231 | msg_result = mach_msg_send_from_kernel(&InP->Head, msgh_size); |
| 232 | #else |
| 233 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 234 | #endif /* __MigKernelSpecificCode */ |
| 235 | __AfterSendSimple(11500, "atm_collect_trace_info" ) |
| 236 | { mig_user_deallocate((char *) Mess, sizeof(*Mess)); return msg_result; } |
| 237 | } |
| 238 | |
| 239 | /* SimpleRoutine atm_inspect_process_buffer */ |
| 240 | mig_external kern_return_t atm_inspect_process_buffer |
| 241 | ( |
| 242 | mach_port_t atm_port, |
| 243 | uint32_t proc_pid, |
| 244 | uint64_t proc_uniqueid, |
| 245 | uint64_t buffer_size, |
| 246 | mach_port_t trace_buffer |
| 247 | ) |
| 248 | { |
| 249 | |
| 250 | #ifdef __MigPackStructs |
| 251 | #pragma pack(4) |
| 252 | #endif |
| 253 | typedef struct { |
| 254 | mach_msg_header_t Head; |
| 255 | /* start of the kernel processed data */ |
| 256 | mach_msg_body_t msgh_body; |
| 257 | mach_msg_port_descriptor_t trace_buffer; |
| 258 | /* end of the kernel processed data */ |
| 259 | NDR_record_t NDR; |
| 260 | uint32_t proc_pid; |
| 261 | uint64_t proc_uniqueid; |
| 262 | uint64_t buffer_size; |
| 263 | } Request __attribute__((unused)); |
| 264 | #ifdef __MigPackStructs |
| 265 | #pragma pack() |
| 266 | #endif |
| 267 | /* |
| 268 | * typedef struct { |
| 269 | * mach_msg_header_t Head; |
| 270 | * NDR_record_t NDR; |
| 271 | * kern_return_t RetCode; |
| 272 | * } mig_reply_error_t; |
| 273 | */ |
| 274 | |
| 275 | union { |
| 276 | Request In; |
| 277 | } Mess; |
| 278 | |
| 279 | Request *InP = &Mess.In; |
| 280 | |
| 281 | mach_msg_return_t msg_result; |
| 282 | |
| 283 | #ifdef __MIG_check__Reply__atm_inspect_process_buffer_t__defined |
| 284 | kern_return_t check_result; |
| 285 | #endif /* __MIG_check__Reply__atm_inspect_process_buffer_t__defined */ |
| 286 | |
| 287 | __DeclareSendSimple(11501, "atm_inspect_process_buffer" ) |
| 288 | |
| 289 | #if UseStaticTemplates |
| 290 | const static mach_msg_port_descriptor_t trace_bufferTemplate = { |
| 291 | /* name = */ MACH_PORT_NULL, |
| 292 | /* pad1 = */ 0, |
| 293 | /* pad2 = */ 0, |
| 294 | /* disp = */ 19, |
| 295 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 296 | }; |
| 297 | #endif /* UseStaticTemplates */ |
| 298 | |
| 299 | InP->msgh_body.msgh_descriptor_count = 1; |
| 300 | #if UseStaticTemplates |
| 301 | InP->trace_buffer = trace_bufferTemplate; |
| 302 | InP->trace_buffer.name = trace_buffer; |
| 303 | #else /* UseStaticTemplates */ |
| 304 | InP->trace_buffer.name = trace_buffer; |
| 305 | InP->trace_buffer.disposition = 19; |
| 306 | InP->trace_buffer.type = MACH_MSG_PORT_DESCRIPTOR; |
| 307 | #endif /* UseStaticTemplates */ |
| 308 | |
| 309 | InP->NDR = NDR_record; |
| 310 | |
| 311 | InP->proc_pid = proc_pid; |
| 312 | |
| 313 | InP->proc_uniqueid = proc_uniqueid; |
| 314 | |
| 315 | InP->buffer_size = buffer_size; |
| 316 | |
| 317 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 318 | MACH_MSGH_BITS(17, 0); |
| 319 | /* msgh_size passed as argument */ |
| 320 | InP->Head.msgh_request_port = atm_port; |
| 321 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 322 | InP->Head.msgh_id = 11501; |
| 323 | InP->Head.msgh_reserved = 0; |
| 324 | |
| 325 | __BeforeSendSimple(11501, "atm_inspect_process_buffer" ) |
| 326 | #if __MigKernelSpecificCode |
| 327 | msg_result = mach_msg_send_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request)); |
| 328 | #else |
| 329 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 330 | #endif /* __MigKernelSpecificCode */ |
| 331 | __AfterSendSimple(11501, "atm_inspect_process_buffer" ) |
| 332 | return msg_result; |
| 333 | } |
| 334 | |