diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-21 11:20:06 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-03-22 01:57:37 +0100 |
commit | b3a6ffd7b269f7a34334d24b54591c225da773a5 (patch) | |
tree | 11ee5b831e28a9460d19a4045560ad307c145f1d /lib/ccan/failtest/failtest_override.h | |
parent | 675593221c25dbebaaf8e4ce9f4271a8fb0171d0 (diff) | |
download | samba-b3a6ffd7b269f7a34334d24b54591c225da773a5.tar.gz samba-b3a6ffd7b269f7a34334d24b54591c225da773a5.tar.bz2 samba-b3a6ffd7b269f7a34334d24b54591c225da773a5.zip |
lib/ccan/failtest: compile fix for OpenBSD
OpenBSD doesn't idempotent-wrap sys/mman.h, so when we #define mmap to
an alternative, it fails to compile when sys/mman.h is included again.
Workaround is not to #define mmap to add arguments on Open BSD.
(Imported from CCAN commit e18e80fe175422d26efe689addc0f67bdba0e097)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan/failtest/failtest_override.h')
-rw-r--r-- | lib/ccan/failtest/failtest_override.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ccan/failtest/failtest_override.h b/lib/ccan/failtest/failtest_override.h index 204494b086..b056d538d4 100644 --- a/lib/ccan/failtest/failtest_override.h +++ b/lib/ccan/failtest/failtest_override.h @@ -64,9 +64,15 @@ #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__) #undef mmap +/* OpenBSD doesn't idempotent-protect sys/mman.h, so we can't add args. */ +#ifdef __OpenBSD__ +#define mmap(addr, length, prot, flags, fd, offset) \ + failtest_mmap_noloc((addr), (length), (prot), (flags), (fd), (offset)) +#else #define mmap(addr, length, prot, flags, fd, offset) \ failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), \ __FILE__, __LINE__) +#endif /* !__OpenBSD__ */ #undef lseek #define lseek(fd, offset, whence) \ |