about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-06 02:56:39 -0700
committerbors <bors@rust-lang.org>2014-04-06 02:56:39 -0700
commitf1f50565a1fda0dfd60d89fea65e2328f42cc5e0 (patch)
treec6afc2ec113c761b4a284e1370f00f29155f7025 /src/libnative
parent667f82a79b2275a696b21086ddf5148a617fe20a (diff)
parent38f7a1b41b0ff9c1bcaec9a892c8ffb64ad6139f (diff)
downloadrust-f1f50565a1fda0dfd60d89fea65e2328f42cc5e0.tar.gz
rust-f1f50565a1fda0dfd60d89fea65e2328f42cc5e0.zip
auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,me
Rebasing of #12526 with a very obscure bug fixed on windows.
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/addrinfo.rs4
-rw-r--r--src/libnative/io/file_unix.rs10
-rw-r--r--src/libnative/io/file_win32.rs4
-rw-r--r--src/libnative/io/mod.rs4
-rw-r--r--src/libnative/io/net.rs2
-rw-r--r--src/libnative/io/pipe_unix.rs2
-rw-r--r--src/libnative/io/pipe_win32.rs2
-rw-r--r--src/libnative/io/process.rs28
-rw-r--r--src/libnative/io/timer_helper.rs6
-rw-r--r--src/libnative/io/timer_other.rs6
-rw-r--r--src/libnative/io/timer_timerfd.rs4
-rw-r--r--src/libnative/io/timer_win32.rs4
-rw-r--r--src/libnative/lib.rs6
13 files changed, 42 insertions, 40 deletions
diff --git a/src/libnative/io/addrinfo.rs b/src/libnative/io/addrinfo.rs
index bca564870e2..5b872a2dbc5 100644
--- a/src/libnative/io/addrinfo.rs
+++ b/src/libnative/io/addrinfo.rs
@@ -12,8 +12,8 @@ use ai = std::io::net::addrinfo;
 use std::c_str::CString;
 use std::cast;
 use std::io::IoError;
-use std::libc;
-use std::libc::{c_char, c_int};
+use libc;
+use libc::{c_char, c_int};
 use std::ptr::{null, mut_null};
 
 use super::net::sockaddr_to_addr;
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs
index 143228b14e9..56460166b48 100644
--- a/src/libnative/io/file_unix.rs
+++ b/src/libnative/io/file_unix.rs
@@ -14,8 +14,8 @@ use std::sync::arc::UnsafeArc;
 use std::c_str::CString;
 use std::io::IoError;
 use std::io;
