1 /* 2 * Copyright (c) 2004, Intel Corporation. All rights reserved. 3 * Created by: crystal.xiong REMOVE-THIS AT intel DOT com 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 8 * Test pthread_attr_setinheritsched() 9 * 10 * Steps: 11 * 1. Initialize a pthread_attr_t object using pthread_attr_init() 12 * 2. Call pthread_attr_setinheritsched with unsupported inheritsched 13 * parameter 14 * 15 */ 16 17 #include <pthread.h> 18 #include <stdio.h> 19 #include <stdlib.h> 20 #include <errno.h> 21 #include "posixtest.h" 22 23 #define TEST "4-1" 24 #define FUNCTION "pthread_attr_setinheritsched" 25 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " 26 27 #define INVALIDSCHED 999 28 29 int main(void) 30 { 31 int rc = 0; 32 pthread_attr_t attr; 33 34 rc = pthread_attr_init(&attr); 35 if (rc != 0) { 36 perror(ERROR_PREFIX "pthread_attr_init"); 37 exit(PTS_UNRESOLVED); 38 } 39 40 rc = pthread_attr_setinheritsched(&attr, INVALIDSCHED); 41 if ((rc != EINVAL)) { 42 perror(ERROR_PREFIX "pthread_attr_setinheritsched"); 43 exit(PTS_FAIL); 44 } 45 rc = pthread_attr_destroy(&attr); 46 if (rc != 0) { 47 perror(ERROR_PREFIX "pthread_attr_destroy"); 48 exit(PTS_UNRESOLVED); 49 } 50 printf("Test PASSED\n"); 51 return PTS_PASS; 52 } 53