From: Karel Zak Date: Tue, 13 Jan 2015 11:13:09 +0000 (+0100) Subject: libmount: (docs) add monitor example X-Git-Tag: v2.26-rc1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05cdd0bf45eb29ff6d20a3e9d7018dfd1618a062;p=thirdparty%2Futil-linux.git libmount: (docs) add monitor example Signed-off-by: Karel Zak --- diff --git a/libmount/src/monitor.c b/libmount/src/monitor.c index f7323f6938..28064b8968 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: + * + * + * + * 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); + * + * + * */ #include "fileutils.h"