IPC stream magic

Adam Lackorzynski adam at os.inf.tu-dresden.de
Sat Apr 11 08:53:12 CEST 2015


On Thu Apr 09, 2015 at 19:46:20 -0400, teclis High Elf wrote:
> I have a complex nested structure that looks something like this:
> 
> typedef struct struct_A
> {
>   int i;
>   struct struct_B[5];
>   int j;
> }
> 
> using an IPC stream I do:
> 
> struct_A a;
> 
> ios.put(a);
> 
> and then in the server process I do:
> 
> struct_A b;
> 
> ios.get(b);
> 
> ( ios is a L4::Ipc::Iostream )
> 
> and magically my complex nested structure reappears with all the data
> intact in the server process running in another address space.
> 
> As the IPC Streams are not well documented would someone be able to explain
> to me how my complex nested structure got automatically marshalled in the
> client and unmarshalled in the server process?

That's the magic of templates. Using those, you know the type of a and b
inside put and get, and thus do an assignment into the UTCB or a memcpy,
or similar.



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/



More information about the l4-hackers mailing list