.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "IOCTL" "9" "29 May 2003" "" "" .SH NAME ioctl \- driver can respond to ioctls .SH SYNOPSIS .sp \fB .sp int ioctl (struct scsi_device * \fIsdp\fB, int \fIcmd\fB, void * \fIarg\fB); \fR .SH "ARGUMENTS" .TP \fB\fIsdp\fB\fR device that ioctl was issued for .TP \fB\fIcmd\fB\fR ioctl number .TP \fB\fIarg\fB\fR pointer to read or write data from. Since it points to user space, should use appropriate kernel functions (e.g. \fBcopy_from_user\fR ). In the Unix style this argument can also be viewed as an unsigned long. .SH "DESCRIPTION" .PP Returns negative ``errno'' value when there is a problem. 0 or a positive value indicates success and is returned to the user space. .SH "REQUIRED" .PP no .SH "LOCKS" .PP none .SH "NOTES" .PP The SCSI subsystem uses a ``trickle down'' ioctl model. The user issues an \fBioctl\fR against an upper level driver (e.g. /dev/sdc) and if the upper level driver doesn't recognize the 'cmd' then it is passed to the SCSI mid level. If the SCSI mid level does not recognize it, then the LLD that controls the device receives the ioctl. According to recent Unix standards unsupported \fBioctl\fR 'cmd' numbers should return -ENOTTY. However the mid level returns -EINVAL for unrecognized 'cmd' numbers when this function is not supplied by the driver. Unfortunately some applications expect -EINVAL and react badly when -ENOTTY is returned; stick with -EINVAL. .SH "DEFINED IN" .PP LLD .SH "ABOUT THIS DOCUMENT" .PP Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". .PP If you have comments on the formatting of this manpage, then please contact Michael Still (mikal@stillhq.com). .PP This documentation was generated with kernel version 2.5.70.