Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Macros | |
#define | K_THREAD_ACCESS_GRANT(name_, ...) |
Grant a static thread access to a list of kernel objects. More... | |
#define | K_OBJ_FLAG_INITIALIZED BIT(0) |
#define | K_OBJ_FLAG_PUBLIC BIT(1) |
#define | K_OBJ_FLAG_ALLOC BIT(2) |
#define | K_OBJ_FLAG_DRIVER BIT(3) |
Functions | |
void | k_object_access_grant (const void *object, struct k_thread *thread) |
void | k_object_access_revoke (const void *object, struct k_thread *thread) |
void | k_object_release (const void *object) |
Release an object. More... | |
void | k_object_access_all_grant (const void *object) |
void * | k_object_alloc (enum k_objects otype) |
static void | k_object_free (void *obj) |
Free an object. More... | |
#define K_OBJ_FLAG_ALLOC BIT(2) |
#include <include/sys/kobject.h>
Object allocated
#define K_OBJ_FLAG_DRIVER BIT(3) |
#include <include/sys/kobject.h>
Driver Object
#define K_OBJ_FLAG_INITIALIZED BIT(0) |
#include <include/sys/kobject.h>
Object initialized
#define K_OBJ_FLAG_PUBLIC BIT(1) |
#include <include/sys/kobject.h>
Object is Public
#define K_THREAD_ACCESS_GRANT | ( | name_, | |
... | |||
) |
#include <include/sys/kobject.h>
Grant a static thread access to a list of kernel objects.
For threads declared with K_THREAD_DEFINE(), grant the thread access to a set of kernel objects. These objects do not need to be in an initialized state. The permissions will be granted when the threads are initialized in the early boot sequence.
All arguments beyond the first must be pointers to kernel objects.
name_ | Name of the thread, as passed to K_THREAD_DEFINE() |
#include <include/sys/kobject.h>
Grant all present and future threads access to an object
If the caller is from supervisor mode, or the caller is from user mode and have sufficient permissions on the object, then that object will have permissions granted to it for all current and future threads running in the system, effectively becoming a public kernel object.
Use of this API should be avoided on systems that are running untrusted code as it is possible for such code to derive the addresses of kernel objects and perform unwanted operations on them.
It is not possible to revoke permissions on public objects; once public, any thread may use it.
object | Address of kernel object |
#include <include/sys/kobject.h>
Grant a thread access to a kernel object
The thread will be granted access to the object if the caller is from supervisor mode, or the caller is from user mode AND has permissions on both the object and the thread whose access is being granted.
object | Address of kernel object |
thread | Thread to grant access to the object |
#include <include/sys/kobject.h>
Revoke a thread's access to a kernel object
The thread will lose access to the object if the caller is from supervisor mode, or the caller is from user mode AND has permissions on both the object and the thread whose access is being revoked.
object | Address of kernel object |
thread | Thread to remove access to the object |
#include <include/sys/kobject.h>
Allocate a kernel object of a designated type
This will instantiate at runtime a kernel object of the specified type, returning a pointer to it. The object will be returned in an uninitialized state, with the calling thread being granted permission on it. The memory for the object will be allocated out of the calling thread's resource pool.
Currently, allocation of thread stacks is not supported.
otype | Requested kernel object type |
#include <include/sys/kobject.h>
Release an object.
Allows user threads to drop their own permission on an object Their permissions are automatically cleared when a thread terminates.
object | The object to be released |