kernel: add k_thread_access_grant()

This is a runtime counterpart to K_THREAD_ACCESS_GRANT().
This function takes a thread and a NULL-terminated list of kernel
objects and runs k_object_access_grant() on each of them.
This function doesn't require any special permissions and doesn't
need to become a system call.

__attribute__((sentinel)) added to warn users if they omit the
required NULL termination.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-10-17 11:38:26 -07:00 committed by Andrew Boie
commit e12857aabf
2 changed files with 35 additions and 0 deletions

View file

@ -615,6 +615,22 @@ extern FUNC_NORETURN void k_thread_user_mode_enter(k_thread_entry_t entry,
void *p1, void *p2,
void *p3);
/**
* @brief Grant a thread access to a NULL-terminated set of kernel objects
*
* This is a convenience function. For the provided thread, grant access to
* the remaining arguments, which must be pointers to kernel objects.
* The final argument must be a NULL.
*
* The thread object must be initialized (i.e. running). The objects don't
* need to be.
*
* @param thread Thread to grant access to objects
* @param ... NULL-terminated list of kernel object pointers
*/
extern void __attribute__((sentinel))
k_thread_access_grant(struct k_thread *thread, ...);
/**
* @brief Put the current thread to sleep.
*