summaryrefslogtreecommitdiffstats
path: root/libmount/src/monitor.c
diff options
context:
space:
mode:
authorKarel Zak2015-01-13 12:13:09 +0100
committerKarel Zak2015-01-13 12:13:09 +0100
commit05cdd0bf45eb29ff6d20a3e9d7018dfd1618a062 (patch)
treee4b0f68ae0150073e6720aab610e439ac28c615c /libmount/src/monitor.c
parentdocs: update API docs years (diff)
downloadkernel-qcow2-util-linux-05cdd0bf45eb29ff6d20a3e9d7018dfd1618a062.tar.gz
kernel-qcow2-util-linux-05cdd0bf45eb29ff6d20a3e9d7018dfd1618a062.tar.xz
kernel-qcow2-util-linux-05cdd0bf45eb29ff6d20a3e9d7018dfd1618a062.zip
libmount: (docs) add monitor example
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/monitor.c')
-rw-r--r--libmount/src/monitor.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libmount/src/monitor.c b/libmount/src/monitor.c
index f7323f693..28064b896 100644
--- a/libmount/src/monitor.c
+++ b/libmount/src/monitor.c
@@ -10,6 +10,26 @@
* @title: Monitor
* @short_description: interface to monitor mount tables
*
+ * For example monitor VFS (/proc/self/mountinfo) for changes:
+ *
+ * <informalexample>
+ * <programlisting>
+ * const char *filename;
+ * struct libmount_monitor *mn = mnt_new_monitor();
+ *
+ * mnt_monitor_enable_kernel(mn, TRUE));
+ *
+ * printf("waiting for changes...\n");
+ * while (mnt_monitor_wait(mn, -1) > 0) {
+ * printf("notification detected\n");
+ *
+ * while (mnt_monitor_next_change(mn, &filename, NULL) == 0)
+ * printf(" %s: change detected\n", filename);
+ * }
+ * mnt_unref_monitor(mn);
+ * </programlisting>
+ * </informalexample>
+ *
*/
#include "fileutils.h"