Source-Changes-HG archive

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

[src/trunk]: src Revert the removal of filemon.



details:   https://anonhg.NetBSD.org/src/rev/3d8fc34e4c59
branches:  trunk
changeset: 847444:3d8fc34e4c59
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Dec 23 06:45:36 2019 +0000

description:
Revert the removal of filemon.

diffstat:

 distrib/sets/lists/base/mi         |    4 +-
 distrib/sets/lists/comp/mi         |    4 +-
 distrib/sets/lists/man/mi          |    8 +-
 etc/MAKEDEV.tmpl                   |    7 +-
 etc/mtree/NetBSD.dist.base         |    3 +-
 share/man/man4/Makefile            |    4 +-
 share/man/man4/filemon.4           |  248 ++++++++++++++++++++
 sys/arch/amd64/conf/ALL            |    6 +-
 sys/arch/i386/conf/ALL             |    6 +-
 sys/conf/files                     |    8 +-
 sys/conf/majors                    |    4 +-
 sys/dev/Makefile                   |    4 +-
 sys/dev/filemon/Makefile           |    8 +
 sys/dev/filemon/filemon.c          |  445 ++++++++++++++++++++++++++++++++++++
 sys/dev/filemon/filemon.h          |   62 +++++
 sys/dev/filemon/filemon_wrapper.c  |  456 +++++++++++++++++++++++++++++++++++++
 sys/dev/filemon/mknod-sh           |   22 +
 sys/modules/Makefile               |    3 +-
 sys/modules/filemon/Makefile       |   20 +
 sys/modules/filemon/filemon.ioconf |    7 +
 usr.sbin/makemandb/nostem.txt      |    1 +
 21 files changed, 1308 insertions(+), 22 deletions(-)

diffs (truncated from 1570 to 300 lines):

diff -r b622e96aa03b -r 3d8fc34e4c59 distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Mon Dec 23 02:50:50 2019 +0000
+++ b/distrib/sets/lists/base/mi        Mon Dec 23 06:45:36 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1223 2019/12/18 07:37:17 maxv Exp $
+# $NetBSD: mi,v 1.1224 2019/12/23 06:45:36 maxv Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -1114,7 +1114,7 @@
 ./usr/include/dev/dmover                       base-c-usr
 ./usr/include/dev/dtv                          base-c-usr
 ./usr/include/dev/eisa                         base-obsolete           obsolete
-./usr/include/dev/filemon                      base-obsolete           obsolete
+./usr/include/dev/filemon                      base-c-usr
 ./usr/include/dev/hdaudio                      base-c-usr
 ./usr/include/dev/hdmicec                      base-c-usr
 ./usr/include/dev/hid                          base-c-usr
diff -r b622e96aa03b -r 3d8fc34e4c59 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Mon Dec 23 02:50:50 2019 +0000
+++ b/distrib/sets/lists/comp/mi        Mon Dec 23 06:45:36 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2298 2019/12/18 07:37:17 maxv Exp $
+#      $NetBSD: mi,v 1.2299 2019/12/23 06:45:36 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -411,7 +411,7 @@
 ./usr/include/dev/eisa/eisadevs_data.h         comp-obsolete           obsolete
 ./usr/include/dev/eisa/eisareg.h               comp-obsolete           obsolete
 ./usr/include/dev/eisa/eisavar.h               comp-obsolete           obsolete
-./usr/include/dev/filemon/filemon.h            comp-obsolete           obsolete
+./usr/include/dev/filemon/filemon.h            comp-c-include
 ./usr/include/dev/fssvar.h                     comp-c-include
 ./usr/include/dev/hdaudio/hdaudioio.h          comp-c-include
 ./usr/include/dev/hdaudio/hdaudioreg.h         comp-c-include
diff -r b622e96aa03b -r 3d8fc34e4c59 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Mon Dec 23 02:50:50 2019 +0000
+++ b/distrib/sets/lists/man/mi Mon Dec 23 06:45:36 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1666 2019/12/18 07:37:17 maxv Exp $
+# $NetBSD: mi,v 1.1667 2019/12/23 06:45:37 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1104,7 +1104,7 @@
 ./usr/share/man/cat4/fast_ipsec.0              man-obsolete            obsolete
 ./usr/share/man/cat4/fd.0                      man-sys-catman          .cat
 ./usr/share/man/cat4/fea.0                     man-sys-catman          .cat
