L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
kobject
1// vi:set ft=cpp: -*- Mode: C++ -*-
2/* \file
3 * Kobject C++ interface.
4 */
5/*
6 * Copyright (C) 2015-2017, 2019, 2021, 2023-2024 Kernkonzept GmbH.
7 * Author(s): Alexander Warg <alexander.warg@kernkonzept.com>
8 *
9 * License: see LICENSE.spdx (in this directory or the directories above)
10 */
11#pragma once
12
13#include "kernel_object.h"
14#include "types.h"
15#include "__typeinfo.h"
16
17namespace L4 {
18
37{
38private:
39 Kobject();
40 Kobject(Kobject const &);
41 Kobject &operator = (Kobject const &);
42
43 template<typename T> friend struct Kobject_typeid;
44
45protected:
46 typedef Typeid::Iface<L4_PROTO_META, Kobject> __Iface;
47 typedef Typeid::Iface_list<__Iface> __Iface_list;
48
55 struct __Kobject_typeid
56 {
57 typedef Type_info::Demand_t<> Demand;
58 static Type_info const _m;
59 };
60
69 l4_cap_idx_t cap() const noexcept { return _c(); }
70
71private:
72
77 l4_cap_idx_t _c() const noexcept
78 { return reinterpret_cast<l4_cap_idx_t>(this) & L4_CAP_MASK; }
79
80public:
101 { return l4_kobject_dec_refcnt_u(cap(), diff, utcb); }
102};
103
104template<typename Derived, long PROTO = L4::PROTO_ANY,
105 typename S_DEMAND = Type_info::Demand_t<> >
106struct Kobject_0t : Kobject_t<Derived, L4::Kobject, PROTO, S_DEMAND> {};
107
108}
109
Type information handling.
Base class for all kinds of kernel objects and remote objects, referenced by capabilities.
Definition kobject:37
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition kobject:69
l4_msgtag_t dec_refcnt(l4_mword_t diff, l4_utcb_t *utcb=l4_utcb())
Decrement the in kernel reference counter for the object.
Definition kobject:100
signed long l4_mword_t
Signed machine word.
Definition l4int.h:37
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:155
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:210
Kernel object system calls.
Common L4 ABI Data Types.
L4 low-level kernel interface.
@ PROTO_ANY
Default protocol used by Kobject_t and Kobject_x.
Definition __typeinfo.h:47
Meta object for handling access to type information of Kobjects.
Definition __typeinfo.h:611
Template type statically describing demand of receive buffers.
Definition __typeinfo.h:554
Dynamic Type Information for L4Re Interfaces.
Definition __typeinfo.h:500
Message tag data structure.
Definition types.h:153