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