summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index f1083391ba6d..28c3c627cb68 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/filio.h>
#include <sys/jail.h>
#include <sys/kbio.h>
+#include <sys/kcov.h>
#include <sys/kernel.h>
#include <sys/linker_set.h>
#include <sys/lock.h>
@@ -117,6 +118,7 @@ static linux_ioctl_function_t linux_ioctl_v4l2;
static linux_ioctl_function_t linux_ioctl_special;
static linux_ioctl_function_t linux_ioctl_fbsd_usb;
static linux_ioctl_function_t linux_ioctl_evdev;
+static linux_ioctl_function_t linux_ioctl_kcov;
static struct linux_ioctl_handler cdrom_handler =
{ linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX };
@@ -146,6 +148,8 @@ static struct linux_ioctl_handler fbsd_usb =
{ linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX };
static struct linux_ioctl_handler evdev_handler =
{ linux_ioctl_evdev, LINUX_IOCTL_EVDEV_MIN, LINUX_IOCTL_EVDEV_MAX };
+static struct linux_ioctl_handler kcov_handler =
+{ linux_ioctl_kcov, LINUX_KCOV_MIN, LINUX_KCOV_MAX };
DATA_SET(linux_ioctl_handler_set, cdrom_handler);
DATA_SET(linux_ioctl_handler_set, vfat_handler);
@@ -161,6 +165,7 @@ DATA_SET(linux_ioctl_handler_set, video_handler);
DATA_SET(linux_ioctl_handler_set, video2_handler);
DATA_SET(linux_ioctl_handler_set, fbsd_usb);
DATA_SET(linux_ioctl_handler_set, evdev_handler);
+DATA_SET(linux_ioctl_handler_set, kcov_handler);
/*
* Keep sorted by low.
@@ -3572,6 +3577,38 @@ linux_ioctl_evdev(struct thread *td, struct linux_ioctl_args *args)
return (sys_ioctl(td, (struct ioctl_args *)args));
}
+static int
+linux_ioctl_kcov(struct thread *td, struct linux_ioctl_args *args)
+{
+ int error;
+
+ error = 0;
+ switch (args->cmd & 0xffff) {
+ case LINUX_KCOV_INIT_TRACE:
+ args->cmd = KIOSETBUFSIZE;
+ break;
+ case LINUX_KCOV_ENABLE:
+ args->cmd = KIOENABLE;
+ if (args->arg == 0)
+ args->arg = KCOV_MODE_TRACE_PC;
+ else if (args->arg == 1)
+ args->arg = KCOV_MODE_TRACE_CMP;
+ else
+ error = EINVAL;
+ break;
+ case LINUX_KCOV_DISABLE:
+ args->cmd = KIODISABLE;
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+
+ if (error == 0)
+ error = sys_ioctl(td, (struct ioctl_args *)args);
+ return (error);
+}
+
/*
* main ioctl syscall function
*/