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 * The policies symbols shall have unique value 12 * I try to test every symbol in a loop. 13 */ 14#include <stdio.h> 15#include <string.h> 16#include <sched.h> 17#include <unistd.h> 18#include "posixtest.h" 19 20struct unique { 21 int value; 22 char *name; 23} sym[] = { 24 25 { 26 SCHED_FIFO, "SCHED_FIFO" 27 }, 28 { 29 SCHED_RR, "SCHED_RR" 30 }, 31#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER) 32 { 33 SCHED_SPORADIC,"SCHED_SPORADIC" 34 }, 35#endif 36 { 37 SCHED_OTHER, "SCHED_OTHER" 38 }, 39 { 40 0, 0 41 } 42}; 43 44int main() 45{ 46 struct unique *tst; 47 int i, ret = PTS_PASS; 48 tst = sym; 49 50 while (tst->name) { 51 for (i = 0; sym[i].name; i++) { 52 if (tst->value == sym[i].value 53 && strcmp(tst->name, sym[i].name)) { 54 printf("%s has a duplicate value with %s\n", 55 tst->name, sym[i].name); 56 ret = PTS_FAIL; 57 } 58 } 59 tst++; 60 } 61 return ret; 62} 63