| 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 | |
| 11 | int main(int argc, char *argv[]) { |
| 12 | int efd = eventfd(count: 42, flags: 0); |
| 13 | assert(efd >= 0); |
| 14 | |
| 15 | eventfd_t v; |
| 16 | int ret = eventfd_read(fd: efd, value: &v); |
| 17 | assert(ret == 0); |
| 18 | __msan_check_mem_is_initialized(x: &v, size: sizeof(v)); |
| 19 | |
| 20 | assert(v == 42); |
| 21 | } |
| 22 |
