fn new(mut addr: UserInOutPtr<u32>, nfds: usize) -> Result<FdSet, LxError> {
        if addr.is_null() {
            Ok(FdSet {
                addr,
                origin: BitVec::new(),
            })
        } else {
            let len = (nfds + FD_PER_ITEM - 1) / FD_PER_ITEM;
            if len > MAX_FDSET_SIZE {
                return Err(LxError::EINVAL);
            }
            let slice = addr.read_array(len)?;

            // save the fdset, and clear it
            let origin = BitVec::from_vec(slice);
            let mut vec0 = Vec::<u32>::new();
            vec0.resize(len, 0);
            addr.write_array(&vec0)?;
            Ok(FdSet { addr, origin })
        }
    }
/// Initialize a `FdSet` from pointer and number of fds
/// Check if the array is large enough
Initialize a `FdSet` from pointer and number of fds
Check if the array is large enough
Initialize a ` FdSet ` from pointer and number of fds Check if the array is large enough
fn new(mut addr: UserInOutPtr<u32>, nfds: usize) -> Result<FdSet, LxError> {
        if addr.is_null() {
            Ok(FdSet {
                addr,
                origin: BitVec::new(),
            })
        } else {
            let len = (nfds + FD_PER_ITEM - 1) / FD_PER_ITEM;
            if len > MAX_FDSET_SIZE {
                return Err(LxError::EINVAL);
            }
            let slice = addr.read_array(len)?;
            // save the fdset, and clear it
            let origin = BitVec::from_vec(slice);
            let mut vec0 = Vec::<u32>::new();
            vec0.resize(len, 0);
            addr.write_array(&vec0)?;
            Ok(FdSet { addr, origin })
        }
    }
fn new ( mut addr : UserInOutPtr < u32 > , nfds : usize ) -> Result < FdSet , LxError > { if addr . is_null ( ) { Ok ( FdSet { addr , origin : BitVec :: new ( ) , } ) } else { let len = ( nfds + FD_PER_ITEM - 1 ) / FD_PER_ITEM ; if len > MAX_FDSET_SIZE { return Err ( LxError :: EINVAL ) ; } let slice = addr . read_array ( len ) ? ; // save the fdset, and clear it let origin = BitVec :: from_vec ( slice ) ; let mut vec0 = Vec :: < u32 > :: new ( ) ; vec0 . resize ( len , 0 ) ; addr . write_array ( & vec0 ) ? ; Ok ( FdSet { addr , origin } ) } }
Initialize a `FdSet` from pointer and number of fds
Check if the array is large enough
Initialize a ` FdSet ` from pointer and number of fds Check if the array is large enough
addr
UserInOutPtr<u32>
nfds
usize
addr
UserInOutPtr<u32>
nfds
usize