1 use dox::{mem, Option}; 2 3 pub type wchar_t = i32; 4 pub type off_t = i64; 5 pub type useconds_t = u32; 6 pub type blkcnt_t = i64; 7 pub type socklen_t = u32; 8 pub type sa_family_t = u8; 9 pub type pthread_t = ::uintptr_t; 10 pub type nfds_t = ::c_uint; 11 12 s! { 13 pub struct sockaddr { 14 pub sa_len: u8, 15 pub sa_family: sa_family_t, 16 pub sa_data: [::c_char; 14], 17 } 18 19 pub struct sockaddr_in6 { 20 pub sin6_len: u8, 21 pub sin6_family: sa_family_t, 22 pub sin6_port: ::in_port_t, 23 pub sin6_flowinfo: u32, 24 pub sin6_addr: ::in6_addr, 25 pub sin6_scope_id: u32, 26 } 27 28 pub struct sockaddr_un { 29 pub sun_len: u8, 30 pub sun_family: sa_family_t, 31 pub sun_path: [c_char; 104] 32 } 33 34 pub struct passwd { 35 pub pw_name: *mut ::c_char, 36 pub pw_passwd: *mut ::c_char, 37 pub pw_uid: ::uid_t, 38 pub pw_gid: ::gid_t, 39 pub pw_change: ::time_t, 40 pub pw_class: *mut ::c_char, 41 pub pw_gecos: *mut ::c_char, 42 pub pw_dir: *mut ::c_char, 43 pub pw_shell: *mut ::c_char, 44 pub pw_expire: ::time_t, 45 46 #[cfg(not(any(target_os = "macos", 47 target_os = "ios", 48 target_os = "netbsd", 49 target_os = "openbsd")))] 50 pub pw_fields: ::c_int, 51 } 52 53 pub struct ifaddrs { 54 pub ifa_next: *mut ifaddrs, 55 pub ifa_name: *mut ::c_char, 56 pub ifa_flags: ::c_uint, 57 pub ifa_addr: *mut ::sockaddr, 58 pub ifa_netmask: *mut ::sockaddr, 59 pub ifa_dstaddr: *mut ::sockaddr, 60 pub ifa_data: *mut ::c_void 61 } 62 63 pub struct fd_set { 64 #[cfg(all(target_pointer_width = "64", 65 any(target_os = "freebsd", target_os = "dragonfly")))] 66 fds_bits: [i64; FD_SETSIZE / 64], 67 #[cfg(not(all(target_pointer_width = "64", 68 any(target_os = "freebsd", target_os = "dragonfly"))))] 69 fds_bits: [i32; FD_SETSIZE / 32], 70 } 71 72 pub struct tm { 73 pub tm_sec: ::c_int, 74 pub tm_min: ::c_int, 75 pub tm_hour: ::c_int, 76 pub tm_mday: ::c_int, 77 pub tm_mon: ::c_int, 78 pub tm_year: ::c_int, 79 pub tm_wday: ::c_int, 80 pub tm_yday: ::c_int, 81 pub tm_isdst: ::c_int, 82 pub tm_gmtoff: ::c_long, 83 pub tm_zone: *mut ::c_char, 84 } 85 86 pub struct utsname { 87 #[cfg(not(target_os = "dragonfly"))] 88 pub sysname: [::c_char; 256], 89 #[cfg(target_os = "dragonfly")] 90 pub sysname: [::c_char; 32], 91 #[cfg(not(target_os = "dragonfly"))] 92 pub nodename: [::c_char; 256], 93 #[cfg(target_os = "dragonfly")] 94 pub nodename: [::c_char; 32], 95 #[cfg(not(target_os = "dragonfly"))] 96 pub release: [::c_char; 256], 97 #[cfg(target_os = "dragonfly")] 98 pub release: [::c_char; 32], 99 #[cfg(not(target_os = "dragonfly"))] 100 pub version: [::c_char; 256], 101 #[cfg(target_os = "dragonfly")] 102 pub version: [::c_char; 32], 103 #[cfg(not(target_os = "dragonfly"))] 104 pub machine: [::c_char; 256], 105 #[cfg(target_os = "dragonfly")] 106 pub machine: [::c_char; 32], 107 } 108 109 pub struct msghdr { 110 pub msg_name: *mut ::c_void, 111 pub msg_namelen: ::socklen_t, 112 pub msg_iov: *mut ::iovec, 113 pub msg_iovlen: ::c_int, 114 pub msg_control: *mut ::c_void, 115 pub msg_controllen: ::socklen_t, 116 pub msg_flags: ::c_int, 117 } 118 119 pub struct cmsghdr { 120 pub cmsg_len: ::socklen_t, 121 pub cmsg_level: ::c_int, 122 pub cmsg_type: ::c_int, 123 } 124 125 pub struct fsid_t { 126 __fsid_val: [::int32_t; 2], 127 } 128 129 pub struct if_nameindex { 130 pub if_index: ::c_uint, 131 pub if_name: *mut ::c_char, 132 } 133 } 134 135 pub const LC_ALL: ::c_int = 0; 136 pub const LC_COLLATE: ::c_int = 1; 137 pub const LC_CTYPE: ::c_int = 2; 138 pub const LC_MONETARY: ::c_int = 3; 139 pub const LC_NUMERIC: ::c_int = 4; 140 pub const LC_TIME: ::c_int = 5; 141 pub const LC_MESSAGES: ::c_int = 6; 142 143 pub const FIOCLEX: ::c_ulong = 0x20006601; 144 pub const FIONBIO: ::c_ulong = 0x8004667e; 145 146 pub const PATH_MAX: ::c_int = 1024; 147 148 pub const SA_ONSTACK: ::c_int = 0x0001; 149 pub const SA_SIGINFO: ::c_int = 0x0040; 150 pub const SA_RESTART: ::c_int = 0x0002; 151 pub const SA_RESETHAND: ::c_int = 0x0004; 152 pub const SA_NOCLDSTOP: ::c_int = 0x0008; 153 pub const SA_NODEFER: ::c_int = 0x0010; 154 pub const SA_NOCLDWAIT: ::c_int = 0x0020; 155 156 pub const SS_ONSTACK: ::c_int = 1; 157 pub const SS_DISABLE: ::c_int = 4; 158 159 pub const SIGCHLD: ::c_int = 20; 160 pub const SIGBUS: ::c_int = 10; 161 pub const SIGUSR1: ::c_int = 30; 162 pub const SIGUSR2: ::c_int = 31; 163 pub const SIGCONT: ::c_int = 19; 164 pub const SIGSTOP: ::c_int = 17; 165 pub const SIGTSTP: ::c_int = 18; 166 pub const SIGURG: ::c_int = 16; 167 pub const SIGIO: ::c_int = 23; 168 pub const SIGSYS: ::c_int = 12; 169 pub const SIGTTIN: ::c_int = 21; 170 pub const SIGTTOU: ::c_int = 22; 171 pub const SIGXCPU: ::c_int = 24; 172 pub const SIGXFSZ: ::c_int = 25; 173 pub const SIGVTALRM: ::c_int = 26; 174 pub const SIGPROF: ::c_int = 27; 175 pub const SIGWINCH: ::c_int = 28; 176 pub const SIGINFO: ::c_int = 29; 177 178 pub const SIG_SETMASK: ::c_int = 3; 179 pub const SIG_BLOCK: ::c_int = 0x1; 180 pub const SIG_UNBLOCK: ::c_int = 0x2; 181 182 pub const IP_MULTICAST_IF: ::c_int = 9; 183 pub const IP_MULTICAST_TTL: ::c_int = 10; 184 pub const IP_MULTICAST_LOOP: ::c_int = 11; 185 186 pub const IPV6_UNICAST_HOPS: ::c_int = 4; 187 pub const IPV6_MULTICAST_IF: ::c_int = 9; 188 pub const IPV6_MULTICAST_HOPS: ::c_int = 10; 189 pub const IPV6_MULTICAST_LOOP: ::c_int = 11; 190 pub const IPV6_V6ONLY: ::c_int = 27; 191 192 pub const ST_RDONLY: ::c_ulong = 1; 193 194 pub const SCM_RIGHTS: ::c_int = 0x01; 195 196 pub const NCCS: usize = 20; 197 198 pub const O_ACCMODE: ::c_int = 0x3; 199 pub const O_RDONLY: ::c_int = 0; 200 pub const O_WRONLY: ::c_int = 1; 201 pub const O_RDWR: ::c_int = 2; 202 pub const O_APPEND: ::c_int = 8; 203 pub const O_CREAT: ::c_int = 512; 204 pub const O_TRUNC: ::c_int = 1024; 205 pub const O_EXCL: ::c_int = 2048; 206 pub const O_ASYNC: ::c_int = 0x40; 207 pub const O_SYNC: ::c_int = 0x80; 208 pub const O_NONBLOCK: ::c_int = 0x4; 209 pub const O_NOFOLLOW: ::c_int = 0x100; 210 pub const O_SHLOCK: ::c_int = 0x10; 211 pub const O_EXLOCK: ::c_int = 0x20; 212 pub const O_FSYNC: ::c_int = O_SYNC; 213 pub const O_NDELAY: ::c_int = O_NONBLOCK; 214 215 pub const F_GETOWN: ::c_int = 5; 216 pub const F_SETOWN: ::c_int = 6; 217 218 pub const MNT_FORCE: ::c_int = 0x80000; 219 220 pub const Q_SYNC: ::c_int = 0x600; 221 pub const Q_QUOTAON: ::c_int = 0x100; 222 pub const Q_QUOTAOFF: ::c_int = 0x200; 223 224 pub const TCIOFF: ::c_int = 3; 225 pub const TCION: ::c_int = 4; 226 pub const TCOOFF: ::c_int = 1; 227 pub const TCOON: ::c_int = 2; 228 pub const TCIFLUSH: ::c_int = 1; 229 pub const TCOFLUSH: ::c_int = 2; 230 pub const TCIOFLUSH: ::c_int = 3; 231 pub const TCSANOW: ::c_int = 0; 232 pub const TCSADRAIN: ::c_int = 1; 233 pub const TCSAFLUSH: ::c_int = 2; 234 pub const VEOF: usize = 0; 235 pub const VEOL: usize = 1; 236 pub const VEOL2: usize = 2; 237 pub const VERASE: usize = 3; 238 pub const VWERASE: usize = 4; 239 pub const VKILL: usize = 5; 240 pub const VREPRINT: usize = 6; 241 pub const VINTR: usize = 8; 242 pub const VQUIT: usize = 9; 243 pub const VSUSP: usize = 10; 244 pub const VDSUSP: usize = 11; 245 pub const VSTART: usize = 12; 246 pub const VSTOP: usize = 13; 247 pub const VLNEXT: usize = 14; 248 pub const VDISCARD: usize = 15; 249 pub const VMIN: usize = 16; 250 pub const VTIME: usize = 17; 251 pub const VSTATUS: usize = 18; 252 pub const _POSIX_VDISABLE: ::cc_t = 0xff; 253 pub const IGNBRK: ::tcflag_t = 0x00000001; 254 pub const BRKINT: ::tcflag_t = 0x00000002; 255 pub const IGNPAR: ::tcflag_t = 0x00000004; 256 pub const PARMRK: ::tcflag_t = 0x00000008; 257 pub const INPCK: ::tcflag_t = 0x00000010; 258 pub const ISTRIP: ::tcflag_t = 0x00000020; 259 pub const INLCR: ::tcflag_t = 0x00000040; 260 pub const IGNCR: ::tcflag_t = 0x00000080; 261 pub const ICRNL: ::tcflag_t = 0x00000100; 262 pub const IXON: ::tcflag_t = 0x00000200; 263 pub const IXOFF: ::tcflag_t = 0x00000400; 264 pub const IXANY: ::tcflag_t = 0x00000800; 265 pub const IMAXBEL: ::tcflag_t = 0x00002000; 266 pub const OPOST: ::tcflag_t = 0x1; 267 pub const ONLCR: ::tcflag_t = 0x2; 268 pub const OXTABS: ::tcflag_t = 0x4; 269 pub const ONOEOT: ::tcflag_t = 0x8; 270 pub const CIGNORE: ::tcflag_t = 0x00000001; 271 pub const CSIZE: ::tcflag_t = 0x00000300; 272 pub const CS5: ::tcflag_t = 0x00000000; 273 pub const CS6: ::tcflag_t = 0x00000100; 274 pub const CS7: ::tcflag_t = 0x00000200; 275 pub const CS8: ::tcflag_t = 0x00000300; 276 pub const CSTOPB: ::tcflag_t = 0x00000400; 277 pub const CREAD: ::tcflag_t = 0x00000800; 278 pub const PARENB: ::tcflag_t = 0x00001000; 279 pub const PARODD: ::tcflag_t = 0x00002000; 280 pub const HUPCL: ::tcflag_t = 0x00004000; 281 pub const CLOCAL: ::tcflag_t = 0x00008000; 282 pub const ECHOKE: ::tcflag_t = 0x00000001; 283 pub const ECHOE: ::tcflag_t = 0x00000002; 284 pub const ECHOK: ::tcflag_t = 0x00000004; 285 pub const ECHO: ::tcflag_t = 0x00000008; 286 pub const ECHONL: ::tcflag_t = 0x00000010; 287 pub const ECHOPRT: ::tcflag_t = 0x00000020; 288 pub const ECHOCTL: ::tcflag_t = 0x00000040; 289 pub const ISIG: ::tcflag_t = 0x00000080; 290 pub const ICANON: ::tcflag_t = 0x00000100; 291 pub const ALTWERASE: ::tcflag_t = 0x00000200; 292 pub const IEXTEN: ::tcflag_t = 0x00000400; 293 pub const EXTPROC: ::tcflag_t = 0x00000800; 294 pub const TOSTOP: ::tcflag_t = 0x00400000; 295 pub const FLUSHO: ::tcflag_t = 0x00800000; 296 pub const NOKERNINFO: ::tcflag_t = 0x02000000; 297 pub const PENDIN: ::tcflag_t = 0x20000000; 298 pub const NOFLSH: ::tcflag_t = 0x80000000; 299 pub const MDMBUF: ::tcflag_t = 0x00100000; 300 301 pub const WNOHANG: ::c_int = 0x00000001; 302 pub const WUNTRACED: ::c_int = 0x00000002; 303 304 pub const RTLD_LAZY: ::c_int = 0x1; 305 pub const RTLD_NOW: ::c_int = 0x2; 306 pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void; 307 pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void; 308 pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void; 309 310 pub const LOG_CRON: ::c_int = 9 << 3; 311 pub const LOG_AUTHPRIV: ::c_int = 10 << 3; 312 pub const LOG_FTP: ::c_int = 11 << 3; 313 pub const LOG_PERROR: ::c_int = 0x20; 314 315 pub const TCP_MAXSEG: ::c_int = 2; 316 317 pub const PIPE_BUF: usize = 512; 318 319 pub const POLLIN: ::c_short = 0x1; 320 pub const POLLPRI: ::c_short = 0x2; 321 pub const POLLOUT: ::c_short = 0x4; 322 pub const POLLERR: ::c_short = 0x8; 323 pub const POLLHUP: ::c_short = 0x10; 324 pub const POLLNVAL: ::c_short = 0x20; 325 pub const POLLRDNORM: ::c_short = 0x040; 326 pub const POLLWRNORM: ::c_short = 0x004; 327 pub const POLLRDBAND: ::c_short = 0x080; 328 pub const POLLWRBAND: ::c_short = 0x100; 329 330 f! { 331 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { 332 let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; 333 let fd = fd as usize; 334 (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); 335 return 336 } 337 338 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { 339 let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; 340 let fd = fd as usize; 341 return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 342 } 343 344 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { 345 let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; 346 let fd = fd as usize; 347 (*set).fds_bits[fd / bits] |= 1 << (fd % bits); 348 return 349 } 350 351 pub fn FD_ZERO(set: *mut fd_set) -> () { 352 for slot in (*set).fds_bits.iter_mut() { 353 *slot = 0; 354 } 355 } 356 357 pub fn WTERMSIG(status: ::c_int) -> ::c_int { 358 status & 0o177 359 } 360 361 pub fn WIFEXITED(status: ::c_int) -> bool { 362 (status & 0o177) == 0 363 } 364 365 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { 366 status >> 8 367 } 368 369 pub fn WCOREDUMP(status: ::c_int) -> bool { 370 (status & 0o200) != 0 371 } 372 373 pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { 374 (cmd << 8) | (type_ & 0x00ff) 375 } 376 } 377 378 extern { getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int379 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; freeifaddrs(ifa: *mut ::ifaddrs)380 pub fn freeifaddrs(ifa: *mut ::ifaddrs); setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int381 pub fn setgroups(ngroups: ::c_int, 382 ptr: *const ::gid_t) -> ::c_int; ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int383 pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; kqueue() -> ::c_int384 pub fn kqueue() -> ::c_int; unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int385 pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; syscall(num: ::c_int, ...) -> ::c_int386 pub fn syscall(num: ::c_int, ...) -> ::c_int; 387 #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] getpwent() -> *mut passwd388 pub fn getpwent() -> *mut passwd; setpwent()389 pub fn setpwent(); endpwent()390 pub fn endpwent(); setgrent()391 pub fn setgrent(); endgrent()392 pub fn endgrent(); getgrent() -> *mut ::group393 pub fn getgrent() -> *mut ::group; 394 getprogname() -> *const ::c_char395 pub fn getprogname() -> *const ::c_char; setprogname(name: *const ::c_char)396 pub fn setprogname(name: *const ::c_char); getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int397 pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; if_nameindex() -> *mut if_nameindex398 pub fn if_nameindex() -> *mut if_nameindex; if_freenameindex(ptr: *mut if_nameindex)399 pub fn if_freenameindex(ptr: *mut if_nameindex); 400 getpeereid(socket: ::c_int, euid: *mut ::uid_t, egid: *mut ::gid_t) -> ::c_int401 pub fn getpeereid(socket: ::c_int, 402 euid: *mut ::uid_t, 403 egid: *mut ::gid_t) -> ::c_int; 404 405 #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] 406 #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] 407 #[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_int408 pub fn glob(pattern: *const ::c_char, 409 flags: ::c_int, 410 errfunc: Option<extern fn(epath: *const ::c_char, 411 errno: ::c_int) -> ::c_int>, 412 pglob: *mut ::glob_t) -> ::c_int; 413 #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] 414 #[cfg_attr(target_os = "freebsd", link_name = "globfree@FBSD_1.0")] globfree(pglob: *mut ::glob_t)415 pub fn globfree(pglob: *mut ::glob_t); 416 posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int417 pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) 418 -> ::c_int; 419 shm_unlink(name: *const ::c_char) -> ::c_int420 pub fn shm_unlink(name: *const ::c_char) -> ::c_int; 421 422 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 423 link_name = "seekdir$INODE64")] 424 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 425 link_name = "seekdir$INODE64$UNIX2003")] seekdir(dirp: *mut ::DIR, loc: ::c_long)426 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); 427 428 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 429 link_name = "telldir$INODE64")] 430 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 431 link_name = "telldir$INODE64$UNIX2003")] telldir(dirp: *mut ::DIR) -> ::c_long432 pub fn telldir(dirp: *mut ::DIR) -> ::c_long; madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int433 pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) 434 -> ::c_int; 435 436 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 437 link_name = "msync$UNIX2003")] 438 #[cfg_attr(target_os = "netbsd", link_name = "__msync13")] msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int439 pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; 440 441 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 442 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_t443 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, 444 flags: ::c_int, addr: *mut ::sockaddr, 445 addrlen: *mut ::socklen_t) -> ::ssize_t; mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int446 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int447 pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; nl_langinfo(item: ::nl_item) -> *mut ::c_char448 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; 449 450 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 451 link_name = "bind$UNIX2003")] bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int452 pub fn bind(socket: ::c_int, address: *const ::sockaddr, 453 address_len: ::socklen_t) -> ::c_int; 454 455 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 456 link_name = "writev$UNIX2003")] writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t457 pub fn writev(fd: ::c_int, 458 iov: *const ::iovec, 459 iovcnt: ::c_int) -> ::ssize_t; 460 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 461 link_name = "readv$UNIX2003")] readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t462 pub fn readv(fd: ::c_int, 463 iov: *const ::iovec, 464 iovcnt: ::c_int) -> ::ssize_t; 465 466 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 467 link_name = "sendmsg$UNIX2003")] sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t468 pub fn sendmsg(fd: ::c_int, 469 msg: *const ::msghdr, 470 flags: ::c_int) -> ::ssize_t; 471 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 472 link_name = "recvmsg$UNIX2003")] recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t473 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) 474 -> ::ssize_t; 475 sync()476 pub fn sync(); 477 #[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_int478 pub fn getgrgid_r(uid: ::uid_t, 479 grp: *mut ::group, 480 buf: *mut ::c_char, 481 buflen: ::size_t, 482 result: *mut *mut ::group) -> ::c_int; 483 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 484 link_name = "sigaltstack$UNIX2003")] 485 #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int486 pub fn sigaltstack(ss: *const stack_t, 487 oss: *mut stack_t) -> ::c_int; sem_close(sem: *mut sem_t) -> ::c_int488 pub fn sem_close(sem: *mut sem_t) -> ::c_int; getdtablesize() -> ::c_int489 pub fn getdtablesize() -> ::c_int; 490 #[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_int491 pub fn getgrnam_r(name: *const ::c_char, 492 grp: *mut ::group, 493 buf: *mut ::c_char, 494 buflen: ::size_t, 495 result: *mut *mut ::group) -> ::c_int; 496 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 497 link_name = "pthread_sigmask$UNIX2003")] pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int498 pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, 499 oldset: *mut sigset_t) -> ::c_int; sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t500 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; getgrnam(name: *const ::c_char) -> *mut ::group501 pub fn getgrnam(name: *const ::c_char) -> *mut ::group; 502 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 503 link_name = "pthread_cancel$UNIX2003")] pthread_cancel(thread: ::pthread_t) -> ::c_int504 pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int505 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; sem_unlink(name: *const ::c_char) -> ::c_int506 pub fn sem_unlink(name: *const ::c_char) -> ::c_int; daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int507 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; 508 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] 509 #[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_int510 pub fn getpwnam_r(name: *const ::c_char, 511 pwd: *mut passwd, 512 buf: *mut ::c_char, 513 buflen: ::size_t, 514 result: *mut *mut passwd) -> ::c_int; 515 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] 516 #[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_int517 pub fn getpwuid_r(uid: ::uid_t, 518 pwd: *mut passwd, 519 buf: *mut ::c_char, 520 buflen: ::size_t, 521 result: *mut *mut passwd) -> ::c_int; 522 #[cfg_attr(all(target_os = "macos", target_arch ="x86"), 523 link_name = "sigwait$UNIX2003")] 524 #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int525 pub fn sigwait(set: *const sigset_t, 526 sig: *mut ::c_int) -> ::c_int; pthread_atfork(prepare: Option<unsafe extern fn()>, parent: Option<unsafe extern fn()>, child: Option<unsafe extern fn()>) -> ::c_int527 pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, 528 parent: Option<unsafe extern fn()>, 529 child: Option<unsafe extern fn()>) -> ::c_int; getgrgid(gid: ::gid_t) -> *mut ::group530 pub fn getgrgid(gid: ::gid_t) -> *mut ::group; 531 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 532 link_name = "popen$UNIX2003")] popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE533 pub fn popen(command: *const c_char, 534 mode: *const c_char) -> *mut ::FILE; faccessat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::c_int, flags: ::c_int) -> ::c_int535 pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, 536 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_int537 pub fn pthread_create(native: *mut ::pthread_t, 538 attr: *const ::pthread_attr_t, 539 f: extern fn(*mut ::c_void) -> *mut ::c_void, 540 value: *mut ::c_void) -> ::c_int; 541 } 542 543 cfg_if! { 544 if #[cfg(any(target_os = "macos", target_os = "ios"))] { 545 mod apple; 546 pub use self::apple::*; 547 } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd", 548 target_os = "bitrig"))] { 549 mod netbsdlike; 550 pub use self::netbsdlike::*; 551 } else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] { 552 mod freebsdlike; 553 pub use self::freebsdlike::*; 554 } else { 555 // Unknown target_os 556 } 557 } 558