]> git.ozlabs.org Git - ccan/blobdiff - ccan/failtest/failtest_override.h
failtest: failtest_has_failed()
[ccan] / ccan / failtest / failtest_override.h
index 3bd0f8fc2443d43a9459ac96529b6792687c0623..dfcc62e0dd5f4ff5630cc727230a1361ce09ca0c 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef CCAN_FAILTEST_OVERRIDE_H
 #define CCAN_FAILTEST_OVERRIDE_H
 /* This file is included before the source file to test. */
+#include "config.h"
 
 /* Replacement of allocators. */
 #include <stdlib.h>
 #define realloc(ptr, size)                                     \
        failtest_realloc((ptr), (size), __FILE__, __LINE__)
 
+#undef free
+#define free(ptr) \
+       failtest_free(ptr)
+
 /* Replacement of I/O. */
 #include <sys/types.h>
 #include <sys/stat.h>
 #define write(fd, buf, count) \
        failtest_write((fd), (buf), (count), __FILE__, __LINE__)
 
+#undef pread
+#define pread(fd, buf, count, off)                             \
+       failtest_pread((fd), (buf), (count), (off), __FILE__, __LINE__)
+
+#undef pwrite
+#define pwrite(fd, buf, count, off)                                    \
+       failtest_pwrite((fd), (buf), (count), (off), __FILE__, __LINE__)
+
 #undef close
-#define close(fd) failtest_close(fd)
+#define close(fd) failtest_close(fd, __FILE__, __LINE__)
 
 #undef fcntl
 #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__)
 
+/* Replacement of getpid (since failtest will fork). */
+#undef getpid
+#define getpid() failtest_getpid(__FILE__, __LINE__)
+
 #include <ccan/failtest/failtest_proto.h>
 
 #endif /* CCAN_FAILTEST_OVERRIDE_H */