Loading...
Searching...
No Matches
L4Re Namespace Reference

L4Re C++ Interfaces. More...

## Namespaces

namespace | Vfs
| Virtual file system for interfaces in POSIX libc.
namespace | Util
| Documentation of the L4 Runtime Environment utility functionality in C++.

## Data Structures

class | Cap_alloc
| Capability allocator interface. 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 | Console
| Console class. More...
class | Dataspace
| Interface for memory-like objects. More...
class | Debug_obj
| Debug interface. More...
class | Dma_space
| Managed DMA Address Space. More...
class | Env
| C++ interface of the initial environment that is provided to an L4 task. More...
class | Event
| Event class. More...
struct | Default_event_payload
| Default event stream payload. More...
class | Event_buffer_t
| Event buffer class. More...
class | Inhibitor
| Set of inhibitor locks, which inhibit specific actions when held. More...
class | Itas
| Interface to the ITAS. More...
class | Log
| Log interface class. More...
class | Mem_alloc
| Memory allocation interface. More...
struct | Mmio_space
| Interface for memory-like address space accessible via IPC. More...
class | Namespace
| Name-space interface. More...
class | Parent
| Parent interface. More...
struct | Random
| Low-bandwidth interface for random number generators. More...
class | Rm
| Region map. 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

void | throw_error (long err, char const *extra="")
| Generate C++ exception.
long | chksys (long err, char const *extra="", long ret=0)
| Generate C++ exception on error.
long | chksys (l4_msgtag_t const &t, char const *extra="", l4_utcb_t *utcb=l4_utcb(), long ret=0)
| Generate C++ exception on error.
long | chksys (l4_msgtag_t const &t, l4_utcb_t *utcb, char const *extra="")
| Generate C++ exception on error.
template<typename T>
T | chkcap (T &&cap, char const *extra="", long err=-L4_ENOMEM)
| Check for valid capability or raise C++ exception.
l4_msgtag_t | chkipc (l4_msgtag_t tag, char const *extra="", l4_utcb_t *utcb=l4_utcb())
| Test a message tag for IPC errors.
template<typename T>
Shared_cap< T > | make_shared_cap (L4Re::Cap_alloc *ca)
| Allocate a capability slot and wrap it in a Shared_cap.
template<typename T>
Shared_del_cap< T > | make_shared_del_cap (L4Re::Cap_alloc *ca)
| Allocate a capability slot and wrap it in a Shared_del_cap.
template<typename T>
Unique_cap< T > | make_unique_cap (L4Re::Cap_alloc *ca)
| Allocate a capability slot and wrap it in an Unique_cap.
template<typename T>
Unique_del_cap< T > | make_unique_del_cap (L4Re::Cap_alloc *ca)
| Allocate a capability slot and wrap it in an Unique_del_cap.

## Detailed Description

L4Re C++ Interfaces.

L4 Runtime Environment.

## Typedef Documentation

## Shared_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Shared_cap.

Definition at line 33 of file shared_cap.

## shared_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Shared_cap.

Definition at line 36 of file shared_cap.

## Shared_del_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Shared_del_cap.

Definition at line 69 of file shared_cap.

## shared_del_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Shared_del_cap.

Definition at line 72 of file shared_cap.

## Unique_cap

template<typename T>

using L4Re::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 Parameters

  T | Type of the object the capability refers to.

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

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Unique_cap.

Definition at line 31 of file unique_cap.

## unique_cap

template<typename T>

using L4Re::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 Parameters

  T | Type of the object the capability refers to.

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

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Unique_cap.

Definition at line 34 of file unique_cap.

## Unique_del_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Unique_del_cap.

Definition at line 64 of file unique_cap.

## unique_del_cap

template<typename T>

using L4Re::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 Parameters

  T | Type 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.

Note
  This type is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::Unique_del_cap.

Definition at line 67 of file unique_cap.

## Function Documentation

## chkcap()

template<typename T>

T L4Re::chkcap | ( | T && | cap,
|  | char const * | extra = "",
|  | long | err = -L4_ENOMEM )

inline

Check for valid capability or raise C++ exception.

