using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace OpenTK.Platform.X11.Bindings
{
// Fully implemented but not currently used by OpenTK
// See System.IO.FileSystemWatcher for a cross-platform alternative
#if false
class INotify
{
const string lib = "";
///
/// Create and initialize inotify instance
///
///
[DllImport(lib, EntryPoint = "inotify_init", ExactSpelling = true)]
public static extern int Init();
///
/// Create and initialize inotify instance with specified flags
///
/// See
/// A System.Int32 handle to a inotify instance
[DllImport(lib, EntryPoint = "inotify_init1", ExactSpelling = true)]
public static extern int Init(INotifyFlags flags);
///
/// Add watch of object pathname to inotify instance fd. Notify about
/// events specified by mask
///
[DllImport(lib, EntryPoint = "inotify_add_watch", ExactSpelling = true)]
public static extern int AddWatch(int fd, string pathname, INotifyFlags mask);
///
/// Remove the watch specified by wd from the inotify instance fd
///
[DllImport(lib, EntryPoint = "inotify_rm_watch", ExactSpelling = true)]
public static extern int RemoveWatch(int fd, int wd);
}
///
/// Describes an INotify event
///
struct INotifyEvent
{
///
/// Watch descriptor for wd parameter of INotify methods
///
public int WatchDescriptor;
///
/// Watch mask for mask parameter of INotify methods
///
public INotifyFlags WatchMask;
///
/// Cookie to synchronize two events
///
public uint Cookie;
///
/// Length (including NULs) of name
///
public uint Length;
///
///
///
public IntPtr Name;
}
///
/// Flags for the parameter of
///
[Flags]
enum INotifyInitFlags
{
CloExec = 02000000,
NonBlock = 04000
}
/// \internal
///
/// Supported events suitable for MASK parameter of AddWatch.
///
[Flags]
enum INotifyFlags
{
///
/// File was accessed
///
Access = 0x00000001,
///
/// File was modified
///
Modify = 0x00000002,
///
/// Metadata changed
///
Attrib = 0x00000004,
///
/// Writable file was closed
///
CloseWrite = 0x00000008,
///
/// Unwritable file closed
///
CloseNoWrite = 0x00000010,
///
/// File closed
///
Close = CloseWrite | CloseNoWrite,
///
/// File was opened
///
Open = 0x00000020,
///
/// File was moved from X
///
MovedFrom = 0x00000040,
///
/// File was moved to Y
///
MovedTo = 0x00000080,
///
/// File was moved
///
Move = MovedFrom | MovedTo,
///
/// Subfile was created
///
Create = 0x00000100,
///
/// Subfile was deleted
///
Delete = 0x00000200,
///
/// Self was deleted
///
DeleteSelf = 0x00000400,
///
/// Self was moved
///
MoveSelf = 0x00000800,
///
/// Backing fs was unmounted
///
Unmount = 0x00002000,
///
/// Event queue overflowed
///
QueueOverflow = 0x00004000,
///
/// File was ignored
///
Ignored = 0x00008000,
///
/// Only watch the path if it is a directory
///
OnlyDirectory = 0x01000000,
///
/// Do not follow symlinks
///
DontFollow = 0x02000000,
///
/// Add to the mask of an already existing watch
///
MaskAdd = 0x20000000,
///
/// Event occurred against dir
///
IsDirectory = 0x40000000,
///
/// Only send event once
///
Oneshot = 0x80000000,
///
/// All events which a program can wait on
///
AllEvents =
Access | Modify | Attrib | Close | Open | Move |
Create | Delete | DeleteSelf | MoveSelf
}
#endif
}