FARGOS/VISTA Object Management Environment Core
..
|
Monitor files and directories for changes. More...
#include <poll_monitor.hpp>
Classes | |
struct | PollResult |
Return result from polling monitor. More... | |
Public Types | |
enum | { NEW_FILE_DATA_AVAILABLE =1, WRITER_CLOSED =8, POLLING_STOPPED =16, WATCHED_BY_INOTIFY =64 } |
enum | { MAX_FDS =2048 } |
Public Member Functions | |
PollMonitor () | |
~PollMonitor () | |
int | addFile (const char *fileName, int connType=0, void *extraInfo=nullptr, OS_HANDLE_TYPE openedFD=INVALID_HANDLE_VALUE) |
Monitor a file for changes. More... | |
int | addDescriptor (OS_HANDLE_TYPE openedFD, int connType=0, void *extraInfo=nullptr) |
Monitor an open descriptor. More... | |
int | addWatchDirectoryForNewFiles (const char *dirName) |
Watch directory for appearance of new files. More... | |
int | addWatchFileForAddedContent (const char *fileName, OS_HANDLE_TYPE openedFD) |
Watch file for increase in size. More... | |
int | dropDescriptor (OS_HANDLE_TYPE fd) |
int | doPoll (PollResult interestingFds[MAX_FDS], int timeout=-1) |
Public Attributes | |
uint32_t | fdsInUse |
PollResult | fdInfo [MAX_FDS] |
int | watchIdToFd [MAX_FDS] |
int | fdToWatchID [MAX_FDS] |
int | fdToEntry [MAX_FDS] |
Protected Member Functions | |
int | getInotifyResults (OS_HANDLE_TYPE *interestingFds, int *eventType) |
int | findFDentry (OS_HANDLE_TYPE fd) |
Static Protected Member Functions | |
static uint64_t | getFileSizeForDescriptor (OS_HANDLE_TYPE fd) |
Monitor files and directories for changes.
anonymous enum |
PollMonitor::PollMonitor | ( | ) |
References addFile(), fdsInUse, fdToEntry, fdToWatchID, INVALID_HANDLE_VALUE, and MAX_FDS.
PollMonitor::~PollMonitor | ( | ) |
|
inline |
Monitor an open descriptor.
References addFile().
int PollMonitor::addFile | ( | const char * | fileName, |
int | connType = 0 , |
||
void * | extraInfo = nullptr , |
||
OS_HANDLE_TYPE | openedFD = INVALID_HANDLE_VALUE |
||
) |
Monitor a file for changes.
References addWatchFileForAddedContent(), PollMonitor::PollResult::connectionType, EPERM, errno, PollMonitor::PollResult::extraData, fd, PollMonitor::PollResult::fd, fdInfo, fdsInUse, fdToEntry, INVALID_HANDLE_VALUE, LOG_CERR, LOG_ENDLINE, OS_HANDLE_TYPE, PollMonitor::PollResult::watchId, and PollMonitor::PollResult::whyReady.
Referenced by addDescriptor(), and PollMonitor().
int PollMonitor::addWatchDirectoryForNewFiles | ( | const char * | dirName | ) |
Watch directory for appearance of new files.
References PollMonitor::PollResult::connectionType, PollMonitor::PollResult::extraData, PollMonitor::PollResult::fd, fdInfo, fdsInUse, INVALID_HANDLE_VALUE, LOG_CERR, LOG_ENDLINE, WATCHED_BY_INOTIFY, PollMonitor::PollResult::watchId, and PollMonitor::PollResult::whyReady.
int PollMonitor::addWatchFileForAddedContent | ( | const char * | fileName, |
OS_HANDLE_TYPE | openedFD | ||
) |
Watch file for increase in size.
References fd, fdInfo, fdsInUse, fdToWatchID, LOG_CERR, LOG_ENDLINE, WATCHED_BY_INOTIFY, PollMonitor::PollResult::watchId, watchIdToFd, and PollMonitor::PollResult::whyReady.
Referenced by addFile().
int PollMonitor::doPoll | ( | PollResult | interestingFds[MAX_FDS], |
int | timeout = -1 |
||
) |
int PollMonitor::dropDescriptor | ( | OS_HANDLE_TYPE | fd | ) |
References fd, PollMonitor::PollResult::fd, fdInfo, fdsInUse, fdToEntry, fdToWatchID, findFDentry(), LOG_CERR, and LOG_ENDLINE.
|
protected |
|
staticprotected |
References fd.
|
protected |
Referenced by doPoll().
PollResult PollMonitor::fdInfo[MAX_FDS] |
Referenced by addFile(), addWatchDirectoryForNewFiles(), addWatchFileForAddedContent(), doPoll(), dropDescriptor(), and findFDentry().
uint32_t PollMonitor::fdsInUse |
Referenced by addFile(), addWatchDirectoryForNewFiles(), addWatchFileForAddedContent(), doPoll(), dropDescriptor(), findFDentry(), and PollMonitor().
int PollMonitor::fdToEntry[MAX_FDS] |
Referenced by addFile(), dropDescriptor(), findFDentry(), and PollMonitor().
int PollMonitor::fdToWatchID[MAX_FDS] |
Referenced by addWatchFileForAddedContent(), dropDescriptor(), and PollMonitor().
int PollMonitor::watchIdToFd[MAX_FDS] |
Referenced by addWatchFileForAddedContent().
![]() | Generated: Tue Jul 28 2020 16:03:27
Support Information |