1-3.c revision 4ca2bbdcd3003f3c8df4e6129e9c7b2bd1514f87
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 sched_get_priority_max() returns the maximum value on
12 * success for SCHED_SPORADIC policy.
13 */
14#include <stdio.h>
15#include <sched.h>
16#include <errno.h>
17#include <unistd.h>
18#include "posixtest.h"
19
20#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1)||defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1)
21
22int main(void)
23{
24	int result = -1;
25
26	result = sched_get_priority_max(SCHED_SPORADIC);
27
28	if (result != -1 && errno == 0) {
29		printf
30		    ("The maximum priority for policy SCHED_SPORADIC is %i.\n",
31		     result);
32		printf("Test PASSED\n");
33		return PTS_PASS;
34	} else {
35		perror("An error occurs");
36		return PTS_FAIL;
37	}
38
39	printf("This code should not be executed.\n");
40	return PTS_UNRESOLVED;
41}
42#else
43int main(void)
44{
45	printf("Does not support SS (SPORADIC SERVER)\n");
46	return PTS_UNSUPPORTED;
47}
48#endif
49