inotify-cxx.h File Reference

inotify C++ interface header More...

#include <stdint.h>
#include <string>
#include <deque>
#include <map>
#include <sys/inotify.h>

Include dependency graph for inotify-cxx.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  InotifyException
 Class for inotify exceptions. More...
class  InotifyEvent
 inotify event class More...
class  InotifyWatch
 inotify watch class More...
class  Inotify
 inotify class More...

Defines

#define INOTIFY_EVENT_SIZE   (sizeof(struct inotify_event))
 Event struct size.
#define INOTIFY_BUFLEN   (1024 * (INOTIFY_EVENT_SIZE + 16))
 Event buffer length.
#define IN_EXC_MSG(msg)   (std::string(__PRETTY_FUNCTION__) + ": " + msg)
 Helper macro for creating exception messages.
#define IN_LOCK_DECL
 inotify-cxx thread safety
#define IN_LOCK_INIT
#define IN_LOCK_DONE
#define IN_READ_BEGIN
#define IN_READ_END
#define IN_READ_END_NOTHROW
#define IN_WRITE_BEGIN
#define IN_WRITE_END
#define IN_WRITE_END_NOTHROW

Typedefs

typedef std::map< int32_t,
InotifyWatch * > 
IN_WATCH_MAP
 Mapping from watch descriptors to watch objects.
typedef std::map< std::string,
InotifyWatch * > 
IN_WP_MAP
 Mapping from paths to watch objects.

Enumerations

enum  InotifyCapability_t { IN_MAX_EVENTS = 0, IN_MAX_INSTANCES = 1, IN_MAX_WATCHES = 2 }
 inotify capability/limit identifiers More...


Detailed Description

inotify C++ interface header

inotify C++ interface

Copyright (C) 2006, 2007, 2009 Lukas Jelinek, <lukas@aiken.cz>

This program is free software; you can redistribute it and/or modify it under the terms of one of the following licenses:

If you want to help with choosing the best license for you, please visit http://www.gnu.org/licenses/license-list.html.

Credits: Mike Frysinger (cleanup of includes)


Define Documentation

#define IN_EXC_MSG ( msg   )     (std::string(__PRETTY_FUNCTION__) + ": " + msg)

Helper macro for creating exception messages.

It prepends the message by the function name.

#define IN_LOCK_DECL

inotify-cxx thread safety

If this symbol is defined you can use this interface safely threaded applications. Remember that it slightly degrades performance.

Even if INOTIFY_THREAD_SAFE is defined some classes stay unsafe. If you must use them (must you?) in more than one thread concurrently you need to implement explicite locking.

You need not to define INOTIFY_THREAD_SAFE in that cases where the application is multithreaded but all the inotify infrastructure will be managed only in one thread. This is the recommended way.

Locking may fail (it is very rare but not impossible). In this case an exception is thrown. But if unlocking fails in case of an error it does nothing (this failure is ignored).

#define IN_LOCK_DONE

#define IN_LOCK_INIT

#define IN_READ_BEGIN

#define IN_READ_END

#define IN_READ_END_NOTHROW

#define IN_WRITE_BEGIN

#define IN_WRITE_END

#define IN_WRITE_END_NOTHROW

#define INOTIFY_BUFLEN   (1024 * (INOTIFY_EVENT_SIZE + 16))

Event buffer length.

#define INOTIFY_EVENT_SIZE   (sizeof(struct inotify_event))

Event struct size.


Typedef Documentation

typedef std::map<int32_t, InotifyWatch*> IN_WATCH_MAP

Mapping from watch descriptors to watch objects.

typedef std::map<std::string, InotifyWatch*> IN_WP_MAP

Mapping from paths to watch objects.


Enumeration Type Documentation

inotify capability/limit identifiers

Enumerator:
IN_MAX_EVENTS  max. events in the kernel queue
IN_MAX_INSTANCES  max. inotify file descriptors per process
IN_MAX_WATCHES  max. watches per file descriptor


doxygen