7 #include "pub_tool_basics.h"
8 #include "vki/vki-scnums-darwin.h"
9 #include "pub_tool_vkiscnums.h"
11 // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to
12 // declare this ourselves.
13 extern int syscall (int __sysno
, ...);
15 // Thorough syscall scalar arg checking. Also serves as thorough checking
16 // for (very) basic syscall use. Generally not trying to do anything
17 // meaningful with the syscalls.
19 #define GO(__NR_xxx, N, s) \
20 fprintf(stderr, "-----------------------------------------------------\n" \
21 "x%lx(%d):%20s %s\n" \
22 "-----------------------------------------------------\n", \
23 (unsigned long)__NR_xxx, N, #__NR_xxx, s);
25 #define GO_UNIMP(n, s) \
26 fprintf(stderr, "-----------------------------------------------------\n" \
28 "-----------------------------------------------------\n", \
31 #define SY(__NR_xxx, args...) res = syscall(__NR_xxx, ##args);
33 #define FAIL assert(-1 == res);
34 #define SUCC assert(-1 != res);
35 #define SUCC_OR_FAIL /* no test */
39 int myerrno = errno; \
44 fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
48 fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \
53 #define SUCC_OR_FAILx(E) \
55 int myerrno = errno; \
60 fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \