minix system call pls help for project

hey i managed to create a new system call.
i want to give 1 argument which is a structure like this mysystemcall(&structure);
next my system call makes some calculations and creates a new same type structure which now has the results.
how can i return that structure in my main.c where i call my system call back to the original structure argument i gave.
i tried a lot but i couldnt find a solution... i tried sys_datacopy() but when i try to printf the structure in my main.c i only get zeros..
the main purpose here is to call the system call with an argument that will put the results there and printf them in main.c.
pls someone help and thnx a lot..

My first question is why you (feel that you) have to copy the structure, and then pass it back.
Where are you copying the structure to?

The method I would recommend is to pass in a structure that can hold both the input and the output content [possibly by storing the output values in the input values].

But if you REALLY have to pass back a different structure, then you (probably) need to allocate space in the kernel code, then make sure that memory can be accessed by the current process, and finally pass that struct back - either by passing in a pointer to a pointer to be filled in, or by passing the pointer back as a result from the function.

A third alternative is to pass in two arguments, one with the (pointer to the) source structure, another with the pointer to destination structure.

--
Mats

Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.