aboutsummaryrefslogtreecommitdiff
path: root/test/msan/Linux/eventfd.cc
blob: 4399211258fff1bad3b716a1efdd31f109821919 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1

#include <assert.h>
#include <sys/eventfd.h>

#include <sanitizer/msan_interface.h>

int main(int argc, char *argv[]) {
  int efd = eventfd(42, 0);
  assert(efd >= 0);

  eventfd_t v;
  int ret = eventfd_read(efd, &v);
  assert(ret == 0);
  __msan_check_mem_is_initialized(&v, sizeof(v));

  assert(v == 42);
}