zephyr/lib/posix/sched.c
Christopher Friedt 4fcf197c50 posix: rename some files for brevity
Most of the posix source files can be easily identified by a
short name. I.e. most of the `pthread_` prefixed files do not
need the `pthread_` prefix.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-06 11:47:07 -04:00

44 lines
805 B
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "pthread_sched.h"
#include <zephyr/kernel.h>
#include <zephyr/posix/sched.h>
/**
* @brief Get minimum priority value for a given policy
*
* See IEEE 1003.1
*/
int sched_get_priority_min(int policy)
{
if (!valid_posix_policy(policy)) {
errno = EINVAL;
return -1;
}
return 0;
}
/**
* @brief Get maximum priority value for a given policy
*
* See IEEE 1003.1
*/
int sched_get_priority_max(int policy)
{
if (IS_ENABLED(CONFIG_COOP_ENABLED) && policy == SCHED_FIFO) {
return CONFIG_NUM_COOP_PRIORITIES - 1;
} else if (IS_ENABLED(CONFIG_PREEMPT_ENABLED) &&
(policy == SCHED_RR || policy == SCHED_OTHER)) {
return CONFIG_NUM_PREEMPT_PRIORITIES - 1;
}
errno = EINVAL;
return -1;
}