note 44579 added to ref.fam
| From: | foobatzenatgmxdotnet at osu1 dot php dot net | Date: | Tue, 10 Aug 2004 05:30:20 +0000 |
| Subject: | note 44579 added to ref.fam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74383@lists.php.net to get a copy of this message | ||
I'm not really an experienced php coder, so please tell me if I'm wrong.
In the example above, I'd rather use fam_next_event() instead of "1" in the while
loop, because fam_next_event() will block until there is an event. Thus, you don't need the
ugly loop with a x second sleep time. Otherwise, I think you'd defeat the whole purpose of fam
with this sleep/poll concept.
The problem is, fam (and dnotify) suck. Badly. fam_monitor_directory() can not be recursive, because
fam doesn't offer this. So if you want to monitor a whole tree, you have to add each
subdirectory to the fam-resource in order to be monitored. Ugly, but possible.
If you do that though, you will not know where a file that caused an event lives. For example, if
you monitor /mnt/temp and /tmp with one fam-resource (and its important to use ONE fam-resource so
you can use fam_next_event() efficiently), you will get events like "file foo.bar has
changed". But you will not know in which one of these two monitored directories foo.bar is
living, because the event only contains the basename. How stupid is that? This becomes even more
problematic as soon as there are files with the same name in /mnt/temp and /tmp. You just don't
know what file has changed, which makes (php-)fam useless.
What also sucks is that when a process writes a big file, you get a file-changed-event almost every
second the file is being written to, instead of ONE event AFTER the process has finished changing
the file.
In conclusion, I have either misunderstood all of this, or THIS SOLUTION SUCKS. I don't want to
make you angry, but currently, this is useless for me and many others. Google agrees, noone likes
fam. It seems noone understands why it made its way into linux 2.6.
It won't work with php, but you might want to look at http://www.lambda-computing.com/~rudi/dnotify/,
works with linux 2.6.3 and maybe above.
If you have any ideas how to still make it work, please post here! Thanks!
----
Manual Page -- http://www.php.net/manual/en/ref.fam.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44579
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44579&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44579&report=yes
Search -- http://master.php.net/manage/user-notes.php