]> git.saurik.com Git - apple/xnu.git/blobdiff - tests/sysctl_get_owned_vmobjects.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / sysctl_get_owned_vmobjects.c
index cedc9f7ece8b4ac4103df7cf935e906242959a38..c8f26eb5a4888b2849826cd888c62fc3d754ae6d 100644 (file)
@@ -89,7 +89,18 @@ main_test(void)
        T_EXPECT_EQ(out_buffer->entries, 1ULL, "should have 1 vm object\n");
        T_EXPECT_NE(out_buffer->data[0].object_id, 0ULL, "vm_object_id should not be 0\n");
 
-       /* get the list for the current process */
+       /* get the list for the current process with an overly large size */
+       out_size = SIZE_MAX;
+       memset(out_buffer, 0, output_size);
+       ret = sysctlbyname(g_sysctl_name, out_buffer, &out_size, &task_name, sizeof(task_name));
+
+       T_QUIET;
+       T_EXPECT_EQ(ret, 0, "sysctlbyname failed\n");
+       T_EXPECT_EQ(out_size, 2 * sizeof(vm_object_query_data_t) + sizeof(int64_t), "sysctl return size is incorrect\n");
+       T_EXPECT_EQ(out_buffer->entries, 2ULL, "should have 2 vm objects\n");
+       T_EXPECT_NE(out_buffer->data[0].object_id, 0ULL, "vm_object_id should not be 0\n");
+
+       /* get the list for the current process with the correct output size */
        out_size = output_size;
        memset(out_buffer, 0, output_size);
        ret = sysctlbyname(g_sysctl_name, out_buffer, &out_size, &task_name, sizeof(task_name));