Debian Codegraph @

debian/missing-sources/libc/src/unix/newlib/horizon/mod.rs

raw
1 //! ARMv6K Nintendo 3DS C Newlib definitions
2
3 use crate::off_t;
4 use crate::prelude::*;
5
6 pub type wchar_t = c_uint;
7
8 pub type u_register_t = c_uint;
9 pub type u_char = c_uchar;
10 pub type u_short = c_ushort;
11 pub type u_int = c_uint;
12 pub type u_long = c_ulong;
13 pub type ushort = c_ushort;
14 pub type uint = c_uint;
15 pub type ulong = c_ulong;
16 pub type clock_t = c_ulong;
17 pub type daddr_t = c_long;
18 pub type caddr_t = *mut c_char;
19 pub type sbintime_t = c_longlong;
20 pub type sigset_t = c_ulong;
21
22 s! {
23 pub struct hostent {
24 pub h_name: *mut c_char,
25 pub h_aliases: *mut *mut c_char,
26 pub h_addrtype: u16,
27 pub h_length: u16,
28 pub h_addr_list: *mut *mut c_char,
29 }
30
31 pub struct pollfd {
32 pub fd: c_int,
33 pub events: c_int,
34 pub revents: c_int,
35 }
36
37 pub struct sockaddr {
38 pub sa_family: crate::sa_family_t,
39 pub sa_data: [c_char; 26usize],
40 }
41
42 pub struct sockaddr_storage {
43 pub ss_family: crate::sa_family_t,
44 pub __ss_padding: [c_char; 26usize],
45 }
46
47 pub struct sockaddr_in {
48 pub sin_family: crate::sa_family_t,
49 pub sin_port: crate::in_port_t,
50 pub sin_addr: crate::in_addr,
51 pub sin_zero: [c_char; 8],
52 }
53
54 pub struct sockaddr_in6 {
55 pub sin6_family: crate::sa_family_t,
56 pub sin6_port: crate::in_port_t,
57 pub sin6_flowinfo: u32,
58 pub sin6_addr: crate::in6_addr,
59 pub sin6_scope_id: u32,
60 }
61
62 pub struct sockaddr_un {
63 pub sun_len: c_uchar,
64 pub sun_family: crate::sa_family_t,
65 pub sun_path: [c_char; 104usize],
66 }
67
68 pub struct sched_param {
69 pub sched_priority: c_int,
70 }
71
72 pub struct stat {
73 pub st_dev: crate::dev_t,
74 pub st_ino: crate::ino_t,
75 pub st_mode: crate::mode_t,
76 pub st_nlink: crate::nlink_t,
77 pub st_uid: crate::uid_t,
78 pub st_gid: crate::gid_t,
79 pub st_rdev: crate::dev_t,
80 pub st_size: off_t,
81 pub st_atim: crate::timespec,
82 pub st_mtim: crate::timespec,
83 pub st_ctim: crate::timespec,
84 pub st_blksize: crate::blksize_t,
85 pub st_blocks: crate::blkcnt_t,
86 pub st_spare4: [c_long; 2usize],
87 }
88 }
89
90 pub const SIGEV_NONE: c_int = 1;
91 pub const SIGEV_SIGNAL: c_int = 2;
92 pub const SIGEV_THREAD: c_int = 3;
93 pub const SA_NOCLDSTOP: c_int = 1;
94 pub const MINSIGSTKSZ: c_int = 2048;
95 pub const SIGSTKSZ: c_int = 8192;
96 pub const SS_ONSTACK: c_int = 1;
97 pub const SS_DISABLE: c_int = 2;
98 pub const SIG_SETMASK: c_int = 0;
99 pub const SIG_BLOCK: c_int = 1;
100 pub const SIG_UNBLOCK: c_int = 2;
101 pub const SIGHUP: c_int = 1;
102 pub const SIGINT: c_int = 2;
103 pub const SIGQUIT: c_int = 3;
104 pub const SIGILL: c_int = 4;
105 pub const SIGTRAP: c_int = 5;
106 pub const SIGABRT: c_int = 6;
107 pub const SIGEMT: c_int = 7;
108 pub const SIGFPE: c_int = 8;
109 pub const SIGKILL: c_int = 9;
110 pub const SIGBUS: c_int = 10;
111 pub const SIGSEGV: c_int = 11;
112 pub const SIGSYS: c_int = 12;
113 pub const SIGPIPE: c_int = 13;
114 pub const SIGALRM: c_int = 14;
115 pub const SIGTERM: c_int = 15;
116 pub const SIGURG: c_int = 16;
117 pub const SIGSTOP: c_int = 17;
118 pub const SIGTSTP: c_int = 18;
119 pub const SIGCONT: c_int = 19;
120 pub const SIGCHLD: c_int = 20;
121 pub const SIGCLD: c_int = 20;
122 pub const SIGTTIN: c_int = 21;
123 pub const SIGTTOU: c_int = 22;
124 pub const SIGIO: c_int = 23;
125 pub const SIGPOLL: c_int = 23;
126 pub const SIGXCPU: c_int = 24;
127 pub const SIGXFSZ: c_int = 25;
128 pub const SIGVTALRM: c_int = 26;
129 pub const SIGPROF: c_int = 27;
130 pub const SIGWINCH: c_int = 28;
131 pub const SIGLOST: c_int = 29;
132 pub const SIGUSR1: c_int = 30;
133 pub const SIGUSR2: c_int = 31;
134 pub const NSIG: c_int = 32;
135 pub const CLOCK_ENABLED: c_uint = 1;
136 pub const CLOCK_DISABLED: c_uint = 0;
137 pub const CLOCK_ALLOWED: c_uint = 1;
138 pub const CLOCK_DISALLOWED: c_uint = 0;
139 pub const TIMER_ABSTIME: c_uint = 4;
140 pub const SOL_SOCKET: c_int = 65535;
141 pub const MSG_OOB: c_int = 1;
142 pub const MSG_PEEK: c_int = 2;
143 pub const MSG_DONTWAIT: c_int = 4;
144 pub const MSG_DONTROUTE: c_int = 0;
145 pub const MSG_WAITALL: c_int = 0;
146 pub const MSG_MORE: c_int = 0;
147 pub const MSG_NOSIGNAL: c_int = 0;
148 pub const SOL_CONFIG: c_uint = 65534;
149
150 pub const PTHREAD_STACK_MIN: size_t = 4096;
151 pub const WNOHANG: c_int = 1;
152
153 pub const POLLIN: c_short = 0x0001;
154 pub const POLLPRI: c_short = 0x0002;
155 pub const POLLOUT: c_short = 0x0004;
156 pub const POLLRDNORM: c_short = 0x0040;
157 pub const POLLWRNORM: c_short = POLLOUT;
158 pub const POLLRDBAND: c_short = 0x0080;
159 pub const POLLWRBAND: c_short = 0x0100;
160 pub const POLLERR: c_short = 0x0008;
161 pub const POLLHUP: c_short = 0x0010;
162 pub const POLLNVAL: c_short = 0x0020;
163
164 pub const EAI_AGAIN: c_int = 2;
165 pub const EAI_BADFLAGS: c_int = 3;
166 pub const EAI_FAIL: c_int = 4;
167 pub const EAI_SERVICE: c_int = 9;
168 pub const EAI_SYSTEM: c_int = 11;
169 pub const EAI_BADHINTS: c_int = 12;
170 pub const EAI_PROTOCOL: c_int = 13;
171 pub const EAI_OVERFLOW: c_int = 14;
172 pub const EAI_MAX: c_int = 15;
173
174 pub const AF_UNIX: c_int = 1;
175 pub const AF_INET6: c_int = 23;
176
177 pub const FIONBIO: c_ulong = 1;
178
179 pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
180
181 // For pthread get/setschedparam
182 pub const SCHED_FIFO: c_int = 1;
183 pub const SCHED_RR: c_int = 2;
184
185 // For getrandom()
186 pub const GRND_NONBLOCK: c_uint = 0x1;
187 pub const GRND_RANDOM: c_uint = 0x2;
188
189 // Horizon OS works doesn't or can't hold any of this information
190 safe_f! {
191 pub const fn WIFSTOPPED(_status: c_int) -> bool {
192 false
193 }
194
195 pub const fn WSTOPSIG(_status: c_int) -> c_int {
196 0
197 }
198
199 pub const fn WIFCONTINUED(_status: c_int) -> bool {
200 true
201 }
202
203 pub const fn WIFSIGNALED(_status: c_int) -> bool {
204 false
205 }
206
207 pub const fn WTERMSIG(_status: c_int) -> c_int {
208 0
209 }
210
211 pub const fn WIFEXITED(_status: c_int) -> bool {
212 true
213 }
214
215 pub const fn WEXITSTATUS(_status: c_int) -> c_int {
216 0
217 }
218
219 pub const fn WCOREDUMP(_status: c_int) -> bool {
220 false
221 }
222 }
223
224 extern "C" {
225 pub fn pthread_create(
226 native: *mut crate::pthread_t,
227 attr: *const crate::pthread_attr_t,
228 f: extern "C" fn(_: *mut c_void) -> *mut c_void,
229 value: *mut c_void,
230 ) -> c_int;
231
232 pub fn pthread_attr_getschedparam(
233 attr: *const crate::pthread_attr_t,
234 param: *mut sched_param,
235 ) -> c_int;
236
237 pub fn pthread_attr_setschedparam(
238 attr: *mut crate::pthread_attr_t,
239 param: *const sched_param,
240 ) -> c_int;
241
242 pub fn pthread_attr_getprocessorid_np(
243 attr: *const crate::pthread_attr_t,
244 processor_id: *mut c_int,
245 ) -> c_int;
246
247 pub fn pthread_attr_setprocessorid_np(
248 attr: *mut crate::pthread_attr_t,
249 processor_id: c_int,
250 ) -> c_int;
251
252 pub fn pthread_getschedparam(
253 native: crate::pthread_t,
254 policy: *mut c_int,
255 param: *mut crate::sched_param,
256 ) -> c_int;
257
258 pub fn pthread_setschedparam(
259 native: crate::pthread_t,
260 policy: c_int,
261 param: *const crate::sched_param,
262 ) -> c_int;
263
264 pub fn pthread_condattr_getclock(
265 attr: *const crate::pthread_condattr_t,
266 clock_id: *mut crate::clockid_t,
267 ) -> c_int;
268
269 pub fn pthread_condattr_setclock(
270 attr: *mut crate::pthread_condattr_t,
271 clock_id: crate::clockid_t,
272 ) -> c_int;
273
274 pub fn pthread_getprocessorid_np() -> c_int;
275
276 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
277
278 pub fn gethostid() -> c_long;
279 }
280
281 pub use crate::unix::newlib::generic::dirent;