Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldi_ioctl(9f) [sunos man page]

ldi_ioctl(9F)						   Kernel Functions for Drivers 					     ldi_ioctl(9F)

NAME
ldi_ioctl - Send an ioctl to a device SYNOPSIS
#include <sys/sunldi.h> int ldi_ioctl(ldi_handle_t lh, int cmd, intptr_t arg, int mode, cred_t *cr, int *rvalp); PARAMETERS
lh Layered handle. cr Pointer to a credential structure used to open a device. rvalp Caller return value. (May be set by driver and is valid only if the ioctl() succeeds). cmd Command argument. Interpreted by driver ioctl() as the operation to be performed. arg Driver parameter. Argument interpretation is driver dependent and usually depends on the command type. mode Bit field that contains: FKIOCTL Inform the target device that the ioctl originated from within the kernel. DESCRIPTION
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 userland 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 which 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. STREAM IOCTLS
For a general description of streams ioctls see streamio(7I). 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(7I). The following streams ioctls are supported: I_PLINK Behaves as documented in streamio(7I). The layered handle lh should point to the streams multiplexer. The arg parameter should point to a layered handle for another streams driver. I_UNPLINK Behaves as documented in streamio(7I)). 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. RETURN VALUES
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. ENOTSUP Operation is not supported for this device. CONTEXT
These functions may be called from user or kernel context. SunOS 5.10 3 June 2003 ldi_ioctl(9F)

Check Out this Related Man Page

ioctl(2)							   System Calls 							  ioctl(2)

NAME
ioctl - control device SYNOPSIS
#include <unistd.h> #include <stropts.h> int ioctl(int fildes, int request, /* arg */ ...); DESCRIPTION
The ioctl() function performs a variety of control functions on devices and STREAMS. For non-STREAMS files, the functions performed by this call are device-specific control functions. The request argument and an optional third argument with varying type are passed to the file designated by fildes and are interpreted by the device driver. For STREAMS files, specific functions are performed by the ioctl() function as described in streamio(7I). The fildes argument is an open file descriptor that refers to a device. The request argument selects the control function to be performed and depends on the device being addressed. The arg argument represents a third argument that has additional information that is needed by this specific device to perform the requested function. The data type of arg depends upon the particular control request, but it is either an int or a pointer to a device-specific data structure. In addition to device-specific and STREAMS functions, generic functions are provided by more than one device driver (for example, the gen- eral terminal interface.) See termio(7I)). RETURN VALUES
Upon successful completion, the value returned depends upon the device control function, but must be a non-negative integer. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The ioctl() function will fail for any type of file if: EBADF The fildes argument is not a valid open file descriptor. EINTR A signal was caught during the execution of the ioctl() function. EINVAL The STREAM or multiplexer referenced by fildes is linked (directly or indirectly) downstream from a multiplexer. The ioctl() function will also fail if the device driver detects an error. In this case, the error is passed through ioctl() without change to the caller. A particular driver might not have all of the following error cases. Under the following conditions, requests to device drivers may fail and set errno to indicate the error EFAULT The request argument requires a data transfer to or from a buffer pointed to by arg, but arg points to an illegal address. EINVAL The request or arg argument is not valid for this device. EIO Some physical I/O error has occurred. ENOLINK The fildes argument is on a remote machine and the link to that machine is no longer active. ENOTTY The fildes argument is not associated with a STREAMS device that accepts control functions. ENXIO The request and arg arguments are valid for this device driver, but the service requested can not be performed on this par- ticular subdevice. ENODEV The fildes argument refers to a valid STREAMS device, but the corresponding device driver does not support the ioctl() function. STREAMS errors are described in streamio(7I). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5), standards(5), streamio(7I), termio(7I) SunOS 5.10 15 Feb 1996 ioctl(2)
Man Page