X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ffailtest%2Ffailtest.c;h=ed9e1e98eeadde6ae55d1635f01b62b3ad73a778;hb=15ed4f453713f1a7bdeec22b53704819fa3d447f;hp=104628352dd580a61e22bb5ff0743b35e0267ad5;hpb=a85a809bb17af6b6cf6fa31b300c6622f64ee700;p=ccan diff --git a/ccan/failtest/failtest.c b/ccan/failtest/failtest.c index 10462835..ed9e1e98 100644 --- a/ccan/failtest/failtest.c +++ b/ccan/failtest/failtest.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -91,7 +91,7 @@ static int control_fd = -1; /* If we're a child, this is the first call we did ourselves. */ static struct failtest_call *our_history_start = NULL; /* For printing runtime with --trace. */ -static struct timeval start; +static struct timespec start; /* Set when failtest_hook returns FAIL_PROBE */ static bool probing = false; /* Table to track duplicates. */ @@ -761,7 +761,7 @@ static bool should_fail(struct failtest_call *call) if (child == 0) { traceindent++; if (tracef) { - struct timeval diff; + struct timespec diff; const char *p; char *failpath; struct failtest_call *c; @@ -776,7 +776,7 @@ static bool should_fail(struct failtest_call *call) p = c->file; trace("%u->%u (%u.%02u): %s (%s:%u)\n", getppid(), getpid(), - (int)diff.tv_sec, (int)diff.tv_usec / 10000, + (int)diff.tv_sec, (int)diff.tv_nsec / 10000000, failpath, p, c->line); free(failpath); } @@ -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",