Skip to content

Commit

Permalink
[eclipse-iceoryx#96] Restrict max path length to save some stack
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Jul 15, 2024
1 parent f9175fe commit c68c730
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/rust/event/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.service_builder("MyEventName".try_into()?)
.event()
.open_or_create()?;
let max_event_id = event.static_config().event_id_max_value();

let notifier = event.notifier_builder().create()?;

let mut counter: usize = 0;
while let NodeEvent::Tick = node.wait(CYCLE_TIME) {
counter += 1;
notifier.notify_with_custom_event_id(EventId::new(counter))?;
notifier.notify_with_custom_event_id(EventId::new(counter % max_event_id))?;

println!("Trigger event with id {} ...", counter);
}
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/ffi/src/api/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl IntoCInt for NodeCreationFailure {
#[repr(C)]
#[repr(align(8))] // alignment of NodeBuilder
pub struct iox2_node_builder_storage_internal_t {
internal: [u8; 18960], // magic number obtained with size_of::<NodeBuilder>()
internal: [u8; 3568], // magic number obtained with size_of::<NodeBuilder>()
}

#[repr(C)]
Expand Down
4 changes: 3 additions & 1 deletion iceoryx2-pal/configuration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pub mod settings {
pub const PATH_SEPARATOR: u8 = b'/';
pub const ROOT: &[u8] = b"/";
pub const FILENAME_LENGTH: usize = 255;
pub const PATH_LENGTH: usize = 4096;
// it is actually 4096 but to be more compatible with windows and also safe some stack the number
// is reduced to 255
pub const PATH_LENGTH: usize = 255;
#[cfg(not(target_os = "macos"))]
pub const AT_LEAST_TIMING_VARIANCE: f32 = 0.25;
#[cfg(target_os = "macos")]
Expand Down

0 comments on commit c68c730

Please sign in to comment.