pub fn attach(&self, ptr: *mut c_void) -> Result<MemoryMap, AllocError> {
        unsafe {
            // note: the success of allocate guarantees `shm_id != -1`.
            assert!(!ptr.is_null());
            let r = shmat(self.id, ptr, 0);
            if r as isize == -1 {
                print_error("shmat");
                return Err(AllocError::Other);
            }
            let map = MemoryMap(ptr);
            if r != ptr {
                print_error("shmat2");
                // map is dropped here, freeing the memory.
                return Err(AllocError::Other);
            }
            Ok(map)
        }
    }
/// Attaches System V shared memory to the memory address at `ptr` in the
/// address space of the current process.
///
/// # Panics
///
/// If `ptr` is null.
Attaches System V shared memory to the memory address at `ptr` in the
address space of the current process.
Attaches System V shared memory to the memory address at ` ptr ` in the address space of the current process .
pub fn attach(&self, ptr: *mut c_void) -> Result<MemoryMap, AllocError> {
        unsafe {
            // note: the success of allocate guarantees `shm_id != -1`.
            assert!(!ptr.is_null());
            let r = shmat(self.id, ptr, 0);
            if r as isize == -1 {
                print_error("shmat");
                return Err(AllocError::Other);
            }
            let map = MemoryMap(ptr);
            if r != ptr {
                print_error("shmat2");
                // map is dropped here, freeing the memory.
                return Err(AllocError::Other);
            }
            Ok(map)
        }
    }
pub fn attach ( & self , ptr : * mut c_void ) -> Result < MemoryMap , AllocError > { unsafe { // note: the success of allocate guarantees `shm_id != -1`. assert ! ( ptr is_null ( ) ) ; let r = shmat ( self . id , ptr , 0 ) ; if r as isize == - 1 { print_error ( " " ) ; return Err ( AllocError :: Other ) ; } let map = MemoryMap ( ptr ) ; if r != ptr { print_error ( " " ) ; // map is dropped here, freeing the memory. return Err ( AllocError :: Other ) ; } Ok ( map ) } }
Attaches System V shared memory to the memory address at `ptr` in the
address space of the current process.
Attaches System V shared memory to the memory address at ` ptr ` in the address space of the current process .
&self
ptr
*mut c_void
&self
ptr
*mut c_void
panics
If `ptr` is null.
If ` ptr ` is null .