1 #include <darwintest.h>
3 #include <mach/mach_types.h>
14 T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
16 T_DECL(proc_info_44873309
, "ensure new proc_pidinfo flavor returns correct table sizes",
17 T_META_CHECK_LEAKS(false), T_META_ASROOT(true))
23 struct proc_ipctableinfo table_info
= {};
24 retval
= proc_pidinfo(pid
, PROC_PIDIPCTABLEINFO
, 0, (void *)&table_info
, (uint32_t)sizeof(table_info
));
25 T_WITH_ERRNO
; T_EXPECT_GT(retval
, 0, "proc_pidinfo(PROC_PIDIPCTABLEINFO) returned %d", retval
);
26 T_EXPECT_EQ(retval
, (int)sizeof(table_info
), "proc_pidinfo(PROC_PIDIPCTABLEINFO) table_size = %u, table_free = %u",
27 table_info
.table_size
, table_info
.table_free
);
29 kern_return_t ret
= mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE
, &port
);
30 T_ASSERT_MACH_SUCCESS(ret
, "mach_port_allocate MACH_PORT_RIGHT_RECEIVE");
32 struct proc_ipctableinfo table_info2
= {};
33 retval
= proc_pidinfo(pid
, PROC_PIDIPCTABLEINFO
, 0, (void *)&table_info2
, (uint32_t)sizeof(table_info2
));
34 T_WITH_ERRNO
; T_EXPECT_GT(retval
, 0, "proc_pidinfo(PROC_PIDIPCTABLEINFO) returned %d", retval
);
35 T_EXPECT_EQ(retval
, (int)sizeof(table_info2
), "proc_pidinfo(PROC_PIDIPCTABLEINFO) table_size2 = %u, table_free2 = %u",
36 table_info2
.table_size
, table_info2
.table_free
);
38 T_EXPECT_EQ(table_info
.table_free
, table_info2
.table_free
+ 1, "Comparing the table_free values");