Re: Accessing ifnet
Re: Accessing ifnet
- Subject: Re: Accessing ifnet
- From: Michael Tüxen <email@hidden>
- Date: Fri, 6 Jun 2008 19:14:30 +0200
Hi John,
comments in-line.
Best regards
Michael
On Jun 6, 2008, at 5:27 PM, Josh Graessley wrote:
On Jun 6, 2008, at 10:02 AM, Rick Macklem wrote:
On Fri, 6 Jun 2008, Michael Tüxen wrote:
Dear all,
in an NKE I'm using code like
TAILQ_FOREACH(ifn, &ifnet, if_list) {
/* Do something with ifn */
}
and need to protect it by
ifnet_head_lock_shared();
TAILQ_FOREACH(ifn, &ifnet, if_list) {
/* Do something with ifn */
}
ifnet_head_done();
but the kextload reports
kld(): Undefined symbols:
_ifnet_head_done
_ifnet_head_lock_shared
As OSBundleLibraries I use com.apple.kernel.
I do know that I'm using unsupported API... but is there a way
to use the mutex routines?
To the best of my knowledge, you can't link to those routines,
because
they aren't in the mach_kernel's symbol table. However, so long as
you
abide by the terms of the APSL, you can crib them from the sources
and
put them in your Kext. (I'm assuming you already understand the risks
associated with doing this, such as "Apple could change them for any
release and you code will then be broken".)
If you download xnu-1228 sources, look in bsd/net/dlil.c for them.
You can also bypass the safety on your food processor and get it to
run while the lid is off and reach your hand in but I wouldn't
recommend it.
1) In order to get your kext to link, you'll have to declare a
dependency on the exact version of the kernel, which means your kext
will only work with one specific version of Mac OS X. Every software
update will break your product.
I know!
2) There's a better way. There are a whole set of KPIs to do
whatever you are likely to be trying to do. They will take and drop
any appropriate locks for you.
I'm using KPIs were possible. However, implementing a transport stack
is currently not possible
with using only supported KPIs... That is why I have build the NKE for
each version of
the OS (more precisely: change the Info.plist file). Major changes to
the code where only
necessary from Panther -> Tiger -> Leopard...
-josh
_______________________________________________
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