Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 1 | //! Definitions found commonly among almost all Unix derivatives |
| 2 | //! |
| 3 | //! More functions and definitions can be found in the more specific modules |
| 4 | //! according to the platform in question. |
| 5 | |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 6 | use dox::Option; |
| 7 | |
Alex Crichton | c674e37 | 2015-09-18 16:22:00 -0700 | [diff] [blame] | 8 | pub type pid_t = i32; |
| 9 | pub type uid_t = u32; |
| 10 | pub type gid_t = u32; |
| 11 | pub type in_addr_t = u32; |
| 12 | pub type in_port_t = u16; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 13 | pub type sighandler_t = ::size_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 14 | pub type cc_t = ::c_uchar; |
Alex Crichton | c674e37 | 2015-09-18 16:22:00 -0700 | [diff] [blame] | 15 | |
Alex Crichton | d6e07e2 | 2015-10-29 22:59:44 -0700 | [diff] [blame] | 16 | pub enum DIR {} |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 17 | pub enum locale_t {} |
Alex Crichton | d6e07e2 | 2015-10-29 22:59:44 -0700 | [diff] [blame] | 18 | |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 19 | s! { |
Knight | 263970d | 2016-07-31 16:58:17 +0800 | [diff] [blame] | 20 | pub struct group { |
| 21 | pub gr_name: *mut ::c_char, |
| 22 | pub gr_passwd: *mut ::c_char, |
| 23 | pub gr_gid: ::gid_t, |
| 24 | pub gr_mem: *mut *mut ::c_char, |
| 25 | } |
| 26 | |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 27 | pub struct utimbuf { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 28 | pub actime: time_t, |
| 29 | pub modtime: time_t, |
| 30 | } |
| 31 | |
| 32 | pub struct timeval { |
| 33 | pub tv_sec: time_t, |
| 34 | pub tv_usec: suseconds_t, |
| 35 | } |
| 36 | |
| 37 | pub struct timespec { |
| 38 | pub tv_sec: time_t, |
| 39 | pub tv_nsec: c_long, |
| 40 | } |
| 41 | |
| 42 | pub struct rlimit { |
| 43 | pub rlim_cur: rlim_t, |
| 44 | pub rlim_max: rlim_t, |
| 45 | } |
| 46 | |
| 47 | pub struct rusage { |
| 48 | pub ru_utime: timeval, |
| 49 | pub ru_stime: timeval, |
| 50 | pub ru_maxrss: c_long, |
| 51 | pub ru_ixrss: c_long, |
| 52 | pub ru_idrss: c_long, |
| 53 | pub ru_isrss: c_long, |
| 54 | pub ru_minflt: c_long, |
| 55 | pub ru_majflt: c_long, |
| 56 | pub ru_nswap: c_long, |
| 57 | pub ru_inblock: c_long, |
| 58 | pub ru_oublock: c_long, |
| 59 | pub ru_msgsnd: c_long, |
| 60 | pub ru_msgrcv: c_long, |
| 61 | pub ru_nsignals: c_long, |
| 62 | pub ru_nvcsw: c_long, |
Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 63 | pub ru_nivcsw: c_long, |
| 64 | |
Jorge Aparicio | 23a5092 | 2016-07-26 16:13:03 -0500 | [diff] [blame] | 65 | #[cfg(any(target_env = "musl"))] |
Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 66 | __reserved: [c_long; 16], |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 67 | } |
| 68 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 69 | #[cfg_attr(target_os = "netbsd", repr(packed))] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 70 | pub struct in_addr { |
| 71 | pub s_addr: in_addr_t, |
| 72 | } |
| 73 | |
| 74 | pub struct in6_addr { |
Alex Crichton | 316c367 | 2015-09-16 14:32:59 -0700 | [diff] [blame] | 75 | pub s6_addr: [u8; 16], |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 76 | __align: [u32; 0], |
| 77 | } |
| 78 | |
| 79 | pub struct ip_mreq { |
| 80 | pub imr_multiaddr: in_addr, |
| 81 | pub imr_interface: in_addr, |
| 82 | } |
Alex Crichton | d809601 | 2015-09-16 16:36:30 -0700 | [diff] [blame] | 83 | |
| 84 | pub struct ipv6_mreq { |
| 85 | pub ipv6mr_multiaddr: in6_addr, |
| 86 | #[cfg(target_os = "android")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 87 | pub ipv6mr_interface: ::c_int, |
Alex Crichton | 2482400 | 2015-09-16 17:34:54 -0700 | [diff] [blame] | 88 | #[cfg(not(target_os = "android"))] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 89 | pub ipv6mr_interface: ::c_uint, |
Alex Crichton | d809601 | 2015-09-16 16:36:30 -0700 | [diff] [blame] | 90 | } |
Alex Crichton | 88d23e7 | 2015-11-02 17:03:19 -0800 | [diff] [blame] | 91 | |
David Hotham | ccacbe8 | 2015-11-14 17:19:12 +0000 | [diff] [blame] | 92 | pub struct hostent { |
| 93 | pub h_name: *mut ::c_char, |
| 94 | pub h_aliases: *mut *mut ::c_char, |
| 95 | pub h_addrtype: ::c_int, |
| 96 | pub h_length: ::c_int, |
| 97 | pub h_addr_list: *mut *mut ::c_char, |
| 98 | } |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 99 | |
| 100 | pub struct iovec { |
| 101 | pub iov_base: *mut ::c_void, |
| 102 | pub iov_len: ::size_t, |
| 103 | } |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 104 | |
| 105 | pub struct pollfd { |
| 106 | pub fd: ::c_int, |
| 107 | pub events: ::c_short, |
| 108 | pub revents: ::c_short, |
| 109 | } |
Kamal Marhubi | 89a7700 | 2016-02-27 14:58:43 -0500 | [diff] [blame] | 110 | |
| 111 | pub struct winsize { |
| 112 | pub ws_row: ::c_ushort, |
| 113 | pub ws_col: ::c_ushort, |
| 114 | pub ws_xpixel: ::c_ushort, |
| 115 | pub ws_ypixel: ::c_ushort, |
| 116 | } |
sateffen | 69e89a1 | 2016-07-11 08:36:52 +0000 | [diff] [blame] | 117 | |
| 118 | pub struct linger { |
| 119 | pub l_onoff: ::c_int, |
| 120 | pub l_linger: ::c_int, |
| 121 | } |
Alan Somers | 9245e07 | 2016-11-13 13:52:34 -0700 | [diff] [blame] | 122 | |
| 123 | pub struct sigval { |
| 124 | // Actually a union of an int and a void* |
| 125 | pub sival_ptr: *mut ::c_void |
| 126 | } |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 129 | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
| 130 | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
| 131 | pub const SIG_ERR: sighandler_t = !0 as sighandler_t; |
| 132 | |
Alex Crichton | f811901 | 2015-12-02 10:30:29 -0800 | [diff] [blame] | 133 | pub const DT_FIFO: u8 = 1; |
| 134 | pub const DT_CHR: u8 = 2; |
| 135 | pub const DT_DIR: u8 = 4; |
| 136 | pub const DT_BLK: u8 = 6; |
| 137 | pub const DT_REG: u8 = 8; |
| 138 | pub const DT_LNK: u8 = 10; |
| 139 | pub const DT_SOCK: u8 = 12; |
| 140 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 141 | pub const FD_CLOEXEC: ::c_int = 0x1; |
| 142 | |
| 143 | pub const USRQUOTA: ::c_int = 0; |
| 144 | pub const GRPQUOTA: ::c_int = 1; |
| 145 | |
| 146 | pub const SIGIOT: ::c_int = 6; |
| 147 | |
| 148 | pub const S_ISUID: ::c_int = 0x800; |
| 149 | pub const S_ISGID: ::c_int = 0x400; |
| 150 | pub const S_ISVTX: ::c_int = 0x200; |
| 151 | |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 152 | pub const POLLIN: ::c_short = 0x1; |
| 153 | pub const POLLPRI: ::c_short = 0x2; |
| 154 | pub const POLLOUT: ::c_short = 0x4; |
| 155 | pub const POLLERR: ::c_short = 0x8; |
| 156 | pub const POLLHUP: ::c_short = 0x10; |
| 157 | pub const POLLNVAL: ::c_short = 0x20; |
| 158 | |
Kamal Marhubi | 0a5dcf0 | 2016-01-25 15:20:46 -0500 | [diff] [blame] | 159 | pub const IF_NAMESIZE: ::size_t = 16; |
| 160 | |
Alex Crichton | 29de598 | 2016-02-04 13:48:13 -0800 | [diff] [blame] | 161 | pub const RTLD_LAZY: ::c_int = 0x1; |
| 162 | |
Raphael Cohn | 7e0dbc3 | 2016-05-04 11:47:02 +0100 | [diff] [blame] | 163 | pub const LOG_EMERG: ::c_int = 0; |
| 164 | pub const LOG_ALERT: ::c_int = 1; |
| 165 | pub const LOG_CRIT: ::c_int = 2; |
| 166 | pub const LOG_ERR: ::c_int = 3; |
| 167 | pub const LOG_WARNING: ::c_int = 4; |
| 168 | pub const LOG_NOTICE: ::c_int = 5; |
| 169 | pub const LOG_INFO: ::c_int = 6; |
| 170 | pub const LOG_DEBUG: ::c_int = 7; |
| 171 | |
| 172 | pub const LOG_KERN: ::c_int = 0; |
| 173 | pub const LOG_USER: ::c_int = 1 << 3; |
| 174 | pub const LOG_MAIL: ::c_int = 2 << 3; |
| 175 | pub const LOG_DAEMON: ::c_int = 3 << 3; |
| 176 | pub const LOG_AUTH: ::c_int = 4 << 3; |
| 177 | pub const LOG_SYSLOG: ::c_int = 5 << 3; |
| 178 | pub const LOG_LPR: ::c_int = 6 << 3; |
| 179 | pub const LOG_NEWS: ::c_int = 7 << 3; |
| 180 | pub const LOG_UUCP: ::c_int = 8 << 3; |
Raphael Cohn | 7e0dbc3 | 2016-05-04 11:47:02 +0100 | [diff] [blame] | 181 | pub const LOG_LOCAL0: ::c_int = 16 << 3; |
| 182 | pub const LOG_LOCAL1: ::c_int = 17 << 3; |
| 183 | pub const LOG_LOCAL2: ::c_int = 18 << 3; |
| 184 | pub const LOG_LOCAL3: ::c_int = 19 << 3; |
| 185 | pub const LOG_LOCAL4: ::c_int = 20 << 3; |
| 186 | pub const LOG_LOCAL5: ::c_int = 21 << 3; |
| 187 | pub const LOG_LOCAL6: ::c_int = 22 << 3; |
| 188 | pub const LOG_LOCAL7: ::c_int = 23 << 3; |
| 189 | |
| 190 | pub const LOG_PID: ::c_int = 0x01; |
| 191 | pub const LOG_CONS: ::c_int = 0x02; |
| 192 | pub const LOG_ODELAY: ::c_int = 0x04; |
| 193 | pub const LOG_NDELAY: ::c_int = 0x08; |
| 194 | pub const LOG_NOWAIT: ::c_int = 0x10; |
Raphael Cohn | 7e0dbc3 | 2016-05-04 11:47:02 +0100 | [diff] [blame] | 195 | |
| 196 | pub const LOG_PRIMASK: ::c_int = 7; |
Raphael Cohn | 7e0dbc3 | 2016-05-04 11:47:02 +0100 | [diff] [blame] | 197 | pub const LOG_FACMASK: ::c_int = 0x3f8; |
| 198 | |
Raphael Cohn | fabef1d | 2016-05-19 14:28:40 +0100 | [diff] [blame] | 199 | pub const PRIO_PROCESS: ::c_int = 0; |
| 200 | pub const PRIO_PGRP: ::c_int = 1; |
| 201 | pub const PRIO_USER: ::c_int = 2; |
| 202 | |
| 203 | pub const PRIO_MIN: ::c_int = -20; |
| 204 | pub const PRIO_MAX: ::c_int = 20; |
| 205 | |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 206 | cfg_if! { |
Alex Crichton | a28ec43 | 2016-04-01 10:43:06 -0700 | [diff] [blame] | 207 | if #[cfg(dox)] { |
| 208 | // on dox builds don't pull in anything |
| 209 | } else if #[cfg(all(not(stdbuild), feature = "use_std"))] { |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 210 | // cargo build, don't pull in anything extra as the libstd dep |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 211 | // already pulls in all libs. |
Jorge Aparicio | 23a5092 | 2016-07-26 16:13:03 -0500 | [diff] [blame] | 212 | } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { |
Alex Crichton | f9323d1 | 2016-10-31 16:44:29 -0700 | [diff] [blame] | 213 | #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))] |
| 214 | #[link(name = "c", cfg(not(target_feature = "crt-static")))] |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 215 | extern {} |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 216 | } else if #[cfg(target_os = "emscripten")] { |
| 217 | #[link(name = "c")] |
| 218 | extern {} |
Alex Crichton | dfd196e | 2016-04-11 10:16:45 -0700 | [diff] [blame] | 219 | } else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] { |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 220 | // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled |
| 221 | // in automatically by the linker. We avoid passing it explicitly, as it |
Sebastian Wicki | 37d4bb9 | 2016-02-27 14:27:10 +0100 | [diff] [blame] | 222 | // causes some versions of binutils to crash with an assertion failure. |
| 223 | #[link(name = "m")] |
| 224 | extern {} |
Alex Crichton | 0c8e61a | 2015-11-22 10:14:13 -0800 | [diff] [blame] | 225 | } else if #[cfg(any(target_os = "macos", |
| 226 | target_os = "ios", |
Sébastien Marie | b83e43b | 2015-11-26 19:54:24 +0100 | [diff] [blame] | 227 | target_os = "android", |
| 228 | target_os = "openbsd", |
| 229 | target_os = "bitrig"))] { |
Alex Crichton | 68a5c44 | 2015-11-20 09:28:12 -0800 | [diff] [blame] | 230 | #[link(name = "c")] |
| 231 | #[link(name = "m")] |
| 232 | extern {} |
Niels Sascha Reedijk | a3ff955 | 2016-02-02 21:21:36 +0100 | [diff] [blame] | 233 | } else if #[cfg(target_os = "haiku")] { |
| 234 | #[link(name = "root")] |
| 235 | #[link(name = "network")] |
| 236 | extern {} |
Raph Levien | 517e86d | 2016-10-11 15:26:47 -0700 | [diff] [blame] | 237 | } else if #[cfg(target_os = "fuchsia")] { |
| 238 | #[link(name = "c")] |
| 239 | #[link(name = "mxio")] |
Raph Levien | 517e86d | 2016-10-11 15:26:47 -0700 | [diff] [blame] | 240 | extern {} |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 241 | } else { |
| 242 | #[link(name = "c")] |
| 243 | #[link(name = "m")] |
Alex Crichton | 68a5c44 | 2015-11-20 09:28:12 -0800 | [diff] [blame] | 244 | #[link(name = "rt")] |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 245 | extern {} |
| 246 | } |
| 247 | } |
| 248 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 249 | extern { |
Knight | 263970d | 2016-07-31 16:58:17 +0800 | [diff] [blame] | 250 | pub fn getgrnam(name: *const ::c_char) -> *mut group; |
| 251 | pub fn getgrgid(gid: ::gid_t) -> *mut group; |
| 252 | |
Knight | 19fb32a | 2016-07-31 17:00:15 +0800 | [diff] [blame] | 253 | pub fn endpwent(); |
| 254 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] |
| 255 | pub fn getpwnam(name: *const ::c_char) -> *mut passwd; |
| 256 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] |
| 257 | pub fn getpwuid(uid: ::uid_t) -> *mut passwd; |
| 258 | |
bluss | 1ebfe63 | 2016-04-13 18:44:56 +0200 | [diff] [blame] | 259 | pub fn fprintf(stream: *mut ::FILE, |
| 260 | format: *const ::c_char, ...) -> ::c_int; |
bluss | 9111f24 | 2016-04-13 18:13:13 +0200 | [diff] [blame] | 261 | pub fn printf(format: *const ::c_char, ...) -> ::c_int; |
| 262 | pub fn snprintf(s: *mut ::c_char, n: ::size_t, |
| 263 | format: *const ::c_char, ...) -> ::c_int; |
| 264 | pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; |
| 265 | pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; |
| 266 | pub fn scanf(format: *const ::c_char, ...) -> ::c_int; |
| 267 | pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; |
Martin Muñoz | 5ec7715 | 2016-09-25 16:31:30 -0400 | [diff] [blame] | 268 | pub fn getchar_unlocked() -> ::c_int; |
| 269 | pub fn putchar_unlocked(c: ::c_int) -> ::c_int; |
bluss | 9111f24 | 2016-04-13 18:13:13 +0200 | [diff] [blame] | 270 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 271 | #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 272 | pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 273 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 274 | link_name = "connect$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 275 | pub fn connect(socket: ::c_int, address: *const sockaddr, |
| 276 | len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 277 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 278 | link_name = "bind$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 279 | pub fn bind(socket: ::c_int, address: *const sockaddr, |
| 280 | address_len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 281 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 282 | link_name = "listen$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 283 | pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 284 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 285 | link_name = "accept$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 286 | pub fn accept(socket: ::c_int, address: *mut sockaddr, |
| 287 | address_len: *mut socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 288 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 289 | link_name = "getpeername$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 290 | pub fn getpeername(socket: ::c_int, address: *mut sockaddr, |
| 291 | address_len: *mut socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 292 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 293 | link_name = "getsockname$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 294 | pub fn getsockname(socket: ::c_int, address: *mut sockaddr, |
| 295 | address_len: *mut socklen_t) -> ::c_int; |
| 296 | pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 297 | value: *const ::c_void, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 298 | option_len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 299 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Steven Fackler | e6c00c2 | 2015-11-03 21:10:08 -0800 | [diff] [blame] | 300 | link_name = "socketpair$UNIX2003")] |
| 301 | pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int, |
| 302 | socket_vector: *mut ::c_int) -> ::c_int; |
| 303 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 304 | link_name = "sendto$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 305 | pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, |
| 306 | flags: ::c_int, addr: *const sockaddr, |
| 307 | addrlen: socklen_t) -> ::ssize_t; |
| 308 | pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 309 | |
| 310 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 311 | link_name = "chmod$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 312 | pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 313 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 314 | link_name = "fchmod$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 315 | pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 316 | |
| 317 | #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 318 | #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 319 | pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 320 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 321 | pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 322 | |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 323 | #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 324 | #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 325 | pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 326 | |
| 327 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 328 | link_name = "popen$UNIX2003")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 329 | pub fn popen(command: *const c_char, |
| 330 | mode: *const c_char) -> *mut ::FILE; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 331 | pub fn pclose(stream: *mut ::FILE) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 332 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 333 | link_name = "fdopen$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 334 | pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; |
| 335 | pub fn fileno(stream: *mut ::FILE) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 336 | |
| 337 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 338 | link_name = "open$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 339 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 340 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 341 | link_name = "creat$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 342 | pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 343 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 344 | link_name = "fcntl$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 345 | pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 346 | |
| 347 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 348 | link_name = "opendir$INODE64")] |
| 349 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 350 | link_name = "opendir$INODE64$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 351 | #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 352 | pub fn opendir(dirname: *const c_char) -> *mut ::DIR; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 353 | #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 354 | #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 355 | pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 356 | result: *mut *mut ::dirent) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 357 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 358 | link_name = "closedir$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 359 | pub fn closedir(dirp: *mut ::DIR) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 360 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 361 | link_name = "rewinddir$INODE64")] |
| 362 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 363 | link_name = "rewinddir$INODE64$UNIX2003")] |
| 364 | pub fn rewinddir(dirp: *mut ::DIR); |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 365 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 366 | pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; |
| 367 | pub fn alarm(seconds: ::c_uint) -> ::c_uint; |
| 368 | pub fn chdir(dir: *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 369 | pub fn chown(path: *const c_char, uid: uid_t, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 370 | gid: gid_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 371 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Knight | e383ee7 | 2016-06-22 16:53:14 +0800 | [diff] [blame] | 372 | link_name = "lchown$UNIX2003")] |
| 373 | pub fn lchown(path: *const c_char, uid: uid_t, |
| 374 | gid: gid_t) -> ::c_int; |
| 375 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 376 | link_name = "close$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 377 | pub fn close(fd: ::c_int) -> ::c_int; |
| 378 | pub fn dup(fd: ::c_int) -> ::c_int; |
| 379 | pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; |
Philipp Keller | da3774f | 2016-12-28 14:22:47 +0100 | [diff] [blame^] | 380 | pub fn execl(path: *const c_char, |
| 381 | arg0: *const c_char, ...) -> ::c_int; |
| 382 | pub fn execle(path: *const ::c_char, |
| 383 | arg0: *const ::c_char, ...) -> ::c_int; |
| 384 | pub fn execlp(file: *const ::c_char, |
| 385 | arg0: *const ::c_char, ...) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 386 | pub fn execv(prog: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 387 | argv: *const *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 388 | pub fn execve(prog: *const c_char, argv: *const *const c_char, |
| 389 | envp: *const *const c_char) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 390 | -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 391 | pub fn execvp(c: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 392 | argv: *const *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 393 | pub fn fork() -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 394 | pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; |
| 395 | pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 396 | pub fn getegid() -> gid_t; |
| 397 | pub fn geteuid() -> uid_t; |
| 398 | pub fn getgid() -> gid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 399 | pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) |
| 400 | -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 401 | pub fn getlogin() -> *mut c_char; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 402 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 403 | link_name = "getopt$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 404 | pub fn getopt(argc: ::c_int, argv: *const *mut c_char, |
| 405 | optstr: *const c_char) -> ::c_int; |
Corey Farwell | 68dba7a | 2016-08-03 08:21:45 -0400 | [diff] [blame] | 406 | pub fn getpgid(pid: pid_t) -> pid_t; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 407 | pub fn getpgrp() -> pid_t; |
| 408 | pub fn getpid() -> pid_t; |
| 409 | pub fn getppid() -> pid_t; |
| 410 | pub fn getuid() -> uid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 411 | pub fn isatty(fd: ::c_int) -> ::c_int; |
| 412 | pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 413 | pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 414 | pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 415 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 416 | link_name = "pause$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 417 | pub fn pause() -> ::c_int; |
| 418 | pub fn pipe(fds: *mut ::c_int) -> ::c_int; |
Tamir Duberstein | 0b102fd | 2016-01-06 18:16:05 -0500 | [diff] [blame] | 419 | pub fn posix_memalign(memptr: *mut *mut ::c_void, |
| 420 | align: ::size_t, |
| 421 | size: ::size_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 422 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 423 | link_name = "read$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 424 | pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) |
| 425 | -> ::ssize_t; |
| 426 | pub fn rmdir(path: *const c_char) -> ::c_int; |
| 427 | pub fn setgid(gid: gid_t) -> ::c_int; |
| 428 | pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 429 | pub fn setsid() -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 430 | pub fn setuid(uid: uid_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 431 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 432 | link_name = "sleep$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 433 | pub fn sleep(secs: ::c_uint) -> ::c_uint; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 434 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 435 | link_name = "nanosleep$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 436 | #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 437 | pub fn nanosleep(rqtp: *const timespec, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 438 | rmtp: *mut timespec) -> ::c_int; |
| 439 | pub fn tcgetpgrp(fd: ::c_int) -> pid_t; |
zethra | c21a30c | 2016-10-27 16:01:18 -0400 | [diff] [blame] | 440 | pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 441 | pub fn ttyname(fd: ::c_int) -> *mut c_char; |
| 442 | pub fn unlink(c: *const c_char) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 443 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 444 | link_name = "wait$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 445 | pub fn wait(status: *mut ::c_int) -> pid_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 446 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 447 | link_name = "waitpid$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 448 | pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 449 | -> pid_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 450 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 451 | link_name = "write$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 452 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) |
| 453 | -> ::ssize_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 454 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 455 | link_name = "pread$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 456 | pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, |
| 457 | offset: off_t) -> ::ssize_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 458 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 459 | link_name = "pwrite$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 460 | pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, |
| 461 | offset: off_t) -> ::ssize_t; |
Andy Caldwell | dd54f29 | 2015-11-30 00:24:15 +0000 | [diff] [blame] | 462 | pub fn umask(mask: mode_t) -> mode_t; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 463 | |
| 464 | #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 465 | pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 466 | |
| 467 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 468 | link_name = "kill$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 469 | pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 470 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 471 | pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
| 472 | pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
| 473 | pub fn mlockall(flags: ::c_int) -> ::c_int; |
| 474 | pub fn munlockall() -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 475 | |
| 476 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 477 | link_name = "mmap$UNIX2003")] |
| 478 | pub fn mmap(addr: *mut ::c_void, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 479 | len: ::size_t, |
| 480 | prot: ::c_int, |
| 481 | flags: ::c_int, |
| 482 | fd: ::c_int, |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 483 | offset: off_t) |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 484 | -> *mut ::c_void; |
| 485 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 486 | link_name = "munmap$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 487 | pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 488 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 489 | pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 490 | pub fn if_indextoname(ifindex: ::c_uint, |
| 491 | ifname: *mut ::c_char) -> *mut ::c_char; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 492 | |
| 493 | #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 494 | #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 495 | pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 496 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 497 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 498 | link_name = "fsync$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 499 | pub fn fsync(fd: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 500 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 501 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 502 | link_name = "setenv$UNIX2003")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 503 | pub fn setenv(name: *const c_char, val: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 504 | overwrite: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 505 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 506 | link_name = "unsetenv$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 507 | #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 508 | pub fn unsetenv(name: *const c_char) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 509 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 510 | pub fn symlink(path1: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 511 | path2: *const c_char) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 512 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 513 | pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 514 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 515 | pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 516 | |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 517 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 518 | link_name = "getrlimit$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 519 | pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 520 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 521 | link_name = "setrlimit$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 522 | pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 523 | #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 524 | pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 525 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 526 | pub fn getdtablesize() -> ::c_int; |
Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 527 | #[cfg_attr(any(target_os = "macos", target_os = "ios"), |
| 528 | link_name = "realpath$DARWIN_EXTSN")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 529 | pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) |
| 530 | -> *mut ::c_char; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 531 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 532 | pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 533 | |
Jason Travis Smith | 270c7d4 | 2016-02-06 05:46:41 -0500 | [diff] [blame] | 534 | #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 535 | pub fn gettimeofday(tp: *mut ::timeval, |
| 536 | tz: *mut ::c_void) -> ::c_int; |
| 537 | |
| 538 | pub fn pthread_self() -> ::pthread_t; |
| 539 | pub fn pthread_create(native: *mut ::pthread_t, |
| 540 | attr: *const ::pthread_attr_t, |
| 541 | f: extern fn(*mut ::c_void) -> *mut ::c_void, |
| 542 | value: *mut ::c_void) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 543 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 544 | link_name = "pthread_join$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 545 | pub fn pthread_join(native: ::pthread_t, |
| 546 | value: *mut *mut ::c_void) -> ::c_int; |
| 547 | pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; |
| 548 | pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; |
| 549 | pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, |
| 550 | stack_size: ::size_t) -> ::c_int; |
| 551 | pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, |
| 552 | state: ::c_int) -> ::c_int; |
| 553 | pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 554 | #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 555 | pub fn sched_yield() -> ::c_int; |
| 556 | pub fn pthread_key_create(key: *mut pthread_key_t, |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 557 | dtor: Option<unsafe extern fn(*mut ::c_void)>) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 558 | -> ::c_int; |
| 559 | pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 560 | pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; |
| 561 | pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 562 | -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 563 | pub fn pthread_mutex_init(lock: *mut pthread_mutex_t, |
| 564 | attr: *const pthread_mutexattr_t) -> ::c_int; |
| 565 | pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; |
| 566 | pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 567 | pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 568 | pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 569 | |
| 570 | pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 571 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 572 | link_name = "pthread_mutexattr_destroy$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 573 | pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; |
| 574 | pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, |
| 575 | _type: ::c_int) -> ::c_int; |
| 576 | |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 577 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Tomasz MiÄ…sko | cb64485 | 2016-07-20 07:31:48 +0200 | [diff] [blame] | 578 | link_name = "pthread_cond_init$UNIX2003")] |
| 579 | pub fn pthread_cond_init(cond: *mut pthread_cond_t, |
| 580 | attr: *const pthread_condattr_t) -> ::c_int; |
| 581 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 582 | link_name = "pthread_cond_wait$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 583 | pub fn pthread_cond_wait(cond: *mut pthread_cond_t, |
| 584 | lock: *mut pthread_mutex_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 585 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 586 | link_name = "pthread_cond_timedwait$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 587 | pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t, |
| 588 | lock: *mut pthread_mutex_t, |
| 589 | abstime: *const ::timespec) -> ::c_int; |
| 590 | pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; |
| 591 | pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; |
| 592 | pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; |
Tomasz MiÄ…sko | cb64485 | 2016-07-20 07:31:48 +0200 | [diff] [blame] | 593 | pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; |
| 594 | pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 595 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 596 | link_name = "pthread_rwlock_destroy$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 597 | pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 598 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 599 | link_name = "pthread_rwlock_rdlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 600 | pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 601 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 602 | link_name = "pthread_rwlock_tryrdlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 603 | pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 604 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 605 | link_name = "pthread_rwlock_wrlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 606 | pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 607 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 608 | link_name = "pthread_rwlock_trywrlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 609 | pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 610 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 611 | link_name = "pthread_rwlock_unlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 612 | pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 613 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 614 | link_name = "pthread_sigmask$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 615 | pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, |
| 616 | oldset: *mut sigset_t) -> ::c_int; |
Tomasz MiÄ…sko | b0b3370 | 2016-02-15 11:00:11 +0100 | [diff] [blame] | 617 | pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; |
NODA, Kai | 75a69bf | 2016-04-03 20:59:44 +0800 | [diff] [blame] | 618 | #[cfg_attr(all(target_os = "linux", not(target_env = "musl")), |
| 619 | link_name = "__xpg_strerror_r")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 620 | pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, |
| 621 | buflen: ::size_t) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 622 | |
| 623 | pub fn getsockopt(sockfd: ::c_int, |
| 624 | level: ::c_int, |
| 625 | optname: ::c_int, |
| 626 | optval: *mut ::c_void, |
| 627 | optlen: *mut ::socklen_t) -> ::c_int; |
| 628 | pub fn raise(signum: ::c_int) -> ::c_int; |
Sebastian Wicki | b7c3e5c | 2016-02-26 21:58:19 +0100 | [diff] [blame] | 629 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 630 | pub fn sigaction(signum: ::c_int, |
| 631 | act: *const sigaction, |
| 632 | oldact: *mut sigaction) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 633 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 634 | link_name = "sigaltstack$UNIX2003")] |
Sebastian Wicki | b7c3e5c | 2016-02-26 21:58:19 +0100 | [diff] [blame] | 635 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 636 | pub fn sigaltstack(ss: *const stack_t, |
| 637 | oss: *mut stack_t) -> ::c_int; |
Philipp Matthias Schaefer | c1982a4 | 2016-02-28 16:06:45 +0100 | [diff] [blame] | 638 | #[cfg_attr(all(target_os = "macos", target_arch ="x86"), |
| 639 | link_name = "sigwait$UNIX2003")] |
| 640 | pub fn sigwait(set: *const sigset_t, |
| 641 | sig: *mut ::c_int) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 642 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 643 | #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 644 | pub fn utimes(filename: *const ::c_char, |
| 645 | times: *const ::timeval) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 646 | pub fn dlopen(filename: *const ::c_char, |
| 647 | flag: ::c_int) -> *mut ::c_void; |
| 648 | pub fn dlerror() -> *mut ::c_char; |
| 649 | pub fn dlsym(handle: *mut ::c_void, |
| 650 | symbol: *const ::c_char) -> *mut ::c_void; |
| 651 | pub fn dlclose(handle: *mut ::c_void) -> ::c_int; |
Alex Crichton | 88d23e7 | 2015-11-02 17:03:19 -0800 | [diff] [blame] | 652 | pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; |
Alex Crichton | b9096d3 | 2015-11-03 10:08:44 -0800 | [diff] [blame] | 653 | |
| 654 | pub fn getaddrinfo(node: *const c_char, |
| 655 | service: *const c_char, |
| 656 | hints: *const addrinfo, |
| 657 | res: *mut *mut addrinfo) -> ::c_int; |
| 658 | pub fn freeaddrinfo(res: *mut addrinfo); |
| 659 | pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 660 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 661 | #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 662 | pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 663 | #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 664 | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
| 665 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 666 | link_name = "mktime$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 667 | #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 668 | pub fn mktime(tm: *mut tm) -> time_t; |
Philipp Keller | a77ea86 | 2016-09-23 22:00:18 +0200 | [diff] [blame] | 669 | #[cfg_attr(target_os = "netbsd", link_name = "__time50")] |
| 670 | pub fn time(time: *mut time_t) -> time_t; |
| 671 | #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] |
| 672 | pub fn localtime(time: *const time_t) -> *mut tm; |
Philipp Keller | a77ea86 | 2016-09-23 22:00:18 +0200 | [diff] [blame] | 673 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 674 | #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] |
| 675 | pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, |
| 676 | dev: ::dev_t) -> ::c_int; |
| 677 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 678 | link_name = "writev$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 679 | pub fn writev(fd: ::c_int, |
| 680 | iov: *const ::iovec, |
| 681 | iovcnt: ::c_int) -> ::ssize_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 682 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 683 | link_name = "readv$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 684 | pub fn readv(fd: ::c_int, |
| 685 | iov: *const ::iovec, |
| 686 | iovcnt: ::c_int) -> ::ssize_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 687 | pub fn uname(buf: *mut ::utsname) -> ::c_int; |
| 688 | pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; |
| 689 | pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; |
| 690 | pub fn chroot(name: *const ::c_char) -> ::c_int; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 691 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 692 | link_name = "usleep$UNIX2003")] |
| 693 | pub fn usleep(secs: ::c_uint) -> ::c_int; |
| 694 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 695 | link_name = "send$UNIX2003")] |
| 696 | pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, |
| 697 | flags: ::c_int) -> ::ssize_t; |
| 698 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 699 | link_name = "recv$UNIX2003")] |
| 700 | pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, |
| 701 | flags: ::c_int) -> ::ssize_t; |
| 702 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 703 | link_name = "putenv$UNIX2003")] |
| 704 | #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] |
| 705 | pub fn putenv(string: *mut c_char) -> ::c_int; |
| 706 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 707 | link_name = "sendmsg$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 708 | pub fn sendmsg(fd: ::c_int, |
| 709 | msg: *const msghdr, |
| 710 | flags: ::c_int) -> ::ssize_t; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 711 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 712 | link_name = "recvmsg$UNIX2003")] |
| 713 | pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t; |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 714 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 715 | link_name = "poll$UNIX2003")] |
| 716 | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; |
Alex Crichton | 993ea7e | 2016-03-01 13:23:53 -0800 | [diff] [blame] | 717 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 718 | link_name = "select$1050")] |
| 719 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 720 | link_name = "select$UNIX2003")] |
| 721 | #[cfg_attr(target_os = "netbsd", link_name = "__select50")] |
| 722 | pub fn select(nfds: ::c_int, |
| 723 | readfs: *mut fd_set, |
| 724 | writefds: *mut fd_set, |
| 725 | errorfds: *mut fd_set, |
| 726 | timeout: *mut timeval) -> ::c_int; |
A.J. Gardner | 5399c89 | 2016-03-30 23:09:25 -0500 | [diff] [blame] | 727 | #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] |
A.J. Gardner | 2bd6f12 | 2016-03-30 00:55:49 -0500 | [diff] [blame] | 728 | pub fn setlocale(category: ::c_int, |
| 729 | locale: *const ::c_char) -> *mut ::c_char; |
A.J. Gardner | 110152c | 2016-03-30 00:36:43 -0500 | [diff] [blame] | 730 | pub fn localeconv() -> *mut lconv; |
Steven Fackler | 41699f7 | 2016-06-03 21:02:56 -0700 | [diff] [blame] | 731 | |
| 732 | pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; |
| 733 | pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; |
| 734 | pub fn sem_close(sem: *mut sem_t) -> ::c_int; |
| 735 | pub fn sem_unlink(name: *const ::c_char) -> ::c_int; |
| 736 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 737 | link_name = "sem_wait$UNIX2003")] |
| 738 | pub fn sem_wait(sem: *mut sem_t) -> ::c_int; |
| 739 | pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; |
| 740 | pub fn sem_post(sem: *mut sem_t) -> ::c_int; |
| 741 | pub fn sem_init(sem: *mut sem_t, |
| 742 | pshared: ::c_int, |
| 743 | value: ::c_uint) |
| 744 | -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 745 | } |
| 746 | |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 747 | // TODO: get rid of this cfg(not(...)) |
| 748 | #[cfg(not(target_os = "android"))] // " if " -- appease style checker |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 749 | extern { |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 750 | #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 751 | #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 752 | pub fn glob(pattern: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 753 | flags: ::c_int, |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 754 | errfunc: Option<extern fn(epath: *const c_char, |
| 755 | errno: ::c_int) -> ::c_int>, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 756 | pglob: *mut glob_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 757 | #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 758 | pub fn globfree(pglob: *mut glob_t); |
| 759 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 760 | pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 761 | -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 762 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 763 | pub fn shm_unlink(name: *const c_char) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 764 | |
| 765 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 766 | link_name = "seekdir$INODE64")] |
| 767 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 768 | link_name = "seekdir$INODE64$UNIX2003")] |
| 769 | pub fn seekdir(dirp: *mut ::DIR, loc: c_long); |
| 770 | |
| 771 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 772 | link_name = "telldir$INODE64")] |
| 773 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 774 | link_name = "telldir$INODE64$UNIX2003")] |
| 775 | pub fn telldir(dirp: *mut ::DIR) -> c_long; |
| 776 | |
| 777 | pub fn getsid(pid: pid_t) -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 778 | pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 779 | -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 780 | pub fn readlink(path: *const c_char, |
| 781 | buf: *mut c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 782 | bufsz: ::size_t) |
| 783 | -> ::ssize_t; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 784 | |
| 785 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 786 | link_name = "msync$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 787 | #[cfg_attr(target_os = "netbsd", link_name = "__msync13")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 788 | pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; |
| 789 | pub fn sysconf(name: ::c_int) -> c_long; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 790 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 791 | link_name = "recvfrom$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 792 | pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, |
| 793 | flags: ::c_int, addr: *mut sockaddr, |
| 794 | addrlen: *mut socklen_t) -> ::ssize_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 795 | pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 796 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 797 | #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 798 | pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 799 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 800 | pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 801 | #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 802 | pub fn sigfillset(set: *mut sigset_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 803 | #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 804 | pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 805 | #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 806 | pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 807 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 808 | link_name = "pselect$1050")] |
| 809 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 810 | link_name = "pselect$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 811 | #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")] |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 812 | pub fn pselect(nfds: ::c_int, |
| 813 | readfs: *mut fd_set, |
| 814 | writefds: *mut fd_set, |
| 815 | errorfds: *mut fd_set, |
| 816 | timeout: *const timespec, |
| 817 | sigmask: *const sigset_t) -> ::c_int; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 818 | pub fn fseeko(stream: *mut ::FILE, |
| 819 | offset: ::off_t, |
| 820 | whence: ::c_int) -> ::c_int; |
| 821 | pub fn ftello(stream: *mut ::FILE) -> ::off_t; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 822 | #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 823 | pub fn timegm(tm: *mut ::tm) -> time_t; |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 824 | pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; |
| 825 | pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 826 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 827 | link_name = "tcdrain$UNIX2003")] |
| 828 | pub fn tcdrain(fd: ::c_int) -> ::c_int; |
| 829 | pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; |
| 830 | pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; |
| 831 | pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
| 832 | pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
| 833 | pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; |
| 834 | pub fn tcsetattr(fd: ::c_int, |
| 835 | optional_actions: ::c_int, |
| 836 | termios: *const ::termios) -> ::c_int; |
| 837 | pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; |
| 838 | pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; |
| 839 | pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; |
Kamal Marhubi | 511a780 | 2016-02-15 00:40:19 -0500 | [diff] [blame] | 840 | pub fn mkstemp(template: *mut ::c_char) -> ::c_int; |
| 841 | pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; |
| 842 | pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; |
Alex Crichton | 87d0076 | 2016-02-29 21:12:44 -0800 | [diff] [blame] | 843 | pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; |
A.J. Gardner | 24c84f1 | 2016-03-31 20:08:03 -0500 | [diff] [blame] | 844 | pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; |
Raphael Cohn | 7e0dbc3 | 2016-05-04 11:47:02 +0100 | [diff] [blame] | 845 | |
| 846 | pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); |
| 847 | pub fn closelog(); |
| 848 | pub fn setlogmask(maskpri: ::c_int) -> ::c_int; |
| 849 | pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); |
Raphael Cohn | fabef1d | 2016-05-19 14:28:40 +0100 | [diff] [blame] | 850 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 851 | link_name = "nice$UNIX2003")] |
| 852 | pub fn nice(incr: ::c_int) -> ::c_int; |
Robbie Harwood | b9f5c46 | 2016-10-18 20:50:11 -0400 | [diff] [blame] | 853 | |
Robbie Harwood | b9f5c46 | 2016-10-18 20:50:11 -0400 | [diff] [blame] | 854 | pub fn grantpt(fd: ::c_int) -> ::c_int; |
| 855 | pub fn posix_openpt(flags: ::c_int) -> ::c_int; |
| 856 | pub fn ptsname(fd: ::c_int) -> *mut ::c_char; |
Robbie Harwood | b9f5c46 | 2016-10-18 20:50:11 -0400 | [diff] [blame] | 857 | pub fn unlockpt(fd: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 858 | } |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 859 | |
| 860 | cfg_if! { |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 861 | if #[cfg(any(target_os = "linux", |
| 862 | target_os = "android", |
Raph Levien | 517e86d | 2016-10-11 15:26:47 -0700 | [diff] [blame] | 863 | target_os = "emscripten", |
| 864 | target_os = "fuchsia"))] { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 865 | mod notbsd; |
| 866 | pub use self::notbsd::*; |
| 867 | } else if #[cfg(any(target_os = "macos", |
Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 868 | target_os = "ios", |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 869 | target_os = "freebsd", |
| 870 | target_os = "dragonfly", |
| 871 | target_os = "openbsd", |
| 872 | target_os = "netbsd", |
| 873 | target_os = "bitrig"))] { |
| 874 | mod bsd; |
| 875 | pub use self::bsd::*; |
Nikita Baksalyar | 702814f | 2016-01-28 10:30:54 +0300 | [diff] [blame] | 876 | } else if #[cfg(target_os = "solaris")] { |
| 877 | mod solaris; |
| 878 | pub use self::solaris::*; |
Niels Sascha Reedijk | a3ff955 | 2016-02-02 21:21:36 +0100 | [diff] [blame] | 879 | } else if #[cfg(target_os = "haiku")] { |
| 880 | mod haiku; |
| 881 | pub use self::haiku::*; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 882 | } else { |
Kamal Marhubi | 66c3375 | 2016-03-10 15:07:32 -0500 | [diff] [blame] | 883 | // Unknown target_os |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 884 | } |
| 885 | } |