2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2016 Joyent, Inc.
19 .Nd device specific I/O control operation
37 A pointer to the driver's private data that was passed in via the
45 A pointer to a STREAMS write-side queue that the ioctl request was
48 A pointer to a message block structure that contains the I/O control
54 entry point is an optional GLDv3 entry point.
55 It provides a means for device-specific I/O control operations to be initiated.
56 In general, this entry point is not recommended for most devices and is
59 The I/O control interface is not like a traditional character or block
62 entry point, rather it is a STREAMS-based I/O control operation.
63 The data pointer of the
68 After handling the message, the driver will need to reply to the message, which
69 is usually done by using the
76 The device driver can access its soft state by casting the value pointed
79 The driver should be careful and ensure that it performs any necessary
80 locking to access members of that structure while processing the I/O
83 Return information is not conveyed by the return value of this function, rather
90 The following example shows how a device driver might structure its
94 #include <sys/types.h>
95 #include <sys/stream.h>
96 #include <sys/stropts.h>
98 #include <sys/sunddi.h>
101 * Note, this example merely shows the structure of this function. It does not
102 * actively handle any device-specific ioctls and instead returns failure for
103 * every one. This is the most common case. Note, miocnak(9F) takes care of
104 * calling putnext(9F) for us.
107 example_m_ioctl(void *arg, queue_t *wq, mblk_t *mp)
109 miocnak(wq, mp, 0, EINVAL);
116 .Xr mac_register 9F ,
123 .%T Writing Device Drivers
126 .%T STREAMS Programming Guide