From owner-freebsd-hackers Sun Oct 27 1:58:11 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05BE537B401; Sun, 27 Oct 2002 01:58:10 -0800 (PST) Received: from baraca.united.net.ua (ns.united.net.ua [193.111.8.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E58D43E42; Sun, 27 Oct 2002 01:58:08 -0800 (PST) (envelope-from max@vega.com) Received: from vega.vega.com (xDSL-2-2.united.net.ua [193.111.9.226]) by baraca.united.net.ua (8.12.6/8.11.6) with ESMTP id g9R9w5h4095172; Sun, 27 Oct 2002 11:58:06 +0200 (EET) (envelope-from max@vega.com) Received: from vega.vega.com (max@localhost [127.0.0.1]) by vega.vega.com (8.12.6/8.12.5) with ESMTP id g9R9w9aJ036811; Sun, 27 Oct 2002 11:58:09 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: (from max@localhost) by vega.vega.com (8.12.6/8.12.5/Submit) id g9R9w8qs036810; Sun, 27 Oct 2002 11:58:08 +0200 (EET) Date: Sun, 27 Oct 2002 11:58:08 +0200 From: Maxim Sobolev To: Juli Mallett Cc: Nate Lawson , jlemon@FreeBSD.ORG, hackers@FreeBSD.ORG, audit@FreeBSD.ORG Subject: Re: New kevent types: NOTE_STARTEXEC and NOTE_STOPEXEC Message-ID: <20021027095808.GA36796@vega.vega.com> References: <3DB79DFA.FA719B8F@FreeBSD.org> <20021027075043.GA36533@vega.vega.com> <20021027010429.A90908@FreeBSD.org> <20021027082309.GC36533@vega.vega.com> <20021027012419.A94775@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20021027012419.A94775@FreeBSD.org> User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Oct 27, 2002 at 01:24:19AM -0700, Juli Mallett wrote: > * De: Maxim Sobolev [ Data: 2002-10-27 ] > [ Subjecte: Re: New kevent types: NOTE_STARTEXEC and NOTE_STOPEXEC ] > > On Sun, Oct 27, 2002 at 01:04:29AM -0700, Juli Mallett wrote: > > > * De: Maxim Sobolev [ Data: 2002-10-27 ] > > > [ Subjecte: Re: New kevent types: NOTE_STARTEXEC and NOTE_STOPEXEC ] > > > > On Sat, Oct 26, 2002 at 06:09:31PM -0700, Nate Lawson wrote: > > > > > On Thu, 24 Oct 2002, Maxim Sobolev wrote: > > > > > > Please review the patch, which adds two new types of events - > > > > > > NOTE_STARTEXEC and NOTE_STOPEXEC, that could be used to get > > > > > > notification when the image starts or stops executing. For example, it > > > > > > could be used to monitor that a daemon is up and running and notify > > > > > > administrator when for some reason in exits. I am running this code > > > > > > for more than a year now without any problems. > > > > > > > > > > > > Any comments and suggestions are welcome. > > > > > > > > > > Couldn't this just be done by init(8) and /etc/ttys? Or inetd? If you > > > > > want to write your own, couldn't you use waitpid()? Or a kevent() of > > > > > EVFILT_PROC with NOTE_EXIT/NOTE_FORK? I'm not sure I see the need for > > > > > this. > > > > > > > > EVFILT_PROC operates on pids, while NOTE_{START,STOP}EXEC operate on > > > > vnodes - it is the main difference. Currently, you can't reliably > > > > get a notification when kernes started executing some arbitrary > > > > executable from your fs. > > > > > > This is not a job for the kernel, I don't think. > > > > Why not? Kernel now reports number of internal events via kqueue(2) interface, > > there is nothing wrong in adding yet another one. BTW, linux and irix already > > have similar functionality provided by /dev/imon. > > If you implemented a kq interface, and an imon wrapper, I'd be much more > impressed. A less-divergant interface to do this would be nice, even if > kq is the backing. In fact, especially if kq is the backing, kq is strong, > kq will make us smart. Actually, the only user of /dev/imon I am aware of is SGI's fam package (file alteration monitor). I've already implemented subset of it using BSD kqueue as a backend instead of imon. Check bsdfam project on sourceforge for details. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message