Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/filemon For files opened O_RDWR, output an R record ...
details: https://anonhg.NetBSD.org/src/rev/561d25de46f1
branches: trunk
changeset: 769827:561d25de46f1
user: sjg <sjg%NetBSD.org@localhost>
date: Sat Sep 24 18:08:15 2011 +0000
description:
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.
diffstat:
sys/dev/filemon/filemon.h | 4 ++--
sys/dev/filemon/filemon_wrapper.c | 13 ++++++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diffs (48 lines):
diff -r 97dad55f4802 -r 561d25de46f1 sys/dev/filemon/filemon.h
--- a/sys/dev/filemon/filemon.h Sat Sep 24 17:55:30 2011 +0000
+++ b/sys/dev/filemon/filemon.h Sat Sep 24 18:08:15 2011 +0000
@@ -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 {
diff -r 97dad55f4802 -r 561d25de46f1 sys/dev/filemon/filemon_wrapper.c
--- a/sys/dev/filemon/filemon_wrapper.c Sat Sep 24 17:55:30 2011 +0000
+++ b/sys/dev/filemon/filemon_wrapper.c Sat Sep 24 18:08:15 2011 +0000
@@ -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 @@
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",
Home |
Main Index |
Thread Index |
Old Index