Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
os: introduce cross-platform MemoryMap bindings
Basically, one may just do:

    MemoryMap::new(16, ~[
      MapExecutable,
      MapReadable,
      MapWritable
    ])

And executable+readable+writable chunk of at least 16 bytes size will be
allocated and freed with the result of `MemoryMap::new`.
  • Loading branch information
indutny committed Jul 9, 2013
1 parent 4a868c7 commit db24ee9
Show file tree
Hide file tree
Showing 2 changed files with 358 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/libstd/libc.rs
Expand Up @@ -732,8 +732,8 @@ pub mod types {
wProcessorArchitecture: 0,
wReserved: 0,
dwPageSize: 0,
lpMinimumApplicationAddress: ptr::null(),
lpMaximumApplicationAddress: ptr::null(),
lpMinimumApplicationAddress: ptr::mut_null(),
lpMaximumApplicationAddress: ptr::mut_null(),
dwActiveProcessorMask: 0,
dwNumberOfProcessors: 0,
dwProcessorType: 0,
Expand Down Expand Up @@ -1011,7 +1011,7 @@ pub mod consts {
}
pub mod extra {
use libc::types::os::arch::c95::c_int;
use libc::types::os::arch::extra::{DWORD, BOOL};
use libc::types::os::arch::extra::{WORD, DWORD, BOOL};

pub static TRUE : BOOL = 1;
pub static FALSE : BOOL = 0;
Expand Down Expand Up @@ -3002,7 +3002,8 @@ pub mod funcs {
LPCVOID};
use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, LPSTARTUPINFO,
LPPROCESS_INFORMATION,
LPMEMORY_BASIC_INFORMATION};
LPMEMORY_BASIC_INFORMATION,
LPSYSTEM_INFO};
use libc::types::os::arch::extra::{HANDLE, LPHANDLE};

#[abi = "stdcall"]
Expand Down

5 comments on commit db24ee9

@bors
Copy link
Contributor

@bors bors commented on db24ee9 Jul 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at indutny@db24ee9

@bors
Copy link
Contributor

@bors bors commented on db24ee9 Jul 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging indutny/rust/feature/memory-api = db24ee9 into auto

@bors
Copy link
Contributor

@bors bors commented on db24ee9 Jul 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indutny/rust/feature/memory-api = db24ee9 merged ok, testing candidate = 5aa0ca9

@bors
Copy link
Contributor

@bors bors commented on db24ee9 Jul 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 5aa0ca9

Please sign in to comment.