1/*
2 *  This program is free software; you can redistribute it and/or modify
3 *  it under the terms of the GNU General Public License version 2.
4 *
5 *  This program is distributed in the hope that it will be useful,
6 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
7 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8 *  GNU General Public License for more details.
9 *
10 *
11 * Test that the priority remain unchanged when the sched_ss_max_repl is lower
12 * than 1.
13 *
14 * @pt:SS
15 */
16#include <sched.h>
17#include <stdio.h>
18#include <unistd.h>
19#include "posixtest.h"
20
21#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1)
22
23int main(void)
24{
25	int old_priority;
26	struct sched_param param;
27
28	if (sched_getparam(0, &param) == -1) {
29		perror("An error occurs when calling sched_getparam()");
30		return PTS_UNRESOLVED;
31	}
32	old_priority = param.sched_priority;
33
34	param.sched_ss_max_repl = 0;
35	param.sched_priority++;
36	sched_setparam(0, &param);
37
38	if (sched_getparam(0, &param) != 0) {
39		perror("An error occurs when calling sched_getparam()");
40		return PTS_UNRESOLVED;
41	}
42
43	if (param.sched_priority == old_priority) {
44		printf("Test PASSED\n");
45		return PTS_PASS;
46	} else {
47		printf("The priority have changed.\n");
48		return PTS_FAIL;
49	}
50
51}
52
53#else
54int main(void)
55{
56	printf("Does not support SS (SPORADIC SERVER)\n");
57	return PTS_UNSUPPORTED;
58}
59
60#endif
61