]>
Commit | Line | Data |
---|---|---|
cb323159 A |
1 | #include <stdio.h> |
2 | #include <errno.h> | |
3 | #include <string.h> | |
4 | #include <unistd.h> | |
5 | #include <mach/mach.h> | |
6 | #include <mach/mach_types.h> | |
7 | #include <darwintest.h> | |
8 | #include <darwintest_utils.h> | |
9 | ||
10 | T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true)); | |
11 | ||
12 | T_DECL(debug_control_port_for_pid_success, | |
13 | "Verify that with debug_port entitlement you can call debug_control_port_for_pid", | |
14 | T_META_ASROOT(true), T_META_CHECK_LEAKS(false)) | |
15 | { | |
16 | if (geteuid() != 0) { | |
17 | T_SKIP("test requires root privileges to run."); | |
18 | } | |
19 | ||
20 | mach_port_t port = MACH_PORT_NULL; | |
21 | T_ASSERT_MACH_SUCCESS(debug_control_port_for_pid(mach_task_self(), 1, &port), "debug_control_port_for_pid"); | |
22 | T_EXPECT_NE(port, MACH_PORT_NULL, "debug_port"); | |
23 | mach_port_deallocate(mach_task_self(), port); | |
24 | } |