• 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: User-space to kernel communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User-space to kernel communication


  • Subject: Re: User-space to kernel communication
  • From: Quinn <email@hidden>
  • Date: Tue, 9 Jan 2007 08:32:46 -0800

At 19:04 -0600 8/1/07, Brian Bergstrand wrote:
On Jan 8, 2007, at 6:18 PM, Greg wrote:
From what I've read about IOUserClient and its IOConnectMethod*'s, it does not seem like they support passing variable length data.

No, you'd have to combine memory mapping with an IOUserKitClient to get true variable length support (by passing a ptr in a struct arg to your method).

Actually, you can do this in two ways with a custom IOUserClient:

1. You can break the data into a sequence of words, and pass it in using IOConnectMethodScalarIScalarO. For example, on input, the first parameter is a count of the number of words supplied in the varargs list. Most folks typically use a fixed value for any given method index, but there's no requirement to do so.

2. You can pack the data into a buffer and pass that in via one of the "IOConnectMethod*StructureI*" methods. In this case, you just pass in a pointer to a buffer and its length. Again, this can vary from request to request.

At 21:19 -0500 8/1/07, Greg wrote:
With this available I don't see why anyone would want to use sysctl or the IOUserClient stuff... are there any disadvantages associated with using kernel control sockets over the aforementioned sysctl/IOConnectMethod stuff?

The considerations I usually apply are:

o If you're already knee deep in BSD KPI, there's a general preference for BSD-based mechanism (sysctl or sockets).

o If you're already knee deep in I/O Kit, there's a general preference for IOUserClient.

o sysctl is /very/ simple.

o sysctl has a command line tool you can use for basic testing. That's very convenient. For example, look at my KauthORama sample.

<http://developer.apple.com/samplecode/KauthORama/index.html>

o sysctl has no notification mechanism. If the client needs to wake up when the value changes, sysctl is inappropriate. Both sockets and IOUserClient let you notify a user process when things change.

o If you need low latency or high bandwidth, IOUserClient is probably your best bet. It has low latency because it's based on Mach messaging (this is especially true prior to 10.4, where BSD stuff can get stuck behind the kernel funnel). It supports high bandwidth because you can pass large blocks out of band (that is, by memory mapping).

o IOUserClient allows you to create shared mappings. You can use this either for high bandwidth communication, or to share state between you user and kernel code.

o On current systems, there is no (supported :-) way to create an IOUserClient that supports 64-bit user space programs. If you need to support such programs, IOUserClient isn't for you.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/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


  • Follow-Ups:
    • Re: User-space to kernel communication
      • From: Greg <email@hidden>
    • Re: User-space to kernel communication
      • From: Andrew Gallatin <email@hidden>
References: 
 >User-space to kernel communication (From: Greg <email@hidden>)
 >Re: User-space to kernel communication (From: Josh Graessley <email@hidden>)
 >Re: User-space to kernel communication (From: Greg <email@hidden>)
 >Re: User-space to kernel communication (From: "Greg Miller" <email@hidden>)
 >Re: User-space to kernel communication (From: Greg <email@hidden>)
 >Re: User-space to kernel communication (From: Brian Bergstrand <email@hidden>)
 >Re: User-space to kernel communication (From: Greg <email@hidden>)
 >Re: User-space to kernel communication (From: Brian Bergstrand <email@hidden>)

  • Prev by Date: Re: User-space to kernel communication
  • Next by Date: Re: User-space to kernel communication
  • Previous by thread: Re: User-space to kernel communication
  • Next by thread: Re: User-space to kernel communication
  • Index(es):
    • Date
    • Thread