1*c54f35caSApple OSS Distributions #include <sys/sysctl.h>
2*c54f35caSApple OSS Distributions #include <darwintest.h>
3*c54f35caSApple OSS Distributions #include <darwintest_utils.h>
4*c54f35caSApple OSS Distributions
5*c54f35caSApple OSS Distributions T_GLOBAL_META(
6*c54f35caSApple OSS Distributions T_META_NAMESPACE("xnu.ipc"),
7*c54f35caSApple OSS Distributions T_META_RADAR_COMPONENT_NAME("xnu"),
8*c54f35caSApple OSS Distributions T_META_RADAR_COMPONENT_VERSION("IPC"),
9*c54f35caSApple OSS Distributions T_META_CHECK_LEAKS(false));
10*c54f35caSApple OSS Distributions
11*c54f35caSApple OSS Distributions static int64_t
run_sysctl_test(const char * t,int64_t value)12*c54f35caSApple OSS Distributions run_sysctl_test(const char *t, int64_t value)
13*c54f35caSApple OSS Distributions {
14*c54f35caSApple OSS Distributions char name[1024];
15*c54f35caSApple OSS Distributions int64_t result = 0;
16*c54f35caSApple OSS Distributions size_t s = sizeof(value);
17*c54f35caSApple OSS Distributions int rc;
18*c54f35caSApple OSS Distributions
19*c54f35caSApple OSS Distributions snprintf(name, sizeof(name), "debug.test.%s", t);
20*c54f35caSApple OSS Distributions rc = sysctlbyname(name, &result, &s, &value, s);
21*c54f35caSApple OSS Distributions T_ASSERT_POSIX_SUCCESS(rc, "sysctlbyname(%s)", t);
22*c54f35caSApple OSS Distributions return result;
23*c54f35caSApple OSS Distributions }
24*c54f35caSApple OSS Distributions
25*c54f35caSApple OSS Distributions T_DECL(waitq_basic, "General waitq test",
26*c54f35caSApple OSS Distributions T_META_RUN_CONCURRENTLY(false))
27*c54f35caSApple OSS Distributions {
28*c54f35caSApple OSS Distributions T_EXPECT_EQ(1ull, run_sysctl_test("waitq_basic", 0), "waitq_basic_test");
29*c54f35caSApple OSS Distributions }
30