File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -839,6 +839,32 @@ f! {
839839 pub fn WCOREDUMP ( status: :: c_int) -> bool {
840840 ( status & 0x80 ) != 0
841841 }
842+
843+ pub fn FD_CLR ( fd: :: c_int, set: * mut fd_set) -> ( ) {
844+ let fd = fd as usize ;
845+ let size = :: mem:: size_of_val( & ( * set) . fds_bits[ 0 ] ) * 8 ;
846+ ( * set) . fds_bits[ fd / size] &= !( 1 << ( fd % size) ) ;
847+ return
848+ }
849+
850+ pub fn FD_ISSET ( fd: :: c_int, set: * mut fd_set) -> bool {
851+ let fd = fd as usize ;
852+ let size = :: mem:: size_of_val( & ( * set) . fds_bits[ 0 ] ) * 8 ;
853+ return ( ( * set) . fds_bits[ fd / size] & ( 1 << ( fd % size) ) ) != 0
854+ }
855+
856+ pub fn FD_SET ( fd: :: c_int, set: * mut fd_set) -> ( ) {
857+ let fd = fd as usize ;
858+ let size = :: mem:: size_of_val( & ( * set) . fds_bits[ 0 ] ) * 8 ;
859+ ( * set) . fds_bits[ fd / size] |= 1 << ( fd % size) ;
860+ return
861+ }
862+
863+ pub fn FD_ZERO ( set: * mut fd_set) -> ( ) {
864+ for slot in ( * set) . fds_bits. iter_mut( ) {
865+ * slot = 0 ;
866+ }
867+ }
842868}
843869
844870extern "C" {
You can’t perform that action at this time.
0 commit comments