userspace: improve dynamic object allocation
We now have a low-level function z_dynamic_object_create() which is not a system call and is used for installing kernel objects that are not supported by k_object_alloc(). Checking for valid object type enumeration values moved completely to the implementation function. A few debug messages and comments were improved. Futexes and sys_mutexes are now properly excluded from dynamic generation. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
9f63a0a0a0
commit
be919d3bf7
4 changed files with 100 additions and 35 deletions
|
@ -352,6 +352,27 @@ void k_object_access_all_grant(void *object);
|
|||
__syscall void *k_object_alloc(enum k_objects otype);
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_OBJECTS
|
||||
/**
|
||||
* Allocate memory and install as a generic kernel object
|
||||
*
|
||||
* This is a low-level function to allocate some memory, and register that
|
||||
* allocated memory in the kernel object lookup tables with type K_OBJ_ANY.
|
||||
* Initialization state and thread permissions will be cleared. The
|
||||
* returned z_object's data value will be uninitialized.
|
||||
*
|
||||
* Most users will want to use k_object_alloc() instead.
|
||||
*
|
||||
* Memory allocated will be drawn from the calling thread's reasource pool
|
||||
* and may be freed later by passing the actual object pointer (found
|
||||
* in the returned z_object's 'name' member) to k_object_free().
|
||||
*
|
||||
* @param size Size of the allocated object
|
||||
* @return NULL on insufficient memory
|
||||
* @return A pointer to the associated z_object that is installed in the
|
||||
* kernel object tables
|
||||
*/
|
||||
struct z_object *z_dynamic_object_create(size_t size);
|
||||
|
||||
/**
|
||||
* Free a kernel object previously allocated with k_object_alloc()
|
||||
*
|
||||
|
@ -370,6 +391,14 @@ static inline void *z_impl_k_object_alloc(enum k_objects otype)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct z_object *z_dynamic_object_create(size_t size)
|
||||
{
|
||||
ARG_UNUSED(size);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Free an object
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue