9022 loader.efi: module placement must check memory map
[unleashed.git] / share / man / man9f / ldi_ioctl.9f
blob4e2648637541e2f8374a53b1e9c3ffa055890939
1 '\" te
2 .\" Copyright (c) 2003, Sun Microsystems, Inc.,  All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH LDI_IOCTL 9F "Jun 3, 2003"
7 .SH NAME
8 ldi_ioctl \- send an ioctl to a device
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/sunldi.h>
16 \fBint\fR \fBldi_ioctl\fR(\fBldi_handle_t\fR \fIlh\fR, \fBint\fR \fIcmd\fR, \fBintptr_t\fR \fIarg\fR, \fBint\fR \fImode\fR,
17      \fBcred_t  *\fR\fIcr\fR, \fBint *\fR\fIrvalp\fR);
18 .fi
20 .SH PARAMETERS
21 .sp
22 .ne 2
23 .na
24 \fB\fIlh\fR\fR
25 .ad
26 .RS 9n
27 Layered handle.
28 .RE
30 .sp
31 .ne 2
32 .na
33 \fB\fIcr\fR\fR
34 .ad
35 .RS 9n
36 Pointer to a credential structure used to open a device.
37 .RE
39 .sp
40 .ne 2
41 .na
42 \fB\fIrvalp\fR\fR
43 .ad
44 .RS 9n
45 Caller return value. (May be set by driver and is valid only if the
46 \fBioctl()\fR succeeds).
47 .RE
49 .sp
50 .ne 2
51 .na
52 \fB\fIcmd\fR\fR
53 .ad
54 .RS 9n
55 Command argument. Interpreted by driver \fBioctl()\fR as the operation to be
56 performed.
57 .RE
59 .sp
60 .ne 2
61 .na
62 \fB\fIarg\fR\fR
63 .ad
64 .RS 9n
65 Driver parameter. Argument interpretation is driver dependent and usually
66 depends on the command type.
67 .RE
69 .sp
70 .ne 2
71 .na
72 \fB\fImode\fR\fR
73 .ad
74 .RS 9n
75 Bit field that contains:
76 .sp
77 .ne 2
78 .na
79 \fBFKIOCTL\fR
80 .ad
81 .RS 11n
82 Inform the target device that the ioctl originated from within the kernel.
83 .RE
85 .RE
87 .SH DESCRIPTION
88 .sp
89 .LP
90 The \fBldi_ioctl()\fR function passes an ioctl request to the device entry
91 point for the device specified by the layered handle. This operation is
92 supported for block, character, and streams devices.
93 .sp
94 .LP
95 If \fIarg\fR is interpreted  as a pointer (that is, as not an immediate value)
96 and the data pointed to by \fIarg\fR is in the kernels address space, the
97 \fBFKIOCTL\fR flag should be set. This indicates to the target driver that no
98 data model conversion is necessary.
99 .sp
101 If the caller of \fBldi_ioctl()\fR is not the originator of the ioctl data
102 pointed to by \fIarg\fR, (for example, when passing on an ioctl request from a
103 user process), the caller must pass on the mode parameter from the original
104 ioctl. This is because the mode parameter contains the contains the
105 \fBFMODELS\fR bits that enable the target driver to determine the data model of
106 the process which originated the ioctl and perform any necessary conversions.
107 See \fBddi_model_convert_from\fR(9F) for more information.
108 .SH STREAM IOCTLS
111 For a general description of streams ioctls see \fBstreamio\fR(7I).
112 \fBldi_ioctl()\fR supports a number of streams ioctls, using layered handles in
113 the place of file descriptors. When issuing streams ioctls the \fBFKIOCTL\fR
114 parameter should be specified. The possible return values for supported ioctl
115 commands are also documented in \fBstreamio\fR(7I).
118 The following streams ioctls are supported:
120 .ne 2
122 \fBI_PLINK\fR
124 .RS 13n
125 Behaves as documented in \fBstreamio\fR(7I). The layered handle \fIlh\fR should
126 point to the streams multiplexer. The \fIarg\fR parameter should point to a
127 layered handle for another streams driver.
131 .ne 2
133 \fBI_UNPLINK\fR
135 .RS 13n
136 Behaves as documented in \fBstreamio\fR(7I)).  The layered handle \fIlh\fR
137 should point to the streams multiplexer. The \fIarg\fR parameter is the
138 multiplexor ID number returned by \fBI_PLINK\fR when the streams were linked.
141 .SH RETURN VALUES
144 The \fBldi_ioctl()\fR function returns \fB0\fR upon success. If a failure
145 occurs before the request is passed on to the device, possible return values
146 are shown below. Otherwise any other error number may be returned by the
147 device.
149 .ne 2
151 \fBEINVAL\fR
153 .RS 11n
154 Invalid input parameters.
158 .ne 2
160 \fBENOTSUP\fR
162 .RS 11n
163 Operation is not supported for this device.
166 .SH CONTEXT
169 These functions can be called from user or kernel context.
170 .SH SEE ALSO
173 \fBstreamio\fR(7I), \fBddi_model_convert_from\fR(9F)