|
| 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 | + |
| 9 | +pub type in_port_t = ::c_ushort; |
| 10 | +pub type u_register_t = ::c_uint; |
| 11 | +pub type u_char = ::c_uchar; |
| 12 | +pub type u_short = ::c_ushort; |
| 13 | +pub type u_int = ::c_uint; |
| 14 | +pub type u_long = c_ulong; |
| 15 | +pub type ushort = ::c_ushort; |
| 16 | +pub type uint = ::c_uint; |
| 17 | +pub type ulong = c_ulong; |
| 18 | +pub type clock_t = c_ulong; |
| 19 | +pub type daddr_t = c_long; |
| 20 | +pub type caddr_t = *mut c_char; |
| 21 | +pub type sbintime_t = ::c_longlong; |
| 22 | + |
| 23 | +// External implementations are needed to use networking and threading. |
| 24 | +s! { |
| 25 | + pub struct sockaddr { |
| 26 | + pub sa_family: ::sa_family_t, |
| 27 | + pub sa_data: [::c_char; 26usize], |
| 28 | + } |
| 29 | + |
| 30 | + pub struct sockaddr_storage { |
| 31 | + pub ss_family: ::sa_family_t, |
| 32 | + pub __ss_padding: [::c_char; 26usize], |
| 33 | + } |
| 34 | + |
| 35 | + pub struct sockaddr_in { |
| 36 | + pub sin_family: ::sa_family_t, |
| 37 | + pub sin_port: in_port_t, |
| 38 | + pub sin_addr: ::in_addr, |
| 39 | + } |
| 40 | + |
| 41 | + pub struct sockaddr_in6 { |
| 42 | + pub sin6_family: ::sa_family_t, |
| 43 | + pub sin6_port: ::in_port_t, |
| 44 | + pub sin6_flowinfo: u32, |
| 45 | + pub sin6_addr: ::in6_addr, |
| 46 | + pub sin6_scope_id: u32, |
| 47 | + } |
| 48 | + |
| 49 | + pub struct sockaddr_un { |
| 50 | + pub sun_len: ::c_uchar, |
| 51 | + pub sun_family: ::sa_family_t, |
| 52 | + pub sun_path: [::c_char; 104usize], |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +pub const SIGEV_NONE: ::c_int = 1; |
| 57 | +pub const SIGEV_SIGNAL: ::c_int = 2; |
| 58 | +pub const SIGEV_THREAD: ::c_int = 3; |
| 59 | +pub const SA_NOCLDSTOP: ::c_int = 1; |
| 60 | +pub const MINSIGSTKSZ: ::c_int = 2048; |
| 61 | +pub const SIGSTKSZ: ::c_int = 8192; |
| 62 | +pub const SS_ONSTACK: ::c_int = 1; |
| 63 | +pub const SS_DISABLE: ::c_int = 2; |
| 64 | +pub const SIG_SETMASK: ::c_int = 0; |
| 65 | +pub const SIG_BLOCK: ::c_int = 1; |
| 66 | +pub const SIG_UNBLOCK: ::c_int = 2; |
| 67 | +pub const SIGHUP: ::c_int = 1; |
| 68 | +pub const SIGINT: ::c_int = 2; |
| 69 | +pub const SIGQUIT: ::c_int = 3; |
| 70 | +pub const SIGILL: ::c_int = 4; |
| 71 | +pub const SIGTRAP: ::c_int = 5; |
| 72 | +pub const SIGABRT: ::c_int = 6; |
| 73 | +pub const SIGEMT: ::c_int = 7; |
| 74 | +pub const SIGFPE: ::c_int = 8; |
| 75 | +pub const SIGKILL: ::c_int = 9; |
| 76 | +pub const SIGBUS: ::c_int = 10; |
| 77 | +pub const SIGSEGV: ::c_int = 11; |
| 78 | +pub const SIGSYS: ::c_int = 12; |
| 79 | +pub const SIGPIPE: ::c_int = 13; |
| 80 | +pub const SIGALRM: ::c_int = 14; |
| 81 | +pub const SIGTERM: ::c_int = 15; |
| 82 | +pub const SIGURG: ::c_int = 16; |
| 83 | +pub const SIGSTOP: ::c_int = 17; |
| 84 | +pub const SIGTSTP: ::c_int = 18; |
| 85 | +pub const SIGCONT: ::c_int = 19; |
| 86 | +pub const SIGCHLD: ::c_int = 20; |
| 87 | +pub const SIGCLD: ::c_int = 20; |
| 88 | +pub const SIGTTIN: ::c_int = 21; |
| 89 | +pub const SIGTTOU: ::c_int = 22; |
| 90 | +pub const SIGIO: ::c_int = 23; |
| 91 | +pub const SIGPOLL: ::c_int = 23; |
| 92 | +pub const SIGXCPU: ::c_int = 24; |
| 93 | +pub const SIGXFSZ: ::c_int = 25; |
| 94 | +pub const SIGVTALRM: ::c_int = 26; |
| 95 | +pub const SIGPROF: ::c_int = 27; |
| 96 | +pub const SIGWINCH: ::c_int = 28; |
| 97 | +pub const SIGLOST: ::c_int = 29; |
| 98 | +pub const SIGUSR1: ::c_int = 30; |
| 99 | +pub const SIGUSR2: ::c_int = 31; |
| 100 | +pub const NSIG: ::c_int = 32; |
| 101 | +pub const CLOCK_ENABLED: ::c_uint = 1; |
| 102 | +pub const CLOCK_DISABLED: ::c_uint = 0; |
| 103 | +pub const CLOCK_ALLOWED: ::c_uint = 1; |
| 104 | +pub const CLOCK_DISALLOWED: ::c_uint = 0; |
| 105 | +pub const TIMER_ABSTIME: ::c_uint = 4; |
| 106 | +pub const SOL_SOCKET: ::c_int = 65535; |
| 107 | +pub const MSG_OOB: ::c_int = 1; |
| 108 | +pub const MSG_PEEK: ::c_int = 2; |
| 109 | +pub const MSG_DONTWAIT: ::c_int = 4; |
| 110 | +pub const MSG_DONTROUTE: ::c_int = 0; |
| 111 | +pub const MSG_WAITALL: ::c_int = 0; |
| 112 | +pub const MSG_MORE: ::c_int = 0; |
| 113 | +pub const MSG_NOSIGNAL: ::c_int = 0; |
| 114 | +pub const SOL_CONFIG: ::c_uint = 65534; |
| 115 | + |
| 116 | +pub const _SC_PAGESIZE: ::c_int = 8; |
| 117 | +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51; |
| 118 | + |
| 119 | +pub const PTHREAD_STACK_MIN: ::size_t = 4096; |
| 120 | +pub const WNOHANG: ::c_int = 1; |
| 121 | + |
| 122 | +pub const POLLIN: ::c_short = 0x0001; |
| 123 | +pub const POLLPRI: ::c_short = 0x0002; |
| 124 | +pub const POLLOUT: ::c_short = 0x0004; |
| 125 | +pub const POLLRDNORM: ::c_short = 0x0040; |
| 126 | +pub const POLLWRNORM: ::c_short = POLLOUT; |
| 127 | +pub const POLLRDBAND: ::c_short = 0x0080; |
| 128 | +pub const POLLWRBAND: ::c_short = 0x0100; |
| 129 | +pub const POLLERR: ::c_short = 0x0008; |
| 130 | +pub const POLLHUP: ::c_short = 0x0010; |
| 131 | +pub const POLLNVAL: ::c_short = 0x0020; |
| 132 | + |
| 133 | +pub const EAI_AGAIN: ::c_int = 2; |
| 134 | +pub const EAI_BADFLAGS: ::c_int = 3; |
| 135 | +pub const EAI_FAIL: ::c_int = 4; |
| 136 | +pub const EAI_SERVICE: ::c_int = 9; |
| 137 | +pub const EAI_SYSTEM: ::c_int = 11; |
| 138 | +pub const EAI_BADHINTS: ::c_int = 12; |
| 139 | +pub const EAI_PROTOCOL: ::c_int = 13; |
| 140 | +pub const EAI_OVERFLOW: ::c_int = 14; |
| 141 | +pub const EAI_MAX: ::c_int = 15; |
| 142 | + |
| 143 | +pub const AF_UNIX: ::c_int = 1; |
| 144 | +pub const AF_INET6: ::c_int = 23; |
| 145 | + |
| 146 | +pub const FIONBIO: ::c_ulong = 1; |
| 147 | + |
| 148 | +pub const RTLD_DEFAULT: *mut ::c_void = 0 as *mut ::c_void; |
| 149 | + |
| 150 | +// Horizon OS works doesn't or can't hold any of this information |
| 151 | +safe_f! { |
| 152 | + pub {const} fn WIFSTOPPED(_status: ::c_int) -> bool { |
| 153 | + false |
| 154 | + } |
| 155 | + |
| 156 | + pub {const} fn WSTOPSIG(_status: ::c_int) -> ::c_int { |
| 157 | + 0 |
| 158 | + } |
| 159 | + |
| 160 | + pub {const} fn WIFCONTINUED(_status: ::c_int) -> bool { |
| 161 | + true |
| 162 | + } |
| 163 | + |
| 164 | + pub {const} fn WIFSIGNALED(_status: ::c_int) -> bool { |
| 165 | + false |
| 166 | + } |
| 167 | + |
| 168 | + pub {const} fn WTERMSIG(_status: ::c_int) -> ::c_int { |
| 169 | + 0 |
| 170 | + } |
| 171 | + |
| 172 | + pub {const} fn WIFEXITED(_status: ::c_int) -> bool { |
| 173 | + true |
| 174 | + } |
| 175 | + |
| 176 | + pub {const} fn WEXITSTATUS(_status: ::c_int) -> ::c_int { |
| 177 | + 0 |
| 178 | + } |
| 179 | + |
| 180 | + pub {const} fn WCOREDUMP(_status: ::c_int) -> bool { |
| 181 | + false |
| 182 | + } |
| 183 | +} |
| 184 | + |
| 185 | +extern "C" { |
| 186 | + pub fn pthread_create( |
| 187 | + native: *mut ::pthread_t, |
| 188 | + attr: *const ::pthread_attr_t, |
| 189 | + f: extern "C" fn(_: *mut ::c_void) -> *mut ::c_void, |
| 190 | + value: *mut ::c_void, |
| 191 | + ) -> ::c_int; |
| 192 | + |
| 193 | + pub fn gethostid() -> ::c_long; |
| 194 | +} |
0 commit comments