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_getparam() returns 0 on success 12 */ 13#include <stdio.h> 14#include <sched.h> 15#include <errno.h> 16#include "posixtest.h" 17 18int main(int argc, char **argv) 19{ 20 21 struct sched_param param; 22 int result = -1; 23 24 param.sched_priority = -1; 25 26 result = sched_getparam(0, ¶m); 27 28 if(result == 0 && 29 param.sched_priority != -1 && 30 errno == 0) { 31 printf("Test PASSED\n"); 32 return PTS_PASS; 33 } 34 35 if(errno != 0 ) { 36 perror("Unexpected error"); 37 return PTS_FAIL; 38 } 39 40 if(result != 0) { 41 printf("returned code is not zero.\n"); 42 return PTS_FAIL; 43 } else { 44 perror("Unresolved test error"); 45 return PTS_UNRESOLVED; 46 } 47 48 printf("This code should not be executed.\n"); 49 return PTS_UNRESOLVED; 50} 51 52 53