1 /* 2 * Copyright (c) 2002, Intel Corporation. All rights reserved. 3 * This file is licensed under the GPL license. For the full content 4 * of this license, see the COPYING file at the top level of this 5 * source tree. 6 * 7 * pthread_barrierattr_getpshared() 8 * 9 * The pthread_barrierattr_getpshared( ) function shall obtain the value of 10 * the process-shared attribute from the attributes object referenced by attr. 11 * 12 */ 13 14 15 #define _XOPEN_SOURCE 600 16 #include <pthread.h> 17 #include <stdio.h> 18 #include <stdlib.h> 19 #include <unistd.h> 20 #include <signal.h> 21 #include <errno.h> 22 #include <string.h> 23 #include "posixtest.h" 24 main()25int main() 26 { 27 int rc; 28 pthread_barrierattr_t ba; 29 int pshared; 30 31 /* Initialize the barrier attribute object */ 32 rc = pthread_barrierattr_init(&ba); 33 if(rc != 0) 34 { 35 printf("Error while initialize attribute object\n"); 36 return PTS_UNRESOLVED; 37 } 38 39 /* Get pshared */ 40 if(pthread_barrierattr_getpshared(&ba, &pshared) != 0) 41 { 42 printf("Error at pthread_barrierattr_getpshared()\n"); 43 return PTS_FAIL; 44 } 45 46 if(pshared != PTHREAD_PROCESS_PRIVATE) 47 { 48 printf("The process shared attribute was not set to " 49 "default value of PTHREAD_PROCESS_PRIVATE\n"); 50 return PTS_UNRESOLVED; 51 } 52 53 /* Cleanup */ 54 rc = pthread_barrierattr_destroy(&ba); 55 if(rc != 0) 56 { 57 printf("Error at pthread_barrierattr_destroy() " 58 "return code: %d, %s", rc, strerror(rc)); 59 return PTS_UNRESOLVED; 60 } 61 62 printf("Test PASSED\n"); 63 return PTS_PASS; 64 } 65