Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright 2012, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15 */
     16 
     17 #ifndef _IOCTLS_PORTABLE_H_
     18 #define _IOCTLS_PORTABLE_H_
     19 
     20 /* Derived from development/ndk/platforms/android-3/include/asm-generic/ioctl.h */
     21 
     22 #define _IOC_NRBITS_PORTABLE 8
     23 #define _IOC_TYPEBITS_PORTABLE 8
     24 #define _IOC_SIZEBITS_PORTABLE 14
     25 #define _IOC_DIRBITS_PORTABLE 2
     26 
     27 #define _IOC_NRMASK_PORTABLE ((1 << _IOC_NRBITS_PORTABLE)-1)
     28 #define _IOC_TYPEMASK_PORTABLE ((1 << _IOC_TYPEBITS_PORTABLE)-1)
     29 #define _IOC_SIZEMASK_PORTABLE ((1 << _IOC_SIZEBITS_PORTABLE)-1)
     30 #define _IOC_DIRMASK_PORTABLE ((1 << _IOC_DIRBITS_PORTABLE)-1)
     31 
     32 #define _IOC_NRSHIFT_PORTABLE 0
     33 #define _IOC_TYPESHIFT_PORTABLE (_IOC_NRSHIFT_PORTABLE+_IOC_NRBITS_PORTABLE)
     34 #define _IOC_SIZESHIFT_PORTABLE (_IOC_TYPESHIFT_PORTABLE+_IOC_TYPEBITS_PORTABLE)
     35 #define _IOC_DIRSHIFT_PORTABLE (_IOC_SIZESHIFT_PORTABLE+_IOC_SIZEBITS_PORTABLE)
     36 
     37 #define _IOC_NONE_PORTABLE 0U
     38 #define _IOC_WRITE_PORTABLE 1U
     39 #define _IOC_READ_PORTABLE 2U
     40 
     41 #define _IOC_PORTABLE(dir,type,nr,size)   (((dir) << _IOC_DIRSHIFT_PORTABLE) |   ((type) << _IOC_TYPESHIFT_PORTABLE) |   ((nr) << _IOC_NRSHIFT_PORTABLE) |   ((size) << _IOC_SIZESHIFT_PORTABLE))
     42 
     43 extern unsigned int __invalid_size_argument_for_IOC;
     44 #define _IOC_TYPECHECK_PORTABLE(t)   ((sizeof(t) == sizeof(t[1]) &&   sizeof(t) < (1 << _IOC_SIZEBITS_PORTABLE)) ?   sizeof(t) : __invalid_size_argument_for_IOC)
     45 
     46 #define _IO_PORTABLE(type,nr) _IOC_PORTABLE(_IOC_NONE_PORTABLE,(type),(nr),0)
     47 #define _IOR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
     48 #define _IOW_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
     49 #define _IOWR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE|_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
     50 
     51 /* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/ioctls.h */
     52 
     53 #define TCGETS_PORTABLE     0x5401
     54 #define TCSETS_PORTABLE     0x5402
     55 #define TCSETSW_PORTABLE    0x5403
     56 #define TCSETSF_PORTABLE    0x5404
     57 #define TCGETA_PORTABLE     0x5405
     58 #define TCSETA_PORTABLE     0x5406
     59 #define TCSETAW_PORTABLE    0x5407
     60 #define TCSETAF_PORTABLE    0x5408
     61 #define TCSBRK_PORTABLE     0x5409
     62 #define TCXONC_PORTABLE     0x540A
     63 #define TCFLSH_PORTABLE     0x540B
     64 #define TIOCEXCL_PORTABLE   0x540C
     65 #define TIOCNXCL_PORTABLE   0x540D
     66 #define TIOCSCTTY_PORTABLE  0x540E
     67 #define TIOCGPGRP_PORTABLE  0x540F
     68 #define TIOCSPGRP_PORTABLE  0x5410
     69 #define TIOCOUTQ_PORTABLE   0x5411
     70 #define TIOCSTI_PORTABLE    0x5412
     71 #define TIOCGWINSZ_PORTABLE 0x5413
     72 #define TIOCSWINSZ_PORTABLE 0x5414
     73 #define TIOCMGET_PORTABLE   0x5415
     74 #define TIOCMBIS_PORTABLE   0x5416
     75 #define TIOCMBIC_PORTABLE   0x5417
     76 #define TIOCMSET_PORTABLE   0x5418
     77 #define TIOCGSOFTCAR_PORTABLE   0x5419
     78 #define TIOCSSOFTCAR_PORTABLE   0x541A
     79 #define FIONREAD_PORTABLE   0x541B
     80 #define TIOCINQ_PORTABLE    FIONREAD_PORTABLE
     81 #define TIOCLINUX_PORTABLE  0x541C
     82 #define TIOCCONS_PORTABLE   0x541D
     83 #define TIOCGSERIAL_PORTABLE    0x541E
     84 #define TIOCSSERIAL_PORTABLE    0x541F
     85 #define TIOCPKT_PORTABLE    0x5420
     86 #define FIONBIO_PORTABLE    0x5421
     87 #define TIOCNOTTY_PORTABLE  0x5422
     88 #define TIOCSETD_PORTABLE   0x5423
     89 #define TIOCGETD_PORTABLE   0x5424
     90 #define TCSBRKP_PORTABLE    0x5425
     91 #define TIOCSBRK_PORTABLE   0x5427
     92 #define TIOCCBRK_PORTABLE   0x5428
     93 #define TIOCGSID_PORTABLE   0x5429
     94 #define TIOCGPTN_PORTABLE _IOR_PORTABLE('T',0x30, unsigned int)
     95 #define TIOCSPTLCK_PORTABLE _IOW_PORTABLE('T',0x31, int)
     96 
     97 #define FIONCLEX_PORTABLE   0x5450
     98 #define FIOCLEX_PORTABLE    0x5451
     99 #define FIOASYNC_PORTABLE   0x5452
    100 #define TIOCSERCONFIG_PORTABLE  0x5453
    101 #define TIOCSERGWILD_PORTABLE   0x5454
    102 #define TIOCSERSWILD_PORTABLE   0x5455
    103 #define TIOCGLCKTRMIOS_PORTABLE 0x5456
    104 #define TIOCSLCKTRMIOS_PORTABLE 0x5457
    105 #define TIOCSERGSTRUCT_PORTABLE 0x5458
    106 #define TIOCSERGETLSR_PORTABLE  0x5459
    107 #define TIOCSERGETMULTI_PORTABLE 0x545A
    108 #define TIOCSERSETMULTI_PORTABLE 0x545B
    109 
    110 #define TIOCMIWAIT_PORTABLE     0x545C
    111 #define TIOCGICOUNT_PORTABLE    0x545D
    112 #define FIOQSIZE_PORTABLE       0x545E /* x86 differs here */
    113 
    114 #define TIOCPKT_DATA_PORTABLE       0
    115 #define TIOCPKT_FLUSHREAD_PORTABLE  1
    116 #define TIOCPKT_FLUSHWRITE_PORTABLE 2
    117 #define TIOCPKT_STOP_PORTABLE       4
    118 #define TIOCPKT_START_PORTABLE      8
    119 #define TIOCPKT_NOSTOP_PORTABLE     16
    120 #define TIOCPKT_DOSTOP_PORTABLE     32
    121 
    122 #define TIOCSER_TEMT_PORTABLE   0x01
    123 
    124 /* Derived from development/ndk/platforms/android-3/include/sys/ioctl_compat.h */
    125 
    126 struct tchars_portable {
    127         char    t_intrc;        /* interrupt */
    128         char    t_quitc;        /* quit */
    129         char    t_startc;       /* start output */
    130         char    t_stopc;        /* stop output */
    131         char    t_eofc;         /* end-of-file */
    132         char    t_brkc;         /* input delimiter (like nl) */
    133 };
    134 
    135 struct ltchars_portable {
    136         char    t_suspc;        /* stop process signal */
    137         char    t_dsuspc;       /* delayed stop process signal */
    138         char    t_rprntc;       /* reprint line */
    139         char    t_flushc;       /* flush output (toggles) */
    140         char    t_werasc;       /* word erase */
    141         char    t_lnextc;       /* literal next character */
    142 };
    143 
    144 struct sgttyb_portable {
    145         char    sg_ispeed;              /* input speed */
    146         char    sg_ospeed;              /* output speed */
    147         char    sg_erase;               /* erase character */
    148         char    sg_kill;                /* kill character */
    149         short   sg_flags;               /* mode flags */
    150 };
    151 
    152 #ifdef USE_OLD_TTY
    153 # define TIOCGETD_PORTABLE   _IOR_PORTABLE('t', 0, int)       /* get line discipline */
    154 # define TIOCSETD_PORTABLE   _IOW_PORTABLE('t', 1, int)       /* set line discipline */
    155 #else
    156 # define OTIOCGETD_PORTABLE  _IOR_PORTABLE('t', 0, int)       /* get line discipline */
    157 # define OTIOCSETD_PORTABLE  _IOW_PORTABLE('t', 1, int)       /* set line discipline */
    158 #endif
    159 #define TIOCHPCL_PORTABLE    _IO_PORTABLE('t', 2)             /* hang up on last close */
    160 #define TIOCGETP_PORTABLE    _IOR_PORTABLE('t', 8,struct sgttyb_portable)/* get parameters -- gtty */
    161 #define TIOCSETP_PORTABLE    _IOW_PORTABLE('t', 9,struct sgttyb_portable)/* set parameters -- stty */
    162 #define TIOCSETN_PORTABLE    _IOW_PORTABLE('t',10,struct sgttyb_portable)/* as above, but no flushtty*/
    163 #define TIOCSETC_PORTABLE    _IOW_PORTABLE('t',17,struct tchars_portable)/* set special characters */
    164 #define TIOCGETC_PORTABLE    _IOR_PORTABLE('t',18,struct tchars_portable)/* get special characters */
    165 
    166 #define TIOCLBIS_PORTABLE    _IOW_PORTABLE('t', 127, int)     /* bis local mode bits */
    167 #define TIOCLBIC_PORTABLE    _IOW_PORTABLE('t', 126, int)     /* bic local mode bits */
    168 #define TIOCLSET_PORTABLE    _IOW_PORTABLE('t', 125, int)     /* set entire local mode word */
    169 #define TIOCLGET_PORTABLE    _IOR_PORTABLE('t', 124, int)     /* get local modes */
    170 #define TIOCSLTC_PORTABLE    _IOW_PORTABLE('t',117,struct ltchars_portable)/* set local special chars*/
    171 #define TIOCGLTC_PORTABLE    _IOR_PORTABLE('t',116,struct ltchars_portable)/* get local special chars*/
    172 #define OTIOCCONS_PORTABLE   _IO_PORTABLE('t', 98)    /* for hp300 -- sans int arg */
    173 
    174 /* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/sockios.h */
    175 
    176 #define FIOSETOWN_PORTABLE 0x8901
    177 #define SIOCSPGRP_PORTABLE 0x8902
    178 #define FIOGETOWN_PORTABLE 0x8903
    179 #define SIOCGPGRP_PORTABLE 0x8904
    180 #define SIOCATMARK_PORTABLE 0x8905
    181 #define SIOCGSTAMP_PORTABLE 0x8906
    182 
    183 #endif /* _IOCTLS_PORTABLE_H */
    184