Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / memcheck / tests / x86-linux / scalar.h
blob52f742e4ac760d6ee3b0f1854de9aa899cd9a636
1 #include "../../../include/vki/vki-scnums-x86-linux.h"
3 #include <assert.h>
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <sys/syscall.h>
9 #include <sys/stat.h>
10 #include <sys/ptrace.h>
11 #include <sys/types.h>
12 #include <sys/mman.h>
14 #ifndef __THROW
15 #define __THROW
16 #endif
18 // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to
19 // declare this ourselves.
20 extern long int syscall (long int __sysno, ...) __THROW;
22 // Thorough syscall scalar arg checking. Also serves as thorough checking
23 // for (very) basic syscall use. Generally not trying to do anything
24 // meaningful with the syscalls.
26 #define GO(__NR_xxx, s) \
27 fprintf(stderr, "-----------------------------------------------------\n" \
28 "%3d:%20s %s\n" \
29 "-----------------------------------------------------\n", \
30 __NR_xxx, #__NR_xxx, s);
32 #define SY res = syscall
34 #define FAIL assert(-1 == res);
35 #define SUCC assert(-1 != res);
36 #define SUCC_OR_FAIL /* no test */
38 #define FAILx(E) \
39 do { \
40 int myerrno = errno; \
41 if (-1 == res) { \
42 if (E == myerrno) { \
43 /* as expected */ \
44 } else { \
45 fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
46 exit(1); \
47 } \
48 } else { \
49 fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \
50 exit(1); \
51 } \
52 } while (0);
54 #define SUCC_OR_FAILx(E) \
55 do { \
56 int myerrno = errno; \
57 if (-1 == res) { \
58 if (E == myerrno) { \
59 /* as expected */ \
60 } else { \
61 fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
62 exit(1); \
63 } \
64 } \
65 } while (0);