Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Kern-control and enqueuing data




Looking at my own reply, it's a little vague. Here are some details:

If you don't set CTL_FLAG_REG_ID_UNIT, you will be using dynamic unit numbers. This allows more than one client to attach at a time. To differentiate between the clients, you have to specify the unit number for the client that you want at the time that you enqueue data.

You can get the unit number from the connect function you specify with ctl_connect in the kern_ctl_reg structure. The sockaddr_ctl passed in will contain the unit number for that client's connection to your kernel control.

-josh

On Dec 5, 2005, at 10:16 AM, Josh Graessley wrote:


If you are using a dynamic kernel control, one where you register a name not a static id, the kernel will not fill in the unit number. The unit number at that point is undefined. You will get a unit number when a client attaches. You can track each client connection using the unit number. The control ref will always be the same, the unit number changes.

-josh

On Dec 5, 2005, at 12:39 AM, Sudarshan S wrote:

I have implemented a kern-control handler in kext. I want to pass some data to the user space program using recv queue. Whenever I tried to enqueue data using ctl_enqueuedata( ), it use to return an error code EINVAL. I was using the kern_ctl_ref and kern_ctl_reg.unit field that I got after ctl_register( ) call. Then I tried to enqueue data in setsockopt call handler (ctl_setopt) by using the parameters passed to that call and ctl_enqueuedata( ) worked fine.
Then I realized that the unit parameter passed to ctl_enqueuedata was not correct and the function was failing in kcb_find( ) call.
 
Is it correct to expect that kernel sets the proper value in kern_ctl_reg.unit after making ctl_register( ) call ?
Or is there any API to get the unit number by passing kern_ctl_ref ?
 
- Leo


Yahoo! Shopping
Find Great Deals on Gifts at Yahoo! Shopping
 _______________________________________________
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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-kernel/email@hidden

This email sent to email@hidden

References: 
 >Kern-control and enqueuing data (From: Sudarshan S <email@hidden>)
 >Re: Kern-control and enqueuing data (From: Josh Graessley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.