Closed epompeii closed 2 years ago
Thanks for bringing this up, @epompeii. I have no idea why the buffer size in that example is so small. Increasing to 1024
is reasonable.
Your buffer size function looks good. Maybe we can include it as a utility function in the library, or did you have something else in mind?
Sounds good! I've opened up PR https://github.com/hannobraun/inotify-rs/pull/187 that includes both the buffer size change and two utility functions.
Currently, the buffer size of the stream example is set to
let mut buffer = [0; 32];
. When I tried to run the example, I hit a rather cryptic OS error,Invalid Argument
. This was easily fixed by increasing the buffer size.The unit test uses
let mut buffer = [0; 1024];
. Maybe the example should use1024
as well?It is unlikely that
tempfile
would produce a path in either case that would cause the inotify message to exceed1024
. I've come up with a function though that given a filepath it will calculate the maximum inotify message size one could expect.Please, let me know if either of these would be worth opening an MR for.