-./usr/share/man/cat4/filemon.0                 man-obsolete            obsolete
+./usr/share/man/cat4/filemon.0                 man-sys-catman          .cat
 ./usr/share/man/cat4/finsio.0                  man-sys-catman          .cat
 ./usr/share/man/cat4/flash.0                   man-sys-catman          .cat
 ./usr/share/man/cat4/fms.0                     man-sys-catman          .cat
@@ -4288,7 +4288,7 @@
 ./usr/share/man/html4/fast_ipsec.html          man-obsolete            obsolete
 ./usr/share/man/html4/fd.html                  man-sys-htmlman         html
 ./usr/share/man/html4/fea.html                 man-sys-htmlman         html
-./usr/share/man/html4/filemon.html             man-obsolete            obsolete
+./usr/share/man/html4/filemon.html             man-sys-htmlman         html
 ./usr/share/man/html4/finsio.html              man-sys-htmlman         html
 ./usr/share/man/html4/flash.html               man-sys-htmlman         html
 ./usr/share/man/html4/fms.html                 man-sys-htmlman         html
@@ -7244,7 +7244,7 @@
 ./usr/share/man/man4/fast_ipsec.4              man-obsolete            obsolete
 ./usr/share/man/man4/fd.4                      man-sys-man             .man
 ./usr/share/man/man4/fea.4                     man-sys-man             .man
-./usr/share/man/man4/filemon.4                 man-obsolete            obsolete
+./usr/share/man/man4/filemon.4                 man-sys-man             .man
 ./usr/share/man/man4/finsio.4                  man-sys-man             .man
 ./usr/share/man/man4/flash.4                   man-sys-man             .man
 ./usr/share/man/man4/fms.4                     man-sys-man             .man
diff -r b622e96aa03b -r 3d8fc34e4c59 etc/MAKEDEV.tmpl
--- a/etc/MAKEDEV.tmpl  Mon Dec 23 02:50:50 2019 +0000
+++ b/etc/MAKEDEV.tmpl  Mon Dec 23 06:45:36 2019 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#      $NetBSD: MAKEDEV.tmpl,v 1.211 2019/12/18 07:37:17 maxv Exp $
+#      $NetBSD: MAKEDEV.tmpl,v 1.212 2019/12/23 06:45:37 maxv Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -816,6 +816,7 @@
        makedev dk24 dk25 dk26 dk27 dk28 dk29 dk30 dk31
        makedev ccd0 ccd1 ccd2 ccd3
        makedev cgd0 cgd1 cgd2 cgd3
+       makedev filemon
        makedev fss0 fss1 fss2 fss3
        makedev md0 md1
        makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
@@ -2181,6 +2182,10 @@
        mkdev dtrace/dtrace c %dtrace_chr% 0 600
        ;;
 