Template Parameters

  T | Type of object to check, must be capability-like (L4::Cap, L4Re::Util::Unique_cap etc.)

Parameters

  cap | Capability value to check.
  extra | Optional text for exception.
  err | Error value for exception or 0 if the error code stored in the invalid capability should be used.

This function checks whether the capability is valid. If the capability is invalid, a C++ exception is generated, using err if err is not zero, otherwise the capability value is used. A valid capability will just be returned.

Definition at line 149 of file error_helper.

References L4_ENOMEM, L4_UNLIKELY, and throw_error().

Referenced by L4virtio::Svr::Dev_config::Dev_config(), L4virtio::Driver::Device::driver_connect(), L4virtio::Svr::Console::Device::register_single_driver_irq(), L4virtio::Svr::Virtio_gpio< Request_handler, Epiface >::register_single_driver_irq(), L4virtio::Svr::Virtio_i2c< Request_handler, Epiface >::register_single_driver_irq(), L4virtio::Svr::Virtio_rng< Rnd_state, Epiface >::register_single_driver_irq(), Virtio_net::register_single_driver_irq(), L4virtio::Driver::Block_device::setup_device(), and L4virtio::Driver::Virtio_net_device::setup_device().

Here is the call graph for this function:
Here is the caller graph for this function:

## chkipc()

l4_msgtag_t L4Re::chkipc | ( | l4_msgtag_t | tag,
|  | char const * | extra = "",
|  | l4_utcb_t * | utcb = l4_utcb() )

inline

Test a message tag for IPC errors.

Parameters

  tag | Message tag returned by the IPC.
  extra | Exception message in case of error.
  utcb | The UTCB used in the IPC operation.

Returns
  On IPC error an exception is thrown, otherwise tag is returned.

Exceptions

  L4::Runtime_exception | with the translated IPC error code

This function does not check the message tag's label value.

Note
  This must be called on a message tag before the UTCB is changed.

Definition at line 180 of file error_helper.

References chksys(), l4_msgtag_t::has_error(), and L4_UNLIKELY.

Here is the call graph for this function:

## chksys() [1/3]

long L4Re::chksys | ( | l4_msgtag_t const & | t,
|  | char const * | extra = "",
|  | l4_utcb_t * | utcb = l4_utcb(),
|  | long | ret = 0 )

inline

Generate C++ exception on error.

Parameters

  t | Message tag.
  extra | Optional text for exception (default "")
  utcb | Option UTCB
  ret | Optional value for exception, default is error value (err)

This function throws an exception if the message tag contains an error or the label in the message tag is negative. Otherwise the label in the message tag is returned.

Definition at line 93 of file error_helper.

References l4_msgtag_t::has_error(), L4_UNLIKELY, l4_msgtag_t::label(), and throw_error().

Here is the call graph for this function:

## chksys() [2/3]

long L4Re::chksys | ( | l4_msgtag_t const & | t,
|  | l4_utcb_t * | utcb,
|  | char const * | extra = "" )

inline

Generate C++ exception on error.

Parameters

  t | Message tag.
  utcb | UTCB.
  extra | Optional text for exception (default "")

This function throws an exception if the message tag contains an error or the label in the message tag is negative. Otherwise the label in the message tag is returned.

Definition at line 116 of file error_helper.

References chksys().

Here is the call graph for this function:

## chksys() [3/3]

long L4Re::chksys | ( | long | err,
|  | char const * | extra = "",
|  | long | ret = 0 )

inline

Generate C++ exception on error.

Parameters

  err | Error value, if negative exception will be thrown
  extra | Optional text for exception (default "")
  ret | Optional value for exception, default is error value (err)

This function throws an exception if the err is negative and otherwise returns err.

Examples
  examples/libs/l4re/c++/shared_ds/ds_srv.cc.

Definition at line 72 of file error_helper.

References L4_UNLIKELY, and throw_error().

