summaryrefslogtreecommitdiff
path: root/i386/i386at/kd_mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'i386/i386at/kd_mouse.c')
-rw-r--r--i386/i386at/kd_mouse.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index 8f4e09a..28114d4 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -314,6 +314,26 @@ kd_mouse_close(dev, mouse_pic)
}
#ifdef MACH_KERNEL
+io_return_t mousegetstat(dev, flavor, data, count)
+ dev_t dev;
+ int flavor;
+ int * data; /* pointer to OUT array */
+ unsigned int *count; /* OUT */
+{
+ io_return_t result;
+
+ switch (flavor) {
+ case DEV_GET_SIZE:
+ data[DEV_GET_SIZE_DEVICE_SIZE] = 0;
+ data[DEV_GET_SIZE_RECORD_SIZE] = sizeof(kd_event);
+ *count = DEV_GET_SIZE_COUNT;
+ break;
+ default:
+ return D_INVALID_OPERATION;
+ }
+ return D_SUCCESS;
+}
+
#else MACH_KERNEL
/*
* mouseioctl - handling for asynch & non-blocking I/O.
@@ -390,6 +410,10 @@ mouseread(dev, ior)
register int err, count;
register spl_t s;
+ /* Check if IO_COUNT is a multiple of the record size. */
+ if (ior->io_count % sizeof(kd_event) != 0)
+ return D_INVALID_SIZE;
+
err = device_read_alloc(ior, (vm_size_t)ior->io_count);
if (err != KERN_SUCCESS)
return (err);