1828c94c0SKevin Athey // RUN: %clangxx -O0 %s -o %t && %run %t
2828c94c0SKevin Athey 
3d50dc33dSKevin Athey // Android does not implement pthread_getaffinity_np.
4d50dc33dSKevin Athey // (Note: libresolv is integrated with libc, but apparently only
5d50dc33dSKevin Athey // sched_getaffinity).
667069e19SKevin Athey // UNSUPPORTED: android
767069e19SKevin Athey 
8828c94c0SKevin Athey #include <assert.h>
9828c94c0SKevin Athey #include <pthread.h>
10828c94c0SKevin Athey #include <sys/sysinfo.h>
11828c94c0SKevin Athey 
12828c94c0SKevin Athey #include <sanitizer/msan_interface.h>
13828c94c0SKevin Athey 
main()14828c94c0SKevin Athey int main() {
15*a86b171dSFangrui Song   cpu_set_t set_x[4];
160777be69SKevin Athey   pthread_t tid = pthread_self();
17*a86b171dSFangrui Song   int res = pthread_getaffinity_np(tid, sizeof(set_x), set_x);
18828c94c0SKevin Athey   assert(res == 0);
19*a86b171dSFangrui Song   assert(CPU_COUNT_S(sizeof(set_x), set_x) == get_nprocs());
20828c94c0SKevin Athey 
21828c94c0SKevin Athey   return 0;
22828c94c0SKevin Athey }
23