MIG RPC from kext question
MIG RPC from kext question
- Subject: MIG RPC from kext question
- From: Marek Kozubal <email@hidden>
- Date: Fri, 26 Sep 2003 05:12:48 -0400 (EDT)
I am trying to use an INOUT parameter in a MIG RPC call from the kernel to
a user land application, unfortunately all my attempts just cause a kernel
panic to happen.
Here is basically what I'm doing (hopefully someone can tell me what I am
missing):
mig .defs file:
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
subsystem KernelUser foo_subsystemServer 1000;
type foo_array_t = array[] of uint8_t;
routine
foo_rpc(
server: mach_port_t;
inout io_foo_array: foo_array_t );
This produces a function that looks like:
mig_external kern_return_t foo_rpc(
mach_port_t server,
foo_array_t *io_foo_array,
mach_msg_type_number_t *io_foo_arrayCnt )
So my question is this, what sort of pointer needs to go into the RPC call
and what do I get in user land and what do I get back in return?
My goal is to send io_foo_array to the userland daemon which makes some
changes to some fields, and then sends it back to the kext I am running
in. I've had success w/fixed length in and out parameters, but this needs
to be variable length. Do I need to do some copyin/copyout stuff? some
vm_map_copyin type stuff? Should I be useing a pointer_t mach type
instead?
Currently I am doing the following:
MALLOC(
foo,
caddr_t,
len,
M_TEMP,
M_WAITOK );
/* do some stuff that puts useful data into foo */
foo_rpc(
server,
(foo_array_t *)foo,
(mach_msg_type_number_t *)&len );
but this just kernal panics deep within the mach message sending code
either with an unhandled exception (bad memory access I think) or trying
to unmap unmappable memory.
So whats the right way to do this, and do I need to do any copyin/copyout
type stuff in the user land client either? Do I need to change this to
having 2 buffers with a seperate IN and OUT buffer?
And for what its worth this is from a file system KEXT.
Thanks in advance!
---
Marek Kozubal
email@hidden
_______________________________________________
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.