Hi All,
We are working on adding a 'file events notification/monitoring' mechanism
to the Event ports framework in Solaris.
There are several different implementations around this file events
notification mechanism currently available, like 'dnotify, inotify' for
Linux or the 'FAM' from SGI etc.
I am interested in knowing what are the file event types that people
care about/find useful, any use cases. Also please share your experience
if you have used any of the file event notification facilities currently
available.
Here are a some of the file event types considered.
FILE_OPEN File opened.
FILE_CLOSE File closed.
FILE_WRITE File was written to.
FILE_READ File was read.
FILE_ATTRIB_CHANGE File attributes changed
FILE_CREATE File/Directory was created.
FILE_REMOVE/UNLINK File/Directory was removed/deleted.
FILE_RENAME_TO/FROM File was renamed to/from.
Expected behavior...
Once any event is delivered should it get de-registered automatically or
not? If it gets de-registered, the application will have to register it
again before it can receive more events on that file. If it does not
get de-registered, it will continue to receive events as they occur
until it is explicitly de-registered.
If a file, being monitored, gets removed/unlinked should it get
De-registered(stop monitoring) or should it continue to be monitored
and deliver events? The file may still be open and being accessed.
This facility will be added to the Event ports framework.
The Event ports framework, introduced in Solaris 10, is an unified event
notification framework. The 'file events notification facility' will
be added as a new event source to the Event ports framework.
If you like to know more about Event ports you can read about it here.
You will see some examples using Event ports.
http://developers.sun.com/solaris/articles/event_completion.html
http://blogs.sun.com/roller/page/barts/20040720
Here it is how the interfaces for 'file event notification mechanism',
would be.
int userdata;
port_event_t pe;
char *fname[]= "/var/tmp/testfile"
/*
* create the port on which to receive the
* events. This port can multiplex events from
* other event sources too.
*/
port = port_create();
/*
* associate or register the file events for a file on this
* port.
*/
port_associate(port, PORT_SOURCE_FILE, (uintptr_t)fname,
FILE_OPEN|FILE_ATTRIB, &userdata);
/*
* collect events from the port
*/
port_getn(port, &pe);
/*
* De-register/stop monitoring.
*/
port_dissociate(port, PORT_SOURCE_FILE, (uintptr_t)fname);
The 'userdata' pointer passed in is delivered along with the event in
the port_event_t structure.
The object 'fname' is the name of the file which is to be monitored.
Instead, the object could be a structure with some additional
info to be passed in/returned back.
Thanks,
-Prakash.
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org