Re: Computer not shutting down
Re: Computer not shutting down
- Subject: Re: Computer not shutting down
- From: Greg <email@hidden>
- Date: Wed, 23 Jul 2008 19:25:17 -0400
After much trial and error I fixed the problem. I know that I'm
probably not going to win any fans here by complaining, but I feel
that Apple could do a whole lot more to document the kernel.
While searching for a potential solution I discovered an email on this
mailing list, from myself, asking for information about the
vnode_lookup function:
http://lists.apple.com/archives/darwin-kernel/2007/Jun/msg00111.html
The only reply I received was from Michael telling me to look through
the kernel source for example uses, which I did, couldn't find any
examples, replied as such, and received no further replies.
My entire experience writing the kernel extension has been one of
poking around in the dark. Since kernel programming is already such a
difficult and dangerous task, why should it be made even *more*
difficult by providing virtually zero documentation for the API?
Should third-party developers really be expected to simply know
everything there is to know about how Darwin works before attempting
to write a KEXT? If that's the case at the very least that should be
stated somewhere in one of the introductory texts Apple offers like
"KEXTConcept" or "KernelProgramming".
My problem was solved by a single vnode_put function call after the
vnode_lookup. The only reason I was able to figure this out was
because I somehow managed to find in the depths of the mailing list an
unanswered email about what the difference between 'vnode_put' and
'vnode_rele' was, and so I figured perhaps I needed to "release" the
vnode_t given to me by vnode_lookup, which was not at all obvious even
after looking at the source for vnode_lookup.
Sorry for the rant. Hopefully this email might prove useful for
somebody else encountering the same problem. Release your vnodes!
- Greg
On Jul 22, 2008, at 11:10 PM, Greg wrote:
Hi, I'm encountering an odd problem, that seems to be occurring on
both 10.4 and 10.5. I have a C-based kernel extension (_start/_stop
routines) that is loaded by a launchd daemon on startup and unloaded
on shutdown (when the daemon gets a signal).
The kernel reports (via printf messages) that it has been unloaded,
in other words the _stop function was called, and it got to a point
where all resources should have been freed and then it returns
KERN_SUCCESS.
However, the output on the screen stops at the following and sits
there:
continuing
Proper shutdown (when the KEXT is not installed) results in this
output:
continuing
done
CPU halted
I'd be very grateful for any ideas or theories as to why this is
happening, what could be going wrong, as I'm not sure where to look,
everything seems to be right..
Much appreciated,
- Greg
_______________________________________________
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