Client/Server example showing how to map a page to another task – Client implementation.
Client/Server example showing how to map a page to another task – Client implementation. Note that there's also a shared memory library that supplies this functionality in more convenient way.
#include <stdio.h>
#include "shared.h"
static int
{
int err;
{
printf("The reservation of one page within our virtual memory failed with %d\n", err);
return 1;
}
if (r)
return r;
printf("String sent by server: %s\n", (char *)addr);
return 0;
}
int
main()
{
{
printf("Could not get capability slot!\n");
return 1;
}
printf("Asking for page from server\n");
if (func_smap_call(server))
{
printf("Error talking to server\n");
return 1;
}
printf("It worked!\n");
return 0;
}
static Env const * env() noexcept
Returns the initial environment for the current task.
L4::Cap< T > get_cap(char const *name, unsigned l) const noexcept
Get the capability selector for the object named name.
l4_cap_idx_t cap() const noexcept
Return capability selector.
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
C++ interface for capabilities.
Input/Output stream for IPC [un]marshalling.
l4_msgtag_t call(l4_cap_idx_t dst, l4_timeout_t timeout, long proto=0)
Do an IPC call using the message in the output stream and receive the reply in the input stream.
unsigned long l4_addr_t
Address type.
long l4_error(l4_msgtag_t tag) L4_NOTHROW
Get IPC error code if any or message tag label otherwise for an IPC call.
#define L4_PAGESIZE
Minimal page size (in bytes).
#define L4_PAGESHIFT
Size of a page, log2-based.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
_Cap_alloc & cap_alloc
Capability allocator.
Common L4 ABI Data Types.
int Opcode
Data type for RPC opcodes.
@ Search_addr
Search for a suitable address range.