#include <stdint.h>
#include <string>
#include <deque>
#include <map>
#include <sys/syscall.h>
#include <sys/inotify.h>
#include <sys/inotify-syscalls.h>
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... |
inotify C++ interface
Copyright (C) 2006, 2007 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:
#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 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.
enum InotifyCapability_t |