1 /* Licensed under LGPL - see LICENSE file for details */
2 #ifndef CCAN_FAILTEST_OVERRIDE_H
3 #define CCAN_FAILTEST_OVERRIDE_H
4 /* This file is included before the source file to test. */
7 /* Replacement of allocators. */
11 #define calloc(nmemb, size) \
12 failtest_calloc((nmemb), (size), __FILE__, __LINE__)
15 #define malloc(size) \
16 failtest_malloc((size), __FILE__, __LINE__)
19 #define realloc(ptr, size) \
20 failtest_realloc((ptr), (size), __FILE__, __LINE__)
26 /* Replacement of I/O. */
27 #include <sys/types.h>
33 #define open(pathname, ...) \
34 failtest_open((pathname), __FILE__, __LINE__, __VA_ARGS__)
37 #define pipe(pipefd) \
38 failtest_pipe((pipefd), __FILE__, __LINE__)
41 #define read(fd, buf, count) \
42 failtest_read((fd), (buf), (count), __FILE__, __LINE__)
45 #define write(fd, buf, count) \
46 failtest_write((fd), (buf), (count), __FILE__, __LINE__)
49 #define pread(fd, buf, count, off) \
50 failtest_pread((fd), (buf), (count), (off), __FILE__, __LINE__)
53 #define pwrite(fd, buf, count, off) \
54 failtest_pwrite((fd), (buf), (count), (off), __FILE__, __LINE__)
57 #define close(fd) failtest_close(fd, __FILE__, __LINE__)
60 #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__)
62 /* Replacement of getpid (since failtest will fork). */
64 #define getpid() failtest_getpid(__FILE__, __LINE__)
66 #include <ccan/failtest/failtest_proto.h>
68 #endif /* CCAN_FAILTEST_OVERRIDE_H */