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]
#include <sys/sunldi.h> int ldi_ioctl(ldi_handle_t lh, int cmd, intptr_t arg, int mode, cred_t *cr, int *rvalp);
Layered handle.
Pointer to a credential structure used to open a device.
Caller return value. (May be set by driver and is valid only if the ioctl() succeeds).
Command argument. Interpreted by driver ioctl() as the operation to be performed.
Driver parameter. Argument interpretation is driver dependent and usually depends on the command type.
Bit field that contains: FKIOCTL
Inform the target device that the ioctl originated from within the kernel.
The ldi_ioctl() 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.
If arg is interpreted as a pointer (that is, as not an immediate value) and the data pointed to by arg is in the kernels address space, the FKIOCTL flag should be set. This indicates to the target driver that no data model conversion is necessary.
If the caller of ldi_ioctl() is not the originator of the ioctl data pointed to by arg, (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 FMODELS bits that enable the target driver to determine the data model of the process which originated the ioctl and perform any necessary conversions. See ddi_model_convert_from(9F) for more information.
For a general description of streams ioctls see streamio(4I). ldi_ioctl() supports a number of streams ioctls, using layered handles in the place of file descriptors. When issuing streams ioctls the FKIOCTL parameter should be specified. The possible return values for supported ioctl commands are also documented in streamio(4I).
The following streams ioctls are supported: I_PLINK
Behaves as documented in streamio(4I). The layered handle lh should point to the streams multiplexer. The arg parameter should point to a layered handle for another streams driver.
Behaves as documented in streamio(4I)). The layered handle lh should point to the streams multiplexer. The arg parameter is the multiplexor ID number returned by I_PLINK when the streams were linked.
The ldi_ioctl() function returns 0 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. EINVAL
Invalid input parameters.
Operation is not supported for this device.
These functions can be called from user or kernel context.
streamio (4I), ddi_model_convert_from (9F)