native: Improve windows file handling
This commit splits the file implementation into file_unix and file_win32. The two implementations have diverged to the point that they share almost 0 code at this point, so it's easier to maintain as separate files. The other major change accompanied with this commit is that file::open is no longer based on libc's open function on windows, but rather windows's CreateFile function. This fixes dealing with binary files on windows (test added in previous commit). This also changes the read/write functions to use ReadFile and WriteFile instead of libc's read/write. Closes #12406
This commit is contained in:
@@ -17,8 +17,8 @@ use std::rt::rtio;
|
||||
use std::sync::arc::UnsafeArc;
|
||||
use std::intrinsics;
|
||||
|
||||
use super::{IoResult, retry};
|
||||
use super::file::{keep_going, fd_t};
|
||||
use super::{IoResult, retry, keep_going};
|
||||
use super::file::fd_t;
|
||||
|
||||
fn unix_socket(ty: libc::c_int) -> IoResult<fd_t> {
|
||||
match unsafe { libc::socket(libc::AF_UNIX, ty, 0) } {
|
||||
|
||||
Reference in New Issue
Block a user