kernel: do not export z_thread_priority_set

This function is only being used by a test, so instead of reimplementing
a syscall in the test, provide a Kconfig option to provide the
functionality that only works with tests and remove some of the
duplication and extra code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2024-02-24 10:37:06 -05:00
commit 5e591c38f1
6 changed files with 17 additions and 40 deletions

View file

@ -25,3 +25,4 @@ CONFIG_USERSPACE=y
# Disable time slicing
CONFIG_TIMESLICING=n
CONFIG_USERSPACE_THREAD_MAY_RAISE_PRIORITY=y

View file

@ -78,29 +78,6 @@ K_PIPE_DEFINE(PIPE_BIGBUFF, 4096, 4);
* Custom syscalls
*/
/**
* @brief Change a thread's priority
*
* Unlike the normal k_thread_priority_set(), this custom syscall allows
* a user thread to raise its priority.
*/
void z_impl_test_thread_priority_set(k_tid_t thread, int prio)
{
extern void z_thread_priority_set(struct k_thread *thread, int prio);
z_thread_priority_set((struct k_thread *)thread, prio);
}
#ifdef CONFIG_USERSPACE
static void z_vrfy_test_thread_priority_set(k_tid_t thread, int prio)
{
z_impl_test_thread_priority_set(thread, prio);
}
#include <syscalls/test_thread_priority_set_mrsh.c>
#endif
/**
* @brief Obtain a timestamp
*

View file

@ -115,7 +115,7 @@ void pipe_test(void)
PRINT_STRING("| "
"non-matching sizes (1_TO_N) to lower priority"
" |\n");
test_thread_priority_set(k_current_get(), TaskPrio - 2);
k_thread_priority_set(k_current_get(), TaskPrio - 2);
}
PRINT_STRING(dashline);
PRINT_1_TO_N_HEADER();
@ -136,7 +136,7 @@ void pipe_test(void)
PRINT_1_TO_N();
}
PRINT_STRING(dashline);
test_thread_priority_set(k_current_get(), TaskPrio);
k_thread_priority_set(k_current_get(), TaskPrio);
}
}