aboutsummaryrefslogtreecommitdiff
path: root/include/apos/caps.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-11-12 16:41:36 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-11-12 16:41:36 +0200
commit41ead8de77963bae907375c1bb115dad3315f46b (patch)
tree4b364db137bd3bea69853f15329292af7662897d /include/apos/caps.h
parent1d37792fb7a47135f0e7b7fc245e83bb1d8fc496 (diff)
downloadkmi-41ead8de77963bae907375c1bb115dad3315f46b.tar.gz
kmi-41ead8de77963bae907375c1bb115dad3315f46b.zip
initial rpc implementations
Diffstat (limited to 'include/apos/caps.h')
-rw-r--r--include/apos/caps.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/apos/caps.h b/include/apos/caps.h
index e8ef76b..be64663 100644
--- a/include/apos/caps.h
+++ b/include/apos/caps.h
@@ -6,6 +6,9 @@
* Capabilities of threads.
* \todo The list of capabilities should maybe be placed in some other file so
* as to easier extract it into userspace programs.
+ *
+ * @todo is it realistic to assume we will never need more than 32 capabilities?
+ * If so, we can remove the offset nonsense.
*/
#include <apos/bits.h>
@@ -22,6 +25,9 @@ enum {
/** Thread is allowed to force interrupt to callback in other thread. */
CAP_CALL = (1 << 2),
+
+ /** Thread is allowed to shut down system. */
+ CAP_POWER = (1 << 3),
};
/**
@@ -67,4 +73,13 @@ enum {
*/
#define get_caps(x, o) (x)
+/**
+ * Check if something has capability.
+ *
+ * @param x Capabilities to check in.
+ * @param c Capability to check for.
+ * @return \ref true if \p x has \p c, \ref false otherwise.
+ */
+#define has_cap(x, c) (x & c)
+
#endif /* APOS_CAPS_H */