Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

3. Device Communication and Control > Defining ioctl Commands

Defining ioctl Commands

To define an ioctl command, you’d call one of the following macros: _IO, _IOR, _IOW, or _IOWR. An explanation of each macro is provided in Table 3-1.

Table 3-1. ioctl Command Macros

Macro

Description

_IO

Creates an ioctl command for an I/O operation that transfers no data—in other words, the data argument in d_ioctl will be unused—for example, ejecting removable media

_IOR

Creates an ioctl command for a read operation; read operations transfer data from the device to user space; for example, retrieving error information

_IOW

Creates an ioctl command for a write operation; write operations transfer data to the device from user space; for example, setting a device parameter

_IOWR

Creates an ioctl command for an I/O operation with bidirectional data transfers


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial