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.
This commit is contained in:
Michael Tuexen 2018-12-29 18:58:16 +01:00 committed by Dmitry Vyukov
parent e8f58194c1
commit a2af97ddf7

View File

@ -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;