1 |
|
|
/* $OpenBSD: sched_prio.c,v 1.1 2011/11/06 12:15:51 guenther Exp $ */ |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
* Copyright (c) 2010 Federico G. Schwindt <fgsch@openbsd.org> |
5 |
|
|
* |
6 |
|
|
* Permission to use, copy, modify, and distribute this software for |
7 |
|
|
* any purpose with or without fee is hereby granted, provided that |
8 |
|
|
* the above copyright notice and this permission notice appear in all |
9 |
|
|
* copies. |
10 |
|
|
* |
11 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
12 |
|
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
13 |
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
14 |
|
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
15 |
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA |
16 |
|
|
* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
17 |
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
18 |
|
|
* PERFORMANCE OF THIS SOFTWARE. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#include <pthread.h> |
22 |
|
|
#include <errno.h> |
23 |
|
|
#include "rthread.h" |
24 |
|
|
|
25 |
|
|
int |
26 |
|
|
sched_get_priority_max(int policy) |
27 |
|
|
{ |
28 |
|
|
if (policy < SCHED_FIFO || policy > SCHED_RR) { |
29 |
|
|
errno = EINVAL; |
30 |
|
|
return (-1); |
31 |
|
|
} |
32 |
|
|
return (PTHREAD_MAX_PRIORITY); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
int |
36 |
|
|
sched_get_priority_min(int policy) |
37 |
|
|
{ |
38 |
|
|
if (policy < SCHED_FIFO || policy > SCHED_RR) { |
39 |
|
|
errno = EINVAL; |
40 |
|
|
return (-1); |
41 |
|
|
} |
42 |
|
|
return (PTHREAD_MIN_PRIORITY); |
43 |
|
|
} |
44 |
|
|
|