1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc., All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LDI_IOCTL 9F "Jun 3, 2003"
.SH NAME
ldi_ioctl \- send an ioctl to a device
.SH SYNOPSIS
.LP
.nf
#include <sys/sunldi.h>
\fBint\fR \fBldi_ioctl\fR(\fBldi_handle_t\fR \fIlh\fR, \fBint\fR \fIcmd\fR, \fBintptr_t\fR \fIarg\fR, \fBint\fR \fImode\fR,
\fBcred_t *\fR\fIcr\fR, \fBint *\fR\fIrvalp\fR);
.fi
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIlh\fR\fR
.ad
.RS 9n
Layered handle.
.RE
.sp
.ne 2
.na
\fB\fIcr\fR\fR
.ad
.RS 9n
Pointer to a credential structure used to open a device.
.RE
.sp
.ne 2
.na
\fB\fIrvalp\fR\fR
.ad
.RS 9n
Caller return value. (May be set by driver and is valid only if the
\fBioctl()\fR succeeds).
.RE
.sp
.ne 2
.na
\fB\fIcmd\fR\fR
.ad
.RS 9n
Command argument. Interpreted by driver \fBioctl()\fR as the operation to be
performed.
.RE
.sp
.ne 2
.na
\fB\fIarg\fR\fR
.ad
.RS 9n
Driver parameter. Argument interpretation is driver dependent and usually
depends on the command type.
.RE
.sp
.ne 2
.na
\fB\fImode\fR\fR
.ad
.RS 9n
Bit field that contains:
.sp
.ne 2
.na
\fBFKIOCTL\fR
.ad
.RS 11n
Inform the target device that the ioctl originated from within the kernel.
.RE
.RE
.SH DESCRIPTION
.sp
.LP
The \fBldi_ioctl()\fR function passes an ioctl request to the device entry
point for the device specified by the layered handle. This operation is
supported for block, character, and streams devices.
.sp
.LP
If \fIarg\fR is interpreted as a pointer (that is, as not an immediate value)
and the data pointed to by \fIarg\fR is in the kernels address space, the
\fBFKIOCTL\fR flag should be set. This indicates to the target driver that no
data model conversion is necessary.
.sp
.LP
If the caller of \fBldi_ioctl()\fR is not the originator of the ioctl data
pointed to by \fIarg\fR, (for example, when passing on an ioctl request from a
user process), the caller must pass on the mode parameter from the original
ioctl. This is because the mode parameter contains the contains the
\fBFMODELS\fR bits that enable the target driver to determine the data model of
the process which originated the ioctl and perform any necessary conversions.
See \fBddi_model_convert_from\fR(9F) for more information.
.SH STREAM IOCTLS
.sp
.LP
For a general description of streams ioctls see \fBstreamio\fR(4I).
\fBldi_ioctl()\fR supports a number of streams ioctls, using layered handles in
the place of file descriptors. When issuing streams ioctls the \fBFKIOCTL\fR
parameter should be specified. The possible return values for supported ioctl
commands are also documented in \fBstreamio\fR(4I).
.sp
.LP
The following streams ioctls are supported:
.sp
.ne 2
.na
\fBI_PLINK\fR
.ad
.RS 13n
Behaves as documented in \fBstreamio\fR(4I). The layered handle \fIlh\fR should
point to the streams multiplexer. The \fIarg\fR parameter should point to a
layered handle for another streams driver.
.RE
.sp
.ne 2
.na
\fBI_UNPLINK\fR
.ad
.RS 13n
Behaves as documented in \fBstreamio\fR(4I)). The layered handle \fIlh\fR
should point to the streams multiplexer. The \fIarg\fR parameter is the
multiplexor ID number returned by \fBI_PLINK\fR when the streams were linked.
.RE
.SH RETURN VALUES
.sp
.LP
The \fBldi_ioctl()\fR function returns \fB0\fR upon success. If a failure
occurs before the request is passed on to the device, possible return values
are shown below. Otherwise any other error number may be returned by the
device.
.sp
.ne 2
.na
\fBEINVAL\fR
.ad
.RS 11n
Invalid input parameters.
.RE
.sp
.ne 2
.na
\fBENOTSUP\fR
.ad
.RS 11n
Operation is not supported for this device.
.RE
.SH CONTEXT
.sp
.LP
These functions can be called from user or kernel context.
.SH SEE ALSO
.sp
.LP
.BR streamio (4I),
.BR ddi_model_convert_from (9F)
|