12c28215423293e443469a07ae7011135d058b671Garrett Cooper/*
20dc076565f772bb1953209fb69ea150b494aaa40robbiew *  This program is free software; you can redistribute it and/or modify
30dc076565f772bb1953209fb69ea150b494aaa40robbiew *  it under the terms of the GNU General Public License version 2.
40dc076565f772bb1953209fb69ea150b494aaa40robbiew *
50dc076565f772bb1953209fb69ea150b494aaa40robbiew *  This program is distributed in the hope that it will be useful,
60dc076565f772bb1953209fb69ea150b494aaa40robbiew *  but WITHOUT ANY WARRANTY; without even the implied warranty of
70dc076565f772bb1953209fb69ea150b494aaa40robbiew *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80dc076565f772bb1953209fb69ea150b494aaa40robbiew *  GNU General Public License for more details.
90dc076565f772bb1953209fb69ea150b494aaa40robbiew *
100dc076565f772bb1953209fb69ea150b494aaa40robbiew *
110dc076565f772bb1953209fb69ea150b494aaa40robbiew * Test that sched_get_priority_max() returns the maximum value on
120dc076565f772bb1953209fb69ea150b494aaa40robbiew * success for SCHED_RR policy.
130dc076565f772bb1953209fb69ea150b494aaa40robbiew */
140dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdio.h>
150dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <sched.h>
160dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <errno.h>
170dc076565f772bb1953209fb69ea150b494aaa40robbiew#include "posixtest.h"
180dc076565f772bb1953209fb69ea150b494aaa40robbiew
194ca2bbdcd3003f3c8df4e6129e9c7b2bd1514f87Cyril Hrubisint main(void)
202c28215423293e443469a07ae7011135d058b671Garrett Cooper{
210dc076565f772bb1953209fb69ea150b494aaa40robbiew	int result = -1;
222c28215423293e443469a07ae7011135d058b671Garrett Cooper
230dc076565f772bb1953209fb69ea150b494aaa40robbiew	result = sched_get_priority_max(SCHED_RR);
242c28215423293e443469a07ae7011135d058b671Garrett Cooper
258fb1cdb0538640f295691929650408688537fb7fGarrett Cooper	if (result != -1 && errno == 0) {
260dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("The maximum priority for policy SCHED_RR is %i.\n",
270dc076565f772bb1953209fb69ea150b494aaa40robbiew		       result);
280dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("Test PASSED\n");
290dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_PASS;
300dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
312c28215423293e443469a07ae7011135d058b671Garrett Cooper
329ca9633cb75c407a81b98673891982b2e0702b29Cyril Hrubis	perror("An error occurs");
339ca9633cb75c407a81b98673891982b2e0702b29Cyril Hrubis	return PTS_FAIL;
34ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman}
35