Re: Is it possible to close a kernel control socket in kernel extension?
Re: Is it possible to close a kernel control socket in kernel extension?
- Subject: Re: Is it possible to close a kernel control socket in kernel extension?
- From: Nick <email@hidden>
- Date: Sat, 07 May 2011 16:45:09 +0300
When a usermode process gets killed, the system closes all opened
descriptors for it, including your control socket.
The only "annoying" thing may occur when you unload your kernel
extension before your application actually closed: your application
has dangling file descriptors pointing on non-existing in kernel
socket. The solution is simple - don't let this happen, by checking if
all usermode control sockets have been disconnected. See tcplognke
sample how to not let it be unloaded when its inappropriate (in kext's
unload routine you should return something different from KERN_SUCCESS
if your socket's ctl_disconnect_func haven't been called, for
example).
2011/5/7 Mike Chen <email@hidden>:
> Hi,
>
> I looked at the docs and I found no method to close an already
> established control socket in kernel. I can do it in userspace with
> close(file_descriptor) but it becomes very annoying when userspace
> application gets killed or encounters unexpected error that causes it
> to shutdown before doing close(). Anyone has a suggestion?
>
> Thanks.
> Mike.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden