/// Monitors file descriptors for readiness (see [select(2)]).
///
/// Returns the total number of ready file descriptors in all sets. The sets are changed so that all
/// file descriptors that are ready for the given operation are set.
///
/// When this function returns, `timeout` has an implementation-defined value.
///
/// # Parameters
///
/// * `nfds`: The highest file descriptor set in any of the passed `FdSet`s, plus 1. If `None`, this
///   is calculated automatically by calling [`FdSet::highest`] on all descriptor sets and adding 1
///   to the maximum of that.
/// * `readfds`: File descriptors to check for being ready to read.
/// * `writefds`: File descriptors to check for being ready to write.
/// * `errorfds`: File descriptors to check for pending error conditions.
/// * `timeout`: Maximum time to wait for descriptors to become ready (`None` to block
///   indefinitely).
///
/// [select(2)]: http://man7.org/linux/man-pages/man2/select.2.html
/// [`FdSet::highest`]: struct.FdSet.html#method.highest
Monitors file descriptors for readiness ]).
Returns the total number of ready file descriptors in all sets. The sets are changed so that all
file descriptors that are ready for the given operation are set.

When this function returns, `timeout` has an implementation-defined value.
Monitors file descriptors for readiness ] ) . Returns the total number of ready file descriptors in all sets . The sets are changed so that all file descriptors that are ready for the given operation are set . When this function returns ` timeout ` has an implementation - defined value .
pub fn select<'a, N, R, W, E, T>(nfds: N,
                                 readfds: R,
                                 writefds: W,
                                 errorfds: E,
                                 timeout: T) -> Result<c_int>
where
    N: Into<Option<c_int>>,
    R: Into<Option<&'a mut FdSet>>,
    W: Into<Option<&'a mut FdSet>>,
    E: Into<Option<&'a mut FdSet>>,
    T: Into<Option<&'a mut TimeVal>>,
{
    let mut readfds = readfds.into();
    let mut writefds = writefds.into();
    let mut errorfds = errorfds.into();
    let timeout = timeout.into();
    let nfds = nfds.into().unwrap_or_else(|| {
        readfds.iter_mut()
            .chain(writefds.iter_mut())
            .chain(errorfds.iter_mut())
            .map(|set| set.highest().unwrap_or(-1))
            .max()
            .unwrap_or(-1) + 1
    });
    let readfds = readfds.map(|set| set as *mut _ as *mut libc::fd_set).unwrap_or(null_mut());
    let writefds = writefds.map(|set| set as *mut _ as *mut libc::fd_set).unwrap_or(null_mut());
    let errorfds = errorfds.map(|set| set as *mut _ as *mut libc::fd_set).unwrap_or(null_mut());
    let timeout = timeout.map(|tv| tv as *mut _ as *mut libc::timeval)
                         .unwrap_or(null_mut());
    let res = unsafe {
        libc::select(nfds, readfds, writefds, errorfds, timeout)
    };
    Errno::result(res)
}
pub fn select < ' a , N , R , W , E , T > ( nfds : N , readfds : R , writefds : W , errorfds : E , timeout : T ) -> Result < c_int > where N : Into < Option < c_int > > , R : Into < Option < & ' a mut FdSet > > , W : Into < Option < & ' a mut FdSet > > , E : Into < Option < & ' a mut FdSet > > , T : Into < Option < & ' a mut TimeVal > > , { let mut readfds = readfds . into ( ) ; let mut writefds = writefds . into ( ) ; let mut errorfds = errorfds . into ( ) ; let timeout = timeout . into ( ) ; let nfds = nfds . into ( ) . unwrap_or_else ( | | { readfds . iter_mut ( ) . chain ( writefds . iter_mut ( ) ) . chain ( errorfds . iter_mut ( ) ) . map ( | set | set . highest ( ) . unwrap_or ( - 1 ) ) . max ( ) . unwrap_or ( - 1 ) + 1 } ) ; let readfds = readfds . map ( | set | set as * mut _ as * mut libc :: fd_set ) . unwrap_or ( null_mut ( ) ) ; let writefds = writefds . map ( | set | set as * mut _ as * mut libc :: fd_set ) . unwrap_or ( null_mut ( ) ) ; let errorfds = errorfds . map ( | set | set as * mut _ as * mut libc :: fd_set ) . unwrap_or ( null_mut ( ) ) ; let timeout = timeout . map ( | tv | tv as * mut _ as * mut libc :: timeval ) . unwrap_or ( null_mut ( ) ) ; let res = unsafe { libc :: select ( nfds , readfds , writefds , errorfds , timeout ) } ; Errno :: result ( res ) }
Monitors file descriptors for readiness (see [select(2)]).
Monitors file descriptors for readiness ( see [ select ( 2 ) ] ) .
nfds
N
readfds
R
writefds
W
errorfds
E
timeout
T