pub fn sys_shmctl(&self, id: usize, cmd: usize, buffer: usize) -> SysResult {
        info!("shmctl: id: {}, cmd: {} buffer: {:#x}", id, cmd, buffer);
        let shm_identifier = self.linux_process().shm_get(id).ok_or(LxError::EINVAL)?;
        let shm_guard = shm_identifier.guard.lock();
        let cmd = match ShmctlCmds::try_from(cmd) {
            Ok(t) => t,
            Err(_) => {
                error!("invalid semctl cmd: {}", cmd);
                return Err(LxError::EINVAL);
            }
        };
        match cmd {
            ShmctlCmds::IPC_RMID => {
                shm_guard.remove();
                self.linux_process().shm_pop(id);
                Ok(0)
            }
            ShmctlCmds::IPC_SET => {
                let buffer: UserInPtr<ShmidDs> = buffer.into();
                let set_ds = buffer.read()?;
                shm_guard.set(&set_ds);
                shm_guard.ctime();
                Ok(0)
            }
            ShmctlCmds::IPC_STAT | ShmctlCmds::SHM_STAT => {
                let shmid_ds = shm_guard.shmid_ds.lock();
                let mut buffer: UserOutPtr<ShmidDs> = buffer.into();
                buffer.write(*shmid_ds)?;
                Ok(0)
            }
            ShmctlCmds::SHM_INFO => {
                let mut buffer: UserOutPtr<ShmInfo> = buffer.into();
                buffer.write(ShmInfo::default())?;
                Ok(0)
            }
            _ => unimplemented!("Semaphore Semctl cmd: {:?}", cmd),
        }
    }
/// shared memory control
///
/// performs the control operation specified by cmd on the shared memory segment whose identifier is given in id
shared memory control
performs the control operation specified by cmd on the shared memory segment whose identifier is given in id
shared memory control performs the control operation specified by cmd on the shared memory segment whose identifier is given in id
pub fn sys_shmctl(&self, id: usize, cmd: usize, buffer: usize) -> SysResult {
        info!("shmctl: id: {}, cmd: {} buffer: {:#x}", id, cmd, buffer);
        let shm_identifier = self.linux_process().shm_get(id).ok_or(LxError::EINVAL)?;
        let shm_guard = shm_identifier.guard.lock();
        let cmd = match ShmctlCmds::try_from(cmd) {
            Ok(t) => t,
            Err(_) => {
                error!("invalid semctl cmd: {}", cmd);
                return Err(LxError::EINVAL);
            }
        };
        match cmd {
            ShmctlCmds::IPC_RMID => {
                shm_guard.remove();
                self.linux_process().shm_pop(id);
                Ok(0)
            }
            ShmctlCmds::IPC_SET => {
                let buffer: UserInPtr<ShmidDs> = buffer.into();
                let set_ds = buffer.read()?;
                shm_guard.set(&set_ds);
                shm_guard.ctime();
                Ok(0)
            }
            ShmctlCmds::IPC_STAT | ShmctlCmds::SHM_STAT => {
                let shmid_ds = shm_guard.shmid_ds.lock();
                let mut buffer: UserOutPtr<ShmidDs> = buffer.into();
                buffer.write(*shmid_ds)?;
                Ok(0)
            }
            ShmctlCmds::SHM_INFO => {
                let mut buffer: UserOutPtr<ShmInfo> = buffer.into();
                buffer.write(ShmInfo::default())?;
                Ok(0)
            }
            _ => unimplemented!("Semaphore Semctl cmd: {:?}", cmd),
        }
    }
pub fn sys_shmctl ( & self , id : usize , cmd : usize , buffer : usize ) -> SysResult { info ! ( " " id cmd buffer ) ; let shm_identifier = self . linux_process ( ) . shm_get ( id ) . ok_or ( LxError :: EINVAL ) ? ; let shm_guard = shm_identifier . guard . lock ( ) ; let cmd = match ShmctlCmds :: try_from ( cmd ) { Ok ( t ) => t , Err ( _ ) => { error ! ( " " cmd ) ; return Err ( LxError :: EINVAL ) ; } } ; match cmd { ShmctlCmds :: IPC_RMID => { shm_guard . remove ( ) ; self . linux_process ( ) . shm_pop ( id ) ; Ok ( 0 ) } ShmctlCmds :: IPC_SET => { let buffer : UserInPtr < ShmidDs > = buffer . into ( ) ; let set_ds = buffer . read ( ) ? ; shm_guard . set ( & set_ds ) ; shm_guard . ctime ( ) ; Ok ( 0 ) } ShmctlCmds :: IPC_STAT | ShmctlCmds :: SHM_STAT => { let shmid_ds = shm_guard . shmid_ds . lock ( ) ; let mut buffer : UserOutPtr < ShmidDs > = buffer . into ( ) ; buffer . write ( * shmid_ds ) ? ; Ok ( 0 ) } ShmctlCmds :: SHM_INFO => { let mut buffer : UserOutPtr < ShmInfo > = buffer . into ( ) ; buffer . write ( ShmInfo :: default ( ) ) ? ; Ok ( 0 ) } _ => unimplemented ! ( " " cmd ) , } }
shared memory control
performs the control operation specified by cmd on the shared memory segment whose identifier is given in id
shared memory control performs the control operation specified by cmd on the shared memory segment whose identifier is given in id
&self
id
usize
cmd
usize
buffer
usize
&self
id
usize
cmd
usize
buffer
usize