1-1.c revision ec6edca7aa42b6affd989ef91b5897f96795e40f
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 190dc076565f772bb1953209fb69ea150b494aaa40robbiewint main(int argc, char **argv) 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 } else { 310dc076565f772bb1953209fb69ea150b494aaa40robbiew perror("An error occurs"); 320dc076565f772bb1953209fb69ea150b494aaa40robbiew return PTS_FAIL; 330dc076565f772bb1953209fb69ea150b494aaa40robbiew } 342c28215423293e443469a07ae7011135d058b671Garrett Cooper 350dc076565f772bb1953209fb69ea150b494aaa40robbiew printf("This code should not be executed.\n"); 360dc076565f772bb1953209fb69ea150b494aaa40robbiew return PTS_UNRESOLVED; 37ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman} 38