Re: How to detect Mac OS X version from a kext
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UJNEVtN5ozauPe/58w/1oYbWrdF2L8VUk2bRpWE2Oz2yyRaiwKnUqptuPuTdtuipcgvYXGIOjpmMAdRAz1Z1R63htG57INO1HMxhpMnkFidGFE4l6UHeS/onQnMBzPYMP1veB+nUT22KnQwAJ4wdAAXl8rw7JTsCbpUYXT5Jtrg= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qDELXa5QajYSqjNjdHddDNKYdvIviAh+JrGKU9NQOB1pM4NZJzBng60NkNQiD3yt8HX+VBgJAnQ26LdlYeFhnBwtbuLr2QUPi2N6j7p24AHR+Lzrxy5WeAAQXDajLyavk/vQoQer4zyoQKYEI5r9rbbJUDhGBT9f4hJv5o7822s= FYI: browsing the xnu code, I found a simple way to determine the major version of the kernel: from libkern/version.h: extern const int version_major; So I guess I can simply check if (version_major == 8), then it must be Tiger. So never mind, I've finally answered my original question. Thanks
Irritatingly, the thing that you most want - the kmod version for the symbol set(s) against which you are matched - is not easy to get. The kmod_info struct that is passed to your kmod_start routine contains a list of kmod references which would include the kernel symbol sets against which you're linked, but if you're an I/O Kit kext I don't think this is readily available because Xcode is generating this function for you magically behind the scenes. So I don't have that problem because I'm not an I/O Kit kext. I'm a direct KPI user. (Am I missing something here, folks? I couldn't find a public interface to fetch the kmod_info data except via invoking kextstat, which doesn't work well for kernel mode consumers...) Just to be clear where you're going with this. Are you suggesting that I walk the list of kmod_info structs passed to my start routine? This number is your best bet; the major digit has consistenly been bumped at each major OS release. You will want to get confirmation from DTS (Garth?), but it seems reasonable to assume that as Panther was 7.x and Tiger was 8.x that Leopard will be 9.x. If someone at Apple can confirm this, I'll gladly use the utsname major number 9 to mean Leopard. That's indeed sounding like my best option. Thanks! -- Bhavesh P. Davda
-- Bhavesh P. Davda _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On 6/17/07, Bhavesh Davda <bhavesh.davda@gmail.com> wrote: This email sent to site_archiver@lists.apple.com
participants (1)
-
Bhavesh Davda