Commit 168a806b authored by lmiskiew's avatar lmiskiew

Address comments

parent c32677dd
Pipeline #4562 passed with stages
in 19 minutes and 51 seconds
......@@ -15,15 +15,13 @@ use platform::types::*;
// fd_set is also defined in C because cbindgen is incompatible with mem::size_of booo
pub const FD_SETSIZE: usize = 1024;
const ARRAY_SIZE: usize = 1024 / (8 * mem::size_of::<c_ulong>());
type bitset = BitSet<[c_ulong; FD_SETSIZE / (8 * mem::size_of::<c_ulong>())]>;
#[repr(C)]
pub struct fd_set {
pub fds_bits: [c_ulong; ARRAY_SIZE],
pub fds_bits: bitset,
}
type bitset = BitSet<[c_ulong; ARRAY_SIZE]>;
pub fn select_epoll(
nfds: c_int,
readfds: Option<&mut fd_set>,
......@@ -44,9 +42,9 @@ pub fn select_epoll(
File::new(epfd)
};
let mut read_bitset : Option<&mut bitset> = readfds.map(|fd_set| bitset::from_ref(&mut fd_set.fds_bits));
let mut write_bitset : Option<&mut bitset> = writefds.map(|fd_set| bitset::from_ref(&mut fd_set.fds_bits));
let mut except_bitset : Option<&mut bitset> = exceptfds.map(|fd_set| bitset::from_ref(&mut fd_set.fds_bits));
let mut read_bitset : Option<&mut bitset> = readfds.map(|fd_set| &mut fd_set.fds_bits);
let mut write_bitset : Option<&mut bitset> = writefds.map(|fd_set| &mut fd_set.fds_bits);
let mut except_bitset : Option<&mut bitset> = exceptfds.map(|fd_set| &mut fd_set.fds_bits);
// Keep track of the number of file descriptors that do not support epoll
let mut not_epoll = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment