From b3a6ffd7b269f7a34334d24b54591c225da773a5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 21 Mar 2012 11:20:06 +1030 Subject: 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 --- lib/ccan/failtest/failtest.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/ccan/failtest/failtest.c') diff --git a/lib/ccan/failtest/failtest.c b/lib/ccan/failtest/failtest.c index 5f68394518..a4a374f4fb 100644 --- a/lib/ccan/failtest/failtest.c +++ b/lib/ccan/failtest/failtest.c @@ -1177,6 +1177,15 @@ void *failtest_mmap(void *addr, size_t length, int prot, int flags, return p->u.mmap.ret; } +/* Since OpenBSD can't handle adding args, we use this file and line. + * This will make all mmaps look the same, reducing coverage. */ +void *failtest_mmap_noloc(void *addr, size_t length, int prot, int flags, + int fd, off_t offset) +{ + return failtest_mmap(addr, length, prot, flags, fd, offset, + __FILE__, __LINE__); +} + static void cleanup_pipe(struct pipe_call *call, bool restore) { trace("cleaning up pipe fd=%i%s,%i%s\n", -- cgit