|
incron
0.5.10
|
inotify class More...
#include <inotify-cxx.h>
Public Member Functions | |
| Inotify () throw (InotifyException) | |
| Constructor. | |
| ~Inotify () | |
| Destructor. | |
| void | Close () |
| Removes all watches and closes the inotify device. | |
| void | Add (InotifyWatch *pWatch) throw (InotifyException) |
| Adds a new watch. | |
| void | Add (InotifyWatch &rWatch) throw (InotifyException) |
| Adds a new watch. | |
| void | Remove (InotifyWatch *pWatch) throw (InotifyException) |
| Removes a watch. | |
| void | Remove (InotifyWatch &rWatch) throw (InotifyException) |
| Removes a watch. | |
| void | RemoveAll () |
| Removes all watches. | |
| size_t | GetWatchCount () const |
| Returns the count of watches. | |
| size_t | GetEnabledCount () const |
| Returns the count of enabled watches. | |
| void | WaitForEvents (bool fNoIntr=false) throw (InotifyException) |
| Waits for inotify events. | |
| size_t | GetEventCount () |
| Returns the count of received and queued events. | |
| bool | GetEvent (InotifyEvent *pEvt) throw (InotifyException) |
| Extracts a queued inotify event. | |
| bool | GetEvent (InotifyEvent &rEvt) throw (InotifyException) |
| Extracts a queued inotify event. | |
| bool | PeekEvent (InotifyEvent *pEvt) throw (InotifyException) |
| Extracts a queued inotify event (without removing). | |
| bool | PeekEvent (InotifyEvent &rEvt) throw (InotifyException) |
| Extracts a queued inotify event (without removing). | |
| InotifyWatch * | FindWatch (int iDescriptor) |
| Searches for a watch by a watch descriptor. | |
| InotifyWatch * | FindWatch (const std::string &rPath) |
| Searches for a watch by a filesystem path. | |
| int | GetDescriptor () const |
| Returns the file descriptor. | |
| void | SetNonBlock (bool fNonBlock) throw (InotifyException) |
| Enables/disables non-blocking mode. | |
| void | SetCloseOnExec (bool fClOnEx) throw (InotifyException) |
| Enables/disables closing on exec. | |
Static Public Member Functions | |
| static uint32_t | GetCapability (InotifyCapability_t cap) throw (InotifyException) |
| Acquires a particular inotify capability/limit. | |
| static void | SetCapability (InotifyCapability_t cap, uint32_t val) throw (InotifyException) |
| Modifies a particular inotify capability/limit. | |
| static uint32_t | GetMaxEvents () throw (InotifyException) |
| Returns the maximum number of events in the kernel queue. | |
| static void | SetMaxEvents (uint32_t val) throw (InotifyException) |
| Sets the maximum number of events in the kernel queue. | |
| static uint32_t | GetMaxInstances () throw (InotifyException) |
| Returns the maximum number of inotify instances per process. | |
| static void | SetMaxInstances (uint32_t val) throw (InotifyException) |
| Sets the maximum number of inotify instances per process. | |
| static uint32_t | GetMaxWatches () throw (InotifyException) |
| Returns the maximum number of inotify watches per instance. | |
| static void | SetMaxWatches (uint32_t val) throw (InotifyException) |
| Sets the maximum number of inotify watches per instance. | |
Friends | |
| class | InotifyWatch |
inotify class
It holds information about the inotify device descriptor and manages the event queue.
If the INOTIFY_THREAD_SAFE is defined this class is thread-safe.
| Inotify::Inotify | ( | ) | throw (InotifyException) |
Constructor.
Creates and initializes an instance of inotify communication object (opens the inotify device).
| InotifyException | thrown if inotify isn't available |
| Inotify::~Inotify | ( | ) |
Destructor.
Calls Close() due to clean-up.
| void Inotify::Add | ( | InotifyWatch * | pWatch | ) | throw (InotifyException) |
Adds a new watch.
| [in] | pWatch | inotify watch |
| InotifyException | thrown if adding failed |
| void Inotify::Add | ( | InotifyWatch & | rWatch | ) | throw (InotifyException) [inline] |
Adds a new watch.
| [in] | rWatch | inotify watch |
| InotifyException | thrown if adding failed |
| void Inotify::Close | ( | ) |
Removes all watches and closes the inotify device.
| InotifyWatch * Inotify::FindWatch | ( | int | iDescriptor | ) |
Searches for a watch by a watch descriptor.
It tries to find a watch by the given descriptor.
| [in] | iDescriptor | watch descriptor |
| InotifyWatch * Inotify::FindWatch | ( | const std::string & | rPath | ) |
Searches for a watch by a filesystem path.
It tries to find a watch by the given filesystem path.
| [in] | rPath | filesystem path |
| uint32_t Inotify::GetCapability | ( | InotifyCapability_t | cap | ) | throw (InotifyException) [static] |
Acquires a particular inotify capability/limit.
| [in] | cap | capability/limit identifier |
| InotifyException | thrown if the given value cannot be acquired |
| int Inotify::GetDescriptor | ( | ) | const [inline] |
Returns the file descriptor.
The descriptor can be used in standard low-level file functions (poll(), select(), fcntl() etc.).
| size_t Inotify::GetEnabledCount | ( | ) | const [inline] |
| bool Inotify::GetEvent | ( | InotifyEvent * | pEvt | ) | throw (InotifyException) |
Extracts a queued inotify event.
The extracted event is removed from the queue. If the pointer is NULL it does nothing.
| [in,out] | pEvt | event object |
| InotifyException | thrown if the provided pointer is NULL |
| bool Inotify::GetEvent | ( | InotifyEvent & | rEvt | ) | throw (InotifyException) [inline] |
Extracts a queued inotify event.
The extracted event is removed from the queue.
| [in,out] | rEvt | event object |
| InotifyException | thrown only in very anomalous cases |
| size_t Inotify::GetEventCount | ( | ) | [inline] |
Returns the count of received and queued events.
This number is related to the events in the queue inside this object, not to the events pending in the kernel.
| static uint32_t Inotify::GetMaxEvents | ( | ) | throw (InotifyException) [inline, static] |
Returns the maximum number of events in the kernel queue.
| InotifyException | thrown if the given value cannot be acquired |
| static uint32_t Inotify::GetMaxInstances | ( | ) | throw (InotifyException) [inline, static] |
Returns the maximum number of inotify instances per process.
It means the maximum number of open inotify file descriptors per running process.
| InotifyException | thrown if the given value cannot be acquired |
| static uint32_t Inotify::GetMaxWatches | ( | ) | throw (InotifyException) [inline, static] |
Returns the maximum number of inotify watches per instance.
It means the maximum number of inotify watches per inotify file descriptor.
| InotifyException | thrown if the given value cannot be acquired |
| size_t Inotify::GetWatchCount | ( | ) | const [inline] |
Returns the count of watches.
This is the total count of all watches (regardless whether enabled or not).
| bool Inotify::PeekEvent | ( | InotifyEvent * | pEvt | ) | throw (InotifyException) |
Extracts a queued inotify event (without removing).
The extracted event stays in the queue. If the pointer is NULL it does nothing.
| [in,out] | pEvt | event object |
| InotifyException | thrown if the provided pointer is NULL |
| bool Inotify::PeekEvent | ( | InotifyEvent & | rEvt | ) | throw (InotifyException) [inline] |
Extracts a queued inotify event (without removing).
The extracted event stays in the queue.
| [in,out] | rEvt | event object |
| InotifyException | thrown only in very anomalous cases |
| void Inotify::Remove | ( | InotifyWatch * | pWatch | ) | throw (InotifyException) |
Removes a watch.
If the given watch is not present it does nothing.
| [in] | pWatch | inotify watch |
| InotifyException | thrown if removing failed |
| void Inotify::Remove | ( | InotifyWatch & | rWatch | ) | throw (InotifyException) [inline] |
Removes a watch.
If the given watch is not present it does nothing.
| [in] | rWatch | inotify watch |
| InotifyException | thrown if removing failed |
| void Inotify::RemoveAll | ( | ) |
Removes all watches.
| void Inotify::SetCapability | ( | InotifyCapability_t | cap, |
| uint32_t | val | ||
| ) | throw (InotifyException) [static] |
Modifies a particular inotify capability/limit.
| [in] | cap | capability/limit identifier |
| [in] | val | new capability/limit value |
| InotifyException | thrown if the given value cannot be set |
| void Inotify::SetCloseOnExec | ( | bool | fClOnEx | ) | throw (InotifyException) |
Enables/disables closing on exec.
Enable this if you want to close the descriptor when executing another program. Otherwise, the descriptor will be inherited.
Closing on exec is disabled by default.
| [in] | fClOnEx | enable/disable closing on exec |
| InotifyException | thrown if setting failed |
| static void Inotify::SetMaxEvents | ( | uint32_t | val | ) | throw (InotifyException) [inline, static] |
Sets the maximum number of events in the kernel queue.
| [in] | val | new value |
| InotifyException | thrown if the given value cannot be set |
| static void Inotify::SetMaxInstances | ( | uint32_t | val | ) | throw (InotifyException) [inline, static] |
Sets the maximum number of inotify instances per process.
| [in] | val | new value |
| InotifyException | thrown if the given value cannot be set |
| static void Inotify::SetMaxWatches | ( | uint32_t | val | ) | throw (InotifyException) [inline, static] |
Sets the maximum number of inotify watches per instance.
| [in] | val | new value |
| InotifyException | thrown if the given value cannot be set |
| void Inotify::SetNonBlock | ( | bool | fNonBlock | ) | throw (InotifyException) |
Enables/disables non-blocking mode.
Use this mode if you want to monitor the descriptor (acquired thru GetDescriptor()) in functions such as poll(), select() etc.
Non-blocking mode is disabled by default.
| [in] | fNonBlock | enable/disable non-blocking mode |
| InotifyException | thrown if setting mode failed |
| void Inotify::WaitForEvents | ( | bool | fNoIntr = false | ) | throw (InotifyException) |
Waits for inotify events.
It waits until one or more events occur. When called in nonblocking mode it only retrieves occurred events to the internal queue and exits.
| [in] | fNoIntr | if true it re-calls the system call after a handled signal |
| InotifyException | thrown if reading events failed |
friend class InotifyWatch [friend] |
1.7.5.1