Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ioctl(2) [opensolaris 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 particu- lar 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.11 15 Feb 1996 ioctl(2)

Check Out this Related Man Page

sad(7)							 Miscellaneous Information Manual						    sad(7)

NAME
sad - STREAMS Administrative Driver SYNOPSIS
... DESCRIPTION
The driver provides an interface to the facility using the function. As an interface, the driver enables administrative tasks to be per- formed on STREAMS modules and drivers. By specifying the command parameter to the function, an administrator can configure information for a device, get information on a device, or check a list of modules. fildes is a file descriptor obtained by opening using command specifies the administrative function to be performed. arg points to a data structure. If command is or arg points to a struct of type If command is arg points to a struct of type Security Restrictions The is restricted to superusers or users with the privilege. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. ioctl Commands The commands used to perform administrative functions on a STREAMS module or driver are specified by the following commands: Allows you to configure information for a device. The arg parameter points to a structure (defined in the header file), whose members are as follows: Allows you to specify the type of configuration to perform. This field can have the following values: Configures all minor devices. Configures a range of minor devices. Configures a single minor device. Clears the previous settings. Specify only the and fields when using this command. If a previous entry specified set the field to 0 (zero). If a previous entry was specified as set the field to the lowest minor device number in the range. Specifies the major device number. Specifies the minor device number. Specifies the range of minor devices. Specifies the number of modules to push. This number must be no more than which is defined in Additionally, this number must not exceed Specifies, in order, the array of modules to push. Lets you use the driver to obtain configuration information for a device by setting the and fields of the structure (see the command) to the major and minor device numbers of the device being queried. arg should point to a struct of type Upon successful completion, the structure contains all of the information used to configure the device. Values of 0 (zero) will appear in any unused entry in the module list. Enables you to check a list of modules. For example, you can determine if a specific module has been installed. The arg parameter points to a structure (defined in the header file), whose members are as follows: Specifies the number of entries you have allocated in an array. Points to the array of module names. The structure (also in the header file) is as follows: where specifies the array of module names. If the array is valid, the command returns a value of 0 (zero). If the array contains an invalid module name, the com- mand returns a value of 1. Upon failure, the command returns a value of -1. Notes As a STREAMS driver, also supports the normal STREAMS In this form, specify the field in the structure to either or The field points to the structure (see the command in the section). Refer to the streamio(7) reference page for further details. RETURN VALUE
Unless specified otherwise, upon successful completion, the commands return a value of 0 (zero). Otherwise, a value of -1 is returned. ERRORS
If any of the following conditions occur, the commands return the corresponding value: The specified major/minor device number pair has already been configured. The arg parameter points outside the allocated address space. The major device number is invalid, the number of modules is invalid, or the list of module names is invalid. The device is not configured for This value is returned from a command. A internal data structure cannot be allocated. The major device does not represent a STREAMS driver. The field is less than the field when the command is or the minor device specified in a command does not exist. Only a superuser or user with privilege is allowed to execute the The arg parameter points outside the allocated address space. The major device number is invalid. The device is not configured for The major device does not represent a STREAMS driver. The arg parameter points outside the allocated address space. The list of module names is invalid. SEE ALSO
autopush(1M), ioctl(2), open(2), privileges(5), streamio(7). sad(7)
Man Page