From 1b5ec6c220f3ea457077a17f4cf6003502a06bb0 Mon Sep 17 00:00:00 2001 From: comex Date: Sun, 25 Jan 2015 21:56:22 -0500 Subject: right, fix cleanup. (compared to the old system, this avoids busywaiting, and properly frees the thread resources) --- test/test-inject.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test/test-inject.c') diff --git a/test/test-inject.c b/test/test-inject.c index 5d7bcff..fa5d029 100644 --- a/test/test-inject.c +++ b/test/test-inject.c @@ -5,6 +5,7 @@ #include #include #include +#include int main(int argc, char **argv) { if (argc <= 2) { @@ -20,16 +21,22 @@ int main(int argc, char **argv) { .u.mach.port = port, .u.mach.right_type = MACH_MSG_TYPE_MAKE_SEND} }; + clock_t a = clock(); int ret = substitute_dlopen_in_pid(pid, argv[2], 0, shuttles, 1, &error); - printf("ret=%d err=%s\n", ret, error); + clock_t b = clock(); + printf("ret=%d err=%s time=%ld\n", ret, error, (long) (b - a)); assert(!ret); free(error); static struct { mach_msg_header_t hdr; char body[5]; + mach_msg_trailer_t huh; } msg; - assert(!mach_msg_overwrite(NULL, MACH_RCV_MSG, 0, sizeof(msg), port, - MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, &msg.hdr, 0)); + kern_return_t kr = mach_msg_overwrite(NULL, MACH_RCV_MSG, 0, sizeof(msg), port, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, + &msg.hdr, 0); + printf("kr=%x\n", kr); + assert(!kr); printf("received '%.5s'\n", msg.body); } -- cgit v1.2.3