diff options
| author | Michael Tuexen <tuexen@freebsd.org> | 2018-12-28 12:41:51 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-12-28 13:34:33 +0100 |
| commit | 4898a4328e9215e546f728fe35fde4c03d2bf466 (patch) | |
| tree | 532d6591691ee9f7d097aa6b916f3f21c28d5d95 /executor/executor_bsd.h | |
| parent | fc6ae81a344440b24e74577076581b6919ba49ad (diff) | |
executor: improve kcov compatibility with upcoming support
Get ioctl() definitions and usage in sync with the upcoming support
reviewed in https://reviews.freebsd.org/D14599.
Diffstat (limited to 'executor/executor_bsd.h')
| -rw-r--r-- | executor/executor_bsd.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h index 290ddce2b..b1aaa8163 100644 --- a/executor/executor_bsd.h +++ b/executor/executor_bsd.h @@ -42,9 +42,9 @@ static long execute_syscall(const call_t* c, long a[kMaxArgs]) // // [1] https://reviews.freebsd.org/D14599 -#define KIOENABLE _IOW('c', 2, int) // Enable coverage recording +#define KIOENABLE _IOWINT('c', 2) // Enable coverage recording #define KIODISABLE _IO('c', 3) // Disable coverage recording -#define KIOSETBUFSIZE _IOW('c', 4, unsigned int) // Set the buffer size +#define KIOSETBUFSIZE _IOWINT('c', 4) // Set the buffer size #define KCOV_MODE_NONE -1 #define KCOV_MODE_TRACE_PC 0 @@ -71,7 +71,7 @@ static void cover_open(cover_t* cov) close(fd); #if GOOS_freebsd - if (ioctl(cov->fd, KIOSETBUFSIZE, &kCoverSize)) + if (ioctl(cov->fd, KIOSETBUFSIZE, kCoverSize)) fail("ioctl init trace write failed"); #elif GOOS_openbsd unsigned long cover_size = kCoverSize; @@ -92,8 +92,13 @@ static void cover_open(cover_t* cov) static void cover_enable(cover_t* cov, bool collect_comps) { int kcov_mode = flag_collect_comps ? KCOV_MODE_TRACE_CMP : KCOV_MODE_TRACE_PC; +#if GOOS_freebsd + if (ioctl(cov->fd, KIOENABLE, kcov_mode)) + exitf("cover enable write trace failed, mode=%d", kcov_mode); +#elif GOOS_openbsd if (ioctl(cov->fd, KIOENABLE, &kcov_mode)) exitf("cover enable write trace failed, mode=%d", kcov_mode); +#endif } static void cover_reset(cover_t* cov) |
