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