]>
git.saurik.com Git - apple/xnu.git/blob - tests/sysctl_hw.c
823e1123ff5ca98ed4616bfc8ddd3a96da3ed753
1 #include <darwintest.h>
2 #include <sys/sysctl.h>
4 T_DECL(sysctl_hw_cpu
, "ensure vital product and CPU-related sysctls exist")
7 size_t buffer_size
= sizeof(buffer
);
9 int ret
= sysctlbyname("hw.target", buffer
,
10 &buffer_size
, NULL
, 0);
11 T_ASSERT_POSIX_SUCCESS(ret
, "hw.target sysctl");
12 T_LOG("hw.target = %s", buffer
);
14 buffer_size
= sizeof(buffer
);
16 ret
= sysctlbyname("hw.product", buffer
,
17 &buffer_size
, NULL
, 0);
18 T_ASSERT_POSIX_SUCCESS(ret
, "hw.product sysctl");
19 T_LOG("hw.product = %s", buffer
);
21 buffer_size
= sizeof(buffer
);
23 ret
= sysctlbyname("machdep.cpu.brand_string", buffer
,
24 &buffer_size
, NULL
, 0);
26 T_ASSERT_POSIX_SUCCESS(ret
, "machdep.cpu.brand_string sysctl");
27 T_LOG("machdep.cpu.brand_string = %s", buffer
);