From 179104605391bdda15c0215c963c797504103d11 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 22 Sep 2015 19:11:04 -0700 Subject: [PATCH 1/2] Use isize/usize --- src/lib.rs | 21 +- src/unix/bsd/apple/b32.rs | 4 - src/unix/bsd/apple/b64.rs | 4 - src/unix/bsd/apple/mod.rs | 1 - src/unix/bsd/freebsdlike/x86.rs | 5 - src/unix/bsd/freebsdlike/x86_64.rs | 5 - src/unix/bsd/openbsdlike/mod.rs | 5 - src/unix/mod.rs | 268 +++++++++++------------ src/unix/notbsd/android/mod.rs | 5 - src/unix/notbsd/linux/mips.rs | 5 - src/unix/notbsd/linux/mod.rs | 12 +- src/unix/notbsd/linux/notmips/b32/mod.rs | 5 - src/unix/notbsd/linux/notmips/b64/mod.rs | 5 - src/windows.rs | 174 ++++++--------- 14 files changed, 226 insertions(+), 293 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7997e11ca08f4..84d89adcf232c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ //! Crate docs -#![allow(bad_style, raw_pointer_derive)] +#![allow(bad_style, raw_pointer_derive, improper_ctypes)] #![cfg_attr(dox, feature(no_core, lang_items))] #![cfg_attr(dox, no_core)] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -77,6 +77,25 @@ pub type uint16_t = u16; pub type uint32_t = u32; pub type uint64_t = u64; +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; + +pub type size_t = usize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; +pub type uintptr_t = usize; +pub type ssize_t = isize; + pub enum FILE {} pub enum fpos_t {} pub enum DIR {} diff --git a/src/unix/bsd/apple/b32.rs b/src/unix/bsd/apple/b32.rs index 293822e721f33..9a46ed05598ea 100644 --- a/src/unix/bsd/apple/b32.rs +++ b/src/unix/bsd/apple/b32.rs @@ -2,10 +2,6 @@ pub type c_long = i32; pub type c_ulong = u32; -pub type size_t = u32; -pub type ptrdiff_t = i32; -pub type intptr_t = i32; -pub type uintptr_t = u32; pub const __PTHREAD_MUTEX_SIZE__: usize = 40; pub const __PTHREAD_COND_SIZE__: usize = 24; diff --git a/src/unix/bsd/apple/b64.rs b/src/unix/bsd/apple/b64.rs index fb9f58ccd244e..344582e35474f 100644 --- a/src/unix/bsd/apple/b64.rs +++ b/src/unix/bsd/apple/b64.rs @@ -2,10 +2,6 @@ pub type c_long = i64; pub type c_ulong = u64; -pub type size_t = u64; -pub type ptrdiff_t = i64; -pub type intptr_t = i64; -pub type uintptr_t = u64; pub const __PTHREAD_MUTEX_SIZE__: usize = 56; pub const __PTHREAD_COND_SIZE__: usize = 40; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index a9697cedc63ff..74435c43ebd58 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -8,7 +8,6 @@ pub type suseconds_t = i32; pub type dev_t = i32; pub type ino_t = u64; pub type mode_t = u16; -pub type ssize_t = c_long; pub type nlink_t = u16; pub type blksize_t = i32; pub type rlim_t = u64; diff --git a/src/unix/bsd/freebsdlike/x86.rs b/src/unix/bsd/freebsdlike/x86.rs index 3be08eee33cc8..8a5e5f9fb8d28 100644 --- a/src/unix/bsd/freebsdlike/x86.rs +++ b/src/unix/bsd/freebsdlike/x86.rs @@ -1,12 +1,7 @@ pub type c_long = i32; pub type c_ulong = u32; -pub type size_t = u32; -pub type ptrdiff_t = i32; pub type time_t = i32; pub type suseconds_t = i32; -pub type intptr_t = i32; -pub type uintptr_t = u32; -pub type ssize_t = i32; s! { pub struct stat { diff --git a/src/unix/bsd/freebsdlike/x86_64.rs b/src/unix/bsd/freebsdlike/x86_64.rs index c45374423b56a..a2da8452c4d34 100644 --- a/src/unix/bsd/freebsdlike/x86_64.rs +++ b/src/unix/bsd/freebsdlike/x86_64.rs @@ -1,12 +1,7 @@ pub type c_long = i64; pub type c_ulong = u64; -pub type size_t = u64; -pub type ptrdiff_t = i64; pub type time_t = i64; pub type suseconds_t = i64; -pub type intptr_t = i64; -pub type uintptr_t = u64; -pub type ssize_t = i64; s! { pub struct stat { diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 239eff2c7edc1..ecd1579e0c211 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -1,15 +1,10 @@ pub type c_long = i64; pub type c_ulong = u64; -pub type size_t = u64; -pub type ptrdiff_t = i64; pub type clock_t = i64; pub type time_t = i64; pub type suseconds_t = i64; -pub type intptr_t = i64; -pub type uintptr_t = u64; pub type dev_t = i32; pub type mode_t = u32; -pub type ssize_t = c_long; pub type nlink_t = uint32_t; pub type blksize_t = uint32_t; pub type ino_t = uint64_t; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index c7c7d4acffa46..c78058674d1b6 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -3,24 +3,12 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; pub type pid_t = i32; pub type uid_t = u32; pub type gid_t = u32; pub type in_addr_t = u32; pub type in_port_t = u16; -pub type sighandler_t = size_t; +pub type sighandler_t = ::size_t; s! { pub struct utimbuf { @@ -82,13 +70,13 @@ s! { pub struct ipv6_mreq { pub ipv6mr_multiaddr: in6_addr, #[cfg(target_os = "android")] - pub ipv6mr_interface: c_int, + pub ipv6mr_interface: ::c_int, #[cfg(not(target_os = "android"))] - pub ipv6mr_interface: c_uint, + pub ipv6mr_interface: ::c_uint, } } -pub const WNOHANG: c_int = 1; +pub const WNOHANG: ::c_int = 1; pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; pub const SIG_ERR: sighandler_t = !0 as sighandler_t; @@ -108,74 +96,74 @@ cfg_if! { } extern { - pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int; + pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "connect$UNIX2003")] - pub fn connect(socket: c_int, address: *const sockaddr, - len: socklen_t) -> c_int; + pub fn connect(socket: ::c_int, address: *const sockaddr, + len: socklen_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "bind$UNIX2003")] - pub fn bind(socket: c_int, address: *const sockaddr, - address_len: socklen_t) -> c_int; + pub fn bind(socket: ::c_int, address: *const sockaddr, + address_len: socklen_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "listen$UNIX2003")] - pub fn listen(socket: c_int, backlog: c_int) -> c_int; + pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "accept$UNIX2003")] - pub fn accept(socket: c_int, address: *mut sockaddr, - address_len: *mut socklen_t) -> c_int; + pub fn accept(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "getpeername$UNIX2003")] - pub fn getpeername(socket: c_int, address: *mut sockaddr, - address_len: *mut socklen_t) -> c_int; + pub fn getpeername(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "getsockname$UNIX2003")] - pub fn getsockname(socket: c_int, address: *mut sockaddr, - address_len: *mut socklen_t) -> c_int; - pub fn setsockopt(socket: c_int, level: c_int, name: c_int, + pub fn getsockname(socket: ::c_int, address: *mut sockaddr, + address_len: *mut socklen_t) -> ::c_int; + pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, - option_len: socklen_t) -> c_int; + option_len: socklen_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "sendto$UNIX2003")] - pub fn sendto(socket: c_int, buf: *const ::c_void, len: size_t, - flags: c_int, addr: *const sockaddr, - addrlen: socklen_t) -> ssize_t; - pub fn shutdown(socket: c_int, how: c_int) -> c_int; + pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, + flags: ::c_int, addr: *const sockaddr, + addrlen: socklen_t) -> ::ssize_t; + pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "chmod$UNIX2003")] - pub fn chmod(path: *const c_char, mode: mode_t) -> c_int; + pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "fchmod$UNIX2003")] - pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; + pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] - pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; + pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; - pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int; + pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] - pub fn stat(path: *const c_char, buf: *mut stat) -> c_int; + pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "popen$UNIX2003")] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; - pub fn pclose(stream: *mut ::FILE) -> c_int; + pub fn pclose(stream: *mut ::FILE) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "fdopen$UNIX2003")] - pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut ::FILE; - pub fn fileno(stream: *mut ::FILE) -> c_int; + pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; + pub fn fileno(stream: *mut ::FILE) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "open$UNIX2003")] - pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int; + pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "creat$UNIX2003")] - pub fn creat(path: *const c_char, mode: mode_t) -> c_int; + pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "fcntl$UNIX2003")] - pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int; + pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "opendir$INODE64")] @@ -184,161 +172,161 @@ extern { pub fn opendir(dirname: *const c_char) -> *mut ::DIR; #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, - result: *mut *mut ::dirent) -> c_int; + result: *mut *mut ::dirent) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "closedir$UNIX2003")] - pub fn closedir(dirp: *mut ::DIR) -> c_int; + pub fn closedir(dirp: *mut ::DIR) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "rewinddir$INODE64")] #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "rewinddir$INODE64$UNIX2003")] pub fn rewinddir(dirp: *mut ::DIR); - pub fn access(path: *const c_char, amode: c_int) -> c_int; - pub fn alarm(seconds: c_uint) -> c_uint; - pub fn chdir(dir: *const c_char) -> c_int; + pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; + pub fn alarm(seconds: ::c_uint) -> ::c_uint; + pub fn chdir(dir: *const c_char) -> ::c_int; pub fn chown(path: *const c_char, uid: uid_t, - gid: gid_t) -> c_int; + gid: gid_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "close$UNIX2003")] - pub fn close(fd: c_int) -> c_int; - pub fn dup(fd: c_int) -> c_int; - pub fn dup2(src: c_int, dst: c_int) -> c_int; + pub fn close(fd: ::c_int) -> ::c_int; + pub fn dup(fd: ::c_int) -> ::c_int; + pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; pub fn execv(prog: *const c_char, - argv: *const *const c_char) -> c_int; + argv: *const *const c_char) -> ::c_int; pub fn execve(prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char) - -> c_int; + -> ::c_int; pub fn execvp(c: *const c_char, - argv: *const *const c_char) -> c_int; + argv: *const *const c_char) -> ::c_int; pub fn fork() -> pid_t; - pub fn fpathconf(filedes: c_int, name: c_int) -> c_long; - pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char; + pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; + pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; pub fn getegid() -> gid_t; pub fn geteuid() -> uid_t; pub fn getgid() -> gid_t; - pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) - -> c_int; + pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) + -> ::c_int; pub fn getlogin() -> *mut c_char; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "getopt$UNIX2003")] - pub fn getopt(argc: c_int, argv: *const *mut c_char, - optstr: *const c_char) -> c_int; + pub fn getopt(argc: ::c_int, argv: *const *mut c_char, + optstr: *const c_char) -> ::c_int; pub fn getpgrp() -> pid_t; pub fn getpid() -> pid_t; pub fn getppid() -> pid_t; pub fn getuid() -> uid_t; - pub fn isatty(fd: c_int) -> c_int; - pub fn link(src: *const c_char, dst: *const c_char) -> c_int; - pub fn lseek(fd: c_int, offset: off_t, whence: c_int) + pub fn isatty(fd: ::c_int) -> ::c_int; + pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; + pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; - pub fn pathconf(path: *const c_char, name: c_int) -> c_long; + pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "pause$UNIX2003")] - pub fn pause() -> c_int; - pub fn pipe(fds: *mut c_int) -> c_int; + pub fn pause() -> ::c_int; + pub fn pipe(fds: *mut ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "read$UNIX2003")] - pub fn read(fd: c_int, buf: *mut ::c_void, count: size_t) - -> ssize_t; - pub fn rmdir(path: *const c_char) -> c_int; - pub fn setgid(gid: gid_t) -> c_int; - pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int; + pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) + -> ::ssize_t; + pub fn rmdir(path: *const c_char) -> ::c_int; + pub fn setgid(gid: gid_t) -> ::c_int; + pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; pub fn setsid() -> pid_t; - pub fn setuid(uid: uid_t) -> c_int; + pub fn setuid(uid: uid_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "sleep$UNIX2003")] - pub fn sleep(secs: c_uint) -> c_uint; + pub fn sleep(secs: ::c_uint) -> ::c_uint; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "nanosleep$UNIX2003")] pub fn nanosleep(rqtp: *const timespec, - rmtp: *mut timespec) -> c_int; - pub fn tcgetpgrp(fd: c_int) -> pid_t; - pub fn ttyname(fd: c_int) -> *mut c_char; - pub fn unlink(c: *const c_char) -> c_int; + rmtp: *mut timespec) -> ::c_int; + pub fn tcgetpgrp(fd: ::c_int) -> pid_t; + pub fn ttyname(fd: ::c_int) -> *mut c_char; + pub fn unlink(c: *const c_char) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "wait$UNIX2003")] - pub fn wait(status: *mut c_int) -> pid_t; + pub fn wait(status: *mut ::c_int) -> pid_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "waitpid$UNIX2003")] - pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) + pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "write$UNIX2003")] - pub fn write(fd: c_int, buf: *const ::c_void, count: size_t) - -> ssize_t; + pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) + -> ::ssize_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "pread$UNIX2003")] - pub fn pread(fd: c_int, buf: *mut ::c_void, count: size_t, - offset: off_t) -> ssize_t; + pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, + offset: off_t) -> ::ssize_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "pwrite$UNIX2003")] - pub fn pwrite(fd: c_int, buf: *const ::c_void, count: size_t, - offset: off_t) -> ssize_t; - pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int; + pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, + offset: off_t) -> ::ssize_t; + pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "kill$UNIX2003")] - pub fn kill(pid: pid_t, sig: c_int) -> c_int; + pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; - pub fn mlock(addr: *const ::c_void, len: size_t) -> c_int; - pub fn munlock(addr: *const ::c_void, len: size_t) -> c_int; - pub fn mlockall(flags: c_int) -> c_int; - pub fn munlockall() -> c_int; + pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn mlockall(flags: ::c_int) -> ::c_int; + pub fn munlockall() -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "mmap$UNIX2003")] pub fn mmap(addr: *mut ::c_void, - len: size_t, - prot: c_int, - flags: c_int, - fd: c_int, + len: ::size_t, + prot: ::c_int, + flags: ::c_int, + fd: ::c_int, offset: off_t) -> *mut ::c_void; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "munmap$UNIX2003")] - pub fn munmap(addr: *mut ::c_void, len: size_t) -> c_int; + pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; - pub fn if_nametoindex(ifname: *const c_char) -> c_uint; + pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] - pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int; + pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "fsync$UNIX2003")] - pub fn fsync(fd: c_int) -> c_int; + pub fn fsync(fd: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "setenv$UNIX2003")] pub fn setenv(name: *const c_char, val: *const c_char, - overwrite: c_int) -> c_int; + overwrite: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "unsetenv$UNIX2003")] - pub fn unsetenv(name: *const c_char) -> c_int; + pub fn unsetenv(name: *const c_char) -> ::c_int; pub fn symlink(path1: *const c_char, - path2: *const c_char) -> c_int; + path2: *const c_char) -> ::c_int; - pub fn ftruncate(fd: c_int, length: off_t) -> c_int; + pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; #[cfg_attr(target_os = "android", link_name = "bsd_signal")] - pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t; + pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "getrlimit$UNIX2003")] - pub fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int; + pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "setrlimit$UNIX2003")] - pub fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int; - pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int; + pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; + pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; - pub fn getdtablesize() -> c_int; + pub fn getdtablesize() -> ::c_int; #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "realpath$DARWIN_EXTSN")] pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; - pub fn flock(fd: c_int, operation: c_int) -> c_int; + pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; @@ -362,11 +350,11 @@ extern { pub fn sched_yield() -> ::c_int; pub fn pthread_key_create(key: *mut pthread_key_t, dtor: ::dox::Option) - -> c_int; - pub fn pthread_key_delete(key: pthread_key_t) -> c_int; + -> ::c_int; + pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) - -> c_int; + -> ::c_int; pub fn pthread_mutex_init(lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t) -> ::c_int; pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; @@ -417,8 +405,8 @@ extern { oldset: *mut sigset_t) -> ::c_int; // #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")] - pub fn strerror_r(errnum: c_int, buf: *mut c_char, - buflen: size_t) -> c_int; + pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, + buflen: ::size_t) -> ::c_int; pub fn getsockopt(sockfd: ::c_int, level: ::c_int, @@ -448,20 +436,20 @@ extern { // TODO: get rid of this #[cfg(not(...))] #[cfg(not(target_os = "android"))] extern { - pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int; + pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ifaddrs); #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] pub fn glob(pattern: *const c_char, - flags: c_int, + flags: ::c_int, errfunc: ::dox::Option c_int>, - pglob: *mut glob_t) -> c_int; + errno: ::c_int) -> ::c_int>, + pglob: *mut glob_t) -> ::c_int; pub fn globfree(pglob: *mut glob_t); - pub fn posix_madvise(addr: *mut ::c_void, len: size_t, advice: c_int) - -> c_int; + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; - pub fn shm_unlink(name: *const c_char) -> c_int; + pub fn shm_unlink(name: *const c_char) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "seekdir$INODE64")] @@ -476,37 +464,37 @@ extern { pub fn telldir(dirp: *mut ::DIR) -> c_long; pub fn getsid(pid: pid_t) -> pid_t; - pub fn madvise(addr: *mut ::c_void, len: size_t, advice: c_int) - -> c_int; + pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) + -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "putenv$UNIX2003")] - pub fn putenv(string: *mut c_char) -> c_int; + pub fn putenv(string: *mut c_char) -> ::c_int; pub fn readlink(path: *const c_char, buf: *mut c_char, - bufsz: size_t) - -> ssize_t; + bufsz: ::size_t) + -> ::ssize_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "msync$UNIX2003")] - pub fn msync(addr: *mut ::c_void, len: size_t, flags: c_int) -> c_int; - pub fn sysconf(name: c_int) -> c_long; + pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; + pub fn sysconf(name: ::c_int) -> c_long; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "usleep$UNIX2003")] - pub fn usleep(secs: c_uint) -> c_int; + pub fn usleep(secs: ::c_uint) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "recvfrom$UNIX2003")] - pub fn recvfrom(socket: c_int, buf: *mut ::c_void, len: size_t, - flags: c_int, addr: *mut sockaddr, - addrlen: *mut socklen_t) -> ssize_t; + pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int, addr: *mut sockaddr, + addrlen: *mut socklen_t) -> ::ssize_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "send$UNIX2003")] - pub fn send(socket: c_int, buf: *const ::c_void, len: size_t, - flags: c_int) -> ssize_t; + pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, + flags: ::c_int) -> ::ssize_t; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "recv$UNIX2003")] - pub fn recv(socket: c_int, buf: *mut ::c_void, len: size_t, - flags: c_int) -> ssize_t; - pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int; + pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, + flags: ::c_int) -> ::ssize_t; + pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index fe296bdfc5ebc..3b3c9eb451c31 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -3,17 +3,12 @@ pub type c_char = u8; pub type c_long = i32; pub type c_ulong = u32; -pub type size_t = u32; -pub type ptrdiff_t = i32; pub type clock_t = i32; pub type time_t = i32; pub type suseconds_t = i32; pub type wchar_t = u32; -pub type intptr_t = i32; -pub type uintptr_t = u32; pub type off_t = i32; pub type ino_t = u32; -pub type ssize_t = i32; pub type blkcnt_t = u32; pub type blksize_t = u32; pub type dev_t = u32; diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index 53cd2db13255a..2f2eabec114f6 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -1,17 +1,12 @@ pub type c_char = i8; pub type c_long = i32; pub type c_ulong = u32; -pub type size_t = u32; -pub type ptrdiff_t = i32; pub type clock_t = i32; pub type time_t = i32; pub type suseconds_t = i32; pub type wchar_t = i32; -pub type intptr_t = i32; -pub type uintptr_t = u32; pub type off_t = i32; pub type ino_t = u32; -pub type ssize_t = i32; pub type blkcnt_t = i32; pub type blksize_t = i32; pub type nlink_t = u32; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index d45cb4eb85ad4..6606b41c9c6e0 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -8,9 +8,9 @@ pub type mode_t = u32; s! { pub struct glob_t { - pub gl_pathc: size_t, + pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut c_char, - pub gl_offs: size_t, + pub gl_offs: ::size_t, pub gl_flags: ::c_int, __unused1: *mut ::c_void, @@ -223,9 +223,9 @@ extern { cfg_if! { if #[cfg(any(target_arch = "arm", target_arch = "x86", target_arch = "x86_64"))] { - pub const PTHREAD_STACK_MIN: size_t = 16384; + pub const PTHREAD_STACK_MIN: ::size_t = 16384; } else { - pub const PTHREAD_STACK_MIN: size_t = 131072; + pub const PTHREAD_STACK_MIN: ::size_t = 131072; } } @@ -255,9 +255,9 @@ cfg_if! { pub fn sysctl(name: *mut ::c_int, namelen: ::c_int, oldp: *mut ::c_void, - oldlenp: *mut size_t, + oldlenp: *mut ::size_t, newp: *mut ::c_void, - newlen: size_t) + newlen: ::size_t) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn backtrace(buf: *mut *mut ::c_void, diff --git a/src/unix/notbsd/linux/notmips/b32/mod.rs b/src/unix/notbsd/linux/notmips/b32/mod.rs index b437d76d95ef0..4e6024fa6d04f 100644 --- a/src/unix/notbsd/linux/notmips/b32/mod.rs +++ b/src/unix/notbsd/linux/notmips/b32/mod.rs @@ -2,16 +2,11 @@ pub type c_long = i32; pub type c_ulong = u32; -pub type size_t = u32; -pub type ptrdiff_t = i32; pub type clock_t = i32; pub type time_t = i32; pub type suseconds_t = i32; -pub type intptr_t = i32; -pub type uintptr_t = u32; pub type ino_t = u32; pub type off_t = i32; -pub type ssize_t = i32; pub type blkcnt_t = i32; pub type blksize_t = i32; diff --git a/src/unix/notbsd/linux/notmips/b64/mod.rs b/src/unix/notbsd/linux/notmips/b64/mod.rs index 1916dc43aac95..ce3f3381c070f 100644 --- a/src/unix/notbsd/linux/notmips/b64/mod.rs +++ b/src/unix/notbsd/linux/notmips/b64/mod.rs @@ -2,16 +2,11 @@ pub type c_long = i64; pub type c_ulong = u64; -pub type size_t = u64; -pub type ptrdiff_t = i64; pub type clock_t = i64; pub type time_t = i64; pub type suseconds_t = i64; -pub type intptr_t = i64; -pub type uintptr_t = u64; pub type ino_t = u64; pub type off_t = i64; -pub type ssize_t = i64; pub type blkcnt_t = i64; s! { diff --git a/src/windows.rs b/src/windows.rs index e69d682d407a0..a4783cb0810a7 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -1,39 +1,9 @@ //! Windows CRT definitions pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; pub type c_long = i32; pub type c_ulong = u32; -pub type c_float = f32; -pub type c_double = f64; pub type wchar_t = u16; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; - -cfg_if! { - if #[cfg(target_arch = "x86")] { - pub type intptr_t = i32; - pub type ptrdiff_t = i32; - pub type size_t = u32; - pub type ssize_t = i32; - pub type uintptr_t = u32; - } else if #[cfg(target_arch = "x86_64")] { - pub type intptr_t = i64; - pub type ptrdiff_t = i64; - pub type size_t = u64; - pub type ssize_t = i64; - pub type uintptr_t = u64; - } else { - // unknown arch - } -} pub type clock_t = i32; @@ -57,9 +27,9 @@ s! { pub st_dev: dev_t, pub st_ino: ino_t, pub st_mode: u16, - pub st_nlink: c_short, - pub st_uid: c_short, - pub st_gid: c_short, + pub st_nlink: ::c_short, + pub st_uid: ::c_short, + pub st_gid: ::c_short, pub st_rdev: dev_t, pub st_size: i64, pub st_atime: time64_t, @@ -84,47 +54,47 @@ s! { } } -pub const EXIT_FAILURE: c_int = 1; -pub const EXIT_SUCCESS: c_int = 0; -pub const RAND_MAX: c_int = 32767; -pub const EOF: c_int = -1; -pub const SEEK_SET: c_int = 0; -pub const SEEK_CUR: c_int = 1; -pub const SEEK_END: c_int = 2; -pub const _IOFBF: c_int = 0; -pub const _IONBF: c_int = 4; -pub const _IOLBF: c_int = 64; -pub const BUFSIZ: c_uint = 512; -pub const FOPEN_MAX: c_uint = 20; -pub const FILENAME_MAX: c_uint = 260; +pub const EXIT_FAILURE: ::c_int = 1; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const RAND_MAX: ::c_int = 32767; +pub const EOF: ::c_int = -1; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const _IOFBF: ::c_int = 0; +pub const _IONBF: ::c_int = 4; +pub const _IOLBF: ::c_int = 64; +pub const BUFSIZ: ::c_uint = 512; +pub const FOPEN_MAX: ::c_uint = 20; +pub const FILENAME_MAX: ::c_uint = 260; cfg_if! { if #[cfg(all(target_env = "gnu"))] { - pub const L_tmpnam: c_uint = 14; - pub const TMP_MAX: c_uint = 0x7fff; + pub const L_tmpnam: ::c_uint = 14; + pub const TMP_MAX: ::c_uint = 0x7fff; } else { - pub const L_tmpnam: c_uint = 260; - pub const TMP_MAX: c_uint = 0x7fff_ffff; + pub const L_tmpnam: ::c_uint = 260; + pub const TMP_MAX: ::c_uint = 0x7fff_ffff; } } -pub const O_RDONLY: c_int = 0; -pub const O_WRONLY: c_int = 1; -pub const O_RDWR: c_int = 2; -pub const O_APPEND: c_int = 8; -pub const O_CREAT: c_int = 256; -pub const O_EXCL: c_int = 1024; -pub const O_TEXT: c_int = 16384; -pub const O_BINARY: c_int = 32768; -pub const O_NOINHERIT: c_int = 128; -pub const O_TRUNC: c_int = 512; -pub const S_IFCHR: c_int = 8192; -pub const S_IFDIR: c_int = 16384; -pub const S_IFREG: c_int = 32768; -pub const S_IFMT: c_int = 61440; -pub const S_IEXEC: c_int = 64; -pub const S_IWRITE: c_int = 128; -pub const S_IREAD: c_int = 256; +pub const O_RDONLY: ::c_int = 0; +pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 2; +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 256; +pub const O_EXCL: ::c_int = 1024; +pub const O_TEXT: ::c_int = 16384; +pub const O_BINARY: ::c_int = 32768; +pub const O_NOINHERIT: ::c_int = 128; +pub const O_TRUNC: ::c_int = 512; +pub const S_IFCHR: ::c_int = 8192; +pub const S_IFDIR: ::c_int = 16384; +pub const S_IFREG: ::c_int = 32768; +pub const S_IFMT: ::c_int = 61440; +pub const S_IEXEC: ::c_int = 64; +pub const S_IWRITE: ::c_int = 128; +pub const S_IREAD: ::c_int = 256; #[cfg(target_env = "msvc")] #[link(name = "msvcrt")] @@ -132,77 +102,77 @@ extern {} extern { #[link_name = "_chmod"] - pub fn chmod(path: *const c_char, mode: c_int) -> c_int; + pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int; #[link_name = "_wchmod"] - pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int; + pub fn wchmod(path: *const wchar_t, mode: ::c_int) -> ::c_int; #[link_name = "_mkdir"] - pub fn mkdir(path: *const c_char) -> c_int; + pub fn mkdir(path: *const c_char) -> ::c_int; #[link_name = "_wrmdir"] - pub fn wrmdir(path: *const wchar_t) -> c_int; + pub fn wrmdir(path: *const wchar_t) -> ::c_int; #[link_name = "_fstat64"] - pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; + pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; #[link_name = "_stat64"] - pub fn stat(path: *const c_char, buf: *mut stat) -> c_int; + pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; #[link_name = "_wstat64"] - pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int; + pub fn wstat(path: *const wchar_t, buf: *mut stat) -> ::c_int; #[link_name = "_wutime64"] - pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int; + pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> ::c_int; #[link_name = "_popen"] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; #[link_name = "_pclose"] - pub fn pclose(stream: *mut ::FILE) -> c_int; + pub fn pclose(stream: *mut ::FILE) -> ::c_int; #[link_name = "_fdopen"] - pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut ::FILE; + pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; #[link_name = "_fileno"] - pub fn fileno(stream: *mut ::FILE) -> c_int; + pub fn fileno(stream: *mut ::FILE) -> ::c_int; #[link_name = "_open"] - pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int; + pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; #[link_name = "_wopen"] - pub fn wopen(path: *const wchar_t, oflag: c_int, ...) -> c_int; + pub fn wopen(path: *const wchar_t, oflag: ::c_int, ...) -> ::c_int; #[link_name = "_creat"] - pub fn creat(path: *const c_char, mode: c_int) -> c_int; + pub fn creat(path: *const c_char, mode: ::c_int) -> ::c_int; #[link_name = "_access"] - pub fn access(path: *const c_char, amode: c_int) -> c_int; + pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; #[link_name = "_chdir"] - pub fn chdir(dir: *const c_char) -> c_int; + pub fn chdir(dir: *const c_char) -> ::c_int; #[link_name = "_close"] - pub fn close(fd: c_int) -> c_int; + pub fn close(fd: ::c_int) -> ::c_int; #[link_name = "_dup"] - pub fn dup(fd: c_int) -> c_int; + pub fn dup(fd: ::c_int) -> ::c_int; #[link_name = "_dup2"] - pub fn dup2(src: c_int, dst: c_int) -> c_int; + pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; #[link_name = "_execv"] - pub fn execv(prog: *const c_char, argv: *const *const c_char) -> intptr_t; + pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::intptr_t; #[link_name = "_execve"] pub fn execve(prog: *const c_char, argv: *const *const c_char, - envp: *const *const c_char) -> c_int; + envp: *const *const c_char) -> ::c_int; #[link_name = "_execvp"] - pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int; + pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; #[link_name = "_execvpe"] pub fn execvpe(c: *const c_char, argv: *const *const c_char, - envp: *const *const c_char) -> c_int; + envp: *const *const c_char) -> ::c_int; #[link_name = "_getcwd"] - pub fn getcwd(buf: *mut c_char, size: c_int) -> *mut c_char; + pub fn getcwd(buf: *mut c_char, size: ::c_int) -> *mut c_char; #[link_name = "_getpid"] - pub fn getpid() -> c_int; + pub fn getpid() -> ::c_int; #[link_name = "_isatty"] - pub fn isatty(fd: c_int) -> c_int; + pub fn isatty(fd: ::c_int) -> ::c_int; #[link_name = "_lseek"] - pub fn lseek(fd: c_int, offset: c_long, origin: c_int) -> c_long; + pub fn lseek(fd: ::c_int, offset: c_long, origin: ::c_int) -> c_long; #[link_name = "_pipe"] - pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int) -> c_int; + pub fn pipe(fds: *mut ::c_int, psize: ::c_uint, textmode: ::c_int) -> ::c_int; #[link_name = "_read"] - pub fn read(fd: c_int, buf: *mut ::c_void, count: c_uint) -> c_int; + pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::c_uint) -> ::c_int; #[link_name = "_rmdir"] - pub fn rmdir(path: *const c_char) -> c_int; + pub fn rmdir(path: *const c_char) -> ::c_int; #[link_name = "_unlink"] - pub fn unlink(c: *const c_char) -> c_int; + pub fn unlink(c: *const c_char) -> ::c_int; #[link_name = "_write"] - pub fn write(fd: c_int, buf: *const ::c_void, count: c_uint) -> c_int; + pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::c_uint) -> ::c_int; #[link_name = "_commit"] - pub fn commit(fd: c_int) -> c_int; + pub fn commit(fd: ::c_int) -> ::c_int; #[link_name = "_get_osfhandle"] - pub fn get_osfhandle(fd: c_int) -> intptr_t; + pub fn get_osfhandle(fd: ::c_int) -> ::intptr_t; #[link_name = "_open_osfhandle"] - pub fn open_osfhandle(osfhandle: intptr_t, flags: c_int) -> c_int; + pub fn open_osfhandle(osfhandle: ::intptr_t, flags: ::c_int) -> ::c_int; } From 41e7a69e2a3904bfe4610088bac19ed61b141d25 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 22 Sep 2015 19:22:09 -0700 Subject: [PATCH 2/2] Fix OSX --- src/unix/bsd/apple/mod.rs | 6 +++--- src/unix/bsd/mod.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 74435c43ebd58..7aefcab271e45 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -19,9 +19,9 @@ pub enum timezone {} s! { pub struct glob_t { - pub gl_pathc: size_t, + pub gl_pathc: ::size_t, __unused1: ::c_int, - pub gl_offs: size_t, + pub gl_offs: ::size_t, __unused2: ::c_int, pub gl_pathv: *mut *mut ::c_char, @@ -389,7 +389,7 @@ pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1; pub const PTHREAD_CREATE_DETACHED: ::c_int = 2; -pub const PTHREAD_STACK_MIN: size_t = 8192; +pub const PTHREAD_STACK_MIN: ::size_t = 8192; pub const RLIMIT_CPU: ::c_int = 0; pub const RLIMIT_FSIZE: ::c_int = 1; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index c994d9c8509a3..a1c854845170d 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -5,7 +5,7 @@ pub type useconds_t = u32; pub type blkcnt_t = i64; pub type socklen_t = u32; pub type sa_family_t = u8; -pub type pthread_t = uintptr_t; +pub type pthread_t = ::uintptr_t; s! { pub struct sockaddr { @@ -76,11 +76,11 @@ pub const IPV6_MULTICAST_LOOP: ::c_int = 11; pub const IPV6_V6ONLY: ::c_int = 27; extern { - pub fn mincore(addr: *const ::c_void, len: size_t, + pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut c_char) -> ::c_int; pub fn sysctlnametomib(name: *const c_char, mibp: *mut ::c_int, - sizep: *mut size_t) + sizep: *mut ::size_t) -> ::c_int; pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;