1570af302Sopenharmony_ci// sched_cpualloc(0) should return unique pointers
2570af302Sopenharmony_ci// (often expected and gnulib replaces sched_cpualloc if sched_cpualloc(0) returns 0)
3570af302Sopenharmony_ci#include <stdlib.h>
4570af302Sopenharmony_ci#include <sched.h>
5570af302Sopenharmony_ci#include "test.h"
6570af302Sopenharmony_ci
7570af302Sopenharmony_ciint main(void)
8570af302Sopenharmony_ci{
9570af302Sopenharmony_ci	cpu_set_t *p = __sched_cpualloc(0);
10570af302Sopenharmony_ci	cpu_set_t *q = __sched_cpualloc(0);
11570af302Sopenharmony_ci	cpu_set_t *r = __sched_cpualloc(0);
12570af302Sopenharmony_ci	if (!p || !q || !r)
13570af302Sopenharmony_ci		t_error("sched_cpualloc(0) returned NULL\n");
14570af302Sopenharmony_ci	if (p == q || p == r || q == r)
15570af302Sopenharmony_ci		t_error("sched_cpualloc(0) returned non-unique pointers: %p, %p, %p\n", p, q, r);
16570af302Sopenharmony_ci	free(q);
17570af302Sopenharmony_ci	free(p);
18570af302Sopenharmony_ci	free(r);
19570af302Sopenharmony_ci	return t_status;
20570af302Sopenharmony_ci}
21