Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
main.c File Reference
#include <zephyr.h>
#include <syscall_handler.h>
#include <ztest.h>
#include <kernel_internal.h>

Macros

#define SEM_ARRAY_SIZE   16
 

Functions

 K_SEM_DEFINE (sem1, 0, 1)
 
static int test_object (struct k_sem *sem, int retval)
 
void object_permission_checks (struct k_sem *sem, bool skip_init)
 
void test_generic_object (void)
 Test to verify object permission. More...
 
void test_kobj_assign_perms_on_alloc_obj (void)
 Test requestor thread will implicitly be assigned permission on the dynamically allocated object. More...
 
void test_no_ref_dyn_kobj_release_mem (void)
 Test dynamically allocated kernel object release memory. More...
 
void test_main (void)
 

Variables

struct k_sem sem1
 
static struct k_sem semarray [16]
 
static struct k_sem * dyn_sem [16]
 
static struct k_mutextest_dyn_mutex
 
static struct k_sem sem2
 
static char bad_sem [sizeof(struct k_sem)]
 
static struct k_sem sem3
 

Macro Definition Documentation

◆ SEM_ARRAY_SIZE

#define SEM_ARRAY_SIZE   16

Function Documentation

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( sem1  ,
,
 
)

◆ object_permission_checks()

void object_permission_checks ( struct k_sem *  sem,
bool  skip_init 
)

◆ test_generic_object()

void test_generic_object ( void  )

Test to verify object permission.

  • The kernel must be able to associate kernel object memory addresses with whether the calling thread has access to that object, the object is of the expected type, and the object is of the expected init state.
  • Test support freeing kernel objects allocated at runtime manually.
See also
k_object_alloc(), k_object_access_grant()

◆ test_kobj_assign_perms_on_alloc_obj()

void test_kobj_assign_perms_on_alloc_obj ( void  )

Test requestor thread will implicitly be assigned permission on the dynamically allocated object.

  • Create kernel object semaphore, dynamically allocate it from the calling thread's resource pool.
  • Check that object's address is in bounds of that memory pool.
  • Then check the requestor thread will implicitly be assigned permission on the allocated object by using semaphore API k_sem_init()
See also
k_object_alloc()

◆ test_main()

void test_main ( void  )

test case main entry

◆ test_no_ref_dyn_kobj_release_mem()

void test_no_ref_dyn_kobj_release_mem ( void  )

Test dynamically allocated kernel object release memory.

Dynamically allocated kernel objects whose access is controlled by the permission system will use object permission as a reference count. If no threads have access to an object, the object's memory released.

See also
k_object_alloc()

◆ test_object()

static int test_object ( struct k_sem *  sem,
int  retval 
)
static

Variable Documentation

◆ bad_sem

char bad_sem[sizeof(struct k_sem)]
static

◆ dyn_sem

struct k_sem* dyn_sem[16]
static

◆ sem1

struct k_sem sem1
extern

◆ sem2

struct k_sem sem2
static

◆ sem3

struct k_sem sem3
static

◆ semarray

struct k_sem semarray[16]
static

◆ test_dyn_mutex

struct k_mutex* test_dyn_mutex
static