[Mono-bugs] [Bug 542485] New: Fix for KeventWatcher

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Sep 27 10:32:42 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=542485


           Summary: Fix for KeventWatcher
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: 64bit
        OS/Version: FreeBSD
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: romain at blogreen.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=320042)
 --> (http://bugzilla.novell.com/attachment.cgi?id=320042)
Various fixes for KeventWatcher

User-Agent:       Mozilla/5.0 (X11; U; FreeBSD amd64; fr-fr) AppleWebKit/531.2+
(KHTML, like Gecko) Safari/531.2+

The KeventWatcher class cannot be used becore of incorect structure size for
P/Invoke and invalid or'ed flags passed to system calls.

The problem has been reported on FreeBSD i386 and amd64 a while ago, but was
worked around using gamin instead of kqueue(3). 

Reproducible: Always

Steps to Reproduce:
A simple program can trigger the problem:

----8<-----------------------
using System;
using System.IO;

namespace FSWTest
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var path = "/tmp";
            if (args.Length>0)
                path = args[0];

            Console.WriteLine("Path: {0}",path);
            FileSystemWatcher fsw = new FileSystemWatcher(path);    

            fsw.Changed += FswEvent; 
            fsw.Created += FswEvent;
            fsw.Deleted += FswEvent;

            while (true) 
            fsw.WaitForChanged(WatcherChangeTypes.All);

        }

        static void FswEvent (object sender, FileSystemEventArgs e)
        {
            Console.WriteLine("EVENT: {0}", e.Name);
        }
    }
}
----8<-----------------------

Compile and run, then create files in /tmp
Actual Results:  
Depending on the system, this may work a bit (sometimes you get an information)
or not at all.

Expected Results:  
Display everything happening.

This patch has been tested with mono-2.4 and the new 2.6 branch on FreeBSD i386
and amd64.

I don't know if KEventWatcher is used on Mac OS, but because of missing 0x in
front of hex value "20" it should not act as expected too.

The patch fix structure sizes, make use of aliases for a better readability
(e.g. NOTE_RENAME instead of 0x0020), fix wrong "|" operations (e.g. 1 | 4 | 20
instead of 1 | 4 | 0x20) and attempt to at least detect that a system call
failed and stop operations.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list