Re: IOConnect Functions
Re: IOConnect Functions
- Subject: Re: IOConnect Functions
- From: Quinn <email@hidden>
- Date: Mon, 12 Jul 2004 14:08:00 +0100
At 9:54 -0700 28/6/04, Krishna Monian wrote:
When I define a function that is going to be called as
a result of an IOConnectMethodScalarIStructureO are
there any restrictions on the parameters the function
has to take?
Yes. Your input parameters must be a sequence of scalars and your
output parameters must a contiguous block of memory. That's the
meaning of "ScalarI" (scalar in) and "StructureO" (structure out)
respectively. Of course, there are other IOConnectMethod routines
for the other permutations.
I want to pass in a char** from user-space(memory
already allocated) to kernel space, and copy some
data into it.
It's generally best if you embed your data in a parameter block and
pass back the data using a "StructureO" routine. That's the approach
that will yield the best long term compatibility. However, you can,
if necessary, pass a pointer in from user space as a scalar
parameter, create a memory descriptor from that pointer (make sure
you use a routine that takes a "withTask" parameter, so you can
specify the address space for the memory), and transfer data to that.
From your other posts it seems like you're working deep in the
kernel. If so, perhaps using I/O Kit for this is the wrong approach.
There may be a more appropriate mechanism for you to transfer data to
user space (sysctl, ioctl, a driver, copyin/out, and so on).
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.