xref: /xnu-10063.121.3/tests/ipc/port_api.c (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions #include <darwintest.h>
2*2c2f96dcSApple OSS Distributions #include <darwintest_utils.h>
3*2c2f96dcSApple OSS Distributions 
4*2c2f96dcSApple OSS Distributions #include <mach/mach.h>
5*2c2f96dcSApple OSS Distributions #include <mach/mach_types.h>
6*2c2f96dcSApple OSS Distributions #include <mach/mach_vm.h>
7*2c2f96dcSApple OSS Distributions #include <mach/message.h>
8*2c2f96dcSApple OSS Distributions #include <mach/mach_error.h>
9*2c2f96dcSApple OSS Distributions #include <mach/task.h>
10*2c2f96dcSApple OSS Distributions 
11*2c2f96dcSApple OSS Distributions #include <pthread.h>
12*2c2f96dcSApple OSS Distributions #include <pthread/workqueue_private.h>
13*2c2f96dcSApple OSS Distributions 
14*2c2f96dcSApple OSS Distributions T_GLOBAL_META(
15*2c2f96dcSApple OSS Distributions 	T_META_NAMESPACE("xnu.ipc"),
16*2c2f96dcSApple OSS Distributions 	T_META_RUN_CONCURRENTLY(TRUE),
17*2c2f96dcSApple OSS Distributions 	T_META_RADAR_COMPONENT_NAME("xnu"),
18*2c2f96dcSApple OSS Distributions 	T_META_RADAR_COMPONENT_VERSION("IPC"));
19*2c2f96dcSApple OSS Distributions 
20*2c2f96dcSApple OSS Distributions T_DECL(mach_port_insert_right_123724977, "regression test for 123724977")
21*2c2f96dcSApple OSS Distributions {
22*2c2f96dcSApple OSS Distributions 	mach_port_name_t pset;
23*2c2f96dcSApple OSS Distributions 	kern_return_t kr;
24*2c2f96dcSApple OSS Distributions 
25*2c2f96dcSApple OSS Distributions 	kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_PORT_SET, &pset);
26*2c2f96dcSApple OSS Distributions 	T_ASSERT_MACH_SUCCESS(kr, "creating port set");
27*2c2f96dcSApple OSS Distributions 
28*2c2f96dcSApple OSS Distributions 	kr = mach_port_insert_right(mach_task_self(), pset, pset,
29*2c2f96dcSApple OSS Distributions 	    MACH_MSG_TYPE_MAKE_SEND);
30*2c2f96dcSApple OSS Distributions 	T_ASSERT_MACH_ERROR(kr, KERN_INVALID_RIGHT, "insert right fails");
31*2c2f96dcSApple OSS Distributions }
32