xref: /drstd/dlibc/src/unix/platform/dragonos/arch/mips/mod.rs (revision 9670759b785600bf6315e4173e46a602f16add7a)
1 s! {
2     pub struct termios2 {
3         pub c_iflag: ::tcflag_t,
4         pub c_oflag: ::tcflag_t,
5         pub c_cflag: ::tcflag_t,
6         pub c_lflag: ::tcflag_t,
7         pub c_line: ::cc_t,
8         pub c_cc: [::cc_t; 23],
9         pub c_ispeed: ::speed_t,
10         pub c_ospeed: ::speed_t,
11     }
12 }
13 
14 // arch/mips/include/uapi/asm/socket.h
15 pub const SOL_SOCKET: ::c_int = 0xffff;
16 
17 // Defined in unix/linux_like/mod.rs
18 // pub const SO_DEBUG: ::c_int = 0x0001;
19 pub const SO_REUSEADDR: ::c_int = 0x0004;
20 pub const SO_KEEPALIVE: ::c_int = 0x0008;
21 pub const SO_DONTROUTE: ::c_int = 0x0010;
22 pub const SO_BROADCAST: ::c_int = 0x0020;
23 pub const SO_LINGER: ::c_int = 0x0080;
24 pub const SO_OOBINLINE: ::c_int = 0x0100;
25 pub const SO_REUSEPORT: ::c_int = 0x0200;
26 pub const SO_TYPE: ::c_int = 0x1008;
27 // pub const SO_STYLE: ::c_int = SO_TYPE;
28 pub const SO_ERROR: ::c_int = 0x1007;
29 pub const SO_SNDBUF: ::c_int = 0x1001;
30 pub const SO_RCVBUF: ::c_int = 0x1002;
31 pub const SO_SNDLOWAT: ::c_int = 0x1003;
32 pub const SO_RCVLOWAT: ::c_int = 0x1004;
33 // NOTE: These definitions are now being renamed with _OLD postfix,
34 // but CI haven't support them yet.
35 // Some related consts could be found in b32.rs and b64.rs
36 pub const SO_SNDTIMEO: ::c_int = 0x1005;
37 pub const SO_RCVTIMEO: ::c_int = 0x1006;
38 // pub const SO_SNDTIMEO_OLD: ::c_int = 0x1005;
39 // pub const SO_RCVTIMEO_OLD: ::c_int = 0x1006;
40 pub const SO_ACCEPTCONN: ::c_int = 0x1009;
41 pub const SO_PROTOCOL: ::c_int = 0x1028;
42 pub const SO_DOMAIN: ::c_int = 0x1029;
43 
44 pub const SO_NO_CHECK: ::c_int = 11;
45 pub const SO_PRIORITY: ::c_int = 12;
46 pub const SO_BSDCOMPAT: ::c_int = 14;
47 pub const SO_PASSCRED: ::c_int = 17;
48 pub const SO_PEERCRED: ::c_int = 18;
49 pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
50 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
51 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
52 pub const SO_BINDTODEVICE: ::c_int = 25;
53 pub const SO_ATTACH_FILTER: ::c_int = 26;
54 pub const SO_DETACH_FILTER: ::c_int = 27;
55 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
56 pub const SO_PEERNAME: ::c_int = 28;
57 pub const SO_PEERSEC: ::c_int = 30;
58 pub const SO_SNDBUFFORCE: ::c_int = 31;
59 pub const SO_RCVBUFFORCE: ::c_int = 33;
60 pub const SO_PASSSEC: ::c_int = 34;
61 pub const SO_MARK: ::c_int = 36;
62 pub const SO_RXQ_OVFL: ::c_int = 40;
63 pub const SO_WIFI_STATUS: ::c_int = 41;
64 pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
65 pub const SO_PEEK_OFF: ::c_int = 42;
66 pub const SO_NOFCS: ::c_int = 43;
67 pub const SO_LOCK_FILTER: ::c_int = 44;
68 pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
69 pub const SO_BUSY_POLL: ::c_int = 46;
70 pub const SO_MAX_PACING_RATE: ::c_int = 47;
71 pub const SO_BPF_EXTENSIONS: ::c_int = 48;
72 pub const SO_INCOMING_CPU: ::c_int = 49;
73 pub const SO_ATTACH_BPF: ::c_int = 50;
74 pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
75 pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
76 pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
77 pub const SO_CNX_ADVICE: ::c_int = 53;
78 pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
79 pub const SO_MEMINFO: ::c_int = 55;
80 pub const SO_INCOMING_NAPI_ID: ::c_int = 56;
81 pub const SO_COOKIE: ::c_int = 57;
82 pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
83 pub const SO_PEERGROUPS: ::c_int = 59;
84 pub const SO_ZEROCOPY: ::c_int = 60;
85 pub const SO_TXTIME: ::c_int = 61;
86 pub const SCM_TXTIME: ::c_int = SO_TXTIME;
87 pub const SO_BINDTOIFINDEX: ::c_int = 62;
88 // NOTE: These definitions are now being renamed with _OLD postfix,
89 // but CI haven't support them yet.
90 // Some related consts could be found in b32.rs and b64.rs
91 pub const SO_TIMESTAMP: ::c_int = 29;
92 pub const SO_TIMESTAMPNS: ::c_int = 35;
93 pub const SO_TIMESTAMPING: ::c_int = 37;
94 // pub const SO_TIMESTAMP_OLD: ::c_int = 29;
95 // pub const SO_TIMESTAMPNS_OLD: ::c_int = 35;
96 // pub const SO_TIMESTAMPING_OLD: ::c_int = 37;
97 // pub const SO_TIMESTAMP_NEW: ::c_int = 63;
98 // pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
99 // pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
100 // pub const SO_RCVTIMEO_NEW: ::c_int = 66;
101 // pub const SO_SNDTIMEO_NEW: ::c_int = 67;
102 // pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
103 // pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
104 // pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
105 
106 pub const FICLONE: ::c_ulong = 0x80049409;
107 pub const FICLONERANGE: ::c_ulong = 0x8020940D;
108 
109 // Defined in unix/linux_like/mod.rs
110 // pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
111 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
112 pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
113 
114 // Ioctl Constants
115 
116 pub const TCGETS: ::Ioctl = 0x540d;
117 pub const TCSETS: ::Ioctl = 0x540e;
118 pub const TCSETSW: ::Ioctl = 0x540f;
119 pub const TCSETSF: ::Ioctl = 0x5410;
120 pub const TCGETA: ::Ioctl = 0x5401;
121 pub const TCSETA: ::Ioctl = 0x5402;
122 pub const TCSETAW: ::Ioctl = 0x5403;
123 pub const TCSETAF: ::Ioctl = 0x5404;
124 pub const TCSBRK: ::Ioctl = 0x5405;
125 pub const TCXONC: ::Ioctl = 0x5406;
126 pub const TCFLSH: ::Ioctl = 0x5407;
127 pub const TIOCEXCL: ::Ioctl = 0x740d;
128 pub const TIOCNXCL: ::Ioctl = 0x740e;
129 pub const TIOCSCTTY: ::Ioctl = 0x5480;
130 pub const TIOCGPGRP: ::Ioctl = 0x40047477;
131 pub const TIOCSPGRP: ::Ioctl = 0x80047476;
132 pub const TIOCOUTQ: ::Ioctl = 0x7472;
133 pub const TIOCSTI: ::Ioctl = 0x5472;
134 pub const TIOCGWINSZ: ::Ioctl = 0x40087468;
135 pub const TIOCSWINSZ: ::Ioctl = 0x80087467;
136 pub const TIOCMGET: ::Ioctl = 0x741d;
137 pub const TIOCMBIS: ::Ioctl = 0x741b;
138 pub const TIOCMBIC: ::Ioctl = 0x741c;
139 pub const TIOCMSET: ::Ioctl = 0x741a;
140 pub const TIOCGSOFTCAR: ::Ioctl = 0x5481;
141 pub const TIOCSSOFTCAR: ::Ioctl = 0x5482;
142 pub const FIONREAD: ::Ioctl = 0x467f;
143 pub const TIOCINQ: ::Ioctl = FIONREAD;
144 pub const TIOCLINUX: ::Ioctl = 0x5483;
145 pub const TIOCCONS: ::Ioctl = 0x80047478;
146 pub const TIOCGSERIAL: ::Ioctl = 0x5484;
147 pub const TIOCSSERIAL: ::Ioctl = 0x5485;
148 pub const TIOCPKT: ::Ioctl = 0x5470;
149 pub const FIONBIO: ::Ioctl = 0x667e;
150 pub const TIOCNOTTY: ::Ioctl = 0x5471;
151 pub const TIOCSETD: ::Ioctl = 0x7401;
152 pub const TIOCGETD: ::Ioctl = 0x7400;
153 pub const TCSBRKP: ::Ioctl = 0x5486;
154 pub const TIOCSBRK: ::Ioctl = 0x5427;
155 pub const TIOCCBRK: ::Ioctl = 0x5428;
156 pub const TIOCGSID: ::Ioctl = 0x7416;
157 pub const TCGETS2: ::Ioctl = 0x4030542a;
158 pub const TCSETS2: ::Ioctl = 0x8030542b;
159 pub const TCSETSW2: ::Ioctl = 0x8030542c;
160 pub const TCSETSF2: ::Ioctl = 0x8030542d;
161 pub const TIOCGPTN: ::Ioctl = 0x40045430;
162 pub const TIOCSPTLCK: ::Ioctl = 0x80045431;
163 pub const TIOCGDEV: ::Ioctl = 0x40045432;
164 pub const TIOCSIG: ::Ioctl = 0x80045436;
165 pub const TIOCVHANGUP: ::Ioctl = 0x5437;
166 pub const TIOCGPKT: ::Ioctl = 0x40045438;
167 pub const TIOCGPTLCK: ::Ioctl = 0x40045439;
168 pub const TIOCGEXCL: ::Ioctl = 0x40045440;
169 pub const TIOCGPTPEER: ::Ioctl = 0x20005441;
170 //pub const TIOCGISO7816: ::Ioctl = 0x40285442;
171 //pub const TIOCSISO7816: ::Ioctl = 0xc0285443;
172 pub const FIONCLEX: ::Ioctl = 0x6602;
173 pub const FIOCLEX: ::Ioctl = 0x6601;
174 pub const FIOASYNC: ::Ioctl = 0x667d;
175 pub const TIOCSERCONFIG: ::Ioctl = 0x5488;
176 pub const TIOCSERGWILD: ::Ioctl = 0x5489;
177 pub const TIOCSERSWILD: ::Ioctl = 0x548a;
178 pub const TIOCGLCKTRMIOS: ::Ioctl = 0x548b;
179 pub const TIOCSLCKTRMIOS: ::Ioctl = 0x548c;
180 pub const TIOCSERGSTRUCT: ::Ioctl = 0x548d;
181 pub const TIOCSERGETLSR: ::Ioctl = 0x548e;
182 pub const TIOCSERGETMULTI: ::Ioctl = 0x548f;
183 pub const TIOCSERSETMULTI: ::Ioctl = 0x5490;
184 pub const TIOCMIWAIT: ::Ioctl = 0x5491;
185 pub const TIOCGICOUNT: ::Ioctl = 0x5492;
186 pub const FIOQSIZE: ::Ioctl = 0x667f;
187 pub const TIOCSLTC: ::Ioctl = 0x7475;
188 pub const TIOCGETP: ::Ioctl = 0x7408;
189 pub const TIOCSETP: ::Ioctl = 0x7409;
190 pub const TIOCSETN: ::Ioctl = 0x740a;
191 pub const BLKIOMIN: ::Ioctl = 0x20001278;
192 pub const BLKIOOPT: ::Ioctl = 0x20001279;
193 pub const BLKSSZGET: ::Ioctl = 0x20001268;
194 pub const BLKPBSZGET: ::Ioctl = 0x2000127B;
195 
196 cfg_if! {
197     if #[cfg(target_env = "musl")] {
198         pub const TIOCGRS485: ::Ioctl = 0x4020542e;
199         pub const TIOCSRS485: ::Ioctl = 0xc020542f;
200     }
201 }
202 
203 pub const TIOCM_LE: ::c_int = 0x001;
204 pub const TIOCM_DTR: ::c_int = 0x002;
205 pub const TIOCM_RTS: ::c_int = 0x004;
206 pub const TIOCM_ST: ::c_int = 0x010;
207 pub const TIOCM_SR: ::c_int = 0x020;
208 pub const TIOCM_CTS: ::c_int = 0x040;
209 pub const TIOCM_CAR: ::c_int = 0x100;
210 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
211 pub const TIOCM_RNG: ::c_int = 0x200;
212 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
213 pub const TIOCM_DSR: ::c_int = 0x400;
214 
215 pub const BOTHER: ::speed_t = 0o010000;
216 pub const IBSHIFT: ::tcflag_t = 16;
217 
218 // RLIMIT Constants
219 
220 cfg_if! {
221     if #[cfg(any(target_env = "gnu",
222                  target_env = "uclibc"))] {
223 
224         pub const RLIMIT_CPU: ::__rlimit_resource_t = 0;
225         pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1;
226         pub const RLIMIT_DATA: ::__rlimit_resource_t = 2;
227         pub const RLIMIT_STACK: ::__rlimit_resource_t = 3;
228         pub const RLIMIT_CORE: ::__rlimit_resource_t = 4;
229         pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5;
230         pub const RLIMIT_AS: ::__rlimit_resource_t = 6;
231         pub const RLIMIT_RSS: ::__rlimit_resource_t = 7;
232         pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8;
233         pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9;
234         pub const RLIMIT_LOCKS: ::__rlimit_resource_t = 10;
235         pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11;
236         pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12;
237         pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
238         pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
239         pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
240         pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS;
241 
242     } else if #[cfg(target_env = "musl")] {
243 
244         pub const RLIMIT_CPU: ::c_int = 0;
245         pub const RLIMIT_FSIZE: ::c_int = 1;
246         pub const RLIMIT_DATA: ::c_int = 2;
247         pub const RLIMIT_STACK: ::c_int = 3;
248         pub const RLIMIT_CORE: ::c_int = 4;
249         pub const RLIMIT_NOFILE: ::c_int = 5;
250         pub const RLIMIT_AS: ::c_int = 6;
251         pub const RLIMIT_RSS: ::c_int = 7;
252         pub const RLIMIT_NPROC: ::c_int = 8;
253         pub const RLIMIT_MEMLOCK: ::c_int = 9;
254         pub const RLIMIT_LOCKS: ::c_int = 10;
255         pub const RLIMIT_SIGPENDING: ::c_int = 11;
256         pub const RLIMIT_MSGQUEUE: ::c_int = 12;
257         pub const RLIMIT_NICE: ::c_int = 13;
258         pub const RLIMIT_RTPRIO: ::c_int = 14;
259         pub const RLIMIT_RTTIME: ::c_int = 15;
260         pub const RLIM_NLIMITS: ::c_int = 15;
261         pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
262         pub const RLIM_INFINITY: ::rlim_t = !0;
263     }
264 }
265 
266 cfg_if! {
267     if #[cfg(target_env = "gnu")] {
268         pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16;
269     } else if #[cfg(target_env = "uclibc")] {
270         pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15;
271     }
272 }
273 
274 cfg_if! {
275     if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"),
276          any(target_env = "gnu",
277              target_env = "uclibc"))] {
278         pub const RLIM_INFINITY: ::rlim_t = !0;
279     }
280 }
281 
282 cfg_if! {
283     if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"),
284          any(target_env = "gnu",
285              target_env = "uclibc"))] {
286         pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
287     }
288 }
289