Skip to content

Commit

Permalink
Remove the ESP-IDF special case as the assessment was wrong and it is…
Browse files Browse the repository at this point in the history
… not necessary
  • Loading branch information
ivmarkov committed Sep 10, 2024
1 parent 30d7fd7 commit fa7fb7d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@ use libc as sys;

use crate::{syscall, syscall_los, syscall_los_eagain};

// For ESP-IDF sys::FDSETSIZE is currently wrongly set to 1024 in the `libc` crate
// Therefore, use a custom value for now
#[cfg(target_os = "espidf")]
const MAX_FDS: usize = 64;

#[cfg(not(target_os = "espidf"))]
const MAX_FDS: usize = sys::FD_SETSIZE;

// In future, we might want to use a smaller - and possibly - configurable - with cargo feature(s)
// amount of registrations to save memory, but for now, let's use the maximum amount
const MAX_REGISTRATIONS: usize = MAX_FDS;
const MAX_REGISTRATIONS: usize = sys::FD_SETSIZE;

#[derive(EnumSetType, Debug)]
pub(crate) enum Event {
Expand Down Expand Up @@ -114,7 +106,7 @@ impl<const N: usize> Registrations<N> {
Err(ErrorKind::InvalidInput)?;
}

if fd >= MAX_FDS as RawFd {
if fd >= sys::FD_SETSIZE as RawFd {
Err(ErrorKind::InvalidInput)?;
}

Expand Down

0 comments on commit fa7fb7d

Please sign in to comment.