Function inotify::get_buffer_size[][src]

pub fn get_buffer_size(path: &Path) -> Result<usize>
Expand description

Get the inotify event buffer size

The maximum size of an inotify event and thus the buffer size to hold it can be calculated using this formula: sizeof(struct inotify_event) + NAME_MAX + 1


The NAME_MAX size formula is: ABSOLUTE_PARENT_PATH_LEN + 1 + 255

  • ABSOLUTE_PARENT_PATH_LEN will be calculated at runtime.
  • Add 1 to account for a /, either in between the parent path and a filename or for the root directory.
  • Add the maximum number of chars in a filename, 255.


Unfortunately, we can’t just do the same with max path length itself.


This function is really just a fallible wrapper around get_absolute_path_buffer_size().

path: A relative or absolute path for the inotify events.