L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Util Namespace Reference

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

Data Structures

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...
 
struct  Counter_atomic
 Thread safe version of counter for Counting_cap_alloc. 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_svr
 Convenience wrapper for implementing an event server. 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 Unique_cap and Unique_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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Functions

template<typename T >
Ref_cap< T >::Cap make_ref_cap ()
 Allocate a capability slot and wrap it in a Ref_cap.
 
template<typename T >
Ref_del_cap< T >::Cap make_ref_del_cap ()
 Allocate a capability slot and wrap it in a Ref_del_cap.
 
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()) noexcept
 Allocate state area.
 
template<typename T >
Shared_cap< T > make_shared_cap ()
 Allocate a capability slot and wrap it in a Shared_cap.
 
template<typename T >
Shared_del_cap< T > make_shared_del_cap ()
 Allocate a capability slot and wrap it in a Shared_del_cap.
 
template<typename T >
Unique_cap< T > make_unique_cap ()
 Allocate a capability slot and wrap it in an Unique_cap.
 
template<typename T >
Unique_del_cap< T > make_unique_del_cap ()
 Allocate a capability slot and wrap it in an Unique_del_cap.
 

Variables

_Cap_alloc & cap_alloc
 Capability allocator.
 

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 = L4Re::Util::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 = L4Re::Util::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.

References cap_alloc.

◆ 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.

References cap_alloc.

◆ 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.

References cap_alloc.

◆ 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.

References cap_alloc.