Created
June 27, 2013 13:49
-
-
Save 0x75/5876556 to your computer and use it in GitHub Desktop.
mach msg server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mach_msg_server(mach_port_t exception_port) { | |
mach_msg_return_t r; | |
r = mach_msg(&msg.head, MACH_RCV_MSG|MACH_RCV_LARGE|MACH_RCV_TIMEOUT, 0, sizeof(msg), exception_port, 0, MACH_PORT_NULL); | |
assert(r != MACH_RCV_TIMED_OUT); | |
assert (r == MACH_MSG_SUCCESS); | |
mach_exc_server(&msg.head, &reply.head); | |
r = mach_msg(&reply.head, MACH_SEND_MSG|MACH_SEND_TIMEOUT, reply.head.msgh_size, 0, MACH_PORT_NULL, 0 ,MACH_PORT_NULL); | |
assert(r != MACH_SEND_TIMED_OUT); | |
assert(r == MACH_MSG_SUCCESS); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment