fileMonitorWatcher Class Reference

Internal tracking via stat(3p) or inotify(7) More...

Collaboration diagram for fileMonitorWatcher:
[legend]

Public Member Functions

 fileMonitorWatcher (const bool useInotify, const label sz=20)
 Initialise inotify. More...
 
 ~fileMonitorWatcher ()
 Remove all watches. More...
 
bool addWatch (const label watchFd, const fileName &fName)
 
bool removeWatch (const label watchFd)
 
 fileMonitorWatcher (const bool useInotify, const label sz=20)
 Initialise inotify. More...
 
 ~fileMonitorWatcher ()
 Remove all watches. More...
 
bool addWatch (const label watchFd, const fileName &fName)
 
bool removeWatch (const label watchFd)
 

Public Attributes

const bool useInotify_
 
int inotifyFd_
 File descriptor for the inotify instance. More...
 
DynamicList< label > dirWatches_
 Current watchIDs and corresponding directory id. More...
 
DynamicList< fileNamedirFiles_
 
DynamicList< double > lastMod_
 From watch descriptor to modified time. More...
 

Detailed Description

Internal tracking via stat(3p) or inotify(7)

Definition at line 113 of file fileMonitor.C.

Constructor & Destructor Documentation

◆ fileMonitorWatcher() [1/2]

fileMonitorWatcher ( const bool  useInotify,
const label  sz = 20 
)
inline

Initialise inotify.

Definition at line 136 of file fileMonitor.C.

References fileMonitorWatcher::dirFiles_, fileMonitorWatcher::dirWatches_, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, fileMonitorWatcher::inotifyFd_, fileMonitorWatcher::lastMod_, DynamicList< T, SizeMin >::setCapacity(), fileMonitorWatcher::useInotify_, and WarningInFunction.

Here is the call graph for this function:

◆ ~fileMonitorWatcher() [1/2]

~fileMonitorWatcher ( )
inline

Remove all watches.

Definition at line 185 of file fileMonitor.C.

References fileMonitorWatcher::dirWatches_, Foam::endl(), forAll, fileMonitorWatcher::inotifyFd_, fileMonitorWatcher::useInotify_, and WarningInFunction.

Here is the call graph for this function:

◆ fileMonitorWatcher() [2/2]

fileMonitorWatcher ( const bool  useInotify,
const label  sz = 20 
)
inline

Initialise inotify.

Definition at line 132 of file fileMonitor.C.

References fileMonitorWatcher::dirFiles_, fileMonitorWatcher::dirWatches_, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, fileMonitorWatcher::inotifyFd_, fileMonitorWatcher::lastMod_, DynamicList< T, SizeMin >::setCapacity(), fileMonitorWatcher::useInotify_, and WarningInFunction.

Here is the call graph for this function:

◆ ~fileMonitorWatcher() [2/2]

~fileMonitorWatcher ( )
inline

Remove all watches.

Definition at line 181 of file fileMonitor.C.

References fileMonitorWatcher::dirWatches_, Foam::endl(), forAll, fileMonitorWatcher::inotifyFd_, fileMonitorWatcher::useInotify_, and WarningInFunction.

Here is the call graph for this function:

Member Function Documentation

◆ addWatch() [1/2]

bool addWatch ( const label  watchFd,
const fileName fName 
)
inline

Definition at line 206 of file fileMonitor.C.

References Foam::abort(), fileMonitorWatcher::dirFiles_, fileMonitorWatcher::dirWatches_, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::highResLastModified(), fileMonitorWatcher::inotifyFd_, Foam::isDir(), fileMonitorWatcher::lastMod_, fileName::name(), fileName::path(), and fileMonitorWatcher::useInotify_.

Here is the call graph for this function:

◆ removeWatch() [1/2]

bool removeWatch ( const label  watchFd)
inline

◆ addWatch() [2/2]

bool addWatch ( const label  watchFd,
const fileName fName 
)
inline

Definition at line 202 of file fileMonitor.C.

References Foam::abort(), fileMonitorWatcher::dirFiles_, fileMonitorWatcher::dirWatches_, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::highResLastModified(), fileMonitorWatcher::inotifyFd_, Foam::isDir(), fileMonitorWatcher::lastMod_, fileName::name(), fileName::path(), and fileMonitorWatcher::useInotify_.

Here is the call graph for this function:

◆ removeWatch() [2/2]

bool removeWatch ( const label  watchFd)
inline

Member Data Documentation

◆ useInotify_

◆ inotifyFd_

int inotifyFd_

◆ dirWatches_

DynamicList< label > dirWatches_

◆ dirFiles_

◆ lastMod_

DynamicList< double > lastMod_

From watch descriptor to modified time.

Definition at line 131 of file fileMonitor.C.

Referenced by fileMonitorWatcher::addWatch(), fileMonitorWatcher::fileMonitorWatcher(), and fileMonitorWatcher::removeWatch().


The documentation for this class was generated from the following file: