RE: String compare
RE: String compare
- Subject: RE: String compare
- From: Quinn <email@hidden>
- Date: Mon, 11 Apr 2005 11:04:48 +0100
Title: RE: String compare
At 14:44 -0400 8/4/05, Carl Smith wrote:
Thanks for the reply Shawn, actually I am not using an
IOKit, it is a NKE, and if I use anything that is not in the sys/
directory my kernel crashes. Like trying to use memcmp. The same goes
for malloc. But if I use _MALLOC, which is defined in sys/malloc.h I
am fine, so I was looking for something along the same line in the
sys/ folders but could not fine anything. Just thought maybe some of
the Apple guys knew of something off the top of there
heads.
strcmp and memcmp are both available to kernel code. As
Justin pointed out in an earlier post, various /bits/ of the standard
C library are available to kernel code, you just have to work out
which bits. For example, malloc isn't available, but strcmp
is.
To find whether a standard C library symbol is available to you,
do the following.
1. Search the Kernel framework. We try to ensure that only
symbols that are available to kernel code are defined in the Kernel
framework. That discipline is kinda lax on current systems, but
it's a lot tighter on Tiger.
2. Confirm that the symbol is exported by /mach_kernel.
$ nm /mach_kernel | grep strcmp
000808b8 T _strcmp
3. Work out which KPI exports the symbol (that is, which bundle
identifier should should add to your OSBundleLibraries property in
order to access the symbol). You can do this using the technique
shown by Sam Vaughan in a recent post:
At 18:19 +1000 10/4/05, Sam Vaughan wrote:
% find
/System/Library/Extensions/System.kext/PlugIns \
-type f -a ! -name "*.plist"
| xargs nm | grep physio
S+E
--
Quinn "The
Eskimo!"
<http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications,
Hardware
_______________________________________________
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