L4Re - L4 Runtime Environment
unique_cap
Go to the documentation of this file.
1 // vim:set ft=cpp: -*- Mode: C++ -*-
6 /*
7  * (c) 2017 Alexander Warg <alexander.warg@kernkonzept.com>
8  *
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU General Public License 2.
11  * Please see the COPYING-GPL-2 file for details.
12  *
13  * As a special exception, you may use this file as part of a free software
14  * library without restriction. Specifically, if other files instantiate
15  * templates or use macros or inline functions from this file, or you compile
16  * this file and link it with other files to produce an executable, this
17  * file does not by itself cause the resulting executable to be covered by
18  * the GNU General Public License. This exception does not however
19  * invalidate any other reasons why the executable file might be covered by
20  * the GNU General Public License.
21  */
22 
23 #pragma once
24 
25 #include <l4/re/util/cap_alloc>
27 
28 namespace L4Re { namespace Util {
29 
53 template< typename T >
54 using Unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>;
56 template< typename T >
57 using unique_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_ALL_SPACES>>;
58 
64 template< typename T >
67 { return Unique_cap<T>(cap_alloc.alloc<T>()); }
68 
96 template< typename T >
97 using Unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>;
98 template< typename T >
100 using unique_del_cap = L4::Detail::Unique_cap_impl<T, Smart_cap_auto<L4_FP_DELETE_OBJ>>;
101 
107 template< typename T >
110 { return Unique_del_cap<T>(cap_alloc.alloc<T>()); }
111 
112 }}
113 
Unique_del_cap< T > make_unique_del_cap()
Allocate a capability slot and wrap it in an Unique_del_cap.
Definition: unique_cap:109
L4Re C++ Interfaces.
Definition: cmd_control:15
L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > > Unique_del_cap
Unique capability that implements automatic free and unmap+delete of the capability selector...
Definition: unique_cap:97
L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > > unique_cap
Unique capability that implements automatic free and unmap of the capability selector.
Definition: unique_cap:57
L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_ALL_SPACES > > Unique_cap
Unique capability that implements automatic free and unmap of the capability selector.
Definition: unique_cap:54
Unique_cap< T > make_unique_cap()
Allocate a capability slot and wrap it in an Unique_cap.
Definition: unique_cap:66
L4::Cap< void > alloc() noexcept
Allocate a new capability slot.
_Cap_alloc & cap_alloc
Capability allocator.
Capability allocator.
L4::Detail::Unique_cap_impl< T, Smart_cap_auto< L4_FP_DELETE_OBJ > > unique_del_cap
Unique capability that implements automatic free and unmap+delete of the capability selector...
Definition: unique_cap:100