1 pub type wchar_t = i32; 2 pub type off_t = i64; 3 pub type useconds_t = u32; 4 pub type blkcnt_t = i64; 5 pub type socklen_t = u32; 6 pub type sa_family_t = u8; 7 pub type pthread_t = ::uintptr_t; 8 pub type nfds_t = ::c_uint; 9 10 s! { 11 pub struct sockaddr { 12 pub sa_len: u8, 13 pub sa_family: sa_family_t, 14 pub sa_data: [::c_char; 14], 15 } 16 17 pub struct sockaddr_in6 { 18 pub sin6_len: u8, 19 pub sin6_family: sa_family_t, 20 pub sin6_port: ::in_port_t, 21 pub sin6_flowinfo: u32, 22 pub sin6_addr: ::in6_addr, 23 pub sin6_scope_id: u32, 24 } 25 26 pub struct passwd { 27 pub pw_name: *mut ::c_char, 28 pub pw_passwd: *mut ::c_char, 29 pub pw_uid: ::uid_t, 30 pub pw_gid: ::gid_t, 31 pub pw_change: ::time_t, 32 pub pw_class: *mut ::c_char, 33 pub pw_gecos: *mut ::c_char, 34 pub pw_dir: *mut ::c_char, 35 pub pw_shell: *mut ::c_char, 36 pub pw_expire: ::time_t, 37 38 #[cfg(not(any(target_os = "macos", 39 target_os = "ios", 40 target_os = "netbsd", 41 target_os = "openbsd")))] 42 pub pw_fields: ::c_int, 43 } 44 45 pub struct ifaddrs { 46 pub ifa_next: *mut ifaddrs, 47 pub ifa_name: *mut ::c_char, 48 pub ifa_flags: ::c_uint, 49 pub ifa_addr: *mut ::sockaddr, 50 pub ifa_netmask: *mut ::sockaddr, 51 pub ifa_dstaddr: *mut ::sockaddr, 52 pub ifa_data: *mut ::c_void, 53 #[cfg(target_os = "netbsd")] 54 pub ifa_addrflags: ::c_uint 55 } 56 57 pub struct fd_set { 58 #[cfg(all(target_pointer_width = "64", 59 any(target_os = "freebsd", target_os = "dragonfly")))] 60 fds_bits: [i64; FD_SETSIZE / 64], 61 #[cfg(not(all(target_pointer_width = "64", 62 any(target_os = "freebsd", target_os = "dragonfly"))))] 63 fds_bits: [i32; FD_SETSIZE / 32], 64 } 65 66 pub struct tm { 67 pub tm_sec: ::c_int, 68 pub tm_min: ::c_int, 69 pub tm_hour: ::c_int, 70 pub tm_mday: ::c_int, 71 pub tm_mon: ::c_int, 72 pub tm_year: ::c_int, 73 pub tm_wday: ::c_int, 74 pub tm_yday: ::c_int, 75 pub tm_isdst: ::c_int, 76 pub tm_gmtoff: ::c_long, 77 pub tm_zone: *mut ::c_char, 78 } 79 80 pub struct msghdr { 81 pub msg_name: *mut ::c_void, 82 pub msg_namelen: ::socklen_t, 83 pub msg_iov: *mut ::iovec, 84 pub msg_iovlen: ::c_int, 85 pub msg_control: *mut ::c_void, 86 pub msg_controllen: ::socklen_t, 87 pub msg_flags: ::c_int, 88 } 89 90 pub struct cmsghdr { 91 pub cmsg_len: ::socklen_t, 92 pub cmsg_level: ::c_int, 93 pub cmsg_type: ::c_int, 94 } 95 96 pub struct fsid_t { 97 __fsid_val: [::int32_t; 2], 98 } 99 100 pub struct if_nameindex { 101 pub if_index: ::c_uint, 102 pub if_name: *mut ::c_char, 103 } 104 } 105 106 s_no_extra_traits!{ 107 pub struct sockaddr_un { 108 pub sun_len: u8, 109 pub sun_family: sa_family_t, 110 pub sun_path: [c_char; 104] 111 } 112 113 pub struct utsname { 114 #[cfg(not(target_os = "dragonfly"))] 115 pub sysname: [::c_char; 256], 116 #[cfg(target_os = "dragonfly")] 117 pub sysname: [::c_char; 32], 118 #[cfg(not(target_os = "dragonfly"))] 119 pub nodename: [::c_char; 256], 120 #[cfg(target_os = "dragonfly")] 121 pub nodename: [::c_char; 32], 122 #[cfg(not(target_os = "dragonfly"))] 123 pub release: [::c_char; 256], 124 #[cfg(target_os = "dragonfly")] 125 pub release: [::c_char; 32], 126 #[cfg(not(target_os = "dragonfly"))] 127 pub version: [::c_char; 256], 128 #[cfg(target_os = "dragonfly")] 129 pub version: [::c_char; 32], 130 #[cfg(not(target_os = "dragonfly"))] 131 pub machine: [::c_char; 256], 132 #[cfg(target_os = "dragonfly")] 133 pub machine: [::c_char; 32], 134 } 135 136 } 137 138 cfg_if! { 139 if #[cfg(feature = "extra_traits")] { 140 impl PartialEq for sockaddr_un { 141 fn eq(&self, other: &sockaddr_un) -> bool { 142 self.sun_len == other.sun_len 143 && self.sun_family == other.sun_family 144 && self 145 .sun_path 146 .iter() 147 .zip(other.sun_path.iter()) 148 .all(|(a,b)| a == b) 149 } 150 } 151 152 impl Eq for sockaddr_un {} 153 154 impl ::fmt::Debug for sockaddr_un { 155 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 156 f.debug_struct("sockaddr_un") 157 .field("sun_len", &self.sun_len) 158 .field("sun_family", &self.sun_family) 159 // FIXME: .field("sun_path", &self.sun_path) 160 .finish() 161 } 162 } 163 164 impl ::hash::Hash for sockaddr_un { 165 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 166 self.sun_len.hash(state); 167 self.sun_family.hash(state); 168 self.sun_path.hash(state); 169 } 170 } 171 172 impl PartialEq for utsname { 173 fn eq(&self, other: &utsname) -> bool { 174 self.sysname 175 .iter() 176 .zip(other.sysname.iter()) 177 .all(|(a,b)| a == b) 178 && self 179 .nodename 180 .iter() 181 .zip(other.nodename.iter()) 182 .all(|(a,b)| a == b) 183 && self 184 .release 185 .iter() 186 .zip(other.release.iter()) 187 .all(|(a,b)| a == b) 188 && self 189 .version 190 .iter() 191 .zip(other.version.iter()) 192 .all(|(a,b)| a == b) 193 && self 194 .machine 195 .iter() 196 .zip(other.machine.iter()) 197 .all(|(a,b)| a == b) 198 } 199 } 200 201 impl Eq for utsname {} 202 203 impl ::fmt::Debug for utsname { 204 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 205 f.debug_struct("utsname") 206 // FIXME: .field("sysname", &self.sysname) 207 // FIXME: .field("nodename", &self.nodename) 208 // FIXME: .field("release", &self.release) 209 // FIXME: .field("version", &self.version) 210 // FIXME: .field("machine", &self.machine) 211 .finish() 212 } 213 } 214 215 impl ::hash::Hash for utsname { 216 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 217 self.sysname.hash(state); 218 self.nodename.hash(state); 219 self.release.hash(state); 220 self.version.hash(state); 221 self.machine.hash(state); 222 } 223 } 224 } 225 } 226 227 pub const LC_ALL: ::c_int = 0; 228 pub const LC_COLLATE: ::c_int = 1; 229 pub const LC_CTYPE: ::c_int = 2; 230 pub const LC_MONETARY: ::c_int = 3; 231 pub const LC_NUMERIC: ::c_int = 4; 232 pub const LC_TIME: ::c_int = 5; 233 pub const LC_MESSAGES: ::c_int = 6; 234 235 pub const FIOCLEX: ::c_ulong = 0x20006601; 236 pub const FIONBIO: ::c_ulong = 0x8004667e; 237 238 pub const PATH_MAX: ::c_int = 1024; 239 240 pub const SA_ONSTACK: ::c_int = 0x0001; 241 pub const SA_SIGINFO: ::c_int = 0x0040; 242 pub const SA_RESTART: ::c_int = 0x0002; 243 pub const SA_RESETHAND: ::c_int = 0x0004; 244 pub const SA_NOCLDSTOP: ::c_int = 0x0008; 245 pub const SA_NODEFER: ::c_int = 0x0010; 246 pub const SA_NOCLDWAIT: ::c_int = 0x0020; 247 248 pub const SS_ONSTACK: ::c_int = 1; 249 pub const SS_DISABLE: ::c_int = 4; 250 251 pub const SIGCHLD: ::c_int = 20; 252 pub const SIGBUS: ::c_int = 10; 253 pub const SIGUSR1: ::c_int = 30; 254 pub const SIGUSR2: ::c_int = 31; 255 pub const SIGCONT: ::c_int = 19; 256 pub const SIGSTOP: ::c_int = 17; 257 pub const SIGTSTP: ::c_int = 18; 258 pub const SIGURG: ::c_int = 16; 259 pub const SIGIO: ::c_int = 23; 260 pub const SIGSYS: ::c_int = 12; 261 pub const SIGTTIN: ::c_int = 21; 262 pub const SIGTTOU: ::c_int = 22; 263 pub const SIGXCPU: ::c_int = 24; 264 pub const SIGXFSZ: ::c_int = 25; 265 pub const SIGVTALRM: ::c_int = 26; 266 pub const SIGPROF: ::c_int = 27; 267 pub const SIGWINCH: ::c_int = 28; 268 pub const SIGINFO: ::c_int = 29; 269 270 pub const SIG_SETMASK: ::c_int = 3; 271 pub const SIG_BLOCK: ::c_int = 0x1; 272 pub const SIG_UNBLOCK: ::c_int = 0x2; 273 274 pub const IP_TOS: ::c_int = 3; 275 pub const IP_MULTICAST_IF: ::c_int = 9; 276 pub const IP_MULTICAST_TTL: ::c_int = 10; 277 pub const IP_MULTICAST_LOOP: ::c_int = 11; 278 279 pub const IPV6_UNICAST_HOPS: ::c_int = 4; 280 pub const IPV6_MULTICAST_IF: ::c_int = 9; 281 pub const IPV6_MULTICAST_HOPS: ::c_int = 10; 282 pub const IPV6_MULTICAST_LOOP: ::c_int = 11; 283 pub const IPV6_V6ONLY: ::c_int = 27; 284 285 pub const IPTOS_ECN_NOTECT: u8 = 0x00; 286 pub const IPTOS_ECN_MASK: u8 = 0x03; 287 pub const IPTOS_ECN_ECT1: u8 = 0x01; 288 pub const IPTOS_ECN_ECT0: u8 = 0x02; 289 pub const IPTOS_ECN_CE: u8 = 0x03; 290 291 pub const ST_RDONLY: ::c_ulong = 1; 292 293 pub const SCM_RIGHTS: ::c_int = 0x01; 294 295 pub const NCCS: usize = 20; 296 297 pub const O_ACCMODE: ::c_int = 0x3; 298 pub const O_RDONLY: ::c_int = 0; 299 pub const O_WRONLY: ::c_int = 1; 300 pub const O_RDWR: ::c_int = 2; 301 pub const O_APPEND: ::c_int = 8; 302 pub const O_CREAT: ::c_int = 512; 303 pub const O_TRUNC: ::c_int = 1024; 304 pub const O_EXCL: ::c_int = 2048; 305 pub const O_ASYNC: ::c_int = 0x40; 306 pub const O_SYNC: ::c_int = 0x80; 307 pub const O_NONBLOCK: ::c_int = 0x4; 308 pub const O_NOFOLLOW: ::c_int = 0x100; 309 pub const O_SHLOCK: ::c_int = 0x10; 310 pub const O_EXLOCK: ::c_int = 0x20; 311 pub const O_FSYNC: ::c_int = O_SYNC; 312 pub const O_NDELAY: ::c_int = O_NONBLOCK; 313 314 pub const F_GETOWN: ::c_int = 5; 315 pub const F_SETOWN: ::c_int = 6; 316 317 pub const F_RDLCK: ::c_short = 1; 318 pub const F_UNLCK: ::c_short = 2; 319 pub const F_WRLCK: ::c_short = 3; 320 321 pub const MNT_FORCE: ::c_int = 0x80000; 322 323 pub const Q_SYNC: ::c_int = 0x600; 324 pub const Q_QUOTAON: ::c_int = 0x100; 325 pub const Q_QUOTAOFF: ::c_int = 0x200; 326 327 pub const TCIOFF: ::c_int = 3; 328 pub const TCION: ::c_int = 4; 329 pub const TCOOFF: ::c_int = 1; 330 pub const TCOON: ::c_int = 2; 331 pub const TCIFLUSH: ::c_int = 1; 332 pub const TCOFLUSH: ::c_int = 2; 333 pub const TCIOFLUSH: ::c_int = 3; 334 pub const TCSANOW: ::c_int = 0; 335 pub const TCSADRAIN: ::c_int = 1; 336 pub const TCSAFLUSH: ::c_int = 2; 337 pub const VEOF: usize = 0; 338 pub const VEOL: usize = 1; 339 pub const VEOL2: usize = 2; 340 pub const VERASE: usize = 3; 341 pub const VWERASE: usize = 4; 342 pub const VKILL: usize = 5; 343 pub const VREPRINT: usize = 6; 344 pub const VINTR: usize = 8; 345 pub const VQUIT: usize = 9; 346 pub const VSUSP: usize = 10; 347 pub const VDSUSP: usize = 11; 348 pub const VSTART: usize = 12; 349 pub const VSTOP: usize = 13; 350 pub const VLNEXT: usize = 14; 351 pub const VDISCARD: usize = 15; 352 pub const VMIN: usize = 16; 353 pub const VTIME: usize = 17; 354 pub const VSTATUS: usize = 18; 355 pub const _POSIX_VDISABLE: ::cc_t = 0xff; 356 pub const IGNBRK: ::tcflag_t = 0x00000001; 357 pub const BRKINT: ::tcflag_t = 0x00000002; 358 pub const IGNPAR: ::tcflag_t = 0x00000004; 359 pub const PARMRK: ::tcflag_t = 0x00000008; 360 pub const INPCK: ::tcflag_t = 0x00000010; 361 pub const ISTRIP: ::tcflag_t = 0x00000020; 362 pub const INLCR: ::tcflag_t = 0x00000040; 363 pub const IGNCR: ::tcflag_t = 0x00000080; 364 pub const ICRNL: ::tcflag_t = 0x00000100; 365 pub const IXON: ::tcflag_t = 0x00000200; 366 pub const IXOFF: ::tcflag_t = 0x00000400; 367 pub const IXANY: ::tcflag_t = 0x00000800; 368 pub const IMAXBEL: ::tcflag_t = 0x00002000; 369 pub const OPOST: ::tcflag_t = 0x1; 370 pub const ONLCR: ::tcflag_t = 0x2; 371 pub const OXTABS: ::tcflag_t = 0x4; 372 pub const ONOEOT: ::tcflag_t = 0x8; 373 pub const CIGNORE: ::tcflag_t = 0x00000001; 374 pub const CSIZE: ::tcflag_t = 0x00000300; 375 pub const CS5: ::tcflag_t = 0x00000000; 376 pub const CS6: ::tcflag_t = 0x00000100; 377 pub const CS7: ::tcflag_t = 0x00000200; 378 pub const CS8: ::tcflag_t = 0x00000300; 379 pub const CSTOPB: ::tcflag_t = 0x00000400; 380 pub const CREAD: ::tcflag_t = 0x00000800; 381 pub const PARENB: ::tcflag_t = 0x00001000; 382 pub const PARODD: ::tcflag_t = 0x00002000; 383 pub const HUPCL: ::tcflag_t = 0x00004000; 384 pub const CLOCAL: ::tcflag_t = 0x00008000; 385 pub const ECHOKE: ::tcflag_t = 0x00000001; 386 pub const ECHOE: ::tcflag_t = 0x00000002; 387 pub const ECHOK: ::tcflag_t = 0x00000004; 388 pub const ECHO: ::tcflag_t = 0x00000008; 389 pub const ECHONL: ::tcflag_t = 0x00000010; 390 pub const ECHOPRT: ::tcflag_t = 0x00000020; 391 pub const ECHOCTL: ::tcflag_t = 0x00000040; 392 pub const ISIG: ::tcflag_t = 0x00000080; 393 pub const ICANON: ::tcflag_t = 0x00000100; 394 pub const ALTWERASE: ::tcflag_t = 0x00000200; 395 pub const IEXTEN: ::tcflag_t = 0x00000400; 396 pub const EXTPROC: ::tcflag_t = 0x00000800; 397 pub const TOSTOP: ::tcflag_t = 0x00400000; 398 pub const FLUSHO: ::tcflag_t = 0x00800000; 399 pub const NOKERNINFO: ::tcflag_t = 0x02000000; 400 pub const PENDIN: ::tcflag_t = 0x20000000; 401 pub const NOFLSH: ::tcflag_t = 0x80000000; 402 pub const MDMBUF: ::tcflag_t = 0x00100000; 403 404 pub const WNOHANG: ::c_int = 0x00000001; 405 pub const WUNTRACED: ::c_int = 0x00000002; 406 407 pub const RTLD_LAZY: ::c_int = 0x1; 408 pub const RTLD_NOW: ::c_int = 0x2; 409 pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void; 410 pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void; 411 pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void; 412 413 pub const LOG_CRON: ::c_int = 9 << 3; 414 pub const LOG_AUTHPRIV: ::c_int = 10 << 3; 415 pub const LOG_FTP: ::c_int = 11 << 3; 416 pub const LOG_PERROR: ::c_int = 0x20; 417 418 pub const TCP_NODELAY: ::c_int = 1; 419 pub const TCP_MAXSEG: ::c_int = 2; 420 421 pub const PIPE_BUF: usize = 512; 422 423 pub const POLLIN: ::c_short = 0x1; 424 pub const POLLPRI: ::c_short = 0x2; 425 pub const POLLOUT: ::c_short = 0x4; 426 pub const POLLERR: ::c_short = 0x8; 427 pub const POLLHUP: ::c_short = 0x10; 428 pub const POLLNVAL: ::c_short = 0x20; 429 pub const POLLRDNORM: ::c_short = 0x040; 430 pub const POLLWRNORM: ::c_short = 0x004; 431 pub const POLLRDBAND: ::c_short = 0x080; 432 pub const POLLWRBAND: ::c_short = 0x100; 433 434 f! { 435 pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr { 436 if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { 437 (*mhdr).msg_control as *mut ::cmsghdr 438 } else { 439 0 as *mut ::cmsghdr 440 } 441 } 442 443 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 444 let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 445 let fd = fd as usize; 446 (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); 447 return 448 } 449 450 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { 451 let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 452 let fd = fd as usize; 453 return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 454 } 455 456 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 457 let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; 458 let fd = fd as usize; 459 (*set).fds_bits[fd / bits] |= 1 << (fd % bits); 460 return 461 } 462 463 pub fn FD_ZERO(set: *mut fd_set) -> () { 464 for slot in (*set).fds_bits.iter_mut() { 465 *slot = 0; 466 } 467 } 468 469 pub fn WTERMSIG(status: ::c_int) -> ::c_int { 470 status & 0o177 471 } 472 473 pub fn WIFEXITED(status: ::c_int) -> bool { 474 (status & 0o177) == 0 475 } 476 477 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { 478 status >> 8 479 } 480 481 pub fn WCOREDUMP(status: ::c_int) -> bool { 482 (status & 0o200) != 0 483 } 484 485 pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { 486 (cmd << 8) | (type_ & 0x00ff) 487 } 488 } 489 490 extern { abs(i: ::c_int) -> ::c_int491 pub fn abs(i: ::c_int) -> ::c_int; atof(s: *const ::c_char) -> ::c_double492 pub fn atof(s: *const ::c_char) -> ::c_double; labs(i: ::c_long) -> ::c_long493 pub fn labs(i: ::c_long) -> ::c_long; rand() -> ::c_int494 pub fn rand() -> ::c_int; srand(seed: ::c_uint)495 pub fn srand(seed: ::c_uint); 496 getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int497 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; freeifaddrs(ifa: *mut ::ifaddrs)498 pub fn freeifaddrs(ifa: *mut ::ifaddrs); setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int499 pub fn setgroups(ngroups: ::c_int, 500 ptr: *const ::gid_t) -> ::c_int; ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int501 pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; kqueue() -> ::c_int502 pub fn kqueue() -> ::c_int; unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int503 pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; syscall(num: ::c_int, ...) -> ::c_int504 pub fn syscall(num: ::c_int, ...) -> ::c_int; 505 #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] getpwent() -> *mut passwd506 pub fn getpwent() -> *mut passwd; setpwent()507 pub fn setpwent(); endpwent()508 pub fn endpwent(); setgrent()509 pub fn setgrent(); endgrent()510 pub fn endgrent(); getgrent() -> *mut ::group511 pub fn getgrent() -> *mut ::group; 512 getprogname() -> *const ::c_char513 pub fn getprogname() -> *const ::c_char; setprogname(name: *const ::c_char)514 pub fn setprogname(name: *const ::c_char); getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int515 pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; if_nameindex() -> *mut if_nameindex516 pub fn if_nameindex() -> *mut if_nameindex; if_freenameindex(ptr: *mut if_nameindex)517 pub fn if_freenameindex(ptr: *mut if_nameindex); 518 getpeereid(socket: ::c_int, euid: *mut ::uid_t, egid: *mut ::gid_t) -> ::c_int519 pub fn getpeereid(socket: ::c_int, 520 euid: *mut ::uid_t, 521 egid: *mut ::gid_t) -> ::c_int; 522 523 #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] 524 #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] 525 #[cfg_attr(target_os = "freebsd", link_name = "glob@FBSD_1.0")] glob(pattern: *const ::c_char, flags: ::c_int, errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int526 pub fn glob(pattern: *const ::c_char, 527 flags: ::c_int, 528 errfunc: ::Option<extern fn(epath: *const ::c_char, 529 errno: ::c_int) -> ::c_int>, 530 pglob: *mut ::glob_t) -> ::c_int; 531 #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] 532 #[cfg_attr(target_os = "freebsd", link_name = "globfree@FBSD_1.0")] globfree(pglob: *mut ::glob_t)533 pub fn globfree(pglob: *mut ::glob_t); 534 posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int535 pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) 536 -> ::c_int; 537 shm_unlink(name: *const ::c_char) -> ::c_int538 pub fn shm_unlink(name: *const ::c_char) -> ::c_int; 539 540 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 541 link_name = "seekdir$INODE64")] 542 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 543 link_name = "seekdir$INODE64$UNIX2003")] seekdir(dirp: *mut ::DIR, loc: ::c_long)544 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); 545 546 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 547 link_name = "telldir$INODE64")] 548 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 549 link_name = "telldir$INODE64$UNIX2003")] telldir(dirp: *mut ::DIR) -> ::c_long550 pub fn telldir(dirp: *mut ::DIR) -> ::c_long; madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int551 pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) 552 -> ::c_int; 553 554 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 555 link_name = "msync$UNIX2003")] 556 #[cfg_attr(target_os = "netbsd", link_name = "__msync13")] msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int557 pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; 558 559 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 560 link_name = "recvfrom$UNIX2003")] recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t561 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, 562 flags: ::c_int, addr: *mut ::sockaddr, 563 addrlen: *mut ::socklen_t) -> ::ssize_t; mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int564 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; 565 #[cfg_attr(target_os = "netbsd", link_name = "__futimes50")] futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int566 pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; nl_langinfo(item: ::nl_item) -> *mut ::c_char567 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; 568 569 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 570 link_name = "bind$UNIX2003")] bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int571 pub fn bind(socket: ::c_int, address: *const ::sockaddr, 572 address_len: ::socklen_t) -> ::c_int; 573 574 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 575 link_name = "writev$UNIX2003")] writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t576 pub fn writev(fd: ::c_int, 577 iov: *const ::iovec, 578 iovcnt: ::c_int) -> ::ssize_t; 579 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 580 link_name = "readv$UNIX2003")] readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t581 pub fn readv(fd: ::c_int, 582 iov: *const ::iovec, 583 iovcnt: ::c_int) -> ::ssize_t; 584 585 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 586 link_name = "sendmsg$UNIX2003")] sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t587 pub fn sendmsg(fd: ::c_int, 588 msg: *const ::msghdr, 589 flags: ::c_int) -> ::ssize_t; 590 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 591 link_name = "recvmsg$UNIX2003")] recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t592 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) 593 -> ::ssize_t; 594 sync()595 pub fn sync(); 596 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] getgrgid_r(uid: ::uid_t, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int597 pub fn getgrgid_r(uid: ::uid_t, 598 grp: *mut ::group, 599 buf: *mut ::c_char, 600 buflen: ::size_t, 601 result: *mut *mut ::group) -> ::c_int; 602 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 603 link_name = "sigaltstack$UNIX2003")] 604 #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int605 pub fn sigaltstack(ss: *const stack_t, 606 oss: *mut stack_t) -> ::c_int; sem_close(sem: *mut sem_t) -> ::c_int607 pub fn sem_close(sem: *mut sem_t) -> ::c_int; getdtablesize() -> ::c_int608 pub fn getdtablesize() -> ::c_int; 609 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] getgrnam_r(name: *const ::c_char, grp: *mut ::group, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::group) -> ::c_int610 pub fn getgrnam_r(name: *const ::c_char, 611 grp: *mut ::group, 612 buf: *mut ::c_char, 613 buflen: ::size_t, 614 result: *mut *mut ::group) -> ::c_int; 615 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 616 link_name = "pthread_sigmask$UNIX2003")] pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int617 pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, 618 oldset: *mut sigset_t) -> ::c_int; sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t619 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; getgrnam(name: *const ::c_char) -> *mut ::group620 pub fn getgrnam(name: *const ::c_char) -> *mut ::group; 621 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 622 link_name = "pthread_cancel$UNIX2003")] pthread_cancel(thread: ::pthread_t) -> ::c_int623 pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int624 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; sem_unlink(name: *const ::c_char) -> ::c_int625 pub fn sem_unlink(name: *const ::c_char) -> ::c_int; 626 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] 627 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] getpwnam_r(name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int628 pub fn getpwnam_r(name: *const ::c_char, 629 pwd: *mut passwd, 630 buf: *mut ::c_char, 631 buflen: ::size_t, 632 result: *mut *mut passwd) -> ::c_int; 633 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] 634 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int635 pub fn getpwuid_r(uid: ::uid_t, 636 pwd: *mut passwd, 637 buf: *mut ::c_char, 638 buflen: ::size_t, 639 result: *mut *mut passwd) -> ::c_int; 640 #[cfg_attr(all(target_os = "macos", target_arch ="x86"), 641 link_name = "sigwait$UNIX2003")] 642 #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int643 pub fn sigwait(set: *const sigset_t, 644 sig: *mut ::c_int) -> ::c_int; pthread_atfork(prepare: ::Option<unsafe extern fn()>, parent: ::Option<unsafe extern fn()>, child: ::Option<unsafe extern fn()>) -> ::c_int645 pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, 646 parent: ::Option<unsafe extern fn()>, 647 child: ::Option<unsafe extern fn()>) -> ::c_int; getgrgid(gid: ::gid_t) -> *mut ::group648 pub fn getgrgid(gid: ::gid_t) -> *mut ::group; 649 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 650 link_name = "popen$UNIX2003")] popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE651 pub fn popen(command: *const c_char, 652 mode: *const c_char) -> *mut ::FILE; faccessat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::c_int, flags: ::c_int) -> ::c_int653 pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, 654 mode: ::c_int, flags: ::c_int) -> ::c_int; pthread_create(native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int655 pub fn pthread_create(native: *mut ::pthread_t, 656 attr: *const ::pthread_attr_t, 657 f: extern fn(*mut ::c_void) -> *mut ::c_void, 658 value: *mut ::c_void) -> ::c_int; acct(filename: *const ::c_char) -> ::c_int659 pub fn acct(filename: *const ::c_char) -> ::c_int; 660 } 661 662 cfg_if! { 663 if #[cfg(any(target_os = "macos", target_os = "ios"))] { 664 mod apple; 665 pub use self::apple::*; 666 } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd", 667 target_os = "bitrig"))] { 668 mod netbsdlike; 669 pub use self::netbsdlike::*; 670 } else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] { 671 mod freebsdlike; 672 pub use self::freebsdlike::*; 673 } else { 674 // Unknown target_os 675 } 676 } 677