Re: close() hangs when closing a kqueue in 10.5 only
Re: close() hangs when closing a kqueue in 10.5 only
- Subject: Re: close() hangs when closing a kqueue in 10.5 only
- From: "Justin C. Walker" <email@hidden>
- Date: Mon, 16 Aug 2010 12:56:16 -0700
On Aug 16, 2010, at 11:41 , Jerry Krinock wrote:
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:
close (kqueueFileDescriptor) ;
The function close() hangs forever. The argument
kqueueFileDescriptor is the integer I got previously from:
NSInteger kqueueFileDescriptor = kqueue() ;
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.
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden