• Eric Paris's avatar
    fanotify: fanotify_mark syscall implementation · 2a3edf86
    Eric Paris authored
    
    
    NAME
    	fanotify_mark - add, remove, or modify an fanotify mark on a
    filesystem object
    
    SYNOPSIS
    	int fanotify_mark(int fanotify_fd, unsigned int flags, u64 mask,
    			  int dfd, const char *pathname)
    
    DESCRIPTION
    	fanotify_mark() is used to add remove or modify a mark on a filesystem
    	object.  Marks are used to indicate that the fanotify group is
    	interested in events which occur on that object.  At this point in
    	time marks may only be added to files and directories.
    
    	fanotify_fd must be a file descriptor returned by fanotify_init()
    
    	The flags field must contain exactly one of the following:
    
    	FAN_MARK_ADD - or the bits in mask and ignored mask into the mark
    	FAN_MARK_REMOVE - bitwise remove the bits in mask and ignored mark
    		from the mark
    
    	The following values can be OR'd into the flags field:
    
    	FAN_MARK_DONT_FOLLOW - same meaning as O_NOFOLLOW as described in open(2)
    	FAN_MARK_ONLYDIR - same meaning as O_DIRECTORY as described in open(2)
    
    	dfd may be any of the following:
    	AT_FDCWD: the object will be lookup up based on pathname similar
    		to open(2)
    
    	file descriptor of a directory: if pathname is not NULL the
    		object to modify will be lookup up similar to openat(2)
    
    	file descriptor of the final object: if pathname is NULL the
    		object to modify will be the object referenced by dfd
    
    	The mask is the bitwise OR of the set of events of interest such as:
    	FAN_ACCESS		- object was accessed (read)
    	FAN_MODIFY		- object was modified (write)
    	FAN_CLOSE_WRITE		- object was writable and was closed
    	FAN_CLOSE_NOWRITE	- object was read only and was closed
    	FAN_OPEN		- object was opened
    	FAN_EVENT_ON_CHILD	- interested in objected that happen to
    				  children.  Only relavent when the object
    				  is a directory
    	FAN_Q_OVERFLOW		- event queue overflowed (not implemented)
    
    RETURN VALUE
    	On success, this system call returns 0. On error, -1 is
    	returned, and errno is set to indicate the error.
    
    ERRORS
    	EINVAL An invalid value was specified in flags.
    
    	EINVAL An invalid value was specified in mask.
    
    	EINVAL An invalid value was specified in ignored_mask.
    
    	EINVAL fanotify_fd is not a file descriptor as returned by
    	fanotify_init()
    
    	EBADF fanotify_fd is not a valid file descriptor
    
    	EBADF dfd is not a valid file descriptor and path is NULL.
    
    	ENOTDIR dfd is not a directory and path is not NULL
    
    	EACCESS no search permissions on some part of the path
    
    	ENENT file not found
    
    	ENOMEM Insufficient kernel memory is available.
    
    CONFORMING TO
    	These system calls are Linux-specific.
    Signed-off-by: default avatarEric Paris <eparis@redhat.com>
    2a3edf86
fanotify_user.c 7.23 KB