[2.6.16-rc5-m3 PATCH] inotify: add the monitor for the event source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Current inotify implementation only focus on change of file system, but it doesn't
 know who results in this change, this patch adds three fields to struct inotify_event,
 tgid, uid and gid, they will save process ID, user ID and user group ID of the process
 which leads to change in the file system, such software as anti-virus can make use 
of this feature to monitor who is modifying a specific file.

Signed-off-by: Yi Yang <[email protected]>
--- a/include/linux/inotify.h.orig	2006-03-08 21:40:12.000000000 +0800
+++ b/include/linux/inotify.h	2006-03-08 23:51:54.000000000 +0800
@@ -19,6 +19,9 @@ struct inotify_event {
 	__s32		wd;		/* watch descriptor */
 	__u32		mask;		/* watch mask */
 	__u32		cookie;		/* cookie to synchronize two events */
+	__u32		tgid;		/* process ID of the event source */
+	__u32		uid;		/* user ID of the responding process */
+	__u32		gid;		/* group ID of the responding process */
 	__u32		len;		/* length (including nulls) of name */
 	char		name[0];	/* stub for possible name */
 };
--- a/fs/inotify.c.orig	2006-03-08 20:58:31.000000000 +0800
+++ b/fs/inotify.c	2006-03-09 00:05:47.000000000 +0800
@@ -219,6 +219,9 @@ static struct inotify_kernel_event * ker
 	kevent->event.wd = wd;
 	kevent->event.mask = mask;
 	kevent->event.cookie = cookie;
+	kevent->event.tgid = current->tgid;
+	kevent->event.uid = current->uid;
+	kevent->event.gid = current->gid;
 
 	INIT_LIST_HEAD(&kevent->list);
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux