filemonitor header¶
The documentation of QEMU’s qemu/filemonitor.h
header.
-
typedef
void
(* QFileMonitorHandler)¶
Parameters
- `` * QFileMonitorHandler``
- undescribed
Description
Invoked whenever a file changes. If event is QFILE_MONITOR_EVENT_IGNORED, filename will be empty.
-
QFileMonitor *
qemu_file_monitor_new
(Error ** errp)¶
Parameters
Error ** errp
- pointer to a NULL-initialized error object
Description
Create a handle for a file monitoring object.
This object does locking internally to enable it to be safe to use from multiple threads
If the platform does not support file monitoring, an error will be reported. Likewise if file monitoring is supported, but cannot be initialized
Currently this is implemented on Linux platforms with the inotify subsystem.
Return
the new monitoring object, or NULL on error
-
void
qemu_file_monitor_free
(QFileMonitor * mon)¶
Parameters
QFileMonitor * mon
- the file monitor context
Description
Free resources associated with the file monitor, including any currently registered watches.
-
int64_t
qemu_file_monitor_add_watch
(QFileMonitor * mon, const char * dirpath, const char * filename, QFileMonitorHandler cb, void * opaque, Error ** errp)¶
Parameters
QFileMonitor * mon
- the file monitor context
const char * dirpath
- the directory whose contents to watch
const char * filename
- optional filename to filter on
QFileMonitorHandler cb
- the function to invoke when dirpath has changes
void * opaque
- data to pass to cb
Error ** errp
- pointer to a NULL-initialized error object
Description
Register to receive notifications of changes in the directory dirpath. All files in the directory will be monitored. If the caller is only interested in one specific file, filename can be used to filter events.
Return
a positive integer watch ID, or -1 on error
-
void
qemu_file_monitor_remove_watch
(QFileMonitor * mon, const char * dirpath, int64_t id)¶
Parameters
QFileMonitor * mon
- the file monitor context
const char * dirpath
- the directory whose contents to unwatch
int64_t id
- id of the watch to remove
Description
Removes the file monitoring watch id, associated with the directory dirpath. This must never be called from a QFileMonitorHandler callback, or a deadlock will result.