fam
[Top] [All Lists]

FAM not detecting directory removal

To: fam@xxxxxxxxxxx
Subject: FAM not detecting directory removal
From: Ian Pilcher <pilchman@xxxxxxxxx>
Date: Thu, 14 Nov 2002 02:19:47 -0600
Sender: fam-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021020
I'm using fam-2.6.8-4 on Red Hat Linux 8.0.  When I monitor a directory,
FAM does not report an event when the directory is removed.  The
following program can be used to demonstrate the problem.

    #include <stdio.h>
    #include <fam.h>

    static const char *const fam_event_names[] =
    {
        NULL, "FAMChanged", "FAMDeleted", "FAMStartExecuting",
        "FAMStopExecuting", "FAMCreated", "FAMMoved",
        "FAMAcknowledge", "FAMExists", "FAMEndExist"
    };

    int main(int argc, char *argv[])
    {
        FAMConnection   fc;
        FAMRequest      fr;
        FAMEvent        fe;

        FAMOpen(&fc);
        FAMMonitorDirectory(&fc, argv[1], &fr, NULL);
        while (1) {
            FAMNextEvent(&fc, &fe);
            printf("%s: %s\n", fe.filename,
                    fam_event_names[fe.code]);
        }

        return 0;
    }

Create a directory and run this program with the absolute path of the
directory as its parameter.  It will report the FAMExists and
FAMEndExist events as expected, and it will report any changes to the
contents of the directory.  If the directory is removed, however, it
will not be reported.

Is this a known behavior?  If so, is there a workaround that's simpler
than monitoring the parent directory?

Thanks!
-- 
========================================================================
Ian Pilcher                                           pilchman@xxxxxxxxx
========================================================================


<Prev in Thread] Current Thread [Next in Thread>
  • FAM not detecting directory removal, Ian Pilcher <=