L4Re - L4 Runtime Environment
L4Re::Util Namespace Reference

Documentation of the L4 Runtime Environment utility functionality in C++. More...

Data Structures

struct  Auto_cap
 Automatic capability that implements automatic free and unmap of the capability selector. More...
 
struct  Auto_del_cap
 Automatic capability that implements automatic free and unmap+delete of the capability selector. More...
 
class  Br_manager
 Buffer-register (BR) manager for L4::Server. More...
 
struct  Br_manager_hooks
 Predefined server-loop hooks for a server loop using the Br_manager. More...
 
struct  Br_manager_timeout_hooks
 Predefined server-loop hooks for a server with using the Br_manager and a timeout queue. More...
 
class  Cap_alloc_base
 Capability allocator. More...
 
struct  Counter
 Counter for Counting_cap_alloc with variable data width. More...
 
class  Counting_cap_alloc
 Internal reference-counting cap allocator. More...
 
class  Dataspace_svr
 Dataspace server class. More...
 
class  Event_buffer_consumer_t
 An event buffer consumer. More...
 
class  Event_buffer_t
 Event_buffer utility class. More...
 
class  Event_t
 Convenience wrapper for getting access to an event object. More...
 
class  Item_alloc_base
 Item allocator. More...
 
class  Object_registry
 A registry that manages server objects and their attached IPC gates for a single server loop for a specific thread. More...
 
struct  Ref_cap
 Automatic capability that implements automatic free and unmap of the capability selector. More...
 
struct  Ref_del_cap
 Automatic capability that implements automatic free and unmap+delete of the capability selector. More...
 
class  Registry_server
 A server loop object which has a Object_registry included. More...
 
class  Smart_cap_auto
 Helper for Auto_cap and Auto_del_cap. More...
 
class  Smart_count_cap
 Helper for Ref_cap and Ref_del_cap. More...
 
class  Vcon_svr
 Console server template class. More...
 

Typedefs

template<typename T >
using Shared_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_ALL_SPACES > >
 Shared capability that implements automatic free and unmap of the capability selector. More...
 
template<typename T >
using shared_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_ALL_SPACES > >
 Shared capability that implements automatic free and unmap of the capability selector. More...
 
template<typename T >
using Shared_del_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_DELETE_OBJ > >
 Shared capability that implements automatic free and unmap+delete of the capability selector. More...
 
template<typename T >
using shared_del_cap = L4::Detail::Shared_cap_impl< T, Smart_count_cap< L4_FP_DELETE_OBJ > >
 Shared capability that implements automatic free and unmap+delete of the capability selector. More...
 
template<typename T >
using Unique_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > >
 Unique capability that implements automatic free and unmap of the capability selector. More...
 
template<typename T >
using unique_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > >
 Unique capability that implements automatic free and unmap of the capability selector. More...
 
template<typename T >
using Unique_del_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > >
 Unique capability that implements automatic free and unmap+delete of the capability selector. More...
 
template<typename T >
using unique_del_cap = L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > >
 Unique capability that implements automatic free and unmap+delete of the capability selector. More...
 

Functions

template<typename T >
Auto_cap< T >::Cap make_auto_cap ()
 Allocate a capability slot and wrap it in an Auto_cap. More...
 
template<typename T >
Auto_del_cap< T >::Cap make_auto_del_cap ()
 Allocate a capability slot and wrap it in an Auto_del_cap. More...
 
template<typename T >
Ref_cap< T >::Cap make_ref_cap ()
 Allocate a capability slot and wrap it in a Ref_cap. More...
 
template<typename T >
Ref_del_cap< T >::Cap make_ref_del_cap ()
 Allocate a capability slot and wrap it in a Ref_del_cap. More...
 
int kumem_alloc (l4_addr_t *mem, unsigned pages_order, L4::Cap< L4::Task > task=L4Re::Env::env() ->task(), L4::Cap< L4Re::Rm > rm=L4Re::Env::env() ->rm()) throw ()
 Allocate state area. More...
 
template<typename T >
Shared_cap< T > make_shared_cap ()
 Allocate a capability slot and wrap it in a Shared_cap. More...
 
template<typename T >
Shared_del_cap< T > make_shared_del_cap ()
 Allocate a capability slot and wrap it in a Shared_del_cap. More...
 
template<typename T >
Unique_cap< T > make_unique_cap ()
 Allocate a capability slot and wrap it in an Unique_cap. More...
 
template<typename T >
Unique_del_cap< T > make_unique_del_cap ()
 Allocate a capability slot and wrap it in an Unique_del_cap. More...
 

Variables

_Cap_alloccap_alloc
 Capability allocator. More...
 

Detailed Description

Documentation of the L4 Runtime Environment utility functionality in C++.

Typedef Documentation

◆ Shared_cap

template<typename T >
using L4Re::Util::Shared_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES> >

Shared capability that implements automatic free and unmap of the capability selector.

Template Parameters
TType of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.

Usage:

L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap;

{
  L4Re::Util::Shared_cap<L4Re::Dataspace>
    ds_cap = make_shared_cap<L4Re::Dataspace>();
  // reference count for the allocated cap selector is now 1

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

  global_ds_cap = ds_cap;
  // reference count is now 2
  ...
}
// reference count dropped to 1 (ds_cap is no longer existing).

Definition at line 59 of file shared_cap.

◆ shared_cap

template<typename T >
using L4Re::Util::shared_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_ALL_SPACES> >

Shared capability that implements automatic free and unmap of the capability selector.

Template Parameters
TType of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero.

Usage:

L4Re::Util::Shared_cap<L4Re::Dataspace> global_ds_cap;

