Introduction   API Reference   Examples   Index  

Examples

Attach / Detach Dataspaces

#include <l4/dm_mem/dm_mem.h>
#include <l4/l4rm/l4rm.h>

int  
main(void)
{
  l4dm_dataspace_t ds;
  void * addr;

  // allocate memory, see DMphys reference manual
  l4dm_mem_open(L4DM_DEFAULT_DSM,8192,0,0,"L4RM example",&ds);

  // attach dataspace to my address space
  l4rm_attach(&ds,8192,0,0,&addr);

  // do something with the meomry, it is attached to address addr 

  // detach dataspace 
  l4rm_detach(addr);

  // close dataspace
  l4dm_close(&ds);
}

L4 Region Mapper Reference Manual, written by Lars Reuther  © 2000-2003