Re: [RFC][PATCH] inotify 0.9.2

Ray Lee
2004-09-23T01:46:56Z

On Tue, 2004-09-21 at 19:27, John McCutchan wrote:
> On Tue, 2004-09-21 at 11:43, Chris Friesen wrote:
> > Edgar Toernig wrote:
> > > Robert Love wrote:
> > >
> > >> struct inotify_event {
> > >> int wd;
> > >> int mask;
> > >>- char filename[256];
> > >>+ char filename[PATH_MAX];
> > >> };
> > >
> > >
> > > You really want to shove >4kB per event to userspace???
> >
> > Ouch.
> >
> > Maybe make it variable-size? On average it would likely be shorter.
> >
> > struct inotify_event {
> > int wd;
> > int mask;
> > short namelen;
> > char filename[0];
> > };
>
> This makes reading events from inotify a pain, first you need to read up
> to namelen, then read namelen more bytes.
>

Not the case. A mildly smarter userspace program would merely read
everything outstanding (or everything up to a fixed buffer length), and
then unserialize the events based on the boundaries it can figure out
from the first portion of the structure.

This is a way common technique.

At least in code I write, anyway :-).

Ray