X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ffailtest%2Ffailtest_override.h;h=204494b086cd380cd7916e7aace2babb3ecbba30;hp=236441fcfc78e74c6dd632308d5bed7eaf4f5223;hb=56023cca5f66a40646a1e807c3d10af6e5913623;hpb=6c02fd599f5b3f925197c3161ee186a3305fc963 diff --git a/ccan/failtest/failtest_override.h b/ccan/failtest/failtest_override.h index 236441fc..204494b0 100644 --- a/ccan/failtest/failtest_override.h +++ b/ccan/failtest/failtest_override.h @@ -1,6 +1,11 @@ +/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_FAILTEST_OVERRIDE_H #define CCAN_FAILTEST_OVERRIDE_H /* This file is included before the source file to test. */ +#include "config.h" +#if HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif /* Replacement of allocators. */ #include @@ -17,9 +22,14 @@ #define realloc(ptr, size) \ failtest_realloc((ptr), (size), __FILE__, __LINE__) +#undef free +#define free(ptr) \ + failtest_free(ptr) + /* Replacement of I/O. */ #include #include +#include #include #include @@ -48,11 +58,24 @@ 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__) +#undef mmap +#define mmap(addr, length, prot, flags, fd, offset) \ + failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), \ + __FILE__, __LINE__) + +#undef lseek +#define lseek(fd, offset, whence) \ + failtest_lseek((fd), (offset), (whence), __FILE__, __LINE__) + +/* Replacement of getpid (since failtest will fork). */ +#undef getpid +#define getpid() failtest_getpid(__FILE__, __LINE__) + #include #endif /* CCAN_FAILTEST_OVERRIDE_H */