Referenced by L4virtio::Svr::Driver_mem_list_t< No_custom_data >::add(), chkipc(), chksys(), L4virtio::Svr::Dev_config::Dev_config(), L4virtio::Svr::Device_t< No_custom_data >::device_notify_irq(), L4virtio::Svr::Device_t< No_custom_data >::device_notify_irq(), L4virtio::Driver::Device::driver_acknowledge(), L4virtio::Driver::Device::driver_connect(), L4virtio::Svr::Driver_mem_region_t< No_custom_data >::Driver_mem_region_t(), L4virtio::Driver::Block_device::process_used_queue(), L4virtio::Svr::Device_t< No_custom_data >::register_driver_irq(), L4virtio::Svr::Console::Device::register_single_driver_irq(), L4virtio::Svr::Device_t< No_custom_data >::register_single_driver_irq(), L4virtio::Svr::Virtio_gpio< Request_handler, Epiface >::register_single_driver_irq(), L4virtio::Svr::Virtio_i2c< Request_handler, Epiface >::register_single_driver_irq(), L4virtio::Svr::Virtio_rng< Rnd_state, Epiface >::register_single_driver_irq(), Virtio_net::register_single_driver_irq(), L4virtio::Svr::Driver_mem_list_t< No_custom_data >::remove(), L4virtio::Driver::Block_device::setup_device(), L4virtio::Driver::Virtio_net_device::setup_device(), L4virtio::Svr::Console::Virtio_con::Virtio_con(), and L4virtio::Driver::Virtio_net_device::wait_rx().

Here is the call graph for this function:
Here is the caller graph for this function:

## make_shared_cap()

template<typename T>

Shared_cap< T > L4Re::make_shared_cap | ( | L4Re::Cap_alloc * | ca | ) |

Allocate a capability slot and wrap it in a Shared_cap.

Template Parameters

  T | Type of the object the capability refers to.

Parameters

  ca | Capability allocator to use.

Note
  This function is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::make_shared_cap<T>().

Definition at line 49 of file shared_cap.

References L4Re::Cap_alloc::alloc().

Here is the call graph for this function:

## make_shared_del_cap()

template<typename T>

Shared_del_cap< T > L4Re::make_shared_del_cap | ( | L4Re::Cap_alloc * | ca | ) |

Allocate a capability slot and wrap it in a Shared_del_cap.

Template Parameters

  T | Type of the object the capability refers to.

Parameters

  ca | Capability allocator to use.

Note
  This function is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::make_shared_del_cap<T>().

Definition at line 85 of file shared_cap.

References L4Re::Cap_alloc::alloc().

Here is the call graph for this function:

## make_unique_cap()

template<typename T>

Unique_cap< T > L4Re::make_unique_cap | ( | L4Re::Cap_alloc * | ca | ) |

Allocate a capability slot and wrap it in an Unique_cap.

Template Parameters

  T | Type of the object the capability refers to.

Parameters

  ca | Capability allocator to use.

Note
  This function is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::make_unique_cap<T>().

Definition at line 47 of file unique_cap.

References L4Re::Cap_alloc::alloc().

Here is the call graph for this function:

## make_unique_del_cap()

template<typename T>

Unique_del_cap< T > L4Re::make_unique_del_cap | ( | L4Re::Cap_alloc * | ca | ) |

Allocate a capability slot and wrap it in an Unique_del_cap.

Template Parameters

  T | Type of the object the capability refers to.

Parameters

  ca | Capability allocator to use.

Note
  This function is intended for users who implement a custom capability allocator; otherwise use L4Re::Util::make_unique_del_cap<T>().

Definition at line 80 of file unique_cap.

References L4Re::Cap_alloc::alloc().

Here is the call graph for this function:

## throw_error()

void L4Re::throw_error | ( | long | err,
|  | char const * | extra = "" )

inline

Generate C++ exception.

Parameters

  err | Error value
  extra | Optional text for exception (default "")

This function throws an L4 exception. The exact exception type depends on the error value (err). This function does never return.

Examples
  examples/libs/l4re/c++/shared_ds/ds_srv.cc.

Definition at line 37 of file error_helper.

References L4_EEXIST, L4_ENOENT, L4_ENOMEM, and L4_ERANGE.

Referenced by chkcap(), chksys(), and chksys().

Here is the caller graph for this function: