blob: d4c5c4ca33ed3c1054136edd0b15c668eccc7335 [file] [log] [blame]
Dmitry V. Levin2aec1e62015-11-15 02:29:29 +00001#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <errno.h>
6#include <stdio.h>
7#include <unistd.h>
8#include <sys/syscall.h>
9
10int
11main(void)
12{
13#ifdef __NR_membarrier
14 if (syscall(__NR_membarrier, 3, 255) != -1)
15 return 77;
16 printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s\n",
17 errno == ENOSYS ?
18 "ENOSYS (Function not implemented)" :
19 "EINVAL (Invalid argument)");
20 if (errno != ENOSYS) {
21 if (syscall(__NR_membarrier, 0, 0) != 1)
22 return 1; /* the test needs to be updated? */
23 puts("membarrier(MEMBARRIER_CMD_QUERY, 0)"
24 " = 0x1 (MEMBARRIER_CMD_SHARED)");
25 }
26 puts("+++ exited with 0 +++");
27 return 0;
28#else
29 return 77;
30#endif
31}