31template<
unsigned Num_caps>
32class Reply_cap_alloc final :
public L4::Reply_cap_alloc
35 static constexpr unsigned Capacity = Num_caps;
37 explicit Reply_cap_alloc(
unsigned bias) noexcept
41 L4::Reply_cap
alloc() noexcept
override
43 if (
long slot = _alloc.alloc(); slot >= 0) [[likely]]
46 return L4::Reply_cap(L4::Reply_cap_idx(idx),
this);
49 return L4::Reply_cap();
53 void free(L4::Reply_cap_idx cap)
noexcept override
58 Item_alloc<Capacity> _alloc;
61using Def_reply_cap_alloc = Reply_cap_alloc<CONFIG_L4RE_CAP_DFL_ALLOCATOR_MAX>;
86template<
unsigned long Unmap_flags = L4_FP_ALL_SPACES >
117template<
unsigned long Unmap_flags = L4_FP_ALL_SPACES >
183template<
typename T >
224template<
typename T >
235template<
typename T >
236typename Ref_cap<T>::Cap
244template<
typename T >
245typename Ref_del_cap<T>::Cap
247{
return typename Ref_del_cap<T>::Cap(
cap_alloc.alloc<T>()); }
Capability allocator implementation.
Helper for Unique_cap and Unique_del_cap.
static void invalidate(L4::Cap_base &c)
Invalidate the provided capability.
static void free(L4::Cap_base &c)
Free the provided capability.
Helper for Ref_cap and Ref_del_cap.
static L4::Cap_base copy(L4::Cap_base const &src)
Copy operation for L4::Smart_cap (increment ref count).
static void free(L4::Cap_base &c) noexcept
Free operation for L4::Smart_cap (decrement ref count and delete if 0).
static void invalidate(L4::Cap_base &c) noexcept
Invalidate operation for L4::Smart_cap.
Adapter to expose the cap allocator implementation as L4Re::Cap_alloc compatible class.
Base class for all kinds of capabilities.
void invalidate() noexcept
Set this capability to invalid (L4_INVALID_CAP).
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.
virtual Reply_cap alloc() noexcept=0
Allocate new reply capability slot.
unsigned long l4_cap_idx_t
Capability selector type.
#define L4_CAP_SHIFT
Capability index shift.
Def_reply_cap_alloc reply_cap_alloc
Reply capability allocator.
_Cap_alloc cap_alloc
Capability allocator.
Ref_del_cap< T >::Cap make_ref_del_cap()
Allocate a capability slot and wrap it in a Ref_del_cap.
Ref_cap< T >::Cap make_ref_cap()
Allocate a capability slot and wrap it in a Ref_cap.
Documentation of the L4 Runtime Environment utility functionality in C++.
Automatic capability that implements automatic free and unmap of the capability selector.
Automatic capability that implements automatic free and unmap+delete of the capability selector.
Common task related definitions.