@@ -1123,6 +1123,11 @@ otherwise noted.
``fadvise``
possibly called by the fadvise64() system call.
+``fd_install``
+ called by the VFS when a file descriptor is installed in the
+ process's file descriptor table, regardless how the file descriptor
+ was acquired -- be it via the open syscall, received over IPC, etc.
+
Note that the file operations are implemented by the specific
filesystem in which the inode resides. When opening a device node
(character or block special) most filesystems will call special
@@ -616,6 +616,9 @@ void __fd_install(struct files_struct *files, unsigned int fd,
void fd_install(unsigned int fd, struct file *file)
{
__fd_install(current->files, fd, file);
+
+ if (file->f_op->fd_install)
+ file->f_op->fd_install(fd, file);
}
EXPORT_SYMBOL(fd_install);
@@ -1864,6 +1864,7 @@ struct file_operations {
struct file *file_out, loff_t pos_out,
loff_t len, unsigned int remap_flags);
int (*fadvise)(struct file *, loff_t, loff_t, int);
+ void (*fd_install)(int, struct file *);
} __randomize_layout;
struct inode_operations {
Provides a per process hook for the acquisition of file descriptors, despite the method used to obtain the descriptor. Signed-off-by: Kalesh Singh <kaleshsingh@google.com> --- Documentation/filesystems/vfs.rst | 5 +++++ fs/file.c | 3 +++ include/linux/fs.h | 1 + 3 files changed, 9 insertions(+)