]> git.ozlabs.org Git - ccan/blob - ccan/failtest/failtest_override.h
hash: use config.h settings for endian.
[ccan] / ccan / failtest / failtest_override.h
1 #ifndef CCAN_FAILTEST_OVERRIDE_H
2 #define CCAN_FAILTEST_OVERRIDE_H
3 /* This file is included before the source file to test. */
4 #include "config.h"
5
6 /* Replacement of allocators. */
7 #include <stdlib.h>
8
9 #undef calloc
10 #define calloc(nmemb, size)     \
11         failtest_calloc((nmemb), (size), __FILE__, __LINE__)
12
13 #undef malloc
14 #define malloc(size)    \
15         failtest_malloc((size), __FILE__, __LINE__)
16
17 #undef realloc
18 #define realloc(ptr, size)                                      \
19         failtest_realloc((ptr), (size), __FILE__, __LINE__)
20
21 #undef free
22 #define free(ptr) \
23         failtest_free(ptr)
24
25 /* Replacement of I/O. */
26 #include <sys/types.h>
27 #include <sys/stat.h>
28 #include <fcntl.h>
29 #include <unistd.h>
30
31 #undef open
32 #define open(pathname, ...) \
33         failtest_open((pathname), __FILE__, __LINE__, __VA_ARGS__)
34
35 #undef pipe
36 #define pipe(pipefd) \
37         failtest_pipe((pipefd), __FILE__, __LINE__)
38
39 #undef read
40 #define read(fd, buf, count) \
41         failtest_read((fd), (buf), (count), __FILE__, __LINE__)
42
43 #undef write
44 #define write(fd, buf, count) \
45         failtest_write((fd), (buf), (count), __FILE__, __LINE__)
46
47 #undef pread
48 #define pread(fd, buf, count, off)                              \
49         failtest_pread((fd), (buf), (count), (off), __FILE__, __LINE__)
50
51 #undef pwrite
52 #define pwrite(fd, buf, count, off)                                     \
53         failtest_pwrite((fd), (buf), (count), (off), __FILE__, __LINE__)
54
55 #undef close
56 #define close(fd) failtest_close(fd, __FILE__, __LINE__)
57
58 #undef fcntl
59 #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__)
60
61 #include <ccan/failtest/failtest_proto.h>
62
63 #endif /* CCAN_FAILTEST_OVERRIDE_H */