-use std::libc::{c_int, c_void};
-use std::libc;
+use libc::{c_int, c_void};
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::slice;
@@ -341,8 +341,8 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
 }
 
 pub fn readdir(p: &CString) -> IoResult<~[Path]> {
-    use std::libc::{dirent_t};
-    use std::libc::{opendir, readdir_r, closedir};
+    use libc::{dirent_t};
+    use libc::{opendir, readdir_r, closedir};
 
     fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
         let root = unsafe { CString::new(root.with_ref(|p| p), false) };
@@ -520,7 +520,7 @@ pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
 mod tests {
     use super::{CFile, FileDesc};
     use std::io;
-    use std::libc;
+    use libc;
     use std::os;
     use std::rt::rtio::RtioFileStream;
 
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index c19e81b5de4..3e8ee55df94 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -14,8 +14,8 @@ use std::c_str::CString;
 use std::cast;
 use std::io::IoError;
 use std::io;
-use std::libc::{c_int, c_void};
-use std::libc;
+use libc::{c_int, c_void};
+use libc;
 use std::mem;
 use std::os::win32::{as_utf16_p, fill_utf16_buf_and_decode};
 use std::ptr;
diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs
index 34843102456..ffca0dbe3dc 100644
--- a/src/libnative/io/mod.rs
+++ b/src/libnative/io/mod.rs
@@ -27,8 +27,8 @@ use std::io::IoError;
 use std::io::net::ip::SocketAddr;
 use std::io::process::ProcessConfig;
 use std::io::signal::Signum;
-use std::libc::c_int;
-use std::libc;
+use libc::c_int;
+use libc;
 use std::os;
 use std::rt::rtio;
 use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioUdpSocket,
diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs
index 6ddd69eb019..cef6a247a00 100644
--- a/src/libnative/io/net.rs
+++ b/src/libnative/io/net.rs
@@ -11,7 +11,7 @@
 use std::cast;
 use std::io::net::ip;
 use std::io;
-use std::libc;
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::sync::arc::UnsafeArc;
diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs
index fb9ac27d830..22ba643e96a 100644
--- a/src/libnative/io/pipe_unix.rs
+++ b/src/libnative/io/pipe_unix.rs
@@ -11,7 +11,7 @@
 use std::c_str::CString;
 use std::cast;
 use std::io;
-use std::libc;
+use libc;
 use std::mem;
 use std::rt::rtio;
 use std::sync::arc::UnsafeArc;
diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs
index 36f2dc7d65c..84b3d887c04 100644
--- a/src/libnative/io/pipe_win32.rs
+++ b/src/libnative/io/pipe_win32.rs
@@ -85,7 +85,7 @@
 //! me!
 
 use std::c_str::CString;
-use std::libc;
+use libc;
 use std::os::win32::as_utf16_p;
 use std::ptr;
 use std::rt::rtio;
diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs
index d2e2db63c1b..1218fab05f0 100644
--- a/src/libnative/io/process.rs
+++ b/src/libnative/io/process.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 use std::io;
-use std::libc::{pid_t, c_void, c_int};
-use std::libc;
+use libc::{pid_t, c_void, c_int};
+use libc;
 use std::os;
 use std::ptr;
 use std::rt::rtio;
@@ -223,20 +223,20 @@ fn spawn_process_os(config: p::ProcessConfig,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
                     err_fd: c_int) -> IoResult<SpawnProcessResult> {
-    use std::libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
-    use std::libc::consts::os::extra::{
+    use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
+    use libc::consts::os::extra::{
         TRUE, FALSE,
         STARTF_USESTDHANDLES,
         INVALID_HANDLE_VALUE,
         DUPLICATE_SAME_ACCESS
     };
-    use std::libc::funcs::extra::kernel32::{
+    use libc::funcs::extra::kernel32::{
         GetCurrentProcess,
         DuplicateHandle,
         CloseHandle,
         CreateProcessA
     };
-    use std::libc::funcs::extra::msvcrt::get_osfhandle;
+    use libc::funcs::extra::msvcrt::get_osfhandle;
 
     use std::mem;
 
@@ -422,9 +422,9 @@ fn spawn_process_os(config: p::ProcessConfig,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int,
                     err_fd: c_int) -> IoResult<SpawnProcessResult> {
-    use std::libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
-    use std::libc::funcs::bsd44::getdtablesize;
-    use std::libc::c_ulong;
+    use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
+    use libc::funcs::bsd44::getdtablesize;
+    use libc::c_ulong;
 
     mod rustrt {
         extern {
@@ -716,8 +716,8 @@ fn waitpid(pid: pid_t) -> p::ProcessExit {
 
     #[cfg(windows)]
     fn waitpid_os(pid: pid_t) -> p::ProcessExit {
-        use std::libc::types::os::arch::extra::DWORD;
-        use std::libc::consts::os::extra::{
+        use libc::types::os::arch::extra::DWORD;
+        use libc::consts::os::extra::{
             SYNCHRONIZE,
             PROCESS_QUERY_INFORMATION,
             FALSE,
@@ -725,7 +725,7 @@ fn waitpid(pid: pid_t) -> p::ProcessExit {
             INFINITE,
             WAIT_FAILED
         };
-        use std::libc::funcs::extra::kernel32::{
+        use libc::funcs::extra::kernel32::{
             OpenProcess,
             GetExitCodeProcess,
             CloseHandle,
@@ -761,7 +761,7 @@ fn waitpid(pid: pid_t) -> p::ProcessExit {
 
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> p::ProcessExit {
-        use std::libc::funcs::posix01::wait;
+        use libc::funcs::posix01::wait;
         let mut status = 0 as c_int;
         match retry(|| unsafe { wait::waitpid(pid, &mut status, 0) }) {
             -1 => fail!("unknown waitpid error: {}", super::last_error()),
@@ -779,7 +779,7 @@ fn waitpid_nowait(pid: pid_t) -> Option<p::ProcessExit> {
 
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> Option<p::ProcessExit> {
-        use std::libc::funcs::posix01::wait;
+        use libc::funcs::posix01::wait;
         let mut status = 0 as c_int;
         match retry(|| unsafe {
             wait::waitpid(pid, &mut status, libc::WNOHANG)
diff --git a/src/libnative/io/timer_helper.rs b/src/libnative/io/timer_helper.rs
index e5f70c4e4b3..4b29feab84f 100644
--- a/src/libnative/io/timer_helper.rs
+++ b/src/libnative/io/timer_helper.rs
@@ -94,7 +94,7 @@ fn shutdown() {
 
 #[cfg(unix)]
 mod imp {
-    use std::libc;
+    use libc;
     use std::os;
 
     use io::file::FileDesc;
@@ -117,9 +117,9 @@ mod imp {
 
 #[cfg(windows)]
 mod imp {
-    use std::libc::{BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
+    use libc::{BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
     use std::ptr;
-    use std::libc;
+    use libc;
 
     pub type signal = HANDLE;
 
diff --git a/src/libnative/io/timer_other.rs b/src/libnative/io/timer_other.rs
index 7979075aa02..13f1ea6319a 100644
--- a/src/libnative/io/timer_other.rs
+++ b/src/libnative/io/timer_other.rs
@@ -47,7 +47,7 @@
 //! Note that all time units in this file are in *milliseconds*.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::mem;
 use std::os;
 use std::ptr;
@@ -287,7 +287,7 @@ impl Drop for Timer {
 
 #[cfg(target_os = "macos")]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static FD_SETSIZE: uint = 1024;
 
@@ -314,7 +314,7 @@ mod imp {
 #[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static FD_SETSIZE: uint = 1024;
 
diff --git a/src/libnative/io/timer_timerfd.rs b/src/libnative/io/timer_timerfd.rs
index d7202d9d765..25dbdc1e1a5 100644
--- a/src/libnative/io/timer_timerfd.rs
+++ b/src/libnative/io/timer_timerfd.rs
@@ -29,7 +29,7 @@
 //! As with timer_other, all units in this file are in units of millseconds.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::ptr;
 use std::os;
 use std::rt::rtio;
@@ -267,7 +267,7 @@ impl Drop for Timer {
 
 #[allow(dead_code)]
 mod imp {
-    use std::libc;
+    use libc;
 
     pub static CLOCK_MONOTONIC: libc::c_int = 1;
     pub static EPOLL_CTL_ADD: libc::c_int = 1;
diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs
index 3e420e45448..278a5a73a36 100644
--- a/src/libnative/io/timer_win32.rs
+++ b/src/libnative/io/timer_win32.rs
@@ -21,7 +21,7 @@
 //! the other two implementations of timers with nothing *that* new showing up.
 
 use std::comm::Data;
-use std::libc;
+use libc;
 use std::ptr;
 use std::rt::rtio;
 
@@ -178,7 +178,7 @@ impl Drop for Timer {
 }
 
 mod imp {
-    use std::libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
+    use libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
                     LONG, LPVOID, DWORD, c_void};
 
     pub type PTIMERAPCROUTINE = *c_void;
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs
index 7e05c4c961c..4c0c4dcc18e 100644
--- a/src/libnative/lib.rs
+++ b/src/libnative/lib.rs
@@ -55,6 +55,8 @@
 //    consider whether they're needed before adding that feature here (the
 //    answer is that you don't need them)
 
+extern crate libc;
+
 use std::os;
 use std::rt;
 use std::str;
@@ -107,8 +109,8 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
     // prevent this problem.
     #[cfg(windows)] fn ignore_sigpipe() {}
     #[cfg(unix)] fn ignore_sigpipe() {
-        use std::libc;
-        use std::libc::funcs::posix01::signal::signal;
+        use libc;
+        use libc::funcs::posix01::signal::signal;
         unsafe {
             assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != -1);
         }