1/* 2 * Copyright (c) 2002, Intel Corporation. All rights reserved. 3 * Created by: bing.wei.liu 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_mutexattr_destroy() 9 * If it fails, an error number shall be returned to indicate the error: 10 * [EINVAL] The value specified by 'attr' is invalid 11 * 12 * Steps: 13 * Try to destroy a NULL mutex attributes object using pthread_mutexattr_destroy(). 14 * If it returns EINVAL, the test passes. 15 * 16 */ 17 18#include <pthread.h> 19#include <stdio.h> 20#include <errno.h> 21#include "posixtest.h" 22 23 24int main() 25{ 26 pthread_mutexattr_t *mta=NULL; 27 int rc; 28 29 /* Try to destroy a NULL mutex attributes object using pthread_mutexattr_destroy() 30 * It should return EINVAL */ 31 if((rc=pthread_mutexattr_destroy(mta)) == EINVAL) 32 { 33 printf("Test PASSED\n"); 34 return PTS_PASS; 35 } 36 else 37 { 38 printf("Test PASSED: *NOTE: Expect %d(EINVAL), but return %d, though standard states 'may' fail\n", EINVAL, rc); 39 return PTS_PASS; 40 } 41} 42 43 44