Debian Codegraph @

debian/missing-sources/libc/src/unix/linux_like/l4re/mod.rs

raw
1 ///! L4Re specifics
2 ///! This module contains definitions required by various L4Re libc backends.
3 ///! Some of them are formally not part of the libc, but are a dependency of the
4 ///! libc and hence we should provide them here.
5 use crate::prelude::*;
6
7 pub type l4_umword_t = c_ulong; // Unsigned machine word.
8 pub type pthread_t = *mut c_void;
9
10 pub type dev_t = u64;
11 pub type socklen_t = u32;
12 pub type mode_t = u32;
13 pub type ino64_t = u64;
14 pub type off64_t = i64;
15 pub type blkcnt64_t = i64;
16 pub type rlim64_t = u64;
17 pub type nfds_t = c_ulong;
18 pub type nl_item = c_int;
19 pub type idtype_t = c_uint;
20 pub type loff_t = c_longlong;
21 pub type pthread_key_t = c_uint;
22 pub type pthread_once_t = c_int;
23 pub type pthread_spinlock_t = c_int;
24
25 s! {
26 /// CPU sets.
27 pub struct l4_sched_cpu_set_t {
28 // from the L4Re docs
29 /// Combination of granularity and offset.
30 ///
31 /// The granularity defines how many CPUs each bit in map describes.
32 /// The offset is the number of the first CPU described by the first
33 /// bit in the bitmap.
34 /// offset must be a multiple of 2^graularity.
35 ///
36 /// | MSB | LSB |
37 /// | ---------------- | ------------------- |
38 /// | 8bit granularity | 24bit offset .. |
39 gran_offset: l4_umword_t,
40 /// Bitmap of CPUs.
41 map: l4_umword_t,
42 }
43
44 pub struct pthread_attr_t {
45 __detachstate: c_int,
46 __schedpolicy: c_int,
47 __schedparam: super::__sched_param,
48 __inheritsched: c_int,
49 __scope: c_int,
50 __guardsize: size_t,
51 __stackaddr_set: c_int,
52 __stackaddr: *mut c_void, // better don't use it
53 __stacksize: size_t,
54 // L4Re specifics
55 pub affinity: l4_sched_cpu_set_t,
56 pub create_flags: c_uint,
57 }
58 }
59
60 // L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
61 // somewhere in the core libraries. uClibc wants 16k, but that's not enough.
62 pub const PTHREAD_STACK_MIN: usize = 65536;
63
64 pub const BOTHER: crate::speed_t = 0o010000;
65
66 pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0;
67 pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1;
68 pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2;
69 pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3;
70 pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4;
71 pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5;
72 pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 6;
73 pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 7;
74 pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8;
75 pub const RLIMIT_AS: crate::__rlimit_resource_t = 9;
76 pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10;
77 pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11;
78 pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12;
79 pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13;
80 pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14;
81 pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15;
82 pub const RLIMIT_NLIMITS: crate::__rlimit_resource_t = RLIM_NLIMITS;
83 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16;
84
85 pub const SOL_SOCKET: c_int = 1;
86
87 // pub const SO_DEBUG: c_int = 1;
88 pub const SO_REUSEADDR: c_int = 2;
89 pub const SO_TYPE: c_int = 3;
90 pub const SO_ERROR: c_int = 4;
91 pub const SO_DONTROUTE: c_int = 5;
92 pub const SO_BROADCAST: c_int = 6;
93 pub const SO_SNDBUF: c_int = 7;
94 pub const SO_RCVBUF: c_int = 8;
95 pub const SO_KEEPALIVE: c_int = 9;
96 pub const SO_OOBINLINE: c_int = 10;
97 pub const SO_NO_CHECK: c_int = 11;
98 pub const SO_PRIORITY: c_int = 12;
99 pub const SO_LINGER: c_int = 13;
100 pub const SO_BSDCOMPAT: c_int = 14;
101 pub const SO_PASSCRED: c_int = 16;
102 pub const SO_PEERCRED: c_int = 17;
103 pub const SO_RCVLOWAT: c_int = 18;
104 pub const SO_SNDLOWAT: c_int = 19;
105 pub const SO_RCVTIMEO: c_int = 20;
106 pub const SO_SNDTIMEO: c_int = 21;
107 pub const SO_SECURITY_AUTHENTICATION: c_int = 22;
108 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23;
109 pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24;
110 pub const SO_BINDTODEVICE: c_int = 25;
111 pub const SO_ATTACH_FILTER: c_int = 26;
112 pub const SO_DETACH_FILTER: c_int = 27;
113 pub const SO_PEERNAME: c_int = 28;
114
115 pub const SO_ACCEPTCONN: c_int = 30;
116 pub const SO_PEERSEC: c_int = 31;
117
118 pub const TCGETS: Ioctl = 0x5401;
119 pub const TCSETS: Ioctl = 0x5402;
120 pub const TCSETSW: Ioctl = 0x5403;
121 pub const TCSETSF: Ioctl = 0x5404;
122 pub const TCGETA: Ioctl = 0x5405;
123 pub const TCSETA: Ioctl = 0x5406;
124 pub const TCSETAW: Ioctl = 0x5407;
125 pub const TCSETAF: Ioctl = 0x5408;
126 pub const TCSBRK: Ioctl = 0x5409;
127 pub const TCXONC: Ioctl = 0x540A;
128 pub const TCFLSH: Ioctl = 0x540B;
129 pub const TIOCM_LE: c_int = 0x001;
130 pub const TIOCM_DTR: c_int = 0x002;
131 pub const TIOCM_RTS: c_int = 0x004;
132 pub const TIOCM_ST: c_int = 0x008;
133 pub const TIOCM_SR: c_int = 0x010;
134 pub const TIOCM_CTS: c_int = 0x020;
135 pub const TIOCM_CAR: c_int = 0x040;
136 pub const TIOCM_CD: c_int = TIOCM_CAR;
137 pub const TIOCM_RNG: c_int = 0x080;
138 pub const TIOCM_RI: c_int = TIOCM_RNG;
139 pub const TIOCM_DSR: c_int = 0x100;
140 pub const TIOCEXCL: Ioctl = 0x540C;
141 pub const TIOCNXCL: Ioctl = 0x540D;
142 pub const TIOCSCTTY: Ioctl = 0x540E;
143 pub const TIOCGPGRP: Ioctl = 0x540F;
144 pub const TIOCSPGRP: Ioctl = 0x5410;
145 pub const TIOCOUTQ: Ioctl = 0x5411;
146 pub const TIOCSTI: Ioctl = 0x5412;
147 pub const TIOCGWINSZ: Ioctl = 0x5413;
148 pub const TIOCSWINSZ: Ioctl = 0x5414;
149 pub const TIOCMGET: Ioctl = 0x5415;
150 pub const TIOCMBIS: Ioctl = 0x5416;
151 pub const TIOCMBIC: Ioctl = 0x5417;
152 pub const TIOCMSET: Ioctl = 0x5418;
153 pub const TIOCGSOFTCAR: Ioctl = 0x5419;
154 pub const TIOCSSOFTCAR: Ioctl = 0x541A;
155 pub const FIONREAD: Ioctl = 0x541B;
156 pub const TIOCINQ: Ioctl = FIONREAD;
157 pub const TIOCLINUX: Ioctl = 0x541C;
158 pub const TIOCCONS: Ioctl = 0x541D;
159 pub const TIOCGSERIAL: Ioctl = 0x541E;
160 pub const TIOCSSERIAL: Ioctl = 0x541F;
161 pub const TIOCPKT: Ioctl = 0x5420;
162 pub const FIONBIO: Ioctl = 0x5421;
163 pub const TIOCNOTTY: Ioctl = 0x5422;
164 pub const TIOCSETD: Ioctl = 0x5423;
165 pub const TIOCGETD: Ioctl = 0x5424;
166 pub const TCSBRKP: Ioctl = 0x5425;
167 pub const TIOCSBRK: Ioctl = 0x5427;
168 pub const TIOCCBRK: Ioctl = 0x5428;
169 pub const TIOCGSID: Ioctl = 0x5429;
170 pub const TIOCGPTN: Ioctl = 0x80045430;
171 pub const TIOCSPTLCK: Ioctl = 0x40045431;
172 pub const FIONCLEX: Ioctl = 0x5450;
173 pub const FIOCLEX: Ioctl = 0x5451;
174 pub const FIOASYNC: Ioctl = 0x5452;
175 pub const TIOCSERCONFIG: Ioctl = 0x5453;
176 pub const TIOCSERGWILD: Ioctl = 0x5454;
177 pub const TIOCSERSWILD: Ioctl = 0x5455;
178 pub const TIOCGLCKTRMIOS: Ioctl = 0x5456;
179 pub const TIOCSLCKTRMIOS: Ioctl = 0x5457;
180 pub const TIOCSERGSTRUCT: Ioctl = 0x5458;
181 pub const TIOCSERGETLSR: Ioctl = 0x5459;
182 pub const TIOCSERGETMULTI: Ioctl = 0x545A;
183 pub const TIOCSERSETMULTI: Ioctl = 0x545B;
184 pub const TIOCMIWAIT: Ioctl = 0x545C;
185 pub const TIOCGICOUNT: Ioctl = 0x545D;
186
187 pub const BLKSSZGET: Ioctl = 0x1268;
188
189 cfg_if! {
190 if #[cfg(not(target_env = "uclibc"))] {
191 pub const NLMSG_NOOP: c_int = 0x1;
192 pub const NLMSG_ERROR: c_int = 0x2;
193 pub const NLMSG_DONE: c_int = 0x3;
194 pub const NLMSG_OVERRUN: c_int = 0x4;
195 pub const NLMSG_MIN_TYPE: c_int = 0x10;
196 }
197 }
198
199 cfg_if! {
200 if #[cfg(target_env = "uclibc")] {
201 mod uclibc;
202 pub use self::uclibc::*;
203 }
204 }