site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PcfhJcvc/XZRWpoyyX04uGmMW7jh7Az9zR04R6nLiuo=; b=KLEgN9ne8g6C0euFZkda3aHh8mREzSNxt35TtDm4wxjvWLtaQEAOQ5Fg1jmMErvH1r G/lYYbqAjGQKrTqVvGHZnjUuunIVzXYCOtrDQGSp7a+/4W6RRJN64N0UrTSi/goZzAx6 hJrzZOjYyRShP3zUUDw+hbFKJ4JY3OCC8dcuA= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bxhKJwTT5zK4A4pLKk6fLN+xIeGAQMpIBAiNCGpIDGtD8H5zmG6dUg3znvlnUofm5h 0xoVxU3aPpaqso1/anC7+IklicuBCS2hGgJkMPpdKL+KizcFJ56x+LotHWybcNDInmLo mZZln6CbFio5Fi8SXehYEhhNM50XYhduCYqqY= 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 <ccp0101@gmail.com>:
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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/eveningnick%40gmail.com
This email sent to eveningnick@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com