sys_datacopy in Minix

I'm writing a program that must log all the kernel calls existing in Minix. I recall that Minix is a microkernel OS.

I've a user process that pass a char* that points to a buffer memory to the kernel level. In the kernel level I get all the information, and now, I would like to copy the info to the buffer passed by the user. How can I do that?

Since kernel and user process are in different address space, I use the sys_datacopy function that should do it.

The problem is that, in the user level, that buffer prints me (null).

the function that I use is:

sys_datacopy(SELF,
(vir_bytes) buf,
who, /* <---- I suppose that this in points to the user process number */
(vir_bytes) m_in.m1_p1);

m_in is a structure of type message, a structure that Minix uses to pass info from the kernel to the user level and otherwise.

m1_p1 is a char* variable.

You can find it more info about the structure in ipc.h.

Thanks,
Pedro

I think that this problem is the who variable. I'm passing the MM constant. Maybe I must get the process number of my user program.

Thanks,
Pedro