Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 1 | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT |
| 2 | // file at the top-level directory of this distribution and at |
| 3 | // http://rust-lang.org/COPYRIGHT. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | // option. This file may not be copied, modified, or distributed |
| 9 | // except according to those terms. |
| 10 | |
Alex Crichton | 95b18b7 | 2015-09-17 10:06:58 -0700 | [diff] [blame] | 11 | //! Crate docs |
| 12 | |
Devon Hollowood | 772f891 | 2015-11-17 01:12:17 -0800 | [diff] [blame] | 13 | #![allow(bad_style, overflowing_literals, improper_ctypes)] |
Alex Crichton | f7efe34 | 2015-11-02 14:26:04 -0800 | [diff] [blame] | 14 | #![crate_type = "rlib"] |
| 15 | #![crate_name = "libc"] |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 16 | #![cfg_attr(dox, feature(no_core, lang_items))] |
| 17 | #![cfg_attr(dox, no_core)] |
| 18 | #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", |
| 19 | html_favicon_url = "https://doc.rust-lang.org/favicon.ico")] |
| 20 | |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 21 | #![cfg_attr(all(target_os = "linux", target_arch = "x86_64"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 22 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 23 | ))] |
| 24 | #![cfg_attr(all(target_os = "linux", target_arch = "x86"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 25 | html_root_url = "https://doc.rust-lang.org/libc/i686-unknown-linux-gnu" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 26 | ))] |
| 27 | #![cfg_attr(all(target_os = "linux", target_arch = "arm"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 28 | html_root_url = "https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 29 | ))] |
| 30 | #![cfg_attr(all(target_os = "linux", target_arch = "mips"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 31 | html_root_url = "https://doc.rust-lang.org/libc/mips-unknown-linux-gnu" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 32 | ))] |
Alex Crichton | d13e1e4 | 2015-09-17 17:29:18 -0700 | [diff] [blame] | 33 | #![cfg_attr(all(target_os = "linux", target_arch = "aarch64"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 34 | html_root_url = "https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu" |
Alex Crichton | d13e1e4 | 2015-09-17 17:29:18 -0700 | [diff] [blame] | 35 | ))] |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 36 | #![cfg_attr(all(target_os = "linux", target_env = "musl"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 37 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 38 | ))] |
| 39 | #![cfg_attr(all(target_os = "macos", target_arch = "x86_64"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 40 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-apple-darwin" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 41 | ))] |
| 42 | #![cfg_attr(all(target_os = "macos", target_arch = "x86"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 43 | html_root_url = "https://doc.rust-lang.org/libc/i686-apple-darwin" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 44 | ))] |
| 45 | #![cfg_attr(all(windows, target_arch = "x86_64", target_env = "gnu"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 46 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 47 | ))] |
Alex Crichton | 611e9a3 | 2015-09-17 10:06:19 -0700 | [diff] [blame] | 48 | #![cfg_attr(all(windows, target_arch = "x86", target_env = "gnu"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 49 | html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-gnu" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 50 | ))] |
| 51 | #![cfg_attr(all(windows, target_arch = "x86_64", target_env = "msvc"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 52 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 53 | ))] |
Alex Crichton | 611e9a3 | 2015-09-17 10:06:19 -0700 | [diff] [blame] | 54 | #![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 55 | html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-msvc" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 56 | ))] |
Alex Crichton | 37b7142 | 2015-12-17 10:50:53 -0800 | [diff] [blame] | 57 | #![cfg_attr(target_os = "android", doc( |
Alex Crichton | 13418a5 | 2015-10-29 11:54:12 -0700 | [diff] [blame] | 58 | html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi" |
Alex Crichton | 730a17f | 2015-09-17 10:05:36 -0700 | [diff] [blame] | 59 | ))] |
Alex Crichton | 37b7142 | 2015-12-17 10:50:53 -0800 | [diff] [blame] | 60 | #![cfg_attr(target_os = "freebsd", doc( |
| 61 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-freebsd" |
| 62 | ))] |
| 63 | #![cfg_attr(target_os = "openbsd", doc( |
| 64 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-openbsd" |
| 65 | ))] |
| 66 | #![cfg_attr(target_os = "bitrig", doc( |
| 67 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-bitrig" |
| 68 | ))] |
| 69 | #![cfg_attr(target_os = "netbsd", doc( |
| 70 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-netbsd" |
| 71 | ))] |
| 72 | #![cfg_attr(target_os = "dragonfly", doc( |
| 73 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly" |
| 74 | ))] |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 75 | |
Alex Crichton | f7efe34 | 2015-11-02 14:26:04 -0800 | [diff] [blame] | 76 | // Attributes needed when building as part of the standard library |
Sebastian Wicki | 37d4bb9 | 2016-02-27 14:27:10 +0100 | [diff] [blame] | 77 | #![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))] |
Alex Crichton | f7efe34 | 2015-11-02 14:26:04 -0800 | [diff] [blame] | 78 | #![cfg_attr(stdbuild, no_std)] |
| 79 | #![cfg_attr(stdbuild, staged_api)] |
Alex Crichton | 56f6104 | 2015-11-02 16:57:39 -0800 | [diff] [blame] | 80 | #![cfg_attr(stdbuild, allow(warnings))] |
Alex Crichton | f7efe34 | 2015-11-02 14:26:04 -0800 | [diff] [blame] | 81 | #![cfg_attr(stdbuild, unstable(feature = "libc", |
| 82 | reason = "use `libc` from crates.io", |
| 83 | issue = "27783"))] |
| 84 | |
Alex Crichton | 6d46b6f | 2016-01-20 16:39:37 -0800 | [diff] [blame] | 85 | #![cfg_attr(not(feature = "use_std"), no_std)] |
| 86 | |
| 87 | #[cfg(all(not(stdbuild), not(dox), feature = "use_std"))] |
Alex Crichton | f7efe34 | 2015-11-02 14:26:04 -0800 | [diff] [blame] | 88 | extern crate std as core; |
| 89 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 90 | #[macro_use] mod macros; |
Alex Crichton | 24abc4f | 2015-09-16 23:54:56 -0700 | [diff] [blame] | 91 | mod dox; |
Alex Crichton | 3150484 | 2015-09-10 23:43:41 -0700 | [diff] [blame] | 92 | |
Alex Crichton | d5c4e55 | 2015-10-29 15:46:16 -0700 | [diff] [blame] | 93 | // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable |
| 94 | // more optimization opportunities around it recognizing things like |
| 95 | // malloc/free. |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 96 | #[repr(u8)] |
| 97 | pub enum c_void { |
Alex Crichton | d5c4e55 | 2015-10-29 15:46:16 -0700 | [diff] [blame] | 98 | // Two dummy variants so the #[repr] attribute can be used. |
Alex Crichton | 9f2b101 | 2015-09-16 23:32:21 -0700 | [diff] [blame] | 99 | #[doc(hidden)] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 100 | __variant1, |
Alex Crichton | 9f2b101 | 2015-09-16 23:32:21 -0700 | [diff] [blame] | 101 | #[doc(hidden)] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 102 | __variant2, |
| 103 | } |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 104 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 105 | pub type int8_t = i8; |
| 106 | pub type int16_t = i16; |
| 107 | pub type int32_t = i32; |
| 108 | pub type int64_t = i64; |
| 109 | pub type uint8_t = u8; |
| 110 | pub type uint16_t = u16; |
| 111 | pub type uint32_t = u32; |
| 112 | pub type uint64_t = u64; |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 113 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 114 | pub type c_schar = i8; |
| 115 | pub type c_uchar = u8; |
| 116 | pub type c_short = i16; |
| 117 | pub type c_ushort = u16; |
| 118 | pub type c_int = i32; |
| 119 | pub type c_uint = u32; |
| 120 | pub type c_float = f32; |
| 121 | pub type c_double = f64; |
| 122 | pub type c_longlong = i64; |
| 123 | pub type c_ulonglong = u64; |
| 124 | pub type intmax_t = i64; |
| 125 | pub type uintmax_t = u64; |
| 126 | |
| 127 | pub type size_t = usize; |
| 128 | pub type ptrdiff_t = isize; |
| 129 | pub type intptr_t = isize; |
| 130 | pub type uintptr_t = usize; |
| 131 | pub type ssize_t = isize; |
| 132 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 133 | pub enum FILE {} |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 134 | pub enum fpos_t {} // TODO: fill this out with a struct |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 135 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 136 | extern { |
| 137 | pub fn isalnum(c: c_int) -> c_int; |
| 138 | pub fn isalpha(c: c_int) -> c_int; |
| 139 | pub fn iscntrl(c: c_int) -> c_int; |
| 140 | pub fn isdigit(c: c_int) -> c_int; |
| 141 | pub fn isgraph(c: c_int) -> c_int; |
| 142 | pub fn islower(c: c_int) -> c_int; |
| 143 | pub fn isprint(c: c_int) -> c_int; |
| 144 | pub fn ispunct(c: c_int) -> c_int; |
| 145 | pub fn isspace(c: c_int) -> c_int; |
| 146 | pub fn isupper(c: c_int) -> c_int; |
| 147 | pub fn isxdigit(c: c_int) -> c_int; |
| 148 | pub fn tolower(c: c_int) -> c_int; |
| 149 | pub fn toupper(c: c_int) -> c_int; |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 150 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 151 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 152 | link_name = "fopen$UNIX2003")] |
| 153 | pub fn fopen(filename: *const c_char, |
| 154 | mode: *const c_char) -> *mut FILE; |
| 155 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 156 | link_name = "freopen$UNIX2003")] |
| 157 | pub fn freopen(filename: *const c_char, mode: *const c_char, |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 158 | file: *mut FILE) -> *mut FILE; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 159 | pub fn fflush(file: *mut FILE) -> c_int; |
| 160 | pub fn fclose(file: *mut FILE) -> c_int; |
| 161 | pub fn remove(filename: *const c_char) -> c_int; |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 162 | pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 163 | pub fn tmpfile() -> *mut FILE; |
| 164 | pub fn setvbuf(stream: *mut FILE, |
| 165 | buffer: *mut c_char, |
| 166 | mode: c_int, |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 167 | size: size_t) -> c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 168 | pub fn setbuf(stream: *mut FILE, buf: *mut c_char); |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 169 | pub fn fgetc(stream: *mut FILE) -> c_int; |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 170 | pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 171 | pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; |
| 172 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 173 | link_name = "fputs$UNIX2003")] |
| 174 | pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int; |
| 175 | pub fn puts(s: *const c_char) -> c_int; |
| 176 | pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; |
| 177 | pub fn fread(ptr: *mut c_void, |
| 178 | size: size_t, |
| 179 | nobj: size_t, |
| 180 | stream: *mut FILE) |
| 181 | -> size_t; |
| 182 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 183 | link_name = "fwrite$UNIX2003")] |
| 184 | pub fn fwrite(ptr: *const c_void, |
| 185 | size: size_t, |
| 186 | nobj: size_t, |
| 187 | stream: *mut FILE) |
| 188 | -> size_t; |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 189 | pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 190 | pub fn ftell(stream: *mut FILE) -> c_long; |
| 191 | pub fn rewind(stream: *mut FILE); |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 192 | #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 193 | pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 194 | #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 195 | pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; |
| 196 | pub fn feof(stream: *mut FILE) -> c_int; |
| 197 | pub fn ferror(stream: *mut FILE) -> c_int; |
| 198 | pub fn perror(s: *const c_char); |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 199 | pub fn atoi(s: *const c_char) -> c_int; |
| 200 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 201 | link_name = "strtod$UNIX2003")] |
Alex Crichton | bfc6ebc | 2015-09-11 15:29:40 -0700 | [diff] [blame] | 202 | pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 203 | pub fn strtol(s: *const c_char, |
| 204 | endp: *mut *mut c_char, base: c_int) -> c_long; |
| 205 | pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, |
| 206 | base: c_int) -> c_ulong; |
| 207 | pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; |
| 208 | pub fn malloc(size: size_t) -> *mut c_void; |
| 209 | pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; |
| 210 | pub fn free(p: *mut c_void); |
Brian Campbell | d81e4a0 | 2016-01-31 22:04:05 -0500 | [diff] [blame] | 211 | pub fn abort() -> !; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 212 | pub fn exit(status: c_int) -> !; |
| 213 | pub fn _exit(status: c_int) -> !; |
| 214 | pub fn atexit(cb: extern fn()) -> c_int; |
| 215 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 216 | link_name = "system$UNIX2003")] |
| 217 | pub fn system(s: *const c_char) -> c_int; |
| 218 | pub fn getenv(s: *const c_char) -> *mut c_char; |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 219 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 220 | pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; |
| 221 | pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) |
| 222 | -> *mut c_char; |
| 223 | pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; |
| 224 | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; |
| 225 | pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; |
| 226 | pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; |
| 227 | pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; |
| 228 | pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; |
| 229 | pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; |
| 230 | pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; |
| 231 | pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; |
| 232 | pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
| 233 | pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; |
| 234 | pub fn strlen(cs: *const c_char) -> size_t; |
| 235 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 236 | link_name = "strerror$UNIX2003")] |
| 237 | pub fn strerror(n: c_int) -> *mut c_char; |
| 238 | pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; |
| 239 | pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; |
| 240 | pub fn wcslen(buf: *const wchar_t) -> size_t; |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 241 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 242 | pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; |
| 243 | pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; |
Alex Crichton | dafaca9 | 2015-09-09 21:50:47 -0700 | [diff] [blame] | 244 | } |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 245 | |
Alex Crichton | d5c4e55 | 2015-10-29 15:46:16 -0700 | [diff] [blame] | 246 | // These are all inline functions on android, so they end up just being entirely |
| 247 | // missing on that platform. |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 248 | #[cfg(not(target_os = "android"))] |
| 249 | extern { |
| 250 | pub fn abs(i: c_int) -> c_int; |
| 251 | pub fn atof(s: *const c_char) -> c_double; |
| 252 | pub fn labs(i: c_long) -> c_long; |
| 253 | pub fn rand() -> c_int; |
| 254 | pub fn srand(seed: c_uint); |
| 255 | } |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 256 | |
| 257 | cfg_if! { |
| 258 | if #[cfg(windows)] { |
| 259 | mod windows; |
| 260 | pub use windows::*; |
| 261 | } else { |
| 262 | mod unix; |
| 263 | pub use unix::*; |
| 264 | } |
| 265 | } |