Client/Server example showing how to map a page to another task – Server implementation. Note that there's also a shared memory library that supplies this functionality in more convenient way.
#include <stdio.h>
#include <l4/re/util/object_registry>
#include "shared.h"
{
public:
};
int
{
ios >> t;
if (t.label() != Mapper::Protocol)
ios >> opcode;
switch (opcode)
{
case Mapper::Do_map:
ios >> snd_base;
snprintf(page_to_map, sizeof(page_to_map), "Hello from the server!");
printf("Sending to client\n");
default:
}
}
int
main()
{
static Smap_server smap;
if (!server.
registry()->register_obj(&smap,
"smap").is_valid())
{
printf("Could not register my service, read-only namespace?\n");
return 1;
}
printf("Welcome to the memory map example server!\n");
return 0;
}