]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (docs) add monitor example
authorKarel Zak <kzak@redhat.com>
Tue, 13 Jan 2015 11:13:09 +0000 (12:13 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Jan 2015 11:13:09 +0000 (12:13 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/monitor.c

index f7323f6938caef1abf9e153e5992b9ec11155762..28064b8968fce0392bd52058766c2d4d21292e06 100644 (file)
  * @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"