Re: close() hangs when closing a kqueue in 10.5 only
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Aug 16, 2010, at 11:41 , Jerry Krinock wrote: close (kqueueFileDescriptor) ; NSInteger kqueueFileDescriptor = kqueue() ; HTH Justin -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds ----------- Like the ski resort full of girls hunting for husbands and husbands hunting for girls, the situation is not as symmetrical as it might seem. - Alan MacKay -- _______________________________________________ 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... A Cocoa app I've written uses a kqueue to watch its document file. It works fine in Mac OS 10.6, but when run in Mac OS 10.5.8, when I close the kqueue like this: The function close() hangs forever. The argument kqueueFileDescriptor is the integer I got previously from: Does anyone know what might be going on here? Documentation says that read() can block until data is ready, but there is no mention of this in the documentation for close(). I suppose I could just leave the kqueue open if running in 10.5, because a typical application run only creates one of them. Is close() open-source? I can't find it in macosforge.org or opensource.apple.com. As mentioned, this system call is in the open-source part of Mac OS X. The tricky part is that very low-level calls like this may not have an implementation as you might expect to see it. I believe that close() is implemented by table-manipulation tom-foolery, during the build of the kernel. The close call in libsystem probably invokes a generic "system call" trap directly, which gets "vectored" to a dispatch table in the kernel. I think the actual code is in bsd/kern/kern_descrip.c called closef_locked(). The logic here is kind of twisty because the system has to account for a variety of different file descriptor types and behaviors, and in particular, detect "last close" issues. This email sent to site_archiver@lists.apple.com
participants (1)
-
Justin C. Walker