Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::os::MemoryMap::new() fails on Windows #16070

Closed
jamesluke opened this issue Jul 29, 2014 · 4 comments
Closed

std::os::MemoryMap::new() fails on Windows #16070

jamesluke opened this issue Jul 29, 2014 · 4 comments
Labels
O-windows Operating system: Windows

Comments

@jamesluke
Copy link
Contributor

Code:

extern crate native;
extern crate rustrt;
use rustrt::rtio::{Open,Read};
fn main() {
    let file = native::io::file::open(&"test.txt".to_c_str(), Open, Read)
        .ok().unwrap();
    let map_options = [std::os::MapReadable, std::os::MapFd(file.fd())];
    std::os::MemoryMap::new(2048, map_options).unwrap();
}

Error: task '

' failed at 'called Result::unwrap() on an Err value: MapViewOfFile failure = 998', C:\bot\slave\nightly-win\build\src\libcore\result.rs:548
OS: Windows 8.1 Pro
Compiler version: rustc 0.12.0-pre-nightly (b2bd998 2014-07-28 22:36:39 +0000)

The file is being opened, as shown by this process monitor scrape:
procmon

@retep998
Copy link
Member

Known issue #13259

@brson brson mentioned this issue Aug 12, 2014
33 tasks
@alexcrichton
Copy link
Member

Yes, I just ran into this as well, and it looks like this is a dupe of #13259. @jamesluke, can you confirm the workaround in that issue works by adding this early on in your code?

unsafe { ::std::rt::stack::record_sp_limit(0); }

@jamesluke
Copy link
Contributor Author

Just tried this again with the latest nightly (would give commit, but for some reason 'rustc --version verbose' isn't giving me one), it now works even without the record_sp_limit(0) workaround you suggested.

@alexcrichton
Copy link
Member

Thanks for investigating @jamesluke! I think I'll just chalk this up to the mysteriousness of #13259 in that case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

4 participants