+filemon)
+       mkdev filemon c %filemon_chr% 0 666
+       ;;
+
 fw[0-9]*)
        unit=${i#fw}
        for j in 0 1 2 3
diff -r b622e96aa03b -r 3d8fc34e4c59 etc/mtree/NetBSD.dist.base
--- a/etc/mtree/NetBSD.dist.base        Mon Dec 23 02:50:50 2019 +0000
+++ b/etc/mtree/NetBSD.dist.base        Mon Dec 23 06:45:36 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.base,v 1.207 2019/12/18 14:44:16 kamil Exp $
+#      $NetBSD: NetBSD.dist.base,v 1.208 2019/12/23 06:45:37 maxv Exp $
 #      @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -121,6 +121,7 @@
 ./usr/include/dev/dm
 ./usr/include/dev/dmover
 ./usr/include/dev/dtv
+./usr/include/dev/filemon
 ./usr/include/dev/hdaudio
 ./usr/include/dev/hdmicec
 ./usr/include/dev/hid
diff -r b622e96aa03b -r 3d8fc34e4c59 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Mon Dec 23 02:50:50 2019 +0000
+++ b/share/man/man4/Makefile   Mon Dec 23 06:45:36 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.691 2019/12/18 07:37:18 maxv Exp $
+#      $NetBSD: Makefile,v 1.692 2019/12/23 06:45:37 maxv Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -23,7 +23,7 @@
        dmphy.4 dpt.4 dpti.4 drm.4 drum.4 drvctl.4 dtv.4 dtviic.4 dwctwo.4 \
        eap.4 ebus.4 edc.4 elmc.4 emuxki.4 ena.4 envsys.4 ep.4 esh.4 \
        esa.4 esiop.4 esm.4 eso.4 et.4 etphy.4 exphy.4 \
-       fd.4 finsio.4 flash.4 fpa.4 fms.4 fss.4 \
+       fd.4 filemon.4 finsio.4 flash.4 fpa.4 fms.4 fss.4 \
        fujbp.4 full.4 fxp.4 \
        gcscaudio.4 gem.4 genfb.4 gentbi.4 geodeide.4 \
        glxtphy.4 gpib.4 gpio.4 gpioirq.4 gpiolock.4 gpiopps.4 gpiopwm.4 \
diff -r b622e96aa03b -r 3d8fc34e4c59 share/man/man4/filemon.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/filemon.4  Mon Dec 23 06:45:36 2019 +0000
@@ -0,0 +1,248 @@
+.\"    $NetBSD: filemon.4,v 1.21 2019/12/23 06:45:37 maxv Exp $
+.\"
+.\" Copyright (c) 2011, Juniper Networks, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd January 6, 2016
+.Dt FILEMON 4
+.Os
+.Sh NAME
+.Nm filemon
+.Nd track interesting system calls
+.Sh SYNOPSIS
+.Cd "pseudo-device filemon"
+.Sh DESCRIPTION
+In normal situations,
+.Nm
+is not built-in to the kernel, and a call to open
+.Pa /dev/filemon
+will auto-load the
+.Nm
+module (see
+.Xr module 7
+for more details).
+.Pp
+(Although not recommended, the
+.Nm
+facility can be included in a kernel build by adding
+.Bd -literal -offset indent
+pseudo-device filemon
+.Ed
+.Pp
+to the kernel configuration file.)
+.Pp
+.Nm
+provides a means for tracking the successful system calls performed by
+a process and its descendants.
+It is used by
+.Xr make 1
+to track the activities of build scripts, for the purpose of automatically
+learning dependencies.
+.Pp
+The data captured by
+.Nm
+for the script
+.Bd -literal -offset indent
+n=`wc -l /etc/motd`; echo "int motd_lines = $n;" > foo.h.new
+cmp -s foo.h foo.h.new 2> /dev/null || mv foo.h.new foo.h
+.Ed
+.Pp
+looks like:
+.Bd -literal -offset indent
+# filemon version 4
+# Target pid 24291
+V 4
+E 29676 /bin/sh
+R 29676 /etc/ld.so.conf
+R 29676 /lib/libedit.so.2
+R 29676 /lib/libterminfo.so.1
+R 29676 /lib/libc.so.12
+F 29676 4899
+E 4899 /usr/bin/wc
+R 4899 /etc/ld.so.conf
+R 4899 /usr/lib/libc.so.12
+R 4899 /etc/motd
+X 4899 0
+W 29676 foo.h.new
+X 29676 0
+# Bye bye
+E 3250 /bin/sh
+R 3250 /etc/ld.so.conf
+R 3250 /lib/libedit.so.2
+R 3250 /lib/libterminfo.so.1
+R 3250 /lib/libc.so.12
+W 26673 /dev/null
+E 26673 /usr/bin/cmp
+R 26673 /etc/ld.so.conf
+R 26673 /usr/lib/libc.so.12
+X 26673 2
+E 576 /bin/mv
+R 576 /etc/ld.so.conf
+R 576 /lib/libc.so.12
+M 576 'foo.h.new' 'foo.h'
+X 576 0
+X 3250 0
+# Bye bye
+.Ed
+.Pp
+Most records follow the format:
+.Bd -literal -offset indent
+type pid data
+.Ed
+.Pp
+where
+.Ar type
+is one of the list below, and unless otherwise specified,
+.Ar data
+is a pathname.
+.Bl -tag -width Ds -offset indent
+.It Dv C
+.Xr chdir 2 .
+.It Dv D
+.Xr unlink 2 .
+.It Dv E
+.Xr exec 3 .
+.It Dv F
+.Xr fork 2 ,
+.Xr vfork 2 ;
+.Ar data
+is the process id of the child.
+.It Dv L
+.Xr link 2 ,
+.Xr symlink 2 ;
+.Ar data
+is two pathnames.
+.It Dv M
+.Xr rename 2 ;
+.Ar data
+is two pathnames.
+.It Dv R
+.Xr open 2
+for read or read-write.
+.It Dv W
+.Xr open 2
+for writing or read-write.
+.It Dv X
+.Xr exit 3 ;
+.Ar data
+is the exit status.
+.It Dv V
+indicates the version of
+.Nm .
+.El
+.Pp
+A
+.Nm
+instance is created by opening
+.Pa /dev/filemon .
+Then use
+.Fn ioctl filemon_fd FILEMON_SET_PID &pid
+to identify the target process to monitor, and



Home | Main Index | Thread Index | Old Index