[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / msan / sigwaitinfo.cc
blobbe7a2c009e0e552049b12e2cc783f1cda01dbaa5
1 // RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t && %run %t
3 #include <assert.h>
4 #include <sanitizer/msan_interface.h>
5 #include <signal.h>
6 #include <sys/time.h>
7 #include <unistd.h>
9 void test_sigwaitinfo() {
10 sigset_t s;
11 sigemptyset(&s);
12 sigaddset(&s, SIGUSR1);
13 sigprocmask(SIG_BLOCK, &s, 0);
15 if (pid_t pid = fork()) {
16 kill(pid, SIGUSR1);
17 _exit(0);
18 } else {
19 siginfo_t info;
20 int res = sigwaitinfo(&s, &info);
21 assert(!res);
22 // The following checks that sig is initialized.
23 assert(info.si_signo == SIGUSR1);
24 assert(-1 == __msan_test_shadow(&info, sizeof(info)));
28 int main(void) {
29 test_sigwaitinfo();
30 return 0;