aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@freebsd.org>2018-12-29 18:58:16 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-12-29 19:17:28 +0100
commita2af97ddf7ceb4d024d2c8cc7c7d08b226365057 (patch)
tree0ed096f1452f0527bb149da1bff74324515e44d9 /executor
parente8f58194c1b72fddba1dbcb86cd84b1a5f91f074 (diff)
executor: Fix FreeBSD such all platforms use same number of entries
FreeBSD sets the kcov buffer as number of bytes instead of number of entries. This also fixes the mmap() call, which was failing due to inconsistent sizes. The failing was hidden due to wrong error handling.
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_bsd.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h
index 3d22f91ed..1095c2beb 100644
--- a/executor/executor_bsd.h
+++ b/executor/executor_bsd.h
@@ -71,7 +71,8 @@ static void cover_open(cover_t* cov)
close(fd);
#if GOOS_freebsd
- if (ioctl(cov->fd, KIOSETBUFSIZE, kCoverSize))
+ // On FreeBSD provide the size in bytes, not in number of entries.
+ if (ioctl(cov->fd, KIOSETBUFSIZE, kCoverSize * sizeof(uint64_t)))
fail("ioctl init trace write failed");
#elif GOOS_openbsd
unsigned long cover_size = kCoverSize;