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

L4Re C++ Interfaces. More...

Namespaces

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

Data Structures

class  Cap_alloc
 Capability allocator interface. More...
 
class  Console
 Console class. More...
 
class  Dataspace
 Interface for memory-like objects. More...
 
class  Debug_obj
 Debug interface. More...
 
struct  Default_event_payload
 Default event stream payload. 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...
 
class  Event_buffer_t
 Event buffer class. More...
 
class  Inhibitor
 Set of inhibitor locks, which inhibit specific actions when held. 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...
 
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...
 

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

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

Definition at line 44 of file shared_cap.

◆ shared_cap

template<typename T >
using L4Re::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.

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

Definition at line 47 of file shared_cap.

◆ Shared_del_cap

template<typename T >
using L4Re::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.

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

Definition at line 80 of file shared_cap.

◆ shared_del_cap

template<typename T >
using L4Re::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.

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

Definition at line 83 of file shared_cap.

◆ Unique_cap

template<typename T >
using L4Re::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.

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

Definition at line 42 of file unique_cap.

◆ unique_cap

template<typename T >
using L4Re::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.

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

Definition at line 45 of file unique_cap.

◆ Unique_del_cap

template<typename T >
using L4Re::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.

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

Definition at line 75 of file unique_cap.

◆ unique_del_cap

template<typename T >
using L4Re::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.

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

Definition at line 78 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
TType of object to check, must be capability-like (L4::Cap, L4Re::Util::Unique_cap etc.)
Parameters
capCapability value to check.
extraOptional text for exception.
errError value for exception or 0 if the capability value should be used.

This function checks whether the capability is valid. If the capability is invalid an 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 145 of file error_helper.

References L4_UNLIKELY, and throw_error().

Referenced by L4virtio::Svr::Dev_config::Dev_config(), L4virtio::Driver::Device::driver_connect(), L4virtio::Driver::Virtio_net_device::setup_device(), and L4virtio::Driver::Block_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
tagMessage tag returned by the IPC.
extraException message in case of error.
utcbThe UTCB used in the IPC operation.
Returns
On IPC error an exception is thrown, otherwise tag is returned.
Exceptions
L4::Runtime_exceptionwith 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 176 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
tMessage tag.
extraOptional text for exception (default "")
utcbOption UTCB
retOptional 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 89 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
tMessage tag.
utcbUTCB.
extraOptional 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 112 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
errError value, if negative exception will be thrown
extraOptional text for exception (default "")
retOptional value for exception, default is error value (err)

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

Definition at line 68 of file error_helper.

References L4_UNLIKELY, and throw_error().

Referenced by L4virtio::Svr::Driver_mem_list_t< DATA >::add(), chkipc(), chksys(), L4virtio::Svr::Dev_config::Dev_config(), L4virtio::Svr::Device_t< DATA >::device_notify_irq(), L4virtio::Svr::Device_t< DATA >::device_notify_irq(), L4virtio::Driver::Device::driver_acknowledge(), L4virtio::Driver::Device::driver_connect(), L4virtio::Svr::Driver_mem_region_t< DATA >::Driver_mem_region_t(), L4virtio::Driver::Block_device::process_used_queue(), L4virtio::Svr::Device_t< DATA >::register_driver_irq(), L4virtio::Svr::Device_t< DATA >::register_single_driver_irq(), L4virtio::Svr::Driver_mem_list_t< DATA >::remove(), L4virtio::Driver::Virtio_net_device::setup_device(), L4virtio::Driver::Block_device::setup_device(), 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
TType of the object the capability refers to.
Parameters
caCapability 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 60 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
TType of the object the capability refers to.
Parameters
caCapability 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 96 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
TType of the object the capability refers to.
Parameters
caCapability 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 58 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
TType of the object the capability refers to.
Parameters
caCapability 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 91 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
errError value
extraOptional 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.

Definition at line 45 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: