The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/Documentation/ioctl-number.txt

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 Ioctl Numbers
    2 19 October 1999
    3 Michael Elizabeth Chastain
    4 <mec@shout.net>
    5 
    6 If you are adding new ioctl's to the kernel, you should use the _IO
    7 macros defined in <linux/ioctl.h>:
    8 
    9     _IO    an ioctl with no parameters
   10     _IOW   an ioctl with write parameters (copy_from_user)
   11     _IOR   an ioctl with read parameters  (copy_to_user)
   12     _IOWR  an ioctl with both write and read parameters.
   13 
   14 'Write' and 'read' are from the user's point of view, just like the
   15 system calls 'write' and 'read'.  For example, a SET_FOO ioctl would
   16 be _IOW, although the kernel would actually read data from user space;
   17 a GET_FOO ioctl would be _IOR, although the kernel would actually write
   18 data to user space.
   19 
   20 The first argument to _IO, _IOW, _IOR, or _IOWR is an identifying letter
   21 or number from the table below.  Because of the large number of drivers,
   22 many drivers share a partial letter with other drivers.
   23 
   24 If you are writing a driver for a new device and need a letter, pick an
   25 unused block with enough room for expansion: 32 to 256 ioctl commands.
   26 You can register the block by patching this file and submitting the
   27 patch to Linus Torvalds.  Or you can e-mail me at <mec@shout.net> and
   28 I'll register one for you.
   29 
   30 The second argument to _IO, _IOW, _IOR, or _IOWR is a sequence number
   31 to distinguish ioctls from each other.  The third argument to _IOW,
   32 _IOR, or _IOWR is the type of the data going into the kernel or coming
   33 out of the kernel (e.g.  'int' or 'struct foo').
   34 
   35 Some devices use their major number as the identifier; this is OK, as
   36 long as it is unique.  Some devices are irregular and don't follow any
   37 convention at all.
   38 
   39 Following this convention is good because:
   40 
   41 (1) Keeping the ioctl's globally unique helps error checking:
   42     if a program calls an ioctl on the wrong device, it will get an
   43     error rather than some unexpected behaviour.
   44 
   45 (2) The 'strace' build procedure automatically finds ioctl numbers
   46     defined with _IO, _IOW, _IOR, or _IOWR.
   47 
   48 (3) 'strace' can decode numbers back into useful names when the
   49     numbers are unique.
   50 
   51 (4) People looking for ioctls can grep for them more easily when
   52     this convention is used to define the ioctl numbers.
   53 
   54 (5) When following the convention, the driver code can use generic
   55     code to copy the parameters between user and kernel space.
   56 
   57 This table lists ioctls visible from user land for Linux/i386.  It contains
   58 most drivers up to 2.3.14, but I know I am missing some.
   59 
   60 Code    Seq#    Include File            Comments
   61 ========================================================
   62 0x00    00-1F   linux/fs.h              conflict!
   63 0x00    00-1F   scsi/scsi_ioctl.h       conflict!
   64 0x00    00-1F   linux/fb.h              conflict!
   65 0x00    00-1F   linux/wavefront.h       conflict!
   66 0x02    all     linux/fd.h
   67 0x03    all     linux/hdreg.h
   68 0x04    all     linux/umsdos_fs.h
   69 0x06    all     linux/lp.h
   70 0x09    all     linux/md.h
   71 0x12    all     linux/fs.h
   72                 linux/blkpg.h
   73 0x20    all     drivers/cdrom/cm206.h
   74 0x22    all     scsi/sg.h
   75 '1'     00-1F   <linux/timepps.h>       PPS kit from Ulrich Windl
   76                                         <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/>
   77 '6'     00-10   <asm-i386/processor.h>  Intel IA32 microcode update driver
   78                                         <mailto:tigran@veritas.com>
   79 '8'     all                             SNP8023 advanced NIC card
   80                                         <mailto:mcr@solidum.com>
   81 'A'     00-1F   linux/apm_bios.h
   82 'B'     C0-FF                           advanced bbus
   83                                         <mailto:maassen@uni-freiburg.de>
   84 'C'     all     linux/soundcard.h
   85 'D'     all     asm-s390/dasd.h
   86 'F'     all     linux/fb.h
   87 'I'     all     linux/isdn.h
   88 'J'     00-1F   drivers/scsi/gdth_ioctl.h
   89 'K'     all     linux/kd.h
   90 'L'     00-1F   linux/loop.h
   91 'L'     E0-FF   linux/ppdd.h            encrypted disk device driver
   92                                         <http://linux01.gwdg.de/~alatham/ppdd.html>
   93 'M'     all     linux/soundcard.h       conflict!
   94 'M'     00-1F   linux/isicom.h          conflict!
   95 'N'     00-1F   drivers/usb/scanner.h
   96 'P'     all     linux/soundcard.h
   97 'Q'     all     linux/soundcard.h
   98 'R'     00-1F   linux/random.h
   99 'S'     all     linux/cdrom.h           conflict!
  100 'S'     80-81   scsi/scsi_ioctl.h       conflict!
  101 'S'     82-FF   scsi/scsi.h             conflict!
  102 'T'     all     linux/soundcard.h       conflict!
  103 'T'     all     asm-i386/ioctls.h       conflict!
  104 'U'     all     linux/drivers/usb/usb.h
  105 'V'     all     linux/vt.h
  106 'W'     00-1F   linux/watchdog.h        conflict!
  107 'W'     00-1F   linux/wanrouter.h       conflict!
  108 'X'     all     linux/xfs_fs.h
  109 'Y'     all     linux/cyclades.h
  110 'a'     all                             ATM on linux
  111                                         <http://lrcwww.epfl.ch/linux-atm/magic.html>
  112 'b'     00-FF                           bit3 vme host bridge
  113                                         <mailto:natalia@nikhefk.nikhef.nl>
  114 'c'     00-7F   linux/comstats.h        conflict!
  115 'c'     00-7F   linux/coda.h            conflict!
  116 'd'     00-1F   linux/devfs_fs.h        conflict!
  117 'd'     00-DF   linux/video_decoder.h   conflict!
  118 'd'     F0-FF   linux/digi1.h
  119 'e'     all     linux/digi1.h           conflict!
  120 'e'     00-1F   linux/video_encoder.h   conflict!
  121 'e'     00-1F   net/irda/irtty.h        conflict!
  122 'f'     00-1F   linux/ext2_fs.h
  123 'h'     00-7F                           Charon filesystem
  124                                         <mailto:zapman@interlan.net>
  125 'i'     00-3F   linux/i2o.h
  126 'j'     00-3F   linux/joystick.h
  127 'k'     all     asm-sparc/kbio.h
  128                 asm-sparc64/kbio.h
  129 'l'     00-3F   linux/tcfs_fs.h         transparent cryptographic file system
  130                                         <http://mikonos.dia.unisa.it/tcfs>
  131 'l'     40-7F   linux/udf_fs_i.h        in development:
  132                                         <http://www.trylinux.com/projects/udf/>
  133 'm'     all     linux/mtio.h            conflict!
  134 'm'     all     linux/soundcard.h       conflict!
  135 'm'     all     linux/synclink.h        conflict!
  136 'm'     00-1F   net/irda/irmod.h        conflict!
  137 'n'     00-7F   linux/ncp_fs.h
  138 'n'     E0-FF   video/matrox.h          matroxfb
  139 'p'     00-3F   linux/mc146818rtc.h
  140 'p'     40-7F   linux/nvram.h
  141 'p'     80-9F                           user-space parport
  142                                         <mailto:tim@cyberelk.net>
  143 'q'     00-1F   linux/videotext.h       conflict!
  144 'q'     80-FF                           Internet PhoneJACK, Internet LineJACK
  145                                         <http://www.quicknet.net>
  146 'r'     00-1F   linux/msdos_fs.h
  147 's'     all     linux/cdk.h
  148 't'     00-7F   linux/if_ppp.h
  149 't'     80-8F   linux/isdn_ppp.h
  150 'u'     00-1F   linux/smb_fs.h
  151 'v'     00-1F   linux/ext2_fs.h         conflict!
  152 'v'     all     linux/videodev.h        conflict!
  153 'w'     all                             CERN SCI driver
  154 'y'     00-1F                           packet based user level communications
  155                                         <mailto:zapman@interlan.net>
  156 'z'     00-3F                           CAN bus card
  157                                         <mailto:hdstich@connectu.ulm.circular.de>
  158 'z'     40-7F                           CAN bus card
  159                                         <mailto:oe@port.de>
  160 0x80    00-1F   linux/fb.h
  161 0x89    00-06   asm-i386/sockios.h
  162 0x89    0B-DF   linux/sockios.h
  163 0x89    E0-EF   linux/sockios.h         SIOCPROTOPRIVATE range
  164 0x89    F0-FF   linux/sockios.h         SIOCDEVPRIVATE range
  165 0x8B    all     linux/wireless.h
  166 0x8C    00-3F                           WiNRADiO driver
  167                                         <http://www.proximity.com.au/~brian/winradio/>
  168 0x90    00      drivers/cdrom/sbpcd.h
  169 0x93    60-7F   linux/auto_fs.h
  170 0x99    00-0F                           537-Addinboard driver
  171                                         <mailto:buk@buks.ipn.de>
  172 0xA0    all     linux/sdp/sdp.h         Industrial Device Project
  173                                         <mailto:kenji@bitgate.com>
  174 0xA2    00-0F   DVD decoder driver      in development:
  175                                         <http://linuxtv.org/dvd/api/>
  176 0xA3    00-1F   Philips SAA7146 dirver  in development:
  177                                         <mailto:Andreas.Beckmann@hamburg.sc.philips.com>
  178 0xA3    80-8F   Port ACL                in development:
  179                                         <mailto:tlewis@mindspring.com>
  180 0xA3    90-9F   linux/dtlk.h
  181 0xAB    00-1F   linux/nbd.h
  182 0xAC    00-1F   linux/raw.h
  183 0xAD    00      Netfilter device        in development:
  184                                         <mailto:rusty@rustcorp.com.au>  
  185 0xB0    all     RATIO devices           in development:
  186                                         <mailto:vgo@ratio.de>
  187 0xB1    00-1F   PPPoX                   <mailto:mostrows@styx.uwaterloo.ca>
  188 0xCB    00-1F   CBM serial IEC bus      in development:
  189                                         <mailto:michael.klein@puffin.lb.shuttle.de>
  190 
  191 0xFE    00-9F   Logical Volume Manager  <mailto:linux-lvm@sistina.com>

Cache object: 868f0a69edc2bc8e53c4ad9031431d92


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.