BSD signal not aborting semaphore_wait() in the kernel on an SMP
BSD signal not aborting semaphore_wait() in the kernel on an SMP
- Subject: BSD signal not aborting semaphore_wait() in the kernel on an SMP
- From: Chandra Khan <email@hidden>
- Date: Mon, 18 Oct 2004 12:40:54 -0700
Hi:
I've done some work with character devices on traditional BSD and
linux in the past. Given that, and my relative inexperience with C++
and IOKit, I chose to implement my tutorial "hello world" pseudo
character device driver wholly within the BSD subsystem of XNU. And
I've run into something and would appreciate some guidance.
The UNIX process in question does an ioctl(my_dev) and, once in kernel
space, sits on a semaphore_wait(). Because this process is
ptrace-attached to a child process, and that child process gets a
signal (as part of the design), I expect that the parent process will
get a SIGCHLD, and in doing so, pop out of the semaphore_wait() with a
KERN_ABORTED.
It works. Unfortunately, not always.
Especially when there is a lot of context switching between the parent
and child (as opposed to the parent mostly sleeping), things dont work
as I expect. While the SIGCHLD is delivered and the custom SIGCHLD
handler *does* run (asynchronously), the parent process never aborts
its semaphore_wait().
Is this an SMP issue? Or something to do with funnels? Or should I be
abandoning Mach semaphores in deference to tsleep()/wakeup()? Or
should I use thread_block(), etc?
I'm somewhat lost, even after having read the relevant sections of the
kernel programming guide (which is a very well-written document, by
the way!), and combing through the archives of this list.
Thanks for any help,
Chandra
_______________________________________________
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