• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing parameters to a kext on load
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing parameters to a kext on load


  • Subject: Re: Passing parameters to a kext on load
  • From: Nik Gervae <email@hidden>
  • Date: Mon, 4 Jun 2007 14:56:16 -0700

That second parameter has always been passed as NULL. I'm afraid there's no clean way to get data passed to your kext at load time (and mixing in libkern C++ with a non-I/O Kit kext is problematic, but it can be done). Feel free to file an enhancement request for the feature you need, and I'll add it to my list. It seems pretty reasonable, after all!

(By the way, the kmod_info_t struct contains fields for your kext's bundle ID and version, and other internal bookkeeping stuff. Nothing much of use to kexts themselves. Check out Kernel.framework/Headers/ mach/kmod.h for the definition.)

--Nik Gervae
--Apple, Inc.


On 28 May, 2007, at 15:31, Nathan Toone wrote:

Will this work as well for an NKE? Most of where I see documentation for this is for IO kit drivers...

I know that using the kernel control mechanisms are the "approved" way of getting parameters to an NKE, but I'd like to set a couple of parameters which can be used in a failure condition - when the userspace application is *not* available.

-Nathan

On May 25, 2007, at 11:34 PM, Jim Guyton wrote:

Your dictionary is passed in with the init() call, then you can
do things like

const OSNumber *numObject = OSDynamicCast(OSNumber, dict- >getObject("parameterName"));
if (numObject)
value = numObject->unsigned32BitValue();


I suspect most of the drivers in the darwin source have some set
of parameters they look for.

Cheers,

-- Jim

On May 25, 2007, at 9:54 PM, Nathan Toone wrote:

That's exactly what I was wondering!  Perfect!

Does anyone have sample code which reads from the registry? (I'm pretty new at kernel development...)

-Nathan

On May 25, 2007, at 9:15 PM, Jim Guyton wrote:

The usual way to pass info to a driver on load is via the dictionary
stored in the Info.plist file. The kext loader will copy the data
items to the registry and the driver can read it from there.


For debugging you can look at the registry with ioreg and/or the
developer tools applicatio IORegistryExplorer.

-- Jim Guyton

On May 25, 2007, at 8:04 PM, Nathan Toone wrote:

I have noticed that kernel modules (I'm specifically working on a socket filter NKE) have parameters passed to their MODULE_START and MODULE_STOP functions. a kmod_info_t * structure and a void *.

What do these parameters represent? Is there a way for me to specify data that gets passed to my module on load? If so, how do I set that up?

Pointers to documentation would be appreciated as well. I wasn't able to find what I was looking for.

Thanks!

-Nathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev 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-dev 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-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: How to be an apple developer without a Mac?
  • Next by Date: Re: How to be an apple developer without a Mac?
  • Previous by thread: Re: [darwin-dev] Reasons for Panic.log not being written?
  • Next by thread: /usr/bin/install
  • Index(es):
    • Date
    • Thread