Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Which notify to use
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Fri Mar 27, 2015 4:49 pm    Post subject: Which notify to use Reply with quote

I want to do some notification-driven stuff. There seem to be at least two, possibly three different notification systems in the kernel, each attempting to get better at it. At the moment it appears that the most (in number of different packages) exists for "inotify". Of course that may be a false metric, maybe there's something newer than inotify that isn't old enough to have many packages yet, but is just obviously better.

In my particular case, I'm going to have a fairly extensive directory tree, typically three levels deep, and would prefer to start one notification at the top. By the time you're down near the bottom, there will likely be a few hundred subdirectories that will need monitoring. Principally I'm looking for files to be created or destroyed in one of those bottom-level subdirectories, but it's also possible, though less frequent, that a bottom-level subdirectory will be created, as well as it's contents.

Right now I'd start the job with pyinotify. Would anyone urge me on a different course?
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat Mar 28, 2015 1:36 am    Post subject: Reply with quote

No, I'd just warn you that you can't do recursive notification, ie you have to monitor subdirectories individually (unless pyinotify wraps that for you.)

AFAIK it's inotify nowadays (replacement for older dnotify.) There's fanotify too, but idk what that's about.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Sat Mar 28, 2015 2:08 am    Post subject: Reply with quote

steveL wrote:
No, I'd just warn you that you can't do recursive notification, ie you have to monitor subdirectories individually (unless pyinotify wraps that for you.)

AFAIK it's inotify nowadays (replacement for older dnotify.) There's fanotify too, but idk what that's about.


I've figured that so far it's inotify. I've seen a little about fanotify, but it seems to have been partially done - just enough for antivirus scanners, and nobody seems to have seen fit to go farther.

The big problem I see is that inotify has 8k systemwide notifications available. That's more than enough for my real needs, but it also means that my UI will need to do some "needs gathering" rather than just setting notifications on all possible uses.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Mon Mar 30, 2015 1:51 pm    Post subject: Reply with quote

I've been playing a bit with pyinotify, and apparently it does wrap directory recursion for me.

For test purposes I've hung one notification on a higher-level directory, then went into my CAD tool and started fiddling with a new schematic. I appear to have received all of the expected notification events, with the creation of a blank schematic. I added a few subcircuits and saved, seeing a further set of modification events. The files related to the circuit are two subdirectories below the inotify monitor point.

I wish there were a way to query the number of inotify handles used. Since this appears to be wrapped, it would seem that one call may generate many, and in fact according to what I just did, a dynamic number of monitor points. Obviously /proc/sys/fs/inotify is just a way to set the max, not to monitor usage. I've taken a quick jaunt around /sys and don't see anything relevant.

But at least it's working.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum