diff options
| author | bors <bors@rust-lang.org> | 2015-11-10 06:56:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-11-10 06:56:30 +0000 |
| commit | 6aee7c5d2c3e5796844671cf072487f6fb04cb9b (patch) | |
| tree | 955886bbc19c1ce0943377edf689ad4dd1842749 /src/test | |
| parent | 2968dfa28597e50b748b641f9b881c7012b041c6 (diff) | |
| parent | 3d28b8b98e6e4f55ef4ecd8babf0a050f48a3d11 (diff) | |
| download | rust-6aee7c5d2c3e5796844671cf072487f6fb04cb9b.tar.gz rust-6aee7c5d2c3e5796844671cf072487f6fb04cb9b.zip | |
Auto merge of #29546 - alexcrichton:new-libc, r=brson
This commit replaces the in-tree liblibc with the [external clone](https://github.com/rust-lang-nursery/libc) which has no evolved beyond the in-tree version in light of its [recent redesign](https://github.com/rust-lang/rfcs/pull/1291).
The primary changes here are:
* `src/liblibc/lib.rs` was deleted
* `src/liblibc` is now a submodule pointing at the external repository
* `src/libstd/sys/unix/{c.rs,sync.rs}` were both deleted having all bindings folded into the external liblibc.
* Many ad-hoc `extern` blocks in the standard library were removed in favor of bindings now being in the external liblibc.
* Many functions/types were added to `src/libstd/sys/windows/c.rs`, and the scattered definitions throughout the standard library were consolidated here.
At the API level this commit is **not a breaking change**, although it is only very lightly tested on the *BSD variants and is probably going to break almost all of their builds! Follow-up commits to liblibc should in theory be all that's necessary to get the build working on the *BSDs again.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-13259-windows-tcb-trash.rs | 11 | ||||
| -rw-r--r-- | src/test/run-pass/rfc-1014-2.rs | 10 | ||||
| -rw-r--r-- | src/test/run-pass/rfc-1014.rs | 12 | ||||
| -rw-r--r-- | src/test/run-pass/wait-forked-but-failed-child.rs | 4 |
4 files changed, 22 insertions, 15 deletions
diff --git a/src/test/run-pass/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issue-13259-windows-tcb-trash.rs index 2e03a9a7244..cca27aebfa4 100644 --- a/src/test/run-pass/issue-13259-windows-tcb-trash.rs +++ b/src/test/run-pass/issue-13259-windows-tcb-trash.rs @@ -14,8 +14,9 @@ extern crate libc; #[cfg(windows)] mod imp { - use libc::{c_void, LPVOID, DWORD}; - use libc::types::os::arch::extra::LPWSTR; + type LPVOID = *mut u8; + type DWORD = u32; + type LPWSTR = *mut u16; extern "system" { fn FormatMessageW(flags: DWORD, @@ -24,15 +25,15 @@ mod imp { langId: DWORD, buf: LPWSTR, nsize: DWORD, - args: *const c_void) + args: *const u8) -> DWORD; } pub fn test() { let mut buf: [u16; 50] = [0; 50]; let ret = unsafe { - FormatMessageW(0x1000, 0 as *mut c_void, 1, 0x400, - buf.as_mut_ptr(), buf.len() as u32, 0 as *const c_void) + FormatMessageW(0x1000, 0 as *mut _, 1, 0x400, + buf.as_mut_ptr(), buf.len() as u32, 0 as *const _) }; // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented // stacks taking control of pvArbitrary diff --git a/src/test/run-pass/rfc-1014-2.rs b/src/test/run-pass/rfc-1014-2.rs index ad76daaace4..7cdaf278a08 100644 --- a/src/test/run-pass/rfc-1014-2.rs +++ b/src/test/run-pass/rfc-1014-2.rs @@ -11,15 +11,19 @@ extern crate libc; +type DWORD = u32; +type HANDLE = *mut u8; +type BOOL = i32; + #[cfg(windows)] extern "system" { - fn SetStdHandle(nStdHandle: libc::DWORD, nHandle: libc::HANDLE) -> libc::BOOL; + fn SetStdHandle(nStdHandle: DWORD, nHandle: HANDLE) -> BOOL; } #[cfg(windows)] fn close_stdout() { - const STD_OUTPUT_HANDLE: libc::DWORD = -11i32 as libc::DWORD; - unsafe { SetStdHandle(STD_OUTPUT_HANDLE, 0 as libc::HANDLE); } + const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; + unsafe { SetStdHandle(STD_OUTPUT_HANDLE, 0 as HANDLE); } } #[cfg(windows)] diff --git a/src/test/run-pass/rfc-1014.rs b/src/test/run-pass/rfc-1014.rs index 98cad4efab7..df969070a2a 100644 --- a/src/test/run-pass/rfc-1014.rs +++ b/src/test/run-pass/rfc-1014.rs @@ -11,20 +11,24 @@ extern crate libc; +type DWORD = u32; +type HANDLE = *mut u8; + #[cfg(windows)] extern "system" { - pub fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE; + fn GetStdHandle(which: DWORD) -> HANDLE; + fn CloseHandle(handle: HANDLE) -> i32; } #[cfg(windows)] fn close_stdout() { - const STD_OUTPUT_HANDLE: libc::DWORD = -11i32 as libc::DWORD; - unsafe { libc::CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } + const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; + unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } } #[cfg(not(windows))] fn close_stdout() { - unsafe { libc::close(libc::STDOUT_FILENO); } + unsafe { libc::close(1); } } fn main() { diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index 1d0004bafa3..795c3f46f75 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -15,8 +15,6 @@ extern crate libc; use std::process::Command; -use libc::funcs::posix88::unistd; - // The output from "ps -A -o pid,ppid,args" should look like this: // PID PPID COMMAND // 1 0 /sbin/init @@ -34,7 +32,7 @@ use libc::funcs::posix88::unistd; #[cfg(unix)] fn find_zombies() { - let my_pid = unsafe { unistd::getpid() }; + let my_pid = unsafe { libc::getpid() }; // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html let ps_cmd_output = Command::new("ps").args(&["-A", "-o", "pid,ppid,args"]).output().unwrap(); |
