]> git.saurik.com Git - apple/xnu.git/blame - tests/debug_control_port_for_pid.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / debug_control_port_for_pid.c
CommitLineData
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
10T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
11
12T_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}