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 {} |
| 17 | |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 18 | s! { |
| 19 | pub struct utimbuf { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 20 | pub actime: time_t, |
| 21 | pub modtime: time_t, |
| 22 | } |
| 23 | |
| 24 | pub struct timeval { |
| 25 | pub tv_sec: time_t, |
| 26 | pub tv_usec: suseconds_t, |
| 27 | } |
| 28 | |
| 29 | pub struct timespec { |
| 30 | pub tv_sec: time_t, |
| 31 | pub tv_nsec: c_long, |
| 32 | } |
| 33 | |
| 34 | pub struct rlimit { |
| 35 | pub rlim_cur: rlim_t, |
| 36 | pub rlim_max: rlim_t, |
| 37 | } |
| 38 | |
| 39 | pub struct rusage { |
| 40 | pub ru_utime: timeval, |
| 41 | pub ru_stime: timeval, |
| 42 | pub ru_maxrss: c_long, |
| 43 | pub ru_ixrss: c_long, |
| 44 | pub ru_idrss: c_long, |
| 45 | pub ru_isrss: c_long, |
| 46 | pub ru_minflt: c_long, |
| 47 | pub ru_majflt: c_long, |
| 48 | pub ru_nswap: c_long, |
| 49 | pub ru_inblock: c_long, |
| 50 | pub ru_oublock: c_long, |
| 51 | pub ru_msgsnd: c_long, |
| 52 | pub ru_msgrcv: c_long, |
| 53 | pub ru_nsignals: c_long, |
| 54 | pub ru_nvcsw: c_long, |
Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 55 | pub ru_nivcsw: c_long, |
| 56 | |
| 57 | #[cfg(target_env = "musl")] |
| 58 | __reserved: [c_long; 16], |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 61 | #[cfg_attr(target_os = "netbsd", repr(packed))] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 62 | pub struct in_addr { |
| 63 | pub s_addr: in_addr_t, |
| 64 | } |
| 65 | |
| 66 | pub struct in6_addr { |
Alex Crichton | 316c367 | 2015-09-16 14:32:59 -0700 | [diff] [blame] | 67 | pub s6_addr: [u8; 16], |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 68 | __align: [u32; 0], |
| 69 | } |
| 70 | |
| 71 | pub struct ip_mreq { |
| 72 | pub imr_multiaddr: in_addr, |
| 73 | pub imr_interface: in_addr, |
| 74 | } |
Alex Crichton | d809601 | 2015-09-16 16:36:30 -0700 | [diff] [blame] | 75 | |
| 76 | pub struct ipv6_mreq { |
| 77 | pub ipv6mr_multiaddr: in6_addr, |
| 78 | #[cfg(target_os = "android")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 79 | pub ipv6mr_interface: ::c_int, |
Alex Crichton | 2482400 | 2015-09-16 17:34:54 -0700 | [diff] [blame] | 80 | #[cfg(not(target_os = "android"))] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 81 | pub ipv6mr_interface: ::c_uint, |
Alex Crichton | d809601 | 2015-09-16 16:36:30 -0700 | [diff] [blame] | 82 | } |
Alex Crichton | 88d23e7 | 2015-11-02 17:03:19 -0800 | [diff] [blame] | 83 | |
David Hotham | ccacbe8 | 2015-11-14 17:19:12 +0000 | [diff] [blame] | 84 | pub struct hostent { |
| 85 | pub h_name: *mut ::c_char, |
| 86 | pub h_aliases: *mut *mut ::c_char, |
| 87 | pub h_addrtype: ::c_int, |
| 88 | pub h_length: ::c_int, |
| 89 | pub h_addr_list: *mut *mut ::c_char, |
| 90 | } |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 91 | |
| 92 | pub struct iovec { |
| 93 | pub iov_base: *mut ::c_void, |
| 94 | pub iov_len: ::size_t, |
| 95 | } |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 96 | |
| 97 | pub struct pollfd { |
| 98 | pub fd: ::c_int, |
| 99 | pub events: ::c_short, |
| 100 | pub revents: ::c_short, |
| 101 | } |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 102 | } |
| 103 | |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 104 | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; |
| 105 | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; |
| 106 | pub const SIG_ERR: sighandler_t = !0 as sighandler_t; |
| 107 | |
Alex Crichton | f811901 | 2015-12-02 10:30:29 -0800 | [diff] [blame] | 108 | pub const DT_FIFO: u8 = 1; |
| 109 | pub const DT_CHR: u8 = 2; |
| 110 | pub const DT_DIR: u8 = 4; |
| 111 | pub const DT_BLK: u8 = 6; |
| 112 | pub const DT_REG: u8 = 8; |
| 113 | pub const DT_LNK: u8 = 10; |
| 114 | pub const DT_SOCK: u8 = 12; |
| 115 | |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 116 | pub const FD_CLOEXEC: ::c_int = 0x1; |
| 117 | |
| 118 | pub const USRQUOTA: ::c_int = 0; |
| 119 | pub const GRPQUOTA: ::c_int = 1; |
| 120 | |
| 121 | pub const SIGIOT: ::c_int = 6; |
| 122 | |
| 123 | pub const S_ISUID: ::c_int = 0x800; |
| 124 | pub const S_ISGID: ::c_int = 0x400; |
| 125 | pub const S_ISVTX: ::c_int = 0x200; |
| 126 | |
David Henningsson | 9d2493e | 2015-12-25 22:06:44 +0100 | [diff] [blame] | 127 | pub const POLLIN: ::c_short = 0x1; |
| 128 | pub const POLLPRI: ::c_short = 0x2; |
| 129 | pub const POLLOUT: ::c_short = 0x4; |
| 130 | pub const POLLERR: ::c_short = 0x8; |
| 131 | pub const POLLHUP: ::c_short = 0x10; |
| 132 | pub const POLLNVAL: ::c_short = 0x20; |
| 133 | |
Kamal Marhubi | 0a5dcf0 | 2016-01-25 15:20:46 -0500 | [diff] [blame] | 134 | pub const IF_NAMESIZE: ::size_t = 16; |
| 135 | |
Alex Crichton | 29de598 | 2016-02-04 13:48:13 -0800 | [diff] [blame] | 136 | pub const RTLD_LAZY: ::c_int = 0x1; |
| 137 | |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 138 | cfg_if! { |
arcnmx | 527b63e | 2016-01-29 13:54:34 -0500 | [diff] [blame] | 139 | if #[cfg(not(stdbuild))] { |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 140 | // cargo build, don't pull in anything extra as the libstd dep |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 141 | // already pulls in all libs. |
Jörg Krause | 8ad2520 | 2016-03-07 00:04:20 +0100 | [diff] [blame^] | 142 | } else if #[cfg(all(target_env = "musl", not(any(target_arch = "mips", |
| 143 | target_arch = "arm"))))] { |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 144 | #[link(name = "c", kind = "static")] |
| 145 | extern {} |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 146 | } else if #[cfg(target_os = "emscripten")] { |
| 147 | #[link(name = "c")] |
| 148 | extern {} |
Sebastian Wicki | 37d4bb9 | 2016-02-27 14:27:10 +0100 | [diff] [blame] | 149 | } else if #[cfg(all(target_vendor = "rumprun", target_os = "netbsd"))] { |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 150 | // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled |
| 151 | // in automatically by the linker. We avoid passing it explicitly, as it |
Sebastian Wicki | 37d4bb9 | 2016-02-27 14:27:10 +0100 | [diff] [blame] | 152 | // causes some versions of binutils to crash with an assertion failure. |
| 153 | #[link(name = "m")] |
| 154 | extern {} |
Alex Crichton | 0c8e61a | 2015-11-22 10:14:13 -0800 | [diff] [blame] | 155 | } else if #[cfg(any(target_os = "macos", |
| 156 | target_os = "ios", |
Sébastien Marie | b83e43b | 2015-11-26 19:54:24 +0100 | [diff] [blame] | 157 | target_os = "android", |
| 158 | target_os = "openbsd", |
| 159 | target_os = "bitrig"))] { |
Alex Crichton | 68a5c44 | 2015-11-20 09:28:12 -0800 | [diff] [blame] | 160 | #[link(name = "c")] |
| 161 | #[link(name = "m")] |
| 162 | extern {} |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 163 | } else { |
| 164 | #[link(name = "c")] |
| 165 | #[link(name = "m")] |
Alex Crichton | 68a5c44 | 2015-11-20 09:28:12 -0800 | [diff] [blame] | 166 | #[link(name = "rt")] |
Alex Crichton | 2c57e36 | 2015-09-15 17:30:53 -0700 | [diff] [blame] | 167 | extern {} |
| 168 | } |
| 169 | } |
| 170 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 171 | extern { |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 172 | #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 173 | 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] | 174 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 175 | link_name = "connect$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 176 | pub fn connect(socket: ::c_int, address: *const sockaddr, |
| 177 | len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 178 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 179 | link_name = "bind$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 180 | pub fn bind(socket: ::c_int, address: *const sockaddr, |
| 181 | address_len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 182 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 183 | link_name = "listen$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 184 | pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 185 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 186 | link_name = "accept$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 187 | pub fn accept(socket: ::c_int, address: *mut sockaddr, |
| 188 | address_len: *mut socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 189 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 190 | link_name = "getpeername$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 191 | pub fn getpeername(socket: ::c_int, address: *mut sockaddr, |
| 192 | address_len: *mut socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 193 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 194 | link_name = "getsockname$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 195 | pub fn getsockname(socket: ::c_int, address: *mut sockaddr, |
| 196 | address_len: *mut socklen_t) -> ::c_int; |
| 197 | pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 198 | value: *const ::c_void, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 199 | option_len: socklen_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 200 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Steven Fackler | e6c00c2 | 2015-11-03 21:10:08 -0800 | [diff] [blame] | 201 | link_name = "socketpair$UNIX2003")] |
| 202 | pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int, |
| 203 | socket_vector: *mut ::c_int) -> ::c_int; |
| 204 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 205 | link_name = "sendto$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 206 | pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, |
| 207 | flags: ::c_int, addr: *const sockaddr, |
| 208 | addrlen: socklen_t) -> ::ssize_t; |
| 209 | pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 210 | |
| 211 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 212 | link_name = "chmod$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 213 | pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 214 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 215 | link_name = "fchmod$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 216 | pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 217 | |
| 218 | #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 219 | #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 220 | pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 221 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 222 | pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 223 | |
Alex Crichton | 084f9ea | 2015-09-11 15:11:59 -0700 | [diff] [blame] | 224 | #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 225 | #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 226 | pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 227 | |
| 228 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 229 | link_name = "popen$UNIX2003")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 230 | pub fn popen(command: *const c_char, |
| 231 | mode: *const c_char) -> *mut ::FILE; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 232 | pub fn pclose(stream: *mut ::FILE) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 233 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 234 | link_name = "fdopen$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 235 | pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; |
| 236 | pub fn fileno(stream: *mut ::FILE) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 237 | |
| 238 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 239 | link_name = "open$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 240 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 241 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 242 | link_name = "creat$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 243 | pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 244 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 245 | link_name = "fcntl$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 246 | pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 247 | |
| 248 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 249 | link_name = "opendir$INODE64")] |
| 250 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 251 | link_name = "opendir$INODE64$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 252 | #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 253 | pub fn opendir(dirname: *const c_char) -> *mut ::DIR; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 254 | #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 255 | #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 256 | pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 257 | result: *mut *mut ::dirent) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 258 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 259 | link_name = "closedir$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 260 | pub fn closedir(dirp: *mut ::DIR) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 261 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 262 | link_name = "rewinddir$INODE64")] |
| 263 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 264 | link_name = "rewinddir$INODE64$UNIX2003")] |
| 265 | pub fn rewinddir(dirp: *mut ::DIR); |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 266 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 267 | pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; |
| 268 | pub fn alarm(seconds: ::c_uint) -> ::c_uint; |
| 269 | pub fn chdir(dir: *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 270 | pub fn chown(path: *const c_char, uid: uid_t, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 271 | gid: gid_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 272 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 273 | link_name = "close$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 274 | pub fn close(fd: ::c_int) -> ::c_int; |
| 275 | pub fn dup(fd: ::c_int) -> ::c_int; |
| 276 | pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 277 | pub fn execv(prog: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 278 | argv: *const *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 279 | pub fn execve(prog: *const c_char, argv: *const *const c_char, |
| 280 | envp: *const *const c_char) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 281 | -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 282 | pub fn execvp(c: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 283 | argv: *const *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 284 | pub fn fork() -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 285 | pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; |
| 286 | 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] | 287 | pub fn getegid() -> gid_t; |
| 288 | pub fn geteuid() -> uid_t; |
| 289 | pub fn getgid() -> gid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 290 | pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) |
| 291 | -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 292 | pub fn getlogin() -> *mut c_char; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 293 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 294 | link_name = "getopt$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 295 | pub fn getopt(argc: ::c_int, argv: *const *mut c_char, |
| 296 | optstr: *const c_char) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 297 | pub fn getpgrp() -> pid_t; |
| 298 | pub fn getpid() -> pid_t; |
| 299 | pub fn getppid() -> pid_t; |
| 300 | pub fn getuid() -> uid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 301 | pub fn isatty(fd: ::c_int) -> ::c_int; |
| 302 | 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] | 303 | 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] | 304 | pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 305 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 306 | link_name = "pause$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 307 | pub fn pause() -> ::c_int; |
| 308 | pub fn pipe(fds: *mut ::c_int) -> ::c_int; |
Tamir Duberstein | 0b102fd | 2016-01-06 18:16:05 -0500 | [diff] [blame] | 309 | pub fn posix_memalign(memptr: *mut *mut ::c_void, |
| 310 | align: ::size_t, |
| 311 | size: ::size_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 312 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 313 | link_name = "read$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 314 | pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) |
| 315 | -> ::ssize_t; |
| 316 | pub fn rmdir(path: *const c_char) -> ::c_int; |
| 317 | pub fn setgid(gid: gid_t) -> ::c_int; |
| 318 | pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 319 | pub fn setsid() -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 320 | pub fn setuid(uid: uid_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 321 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 322 | link_name = "sleep$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 323 | pub fn sleep(secs: ::c_uint) -> ::c_uint; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 324 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 325 | link_name = "nanosleep$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 326 | #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 327 | pub fn nanosleep(rqtp: *const timespec, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 328 | rmtp: *mut timespec) -> ::c_int; |
| 329 | pub fn tcgetpgrp(fd: ::c_int) -> pid_t; |
| 330 | pub fn ttyname(fd: ::c_int) -> *mut c_char; |
| 331 | pub fn unlink(c: *const c_char) -> ::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 = "wait$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 334 | pub fn wait(status: *mut ::c_int) -> pid_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 335 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 336 | link_name = "waitpid$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 337 | 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] | 338 | -> pid_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 339 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 340 | link_name = "write$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 341 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) |
| 342 | -> ::ssize_t; |
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 = "pread$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 345 | pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, |
| 346 | offset: off_t) -> ::ssize_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 347 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 348 | link_name = "pwrite$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 349 | pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, |
| 350 | offset: off_t) -> ::ssize_t; |
Andy Caldwell | dd54f29 | 2015-11-30 00:24:15 +0000 | [diff] [blame] | 351 | pub fn umask(mask: mode_t) -> mode_t; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 352 | |
| 353 | #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 354 | pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 355 | |
| 356 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 357 | link_name = "kill$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 358 | pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 359 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 360 | pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
| 361 | pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; |
| 362 | pub fn mlockall(flags: ::c_int) -> ::c_int; |
| 363 | pub fn munlockall() -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 364 | |
| 365 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 366 | link_name = "mmap$UNIX2003")] |
| 367 | pub fn mmap(addr: *mut ::c_void, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 368 | len: ::size_t, |
| 369 | prot: ::c_int, |
| 370 | flags: ::c_int, |
| 371 | fd: ::c_int, |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 372 | offset: off_t) |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 373 | -> *mut ::c_void; |
| 374 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 375 | link_name = "munmap$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 376 | pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 377 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 378 | pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 379 | pub fn if_indextoname(ifindex: ::c_uint, |
| 380 | ifname: *mut ::c_char) -> *mut ::c_char; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 381 | |
| 382 | #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 383 | #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 384 | pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 385 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 386 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 387 | link_name = "fsync$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 388 | pub fn fsync(fd: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 389 | |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 390 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 391 | link_name = "setenv$UNIX2003")] |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 392 | pub fn setenv(name: *const c_char, val: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 393 | overwrite: ::c_int) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 394 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 395 | link_name = "unsetenv$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 396 | #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 397 | pub fn unsetenv(name: *const c_char) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 398 | |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 399 | pub fn symlink(path1: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 400 | path2: *const c_char) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 401 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 402 | pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 403 | |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 404 | #[cfg_attr(target_os = "android", link_name = "bsd_signal")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 405 | pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 406 | |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 407 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 408 | link_name = "getrlimit$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 409 | pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 410 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 411 | link_name = "setrlimit$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 412 | pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 413 | #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 414 | pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 415 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 416 | pub fn getdtablesize() -> ::c_int; |
Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 417 | #[cfg_attr(any(target_os = "macos", target_os = "ios"), |
| 418 | link_name = "realpath$DARWIN_EXTSN")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 419 | pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) |
| 420 | -> *mut ::c_char; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 421 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 422 | pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 423 | |
Jason Travis Smith | 270c7d4 | 2016-02-06 05:46:41 -0500 | [diff] [blame] | 424 | #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 425 | pub fn gettimeofday(tp: *mut ::timeval, |
| 426 | tz: *mut ::c_void) -> ::c_int; |
| 427 | |
| 428 | pub fn pthread_self() -> ::pthread_t; |
| 429 | pub fn pthread_create(native: *mut ::pthread_t, |
| 430 | attr: *const ::pthread_attr_t, |
| 431 | f: extern fn(*mut ::c_void) -> *mut ::c_void, |
| 432 | value: *mut ::c_void) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 433 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 434 | link_name = "pthread_join$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 435 | pub fn pthread_join(native: ::pthread_t, |
| 436 | value: *mut *mut ::c_void) -> ::c_int; |
| 437 | pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; |
| 438 | pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; |
| 439 | pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, |
| 440 | stack_size: ::size_t) -> ::c_int; |
| 441 | pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, |
| 442 | state: ::c_int) -> ::c_int; |
| 443 | pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 444 | #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 445 | pub fn sched_yield() -> ::c_int; |
| 446 | pub fn pthread_key_create(key: *mut pthread_key_t, |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 447 | dtor: Option<unsafe extern fn(*mut ::c_void)>) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 448 | -> ::c_int; |
| 449 | pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 450 | pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; |
| 451 | pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 452 | -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 453 | pub fn pthread_mutex_init(lock: *mut pthread_mutex_t, |
| 454 | attr: *const pthread_mutexattr_t) -> ::c_int; |
| 455 | pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; |
| 456 | pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 457 | pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 458 | pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; |
| 459 | |
| 460 | pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 461 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 462 | link_name = "pthread_mutexattr_destroy$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 463 | pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; |
| 464 | pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, |
| 465 | _type: ::c_int) -> ::c_int; |
| 466 | |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 467 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 468 | link_name = "pthread_cond_wait$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 469 | pub fn pthread_cond_wait(cond: *mut pthread_cond_t, |
| 470 | lock: *mut pthread_mutex_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 471 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 472 | link_name = "pthread_cond_timedwait$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 473 | pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t, |
| 474 | lock: *mut pthread_mutex_t, |
| 475 | abstime: *const ::timespec) -> ::c_int; |
| 476 | pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; |
| 477 | pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; |
| 478 | pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 479 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 480 | link_name = "pthread_rwlock_destroy$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 481 | pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 482 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 483 | link_name = "pthread_rwlock_rdlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 484 | pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 485 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 486 | link_name = "pthread_rwlock_tryrdlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 487 | pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 488 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 489 | link_name = "pthread_rwlock_wrlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 490 | pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 491 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 492 | link_name = "pthread_rwlock_trywrlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 493 | pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 494 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 495 | link_name = "pthread_rwlock_unlock$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 496 | pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 497 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 498 | link_name = "pthread_sigmask$UNIX2003")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 499 | pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, |
| 500 | oldset: *mut sigset_t) -> ::c_int; |
Tomasz MiÄ…sko | b0b3370 | 2016-02-15 11:00:11 +0100 | [diff] [blame] | 501 | pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 502 | |
| 503 | // #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 504 | pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, |
| 505 | buflen: ::size_t) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 506 | |
| 507 | pub fn getsockopt(sockfd: ::c_int, |
| 508 | level: ::c_int, |
| 509 | optname: ::c_int, |
| 510 | optval: *mut ::c_void, |
| 511 | optlen: *mut ::socklen_t) -> ::c_int; |
| 512 | pub fn raise(signum: ::c_int) -> ::c_int; |
Sebastian Wicki | b7c3e5c | 2016-02-26 21:58:19 +0100 | [diff] [blame] | 513 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 514 | pub fn sigaction(signum: ::c_int, |
| 515 | act: *const sigaction, |
| 516 | oldact: *mut sigaction) -> ::c_int; |
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 = "sigaltstack$UNIX2003")] |
Sebastian Wicki | b7c3e5c | 2016-02-26 21:58:19 +0100 | [diff] [blame] | 519 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 520 | pub fn sigaltstack(ss: *const stack_t, |
| 521 | oss: *mut stack_t) -> ::c_int; |
Philipp Matthias Schaefer | c1982a4 | 2016-02-28 16:06:45 +0100 | [diff] [blame] | 522 | #[cfg_attr(all(target_os = "macos", target_arch ="x86"), |
| 523 | link_name = "sigwait$UNIX2003")] |
| 524 | pub fn sigwait(set: *const sigset_t, |
| 525 | sig: *mut ::c_int) -> ::c_int; |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 526 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 527 | #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] |
Alex Crichton | cd9b33e | 2015-09-17 14:47:40 -0700 | [diff] [blame] | 528 | pub fn utimes(filename: *const ::c_char, |
| 529 | times: *const ::timeval) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 530 | pub fn dlopen(filename: *const ::c_char, |
| 531 | flag: ::c_int) -> *mut ::c_void; |
| 532 | pub fn dlerror() -> *mut ::c_char; |
| 533 | pub fn dlsym(handle: *mut ::c_void, |
| 534 | symbol: *const ::c_char) -> *mut ::c_void; |
| 535 | pub fn dlclose(handle: *mut ::c_void) -> ::c_int; |
Alex Crichton | 88d23e7 | 2015-11-02 17:03:19 -0800 | [diff] [blame] | 536 | 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] | 537 | |
| 538 | pub fn getaddrinfo(node: *const c_char, |
| 539 | service: *const c_char, |
| 540 | hints: *const addrinfo, |
| 541 | res: *mut *mut addrinfo) -> ::c_int; |
| 542 | pub fn freeaddrinfo(res: *mut addrinfo); |
| 543 | pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 544 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 545 | #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 546 | 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] | 547 | #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 548 | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; |
| 549 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 550 | link_name = "mktime$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 551 | #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 552 | pub fn mktime(tm: *mut tm) -> time_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 553 | |
| 554 | #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] |
| 555 | pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, |
| 556 | dev: ::dev_t) -> ::c_int; |
| 557 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 558 | link_name = "writev$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 559 | pub fn writev(fd: ::c_int, |
| 560 | iov: *const ::iovec, |
| 561 | iovcnt: ::c_int) -> ::ssize_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 562 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 563 | link_name = "readv$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 564 | pub fn readv(fd: ::c_int, |
| 565 | iov: *const ::iovec, |
| 566 | iovcnt: ::c_int) -> ::ssize_t; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 567 | pub fn uname(buf: *mut ::utsname) -> ::c_int; |
| 568 | pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; |
| 569 | pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; |
| 570 | pub fn chroot(name: *const ::c_char) -> ::c_int; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 571 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 572 | link_name = "usleep$UNIX2003")] |
| 573 | pub fn usleep(secs: ::c_uint) -> ::c_int; |
| 574 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 575 | link_name = "send$UNIX2003")] |
| 576 | pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, |
| 577 | flags: ::c_int) -> ::ssize_t; |
| 578 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 579 | link_name = "recv$UNIX2003")] |
| 580 | pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, |
| 581 | flags: ::c_int) -> ::ssize_t; |
| 582 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 583 | link_name = "putenv$UNIX2003")] |
| 584 | #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] |
| 585 | pub fn putenv(string: *mut c_char) -> ::c_int; |
| 586 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 587 | link_name = "sendmsg$UNIX2003")] |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 588 | pub fn sendmsg(fd: ::c_int, |
| 589 | msg: *const msghdr, |
| 590 | flags: ::c_int) -> ::ssize_t; |
Alex Crichton | 881ef9b | 2015-12-01 09:04:13 -0800 | [diff] [blame] | 591 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 592 | link_name = "recvmsg$UNIX2003")] |
| 593 | 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] | 594 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 595 | link_name = "poll$UNIX2003")] |
| 596 | 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] | 597 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 598 | link_name = "select$1050")] |
| 599 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 600 | link_name = "select$UNIX2003")] |
| 601 | #[cfg_attr(target_os = "netbsd", link_name = "__select50")] |
| 602 | pub fn select(nfds: ::c_int, |
| 603 | readfs: *mut fd_set, |
| 604 | writefds: *mut fd_set, |
| 605 | errorfds: *mut fd_set, |
| 606 | timeout: *mut timeval) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 607 | } |
| 608 | |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 609 | // TODO: get rid of this cfg(not(...)) |
| 610 | #[cfg(not(target_os = "android"))] // " if " -- appease style checker |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 611 | extern { |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 612 | pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 613 | pub fn freeifaddrs(ifa: *mut ifaddrs); |
Alex Crichton | de9736d | 2015-09-17 15:47:44 -0700 | [diff] [blame] | 614 | #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 615 | #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 616 | pub fn glob(pattern: *const c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 617 | flags: ::c_int, |
Alex Crichton | 8a8bc66 | 2016-02-29 23:02:36 -0800 | [diff] [blame] | 618 | errfunc: Option<extern fn(epath: *const c_char, |
| 619 | errno: ::c_int) -> ::c_int>, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 620 | pglob: *mut glob_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 621 | #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 622 | pub fn globfree(pglob: *mut glob_t); |
| 623 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 624 | pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 625 | -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 626 | |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 627 | pub fn shm_unlink(name: *const c_char) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 628 | |
| 629 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 630 | link_name = "seekdir$INODE64")] |
| 631 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 632 | link_name = "seekdir$INODE64$UNIX2003")] |
| 633 | pub fn seekdir(dirp: *mut ::DIR, loc: c_long); |
| 634 | |
| 635 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
| 636 | link_name = "telldir$INODE64")] |
| 637 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 638 | link_name = "telldir$INODE64$UNIX2003")] |
| 639 | pub fn telldir(dirp: *mut ::DIR) -> c_long; |
| 640 | |
| 641 | pub fn getsid(pid: pid_t) -> pid_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 642 | pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) |
| 643 | -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 644 | pub fn readlink(path: *const c_char, |
| 645 | buf: *mut c_char, |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 646 | bufsz: ::size_t) |
| 647 | -> ::ssize_t; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 648 | |
| 649 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 650 | link_name = "msync$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 651 | #[cfg_attr(target_os = "netbsd", link_name = "__msync13")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 652 | pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; |
| 653 | pub fn sysconf(name: ::c_int) -> c_long; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 654 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 655 | link_name = "recvfrom$UNIX2003")] |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 656 | pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, |
| 657 | flags: ::c_int, addr: *mut sockaddr, |
| 658 | addrlen: *mut socklen_t) -> ::ssize_t; |
Alex Crichton | 1791046 | 2015-09-22 19:11:04 -0700 | [diff] [blame] | 659 | pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 660 | |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 661 | #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] |
Alex Crichton | 1ff9610 | 2015-09-17 15:09:02 -0700 | [diff] [blame] | 662 | pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 663 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 664 | pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 665 | #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 666 | pub fn sigfillset(set: *mut sigset_t) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 667 | #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 668 | pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 669 | #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] |
Alex Crichton | fe5f36b | 2015-11-02 17:06:59 -0800 | [diff] [blame] | 670 | pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 671 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 672 | link_name = "pselect$1050")] |
| 673 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
| 674 | link_name = "pselect$UNIX2003")] |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 675 | #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")] |
Alex Crichton | 07d3a0d | 2015-10-30 10:21:32 -0700 | [diff] [blame] | 676 | pub fn pselect(nfds: ::c_int, |
| 677 | readfs: *mut fd_set, |
| 678 | writefds: *mut fd_set, |
| 679 | errorfds: *mut fd_set, |
| 680 | timeout: *const timespec, |
| 681 | sigmask: *const sigset_t) -> ::c_int; |
Alex Crichton | 7482522 | 2015-10-29 17:36:55 -0700 | [diff] [blame] | 682 | pub fn fseeko(stream: *mut ::FILE, |
| 683 | offset: ::off_t, |
| 684 | whence: ::c_int) -> ::c_int; |
| 685 | pub fn ftello(stream: *mut ::FILE) -> ::off_t; |
Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 686 | #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] |
Alex Crichton | 568705e | 2015-11-03 14:18:52 -0800 | [diff] [blame] | 687 | pub fn timegm(tm: *mut ::tm) -> time_t; |
Dan Burkert | 85a76f8 | 2015-11-04 20:26:27 -0800 | [diff] [blame] | 688 | pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; |
| 689 | pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 690 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), |
Alex Crichton | 8dce9ad | 2015-12-03 11:44:14 -0800 | [diff] [blame] | 691 | link_name = "tcdrain$UNIX2003")] |
| 692 | pub fn tcdrain(fd: ::c_int) -> ::c_int; |
| 693 | pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; |
| 694 | pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; |
| 695 | pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
| 696 | pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; |
| 697 | pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; |
| 698 | pub fn tcsetattr(fd: ::c_int, |
| 699 | optional_actions: ::c_int, |
| 700 | termios: *const ::termios) -> ::c_int; |
| 701 | pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; |
| 702 | pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; |
| 703 | pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; |
Kamal Marhubi | 511a780 | 2016-02-15 00:40:19 -0500 | [diff] [blame] | 704 | pub fn mkstemp(template: *mut ::c_char) -> ::c_int; |
| 705 | pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; |
| 706 | pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; |
Alex Crichton | 87d0076 | 2016-02-29 21:12:44 -0800 | [diff] [blame] | 707 | pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; |
Alex Crichton | 5d6cf05 | 2015-09-11 14:52:34 -0700 | [diff] [blame] | 708 | } |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 709 | |
| 710 | cfg_if! { |
Brian Anderson | 7d1d575 | 2015-11-26 23:27:45 +0000 | [diff] [blame] | 711 | if #[cfg(any(target_os = "linux", |
| 712 | target_os = "android", |
| 713 | target_os = "emscripten"))] { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 714 | mod notbsd; |
| 715 | pub use self::notbsd::*; |
| 716 | } else if #[cfg(any(target_os = "macos", |
Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 717 | target_os = "ios", |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 718 | target_os = "freebsd", |
| 719 | target_os = "dragonfly", |
| 720 | target_os = "openbsd", |
| 721 | target_os = "netbsd", |
| 722 | target_os = "bitrig"))] { |
| 723 | mod bsd; |
| 724 | pub use self::bsd::*; |
Nikita Baksalyar | 702814f | 2016-01-28 10:30:54 +0300 | [diff] [blame] | 725 | } else if #[cfg(target_os = "solaris")] { |
| 726 | mod solaris; |
| 727 | pub use self::solaris::*; |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 728 | } else { |
Alex Crichton | 50a42e2 | 2015-09-15 14:27:15 -0700 | [diff] [blame] | 729 | // ... |
Alex Crichton | d3d7792 | 2015-09-11 17:03:39 -0700 | [diff] [blame] | 730 | } |
| 731 | } |