Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 1996 15:15:20 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        julian@ref.tfs.com (Julian Elischer)
Cc:        hackers@FreeBSD.org
Subject:   Re: Adding reboot/exit callouts.. comments please
Message-ID:  <199607152215.PAA09454@phaeton.artisoft.com>
In-Reply-To: <199607151835.LAA25108@ref.tfs.com> from "Julian Elischer" at Jul 15, 96 11:35:09 am

next in thread | previous in thread | raw e-mail | index | archive | help
> I want to add the following two callouts to the system:
> 
> 1/ a callout list for things to do at shutdown
> 2/ a callout list  of things to do on process exit.
> 
> I see these as being useful for several purposes..
> 1/ third party modules that need to notify hardware of shutdown
> 2/ LKMs that need to clean up on process exit.
> 
> does anyone have work underway in this?
> does anyone object?
> does anyone have comments?

Any possibility of generalizing this?

It's pretty obvious that we could implement SYSV IPC/SHM/Semaphores
as an LKM IFF:

o	There was an __exit method registration mechanism

o	There was a __fork method registration mechanism

o	There wasn an __exec method registration mechanism



More generally, you want to be able to register:

o	init
o	deinit
o	attach process
o	detach process
	etc.

This resolves the fork/exec issues by hiding the behaviours (like the
close-on-exec or unmap-on-fork) under the attach/detach interface
mechanism, so that each component could implement its own policy.

So we can get:

	void
	policy_handler( void *context, event_t event)
	{

		switch( event) {
		case EVENT_INIT:
			...
			break;

		case EVENT_DEINIT:
			...
			break;

		case EVENT_THREAD_ATTACH:
			...
			break;

		case EVENT_THREAD_DETACH:
			...
			break;

		case EVENT_PROC_ATTACH:
			...
			break;

		case EVENT_PROC_DETACH:
			...
			break;
		...
		}
	}

This should also, incidently, generalize (and remove) the disctinction
between a loadable module anda statically linked module.


I'm loathe to go into more detail on anything like this with the
other interesting dicussions that are already in progress...


					Regards,
					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607152215.PAA09454>