pub fn new(len: usize) -> io::Result<UserMem> {
        let ptr = unsafe {
            libc::mmap(
                std::ptr::null_mut(),
                len,
                libc::PROT_READ | libc::PROT_WRITE,
                libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
                -1,
                0,
            )
        };

        if ptr == libc::MAP_FAILED {
            Err(io::Error::last_os_error())
        } else {
            Ok(UserMem {
                ptr: ptr.cast(),
                len,
            })
        }
    }
/// Allocate a zero-initialized memory region of `len` bytes.
Allocate a zero-initialized memory region of `len` bytes.
Allocate a zero - initialized memory region of ` len ` bytes .
pub fn new(len: usize) -> io::Result<UserMem> {
        let ptr = unsafe {
            libc::mmap(
                std::ptr::null_mut(),
                len,
                libc::PROT_READ | libc::PROT_WRITE,
                libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
                -1,
                0,
            )
        };
        if ptr == libc::MAP_FAILED {
            Err(io::Error::last_os_error())
        } else {
            Ok(UserMem {
                ptr: ptr.cast(),
                len,
            })
        }
    }
pub fn new ( len : usize ) -> io :: Result < UserMem > { let ptr = unsafe { libc :: mmap ( std :: ptr :: null_mut ( ) , len , libc :: PROT_READ | libc :: PROT_WRITE , libc :: MAP_PRIVATE | libc :: MAP_ANONYMOUS , - 1 , 0 , ) } ; if ptr == libc :: MAP_FAILED { Err ( io :: Error :: last_os_error ( ) ) } else { Ok ( UserMem { ptr : ptr . cast ( ) , len , } ) } }
Allocate a zero-initialized memory region of `len` bytes.
Allocate a zero - initialized memory region of ` len ` bytes .
len
usize