From: Henry Wilson <henry.wilson@xxxxxxxxxxx> Added documentation for new flag IN_MASK_CREATE for inotify_add_watch() which is used to only allow new watches to be created. Information obtained from a patch I submitted to the linux kernel https://marc.info/?l=linux-fsdevel&m=152775980422847&w=2 --- man7/inotify.7 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/man7/inotify.7 b/man7/inotify.7 index 85c05a9bc..873bc27bc 100644 --- a/man7/inotify.7 +++ b/man7/inotify.7 @@ -347,7 +347,12 @@ If a watch instance already exists for the filesystem object corresponding to .IR pathname , add (OR) the events in .I mask -to the watch mask (instead of replacing the mask). +to the watch mask (instead of replacing the mask); +the error +.B EINVAL +results if +.B IN_MASK_CREATE +is also specified. .TP .B IN_ONESHOT Monitor the filesystem object corresponding to @@ -366,6 +371,22 @@ results if is not a directory. Using this flag provides an application with a race-free way of ensuring that the monitored object is a directory. +.TP +.BR IN_MASK_CREATE " (from Linux 4.18)" +Watch +.I pathname +only if it does not already have a watch associated with it; +the error +.B EEXIST +results if +.I pathname +already is being watched. +Using this flag provides an application with a way of ensuring +that new watches do not modify existing ones. This is useful +because multiple paths may refer to the same inode, and +multiple calls to +.B inotify_add_watch (2) +without this flag may clobber existing watch masks. .RE .PP The following bits may be set in the -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html