xref: /llvm-project/compiler-rt/test/msan/eventfd.cpp (revision 619a0069240b0b55ab3e7dc280a8ca31e805747a)
1 /* RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
2 
3    REQUIRES: target={{.*(linux|freebsd).*}}
4 */
5 
6 #include <assert.h>
7 #include <sys/eventfd.h>
8 
9 #include <sanitizer/msan_interface.h>
10 
main(int argc,char * argv[])11 int main(int argc, char *argv[]) {
12   int efd = eventfd(42, 0);
13   assert(efd >= 0);
14 
15   eventfd_t v;
16   int ret = eventfd_read(efd, &v);
17   assert(ret == 0);
18   __msan_check_mem_is_initialized(&v, sizeof(v));
19 
20   assert(v == 42);
21 }
22