Module Name:    src
Committed By:   sjg
Date:           Sat Sep 24 18:08:15 UTC 2011

Modified Files:
        src/sys/dev/filemon: filemon.h filemon_wrapper.c

Log Message:
For files opened O_RDWR, output an R record as well as W
so that clients that only care about files read can ignore W.
Bump version.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/filemon/filemon.h \
    src/sys/dev/filemon/filemon_wrapper.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.h
diff -u src/sys/dev/filemon/filemon.h:1.2 src/sys/dev/filemon/filemon.h:1.3
--- src/sys/dev/filemon/filemon.h:1.2	Mon Jul  4 23:37:30 2011
+++ src/sys/dev/filemon/filemon.h	Sat Sep 24 18:08:15 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: filemon.h,v 1.2 2011/07/04 23:37:30 sjg Exp $ */
+/* $NetBSD: filemon.h,v 1.3 2011/09/24 18:08:15 sjg Exp $ */
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
  *
@@ -31,7 +31,7 @@
 #define FILEMON_SET_FD		_IOWR('S', 1, int)
 #define FILEMON_SET_PID		_IOWR('S', 2, pid_t)
 
-#define FILEMON_VERSION		3
+#define FILEMON_VERSION		4
 
 #ifdef _KERNEL
 struct filemon {
Index: src/sys/dev/filemon/filemon_wrapper.c
diff -u src/sys/dev/filemon/filemon_wrapper.c:1.2 src/sys/dev/filemon/filemon_wrapper.c:1.3
--- src/sys/dev/filemon/filemon_wrapper.c:1.2	Sun Mar 13 21:26:31 2011
+++ src/sys/dev/filemon/filemon_wrapper.c	Sat Sep 24 18:08:15 2011
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filemon_wrapper.c,v 1.2 2011/03/13 21:26:31 sjg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon_wrapper.c,v 1.3 2011/09/24 18:08:15 sjg Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -164,6 +164,17 @@ filemon_wrapper_open(struct lwp * l, str
 			error = copyinstr(SCARG(uap, path), filemon->fm_fname1,
 			    sizeof(filemon->fm_fname1), &done);
 			if (error == 0) {
+				if (SCARG(uap, flags) & O_RDWR) {
+					/* we want a separate R record */
+					len = snprintf(filemon->fm_msgbufr,
+						sizeof(filemon->fm_msgbufr),
+						"R %d %s\n",
+						curproc->p_pid,
+						filemon->fm_fname1);
+
+					filemon_output(filemon,
+						filemon->fm_msgbufr, len);
+				}			
 				len = snprintf(filemon->fm_msgbufr,
 				    sizeof(filemon->fm_msgbufr),
 				    "%c %d %s\n",

Reply via email to