{
  L4Re::Util::Shared_cap<L4Re::Dataspace>
    ds_cap = make_shared_cap<L4Re::Dataspace>();
  // reference count for the allocated cap selector is now 1

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

  global_ds_cap = ds_cap;
  // reference count is now 2
  ...
}
// reference count dropped to 1 (ds_cap is no longer existing).

Definition at line 62 of file shared_cap.

◆ Shared_del_cap

template<typename T >
using L4Re::Util::Shared_del_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ> >

Shared capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters
TType of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap;

{
  L4Re::Util::Shared_del_cap<L4Re::Dataspace>
    ds_cap = make_shared_del_cap<L4Re::Dataspace>();
  // reference count for the allocated cap selector is now 1

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

  global_ds_cap = ds_cap;
  // reference count is now 2
  ...
}
// reference count dropped to 1 (ds_cap is no longer existing).
...
global_ds_cap = L4_INVALID_CAP;
// reference count dropped to 0 (data space shall be deleted).

Definition at line 109 of file shared_cap.

◆ shared_del_cap

template<typename T >
using L4Re::Util::shared_del_cap = typedef L4::Detail::Shared_cap_impl<T, Smart_count_cap<L4_FP_DELETE_OBJ> >

Shared capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters
TType of the object the capability refers to.

This shared capability implements a counted reference to a capability selector. The capability shall be unmapped and freed when the reference count in the allocator goes to zero. The main difference to Shared_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

L4Re::Util::Shared_del_cap<L4Re::Dataspace> global_ds_cap;

{
  L4Re::Util::Shared_del_cap<L4Re::Dataspace>
    ds_cap = make_shared_del_cap<L4Re::Dataspace>();
  // reference count for the allocated cap selector is now 1

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(4096, ds_cap.get()));

  global_ds_cap = ds_cap;
  // reference count is now 2
  ...
}
// reference count dropped to 1 (ds_cap is no longer existing).
...
global_ds_cap = L4_INVALID_CAP;
// reference count dropped to 0 (data space shall be deleted).

Definition at line 112 of file shared_cap.

◆ Unique_cap

template<typename T >
using L4Re::Util::Unique_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES> >

Unique capability that implements automatic free and unmap of the capability selector.

Template Parameters
TType of the object the capability refers to.

The ownership of the capability is managed in the same way as unique_ptr.

Usage:

{
  L4Re::Util::Unique_cap<L4Re::Dataspace>
    ds_cap = make_unique_cap<L4Re::Dataspace>();

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

  ...

  // At the end of the scope ds_cap is unmapped and the capability
  // selector is freed.
}

Definition at line 54 of file unique_cap.

◆ unique_cap

template<typename T >
using L4Re::Util::unique_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES> >

Unique capability that implements automatic free and unmap of the capability selector.

Template Parameters
TType of the object the capability refers to.

The ownership of the capability is managed in the same way as unique_ptr.

Usage:

{
  L4Re::Util::Unique_cap<L4Re::Dataspace>
    ds_cap = make_unique_cap<L4Re::Dataspace>();

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

  ...

  // At the end of the scope ds_cap is unmapped and the capability
  // selector is freed.
}

Definition at line 57 of file unique_cap.

◆ Unique_del_cap

template<typename T >
using L4Re::Util::Unique_del_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ> >

Unique capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters
TType of the object the capability refers to.

The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

{
  L4Re::Util::Unique_del_cap<L4Re::Dataspace>
    ds_cap = make_unique_del_cap<L4Re::Dataspace>());

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

  ...

  // At the end of the scope ds_cap is unmapped and the capability
  // selector is freed. Because the deletion flag is set the data space
  // shall also be deleted (even if there are other references to this
  // data space).
}

Definition at line 97 of file unique_cap.

◆ unique_del_cap

template<typename T >
using L4Re::Util::unique_del_cap = typedef L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ> >

Unique capability that implements automatic free and unmap+delete of the capability selector.

Template Parameters
TType of the object the capability refers to.

The main difference to Unique_cap is that the unmap is done with the deletion flag enabled and this leads to the deletion of the object if the current task holds appropriate deletion rights.

Usage:

{
  L4Re::Util::Unique_del_cap<L4Re::Dataspace>
    ds_cap = make_unique_del_cap<L4Re::Dataspace>());

  // use the dataspace cap
  L4Re::chksys(mem_alloc->alloc(L4_PAGESIZE, ds_cap.get()));

  ...

  // At the end of the scope ds_cap is unmapped and the capability
  // selector is freed. Because the deletion flag is set the data space
  // shall also be deleted (even if there are other references to this
  // data space).
}

Definition at line 100 of file unique_cap.

Function Documentation

◆ make_shared_cap()

template<typename T >
Shared_cap<T> L4Re::Util::make_shared_cap ( )

Allocate a capability slot and wrap it in a Shared_cap.

Template Parameters
TType of the object the capability refers to.

Definition at line 71 of file shared_cap.

◆ make_shared_del_cap()

template<typename T >
Shared_del_cap<T> L4Re::Util::make_shared_del_cap ( )

Allocate a capability slot and wrap it in a Shared_del_cap.

Template Parameters
TType of the object the capability refers to.

Definition at line 121 of file shared_cap.

◆ make_unique_cap()

template<typename T >
Unique_cap<T> L4Re::Util::make_unique_cap ( )

Allocate a capability slot and wrap it in an Unique_cap.

Template Parameters
TType of the object the capability refers to.

Definition at line 66 of file unique_cap.

◆ make_unique_del_cap()

template<typename T >
Unique_del_cap<T> L4Re::Util::make_unique_del_cap ( )

Allocate a capability slot and wrap it in an Unique_del_cap.

Template Parameters
TType of the object the capability refers to.

Definition at line 109 of file unique_cap.