| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated Tue Apr 9 11:33:40 2019 |
| 4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
| 5 | * OPTIONS: |
| 6 | * KernelUser |
| 7 | */ |
| 8 | #define __MIG_check__Reply__lockd_mach_subsystem__ 1 |
| 9 | |
| 10 | #include "lockd_mach.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 lockd_request */ |
| 109 | mig_external kern_return_t lockd_request |
| 110 | ( |
| 111 | mach_port_t server, |
| 112 | uint32_t vers, |
| 113 | uint32_t flags, |
| 114 | uint64_t xid, |
| 115 | int64_t flk_start, |
| 116 | int64_t flk_len, |
| 117 | int32_t flk_pid, |
| 118 | int32_t flk_type, |
| 119 | int32_t flk_whence, |
| 120 | sock_storage sock_address, |
| 121 | xcred cred, |
| 122 | uint32_t fh_len, |
| 123 | nfs_handle fh |
| 124 | ) |
| 125 | { |
| 126 | |
| 127 | #ifdef __MigPackStructs |
| 128 | #pragma pack(4) |
| 129 | #endif |
| 130 | typedef struct { |
| 131 | mach_msg_header_t Head; |
| 132 | NDR_record_t NDR; |
| 133 | uint32_t vers; |
| 134 | uint32_t flags; |
| 135 | uint64_t xid; |
| 136 | int64_t flk_start; |
| 137 | int64_t flk_len; |
| 138 | int32_t flk_pid; |
| 139 | int32_t flk_type; |
| 140 | int32_t flk_whence; |
| 141 | sock_storage sock_address; |
| 142 | xcred cred; |
| 143 | uint32_t fh_len; |
| 144 | nfs_handle fh; |
| 145 | } Request __attribute__((unused)); |
| 146 | #ifdef __MigPackStructs |
| 147 | #pragma pack() |
| 148 | #endif |
| 149 | /* |
| 150 | * typedef struct { |
| 151 | * mach_msg_header_t Head; |
| 152 | * NDR_record_t NDR; |
| 153 | * kern_return_t RetCode; |
| 154 | * } mig_reply_error_t; |
| 155 | */ |
| 156 | |
| 157 | union { |
| 158 | Request In; |
| 159 | } Mess; |
| 160 | |
| 161 | Request *InP = &Mess.In; |
| 162 | |
| 163 | mach_msg_return_t msg_result; |
| 164 | |
| 165 | #ifdef __MIG_check__Reply__lockd_request_t__defined |
| 166 | kern_return_t check_result; |
| 167 | #endif /* __MIG_check__Reply__lockd_request_t__defined */ |
| 168 | |
| 169 | __DeclareSendSimple(1023, "lockd_request" ) |
| 170 | |
| 171 | InP->NDR = NDR_record; |
| 172 | |
| 173 | InP->vers = vers; |
| 174 | |
| 175 | InP->flags = flags; |
| 176 | |
| 177 | InP->xid = xid; |
| 178 | |
| 179 | InP->flk_start = flk_start; |
| 180 | |
| 181 | InP->flk_len = flk_len; |
| 182 | |
| 183 | InP->flk_pid = flk_pid; |
| 184 | |
| 185 | InP->flk_type = flk_type; |
| 186 | |
| 187 | InP->flk_whence = flk_whence; |
| 188 | |
| 189 | { typedef struct { char data[128]; } *sp; |
| 190 | * (sp) InP->sock_address = * (sp) sock_address; |
| 191 | } |
| 192 | |
| 193 | { typedef struct { char data[76]; } *sp; |
| 194 | * (sp) InP->cred = * (sp) cred; |
| 195 | } |
| 196 | |
| 197 | InP->fh_len = fh_len; |
| 198 | |
| 199 | { typedef struct { char data[64]; } *sp; |
| 200 | * (sp) InP->fh = * (sp) fh; |
| 201 | } |
| 202 | |
| 203 | InP->Head.msgh_bits = |
| 204 | MACH_MSGH_BITS(19, 0); |
| 205 | /* msgh_size passed as argument */ |
| 206 | InP->Head.msgh_request_port = server; |
| 207 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 208 | InP->Head.msgh_id = 1023; |
| 209 | InP->Head.msgh_reserved = 0; |
| 210 | |
| 211 | __BeforeSendSimple(1023, "lockd_request" ) |
| 212 | #if __MigKernelSpecificCode |
| 213 | msg_result = mach_msg_send_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request)); |
| 214 | #else |
| 215 | 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); |
| 216 | #endif /* __MigKernelSpecificCode */ |
| 217 | __AfterSendSimple(1023, "lockd_request" ) |
| 218 | return msg_result; |
| 219 | } |
| 220 | |
| 221 | #if ( __MigTypeCheck ) |
| 222 | #if __MIG_check__Reply__lockd_mach_subsystem__ |
| 223 | #if !defined(__MIG_check__Reply__lockd_ping_t__defined) |
| 224 | #define __MIG_check__Reply__lockd_ping_t__defined |
| 225 | |
| 226 | mig_internal kern_return_t __MIG_check__Reply__lockd_ping_t(__Reply__lockd_ping_t *Out0P) |
| 227 | { |
| 228 | |
| 229 | typedef __Reply__lockd_ping_t __Reply __attribute__((unused)); |
| 230 | if (Out0P->Head.msgh_id != 1124) { |
| 231 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
| 232 | { return MIG_SERVER_DIED; } |
| 233 | else |
| 234 | { return MIG_REPLY_MISMATCH; } |
| 235 | } |
| 236 | |
| 237 | #if __MigTypeCheck |
| 238 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
| 239 | (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) |
| 240 | { return MIG_TYPE_ERROR ; } |
| 241 | #endif /* __MigTypeCheck */ |
| 242 | |
| 243 | { |
| 244 | return Out0P->RetCode; |
| 245 | } |
| 246 | } |
| 247 | #endif /* !defined(__MIG_check__Reply__lockd_ping_t__defined) */ |
| 248 | #endif /* __MIG_check__Reply__lockd_mach_subsystem__ */ |
| 249 | #endif /* ( __MigTypeCheck ) */ |
| 250 | |
| 251 | |
| 252 | /* Routine lockd_ping */ |
| 253 | mig_external kern_return_t lockd_ping |
| 254 | ( |
| 255 | mach_port_t server |
| 256 | ) |
| 257 | { |
| 258 | |
| 259 | #ifdef __MigPackStructs |
| 260 | #pragma pack(4) |
| 261 | #endif |
| 262 | typedef struct { |
| 263 | mach_msg_header_t Head; |
| 264 | } Request __attribute__((unused)); |
| 265 | #ifdef __MigPackStructs |
| 266 | #pragma pack() |
| 267 | #endif |
| 268 | |
| 269 | #ifdef __MigPackStructs |
| 270 | #pragma pack(4) |
| 271 | #endif |
| 272 | typedef struct { |
| 273 | mach_msg_header_t Head; |
| 274 | NDR_record_t NDR; |
| 275 | kern_return_t RetCode; |
| 276 | mach_msg_trailer_t trailer; |
| 277 | } Reply __attribute__((unused)); |
| 278 | #ifdef __MigPackStructs |
| 279 | #pragma pack() |
| 280 | #endif |
| 281 | |
| 282 | #ifdef __MigPackStructs |
| 283 | #pragma pack(4) |
| 284 | #endif |
| 285 | typedef struct { |
| 286 | mach_msg_header_t Head; |
| 287 | NDR_record_t NDR; |
| 288 | kern_return_t RetCode; |
| 289 | } __Reply __attribute__((unused)); |
| 290 | #ifdef __MigPackStructs |
| 291 | #pragma pack() |
| 292 | #endif |
| 293 | /* |
| 294 | * typedef struct { |
| 295 | * mach_msg_header_t Head; |
| 296 | * NDR_record_t NDR; |
| 297 | * kern_return_t RetCode; |
| 298 | * } mig_reply_error_t; |
| 299 | */ |
| 300 | |
| 301 | union { |
| 302 | Request In; |
| 303 | Reply Out; |
| 304 | } Mess; |
| 305 | |
| 306 | Request *InP = &Mess.In; |
| 307 | Reply *Out0P = &Mess.Out; |
| 308 | |
| 309 | mach_msg_return_t msg_result; |
| 310 | |
| 311 | #ifdef __MIG_check__Reply__lockd_ping_t__defined |
| 312 | kern_return_t check_result; |
| 313 | #endif /* __MIG_check__Reply__lockd_ping_t__defined */ |
| 314 | |
| 315 | __DeclareSendRpc(1024, "lockd_ping" ) |
| 316 | |
| 317 | InP->Head.msgh_bits = |
| 318 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
| 319 | /* msgh_size passed as argument */ |
| 320 | InP->Head.msgh_request_port = server; |
| 321 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
| 322 | InP->Head.msgh_id = 1024; |
| 323 | InP->Head.msgh_reserved = 0; |
| 324 | |
| 325 | __BeforeSendRpc(1024, "lockd_ping" ) |
| 326 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
| 327 | msg_result = mach_msg_rpc_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply)); |
| 328 | #else |
| 329 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 330 | #endif /* __MigKernelSpecificCode */ |
| 331 | __AfterSendRpc(1024, "lockd_ping" ) |
| 332 | if (msg_result != MACH_MSG_SUCCESS) { |
| 333 | __MachMsgErrorWithoutTimeout(msg_result); |
| 334 | { return msg_result; } |
| 335 | } |
| 336 | |
| 337 | |
| 338 | #if defined(__MIG_check__Reply__lockd_ping_t__defined) |
| 339 | check_result = __MIG_check__Reply__lockd_ping_t((__Reply__lockd_ping_t *)Out0P); |
| 340 | if (check_result != MACH_MSG_SUCCESS) |
| 341 | { return check_result; } |
| 342 | #endif /* defined(__MIG_check__Reply__lockd_ping_t__defined) */ |
| 343 | |
| 344 | return KERN_SUCCESS; |
| 345 | } |
| 346 | |
| 347 | /* SimpleRoutine lockd_shutdown */ |
| 348 | mig_external kern_return_t lockd_shutdown |
| 349 | ( |
| 350 | mach_port_t server |
| 351 | ) |
| 352 | { |
| 353 | |
| 354 | #ifdef __MigPackStructs |
| 355 | #pragma pack(4) |
| 356 | #endif |
| 357 | typedef struct { |
| 358 | mach_msg_header_t Head; |
| 359 | } Request __attribute__((unused)); |
| 360 | #ifdef __MigPackStructs |
| 361 | #pragma pack() |
| 362 | #endif |
| 363 | /* |
| 364 | * typedef struct { |
| 365 | * mach_msg_header_t Head; |
| 366 | * NDR_record_t NDR; |
| 367 | * kern_return_t RetCode; |
| 368 | * } mig_reply_error_t; |
| 369 | */ |
| 370 | |
| 371 | union { |
| 372 | Request In; |
| 373 | } Mess; |
| 374 | |
| 375 | Request *InP = &Mess.In; |
| 376 | |
| 377 | mach_msg_return_t msg_result; |
| 378 | |
| 379 | #ifdef __MIG_check__Reply__lockd_shutdown_t__defined |
| 380 | kern_return_t check_result; |
| 381 | #endif /* __MIG_check__Reply__lockd_shutdown_t__defined */ |
| 382 | |
| 383 | __DeclareSendSimple(1025, "lockd_shutdown" ) |
| 384 | |
| 385 | InP->Head.msgh_bits = |
| 386 | MACH_MSGH_BITS(19, 0); |
| 387 | /* msgh_size passed as argument */ |
| 388 | InP->Head.msgh_request_port = server; |
| 389 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 390 | InP->Head.msgh_id = 1025; |
| 391 | InP->Head.msgh_reserved = 0; |
| 392 | |
| 393 | __BeforeSendSimple(1025, "lockd_shutdown" ) |
| 394 | #if __MigKernelSpecificCode |
| 395 | msg_result = mach_msg_send_from_kernel(&InP->Head, (mach_msg_size_t)sizeof(Request)); |
| 396 | #else |
| 397 | 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); |
| 398 | #endif /* __MigKernelSpecificCode */ |
| 399 | __AfterSendSimple(1025, "lockd_shutdown" ) |
| 400 | return msg_result; |
| 401 | } |
| 402 | |