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. */
6 #if HAVE_FILE_OFFSET_BITS
7 #define _FILE_OFFSET_BITS 64
10 /* Replacement of allocators. */
14 #define calloc(nmemb, size) \
15 failtest_calloc((nmemb), (size), __FILE__, __LINE__)
18 #define malloc(size) \
19 failtest_malloc((size), __FILE__, __LINE__)
22 #define realloc(ptr, size) \
23 failtest_realloc((ptr), (size), __FILE__, __LINE__)
29 /* Replacement of I/O. */
30 #include <sys/types.h>
37 #define open(pathname, ...) \
38 failtest_open((pathname), __FILE__, __LINE__, __VA_ARGS__)
41 #define pipe(pipefd) \
42 failtest_pipe((pipefd), __FILE__, __LINE__)
45 #define read(fd, buf, count) \
46 failtest_read((fd), (buf), (count), __FILE__, __LINE__)
49 #define write(fd, buf, count) \
50 failtest_write((fd), (buf), (count), __FILE__, __LINE__)
53 #define pread(fd, buf, count, off) \
54 failtest_pread((fd), (buf), (count), (off), __FILE__, __LINE__)
57 #define pwrite(fd, buf, count, off) \
58 failtest_pwrite((fd), (buf), (count), (off), __FILE__, __LINE__)
61 #define close(fd) failtest_close(fd, __FILE__, __LINE__)
64 #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__)
67 #define mmap(addr, length, prot, flags, fd, offset) \
68 failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), \
72 #define lseek(fd, offset, whence) \
73 failtest_lseek((fd), (offset), (whence), __FILE__, __LINE__)
75 /* Replacement of getpid (since failtest will fork). */
77 #define getpid() failtest_getpid(__FILE__, __LINE__)
79 #include <ccan/failtest/failtest_proto.h>
81 #endif /* CCAN_FAILTEST_OVERRIDE_H */