• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this list of
8  *    conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  *    of conditions and the following disclaimer in the documentation and/or other materials
12  *    provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
15  *    to endorse or promote products derived from this software without specific prior written
16  *    permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef _ADAPT_SYS_IOCTL_H
32 #define _ADAPT_SYS_IOCTL_H
33 
34 #include <sys/types.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define TCGETS          0x5401
41 #define TCSETS          0x5402
42 #define TCSETSW         0x5403
43 #define TCSETSF         0x5404
44 #define TCGETA          0x5405
45 #define TCSETA          0x5406
46 #define TCSETAW         0x5407
47 #define TCSETAF         0x5408
48 #define TCSBRK          0x5409
49 #define TCXONC          0x540A
50 #define TCFLSH          0x540B
51 #define TIOCEXCL        0x540C
52 #define TIOCNXCL        0x540D
53 #define TIOCSCTTY       0x540E
54 #define TIOCGPGRP       0x540F
55 #define TIOCSPGRP       0x5410
56 #define TIOCOUTQ        0x5411
57 #define TIOCSTI         0x5412
58 #define TIOCGWINSZ      0x5413
59 #define TIOCSWINSZ      0x5414
60 #define TIOCMGET        0x5415
61 #define TIOCMBIS        0x5416
62 #define TIOCMBIC        0x5417
63 #define TIOCMSET        0x5418
64 #define TIOCGSOFTCAR    0x5419
65 #define TIOCSSOFTCAR    0x541A
66 #define FIONREAD        0x541B
67 #define TIOCINQ         FIONREAD
68 #define TIOCLINUX       0x541C
69 #define TIOCCONS        0x541D
70 #define TIOCGSERIAL     0x541E
71 #define TIOCSSERIAL     0x541F
72 #define TIOCPKT         0x5420
73 #define FIONBIO         0x5421
74 
75 #define SIOCADDRT          0x890B
76 #define SIOCDELRT          0x890C
77 #define SIOCRTMSG          0x890D
78 
79 #define SIOCGIFNAME        0x8910
80 #define SIOCSIFLINK        0x8911
81 #define SIOCGIFCONF        0x8912
82 #define SIOCGIFFLAGS       0x8913
83 #define SIOCSIFFLAGS       0x8914
84 #define SIOCGIFADDR        0x8915
85 #define SIOCSIFADDR        0x8916
86 #define SIOCGIFDSTADDR     0x8917
87 #define SIOCSIFDSTADDR     0x8918
88 #define SIOCGIFBRDADDR     0x8919
89 #define SIOCSIFBRDADDR     0x891a
90 #define SIOCGIFNETMASK     0x891b
91 #define SIOCSIFNETMASK     0x891c
92 #define SIOCGIFMETRIC      0x891d
93 #define SIOCSIFMETRIC      0x891e
94 #define SIOCGIFMEM         0x891f
95 #define SIOCSIFMEM         0x8920
96 #define SIOCGIFMTU         0x8921
97 #define SIOCSIFMTU         0x8922
98 #define SIOCSIFNAME        0x8923
99 #define SIOCSIFHWADDR      0x8924
100 #define SIOCGIFENCAP       0x8925
101 #define SIOCSIFENCAP       0x8926
102 #define SIOCGIFHWADDR      0x8927
103 #define SIOCGIFSLAVE       0x8929
104 #define SIOCSIFSLAVE       0x8930
105 #define SIOCADDMULTI       0x8931
106 #define SIOCDELMULTI       0x8932
107 #define SIOCGIFINDEX       0x8933
108 #define SIOGIFINDEX        SIOCGIFINDEX
109 
110 #define _IOC(a, b, c, d)  (((a) << 30) | ((b) << 8) | (c) | ((d) << 16))
111 #define _IOC_NONE  0U
112 #define _IOC_WRITE 1U
113 #define _IOC_READ  2U
114 
115 #define _IO(a, b)       _IOC(_IOC_NONE, (a), (b), 0)
116 #define _IOW(a, b, c)   _IOC(_IOC_WRITE, (a), (b), sizeof(c))
117 #define _IOR(a, b, c)   _IOC(_IOC_READ, (a), (b), sizeof(c))
118 #define _IOWR(a, b, c)  _IOC(_IOC_READ | _IOC_WRITE, (a), (b), sizeof(c))
119 
120 int ioctl(int, int, ...);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* !_ADAPT_SYS_IOCTL_H */
127