Re: User-space to kernel communication
Re: User-space to kernel communication
- Subject: Re: User-space to kernel communication
- From: Michael Smith <email@hidden>
- Date: Tue, 9 Jan 2007 09:27:22 -0800
On Jan 8, 2007, at 4: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.
Perhaps I'm missing something, could you point me to what you're
referring to or perhaps a code example?
If you have an upper bound on your data, and it is around 4KiB or so,
then it makes no sense to implement a "variable length" interface of
any sort. The work you do supporting that interface will be
comparable to, if not greater, than the work involved in copying
those 4KiB in/out on your call, especially if you are not making this
call at a rate of thousands per second.
= Mike
- Greg
On Jan 8, 2007, at 7:07 PM, Brian Bergstrand wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
There is no "correct" way. There are ways that make more "sense"
given your current setup, but that's about it. If you want bi-
directional communication and you are already an IOKit kext, the
easiest method will be an IOUserClient nub (as Josh already
stated). You could also easily use a kernel control socket or
memory mapping (from personal experience, the former is a tad
easier than the latter because of certain kernel restrictions on
mapping memory from userland into the kernel).
Also from personal experience, sysctls and ioctls do not make for
easy bi-directional communication channels.
On Jan 8, 2007, at 5:41 PM, Greg wrote:
Sorry for the followup, but perhaps somebody could just advice me
on a specific method.
That document does provide details for the sysctl API but skims
over memory-mapping and a few others.
Apple provides an IODataQueue example but that is only for kernel
-> user-client communication, I'm not exactly sure how I would
reverse that direction.
However, it seems that sysctl is a viable option for my
purposes. It does seem to be able to handle variable length data
of moderate size, I guess I'll just use that. The reason for my
confusion is simply the shear number of options and the rather
sparse documentation on them; I'm just trying to find the
"correct" way of doing this...
- Greg
On Jan 8, 2007, at 6:17 PM, Greg Miller wrote:
Take a look at the document at
http://developer.apple.com/documentation/Darwin/Conceptual/
KernelProgramming/boundaries/chapter_14_section_1.html#//
apple_ref/doc/uid/TP30000905-CH217-DontLinkElementID_9
G~
On 1/8/07, Greg <email@hidden> wrote:
Like I said, I'm trying to send the kernel variable length data of
around 50 bytes. I am using the IOKit but I would also like to
know
how to do this without it. Is there any documentation on this? I
would really prefer to avoid blindly going through header files.
- Greg
On Jan 8, 2007, at 3:15 PM, Josh Graessley wrote:
>
> This depends on what you are trying to communicate with in the
> kernel. If you are already using IOKit, I would imagine an
> IOUserClient would be the way to go. If you're writing a non-
IOKit
> kext, you may want to look in to a kernel control socket (sys/
> kern_control.h).
>
> -josh
>
> On Jan 7, 2007, at 6:40 PM, Greg wrote:
>
>> Hi, what is the best way(s) to send variable length data
(around
>> 50 bytes or so) to a kernel extension from a user-land
>> application? Are there different ways to do this if the kext
uses
>> the IOUserClient schema to talk to user-land apps? If you
could
>> also point me to documentation or a tutorial on how to do
this I
>> would be much obliged!
>>
>> Thanks,
>>
Brian Bergstrand
<http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
iD8DBQFFotzdedHYW7bHtqIRAmI5AKDCYEhYQLuutfXymWbA2TNMJt114wCg81qa
4bWZYkEPhRifL2tebI39JTQ=
=qi/Q
-----END PGP SIGNATURE-----
_______________________________________________
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