libc_extra/android_linux/asm_generic/
ioctls.rs

1// This file is part of libc-extra. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/libc-extra/master/COPYRIGHT. No part of libc-extra, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2016-2018 The developers of libc-extra. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/libc-extra/master/COPYRIGHT.
3
4
5use ::libc::c_uint;
6use ::libc::c_int;
7
8
9pub const TCGETS: c_int = 0x5401;
10pub const TCSETS: c_int = 0x5402;
11pub const TCSETSW: c_int = 0x5403;
12pub const TCSETSF: c_int = 0x5404;
13pub const TCGETA: c_int = 0x5405;
14pub const TCSETA: c_int = 0x5406;
15pub const TCSETAW: c_int = 0x5407;
16pub const TCSETAF: c_int = 0x5408;
17pub const TCSBRK: c_int = 0x5409;
18pub const TCXONC: c_int = 0x540A;
19pub const TCFLSH: c_int = 0x540B;
20pub const TIOCEXCL: c_int = 0x540C;
21pub const TIOCNXCL: c_int = 0x540D;
22pub const TIOCSCTTY: c_int = 0x540E;
23pub const TIOCGPGRP: c_int = 0x540F;
24pub const TIOCSPGRP: c_int = 0x5410;
25pub const TIOCOUTQ: c_int = 0x5411;
26pub const TIOCSTI: c_int = 0x5412;
27pub const TIOCGWINSZ: c_int = 0x5413;
28pub const TIOCSWINSZ: c_int = 0x5414;
29pub const TIOCMGET: c_int = 0x5415;
30pub const TIOCMBIS: c_int = 0x5416;
31pub const TIOCMBIC: c_int = 0x5417;
32pub const TIOCMSET: c_int = 0x5418;
33pub const TIOCGSOFTCAR: c_int = 0x5419;
34pub const TIOCSSOFTCAR: c_int = 0x541A;
35pub const FIONREAD: c_int = 0x541B;
36pub const TIOCINQ: c_int = FIONREAD;
37pub const TIOCLINUX: c_int = 0x541C;
38pub const TIOCCONS: c_int = 0x541D;
39pub const TIOCGSERIAL: c_int = 0x541E;
40pub const TIOCSSERIAL: c_int = 0x541F;
41pub const TIOCPKT: c_int = 0x5420;
42pub const FIONBIO: c_int = 0x5421;
43pub const TIOCNOTTY: c_int = 0x5422;
44pub const TIOCSETD: c_int = 0x5423;
45pub const TIOCGETD: c_int = 0x5424;
46pub const TCSBRKP: c_int = 0x5425;
47pub const TIOCSBRK: c_int = 0x5427;
48pub const TIOCCBRK: c_int = 0x5428;
49pub const TIOCGSID: c_int = 0x5429;
50
51// mips, mips64, powerpc and powerpc64 do not use the '2' versions so has no definition
52#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TCGETS2: c_int = 0x802c542a;
53// #[cfg(target_arch = "sparc64")] pub const TCGETS2: c_int = 0x402c540c;
54
55// mips, mips64, powerpc and powerpc64 do not use the '2' versions so has no definition
56#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] pub const TCSETS2: c_int = 0x402c542b;
57// #[cfg(target_arch = "sparc64")] pub const TCSETS2: c_int = 0x802c540d;
58
59// mips, mips64, powerpc and powerpc64 do not use the '2' versions so has no definition
60#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] pub const TCSETSW2: c_int = 0x402c542c;
61// #[cfg(target_arch = "sparc64")] pub const TCSETSW2: c_int = 0x802c540e;
62
63// mips, mips64, powerpc and powerpc64 do not use the '2' versions so has no definition
64#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] pub const TCSETSF2: c_int = 0x402c542d;
65// #[cfg(target_arch = "sparc64")] pub const TCSETSF2: c_int = 0x802c540f;
66
67cfg_if!
68{
69	if #[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch="powerpc", target_arch="powerpc64", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))]
70	{
71		pub const TIOCSRS485: c_int = 0x542F;
72	}
73	else if #[cfg(target_arch = "mips64")]
74	{
75	 	pub const TIOCSRS485: c_int = 0xc0205442;
76	}
77	/*
78	else if #[cfg(target_arch = "cris")]
79	{
80	 	pub const TIOCSRS485: c_int = 0x5463;
81	}
82	else if #[cfg(target_arch = "sparc64")]
83	{
84	 	pub const TIOCSRS485: c_int = 0x802c540f;
85	}
86	*/
87	/* TODO: Probable but not certain: 
88	else if #[cfg(target_arch = "mips")]
89	{
90	 	pub const TIOCSRS485: c_int = 0xc0205442;
91	}
92	*/
93	else
94	{
95	}
96}
97
98#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCGPTN: c_int = 0x80045430;
99#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCGPTN: c_int = 0x40045430;
100// #[cfg(target_arch = "sparc64")] pub const TIOCGPTN: c_int = 0x40047486;
101// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCGPTN: c_int = 0x40045430;
102
103#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCSPTLCK: c_int = 0x40045431;
104#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCSPTLCK: c_int = 0x80045431;
105// #[cfg(target_arch = "sparc64")] pub const TIOCSPTLCK: c_int = 0x80045431;
106// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCSPTLCK: c_int = 0x80045431;
107
108#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCGDEV: c_int = 0x80045432;
109#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCGDEV: c_int = 0x40045432;
110// #[cfg(target_arch = "sparc64")] pub const TIOCGDEV: c_int = 0x40045432;
111// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCGDEV: c_int = 0x40045432;
112
113pub const TCGETX: c_int = 0x5432;
114
115pub const TCSETX: c_int = 0x5433;
116
117pub const TCSETXF: c_int = 0x5434;
118
119pub const TCSETXW: c_int = 0x5435;
120
121#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] pub const TIOCSIG: c_int = 0x40045436;
122#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCSIG: c_int = 0x80045436;
123// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCSIG: c_int = 0x80045436;
124// #[cfg(target_arch = "sparc64")] pub const TIOCSIG: c_int = 0x80045436;
125
126pub const TIOCVHANGUP: c_int = 0x5437;
127
128#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCGPKT: c_int = 0x80045438;
129#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCGPKT: c_int = 0x40045438;
130// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCGPKT: c_int = 0x40045438;
131// #[cfg(target_arch = "sparc64")] pub const TIOCGPKT: c_int = 0x40045438;
132
133#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCGPTLCK: c_int = 0x80045439;
134#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCGPTLCK: c_int = 0x40045439;
135// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCGPTLCK: c_int = 0x40045439;
136// #[cfg(target_arch = "sparc64")] pub const TIOCGPTLCK: c_int = 0x40045439;
137
138#[cfg(any(target_arch = "aarch64", target_arch = "arm", target_arch = "s390x", target_arch = "x86", target_arch = "x86_64"))] #[allow(overflowing_literals)] pub const TIOCGEXCL: c_int = 0x80045440;
139#[cfg(any(target_arch = "mips64", target_arch = "powerpc64"))] pub const TIOCGEXCL: c_int = 0x40045440;
140// TODO: Probable but not certain: #[cfg(any(target_arch = "mips", target_arch = "powerpc"))] pub const TIOCGEXCL: c_int = 0x40045440;
141// #[cfg(target_arch = "sparc64")] pub const TIOCGEXCL: c_int = 0x40045440;
142
143pub const FIONCLEX: c_int = 0x5450;
144
145pub const FIOCLEX: c_int = 0x5451;
146
147pub const FIOASYNC: c_int = 0x5452;
148
149pub const TIOCSERCONFIG: c_int = 0x5453;
150
151pub const TIOCSERGWILD: c_int = 0x5454;
152
153pub const TIOCSERSWILD: c_int = 0x5455;
154
155pub const TIOCGLCKTRMIOS: c_int = 0x5456;
156
157pub const TIOCSLCKTRMIOS: c_int = 0x5457;
158
159pub const TIOCSERGSTRUCT: c_int = 0x5458;
160
161pub const TIOCSERGETLSR: c_int = 0x5459;
162
163pub const TIOCSERGETMULTI: c_int = 0x545A;
164
165pub const TIOCSERSETMULTI: c_int = 0x545B;
166
167pub const TIOCMIWAIT: c_int = 0x545C;
168
169pub const TIOCGICOUNT: c_int = 0x545D;
170
171cfg_if!
172{
173	// also alpha, sh / sh64, sparc / sparc64 and xtensa
174	if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
175	{
176		// see http://tomoyo.osdn.jp/cgi-bin/lxr/source/include/uapi/asm-generic/ioctl.h#L77 to work out value.
177		// _IOR('f', 128, loff_t);
178		pub const FIOQSIZE: c_int = 0x80086680;
179	}
180	else if #[cfg(any(target_arch = "mips", target_arch = "mips64"))]
181	{
182		pub const FIOQSIZE: c_int = 0x667F;
183	}
184	// also blackfin. frv and m68k
185	else if #[cfg(any(target_arch = "arm", target_arch = "s390x"))]
186	{
187		pub const FIOQSIZE: c_int = 0x545E;
188	}
189	else
190	{
191		pub const FIOQSIZE: c_int = 0x5460;
192	}
193}
194
195// Used for packet mode
196pub const TIOCPKT_DATA: c_uint = 0;
197pub const TIOCPKT_FLUSHREAD: c_uint = 1;
198pub const TIOCPKT_FLUSHWRITE: c_uint = 2;
199pub const TIOCPKT_STOP: c_uint = 4;
200pub const TIOCPKT_START: c_uint = 8;
201pub const TIOCPKT_NOSTOP: c_uint = 16;
202pub const TIOCPKT_DOSTOP: c_uint = 32;
203pub const TIOCPKT_IOCTL: c_uint = 64;
204
205// Transmitter physically empty
206pub const TIOCSER_TEMT: c_uint = 0x01;