tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: In-kernel process exit hooks?
On Fri, Jan 08, 2016 at 12:26:14PM +0700, Robert Elz wrote:
> Date: Fri, 8 Jan 2016 11:22:28 +0800 (PHT)
> From: Paul Goyette <paul%vps1.whooppee.com@localhost>
> Message-ID: <Pine.NEB.4.64.1601081115270.22533%vps1.whooppee.com@localhost>
>
> | Is there a "supported" interface for detaching the file (or descriptor)
> | from the process without closing it?
>
> Inside the kernel you want to follow the exact same procedure as would
> be done by
>
> newfd = dup(oldfd);
> close(oldfd);
>
> except instead of dup (and assigning to a newfd in the process) we
> take the file reference and stick it in filemon. There's nothing
> magic about this step. What magic there is (though barely worthy of
> the title) would be in ensuring that filemon properly releases the file
> when it is closing.
Years ago I added to gre(4) an ioctl that a user thread can use to
delegate to the kernel a UDP socket that carries tunnel traffic. I
think that that code should cover at least the dup(2) part of Robert's
suggestion.
Dave
--
David Young
dyoung%pobox.com@localhost Urbana, IL (217) 721-9981
Home |
Main Index |
Thread Index |
Old Index