L4Re - L4 Runtime Environment
ds_util.h
1 /*
2  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3  * economic rights: Technische Universit├Ąt Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  *
9  * As a special exception, you may use this file as part of a free software
10  * library without restriction. Specifically, if other files instantiate
11  * templates or use macros or inline functions from this file, or you compile
12  * this file and link it with other files to produce an executable, this
13  * file does not by itself cause the resulting executable to be covered by
14  * the GNU General Public License. This exception does not however
15  * invalidate any other reasons why the executable file might be covered by
16  * the GNU General Public License.
17  */
18 #pragma once
19 
20 #include <l4/sys/capability>
21 #include <l4/re/dataspace>
22 #include <l4/re/env>
23 // #include <l4/sys/kdebug.h>
24 
25 namespace L4Re { namespace Core {
26 
27 static
28 bool
29 release_ds(L4::Cap<L4Re::Dataspace> const &c)
30 {
31  int l = c.validate(L4Re::This_task).label();
32  // outstring("RELEASE CAP: "); outhex32(c.cap()); outstring(" ");
33  // outhex32(l); outstring("\n");
34  //printf("release_cap: %lx %d\n", c.cap(), l);
35  if (!l)
36  {
38  return true;
39  }
40 
41  return false;
42 }
43 
44 
45 }}
l4_msgtag_t validate(l4_utcb_t *u=l4_utcb()) const
Check whether a capability is present (refers to an object).
Definition: capability:87
L4Re C++ Interfaces.
Definition: cmd_control:15
L4::Cap related definitions.
long label() const
Get the protocol value.
Definition: types.h:163
Environment interface.
bool free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES)
Free the capability.
_Cap_alloc & cap_alloc
Capability allocator.
Dataspace interface.