1/*
2 * Copyright (c) 2002, Intel Corporation. All rights reserved.
3 * Created by:  rolla.n.selbak 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 that pthread_attr_init()
9 * Upon successful completion, pthread_attr_init() shall return a value of 0.
10
11 * Steps:
12 * 1.  Initialize a pthread_attr_t object using pthread_attr_init()
13 * 2.  ENOMEM is the only error it returns, so if it doesn't return that error,
14 *     the return number should be 0.
15 */
16
17#include <pthread.h>
18#include <stdio.h>
19#include <errno.h>
20#include "posixtest.h"
21
22int main()
23{
24	pthread_attr_t new_attr;
25	int ret;
26
27	/* Initialize attribute */
28	ret=pthread_attr_init(&new_attr);
29	if(ret == 0)
30	{
31		printf("Test PASSED\n");
32		return PTS_PASS;
33	}
34	/* There's insufficient memory, can't run test */
35	else if(ret == ENOMEM)
36	{
37		perror("Error in pthread_attr_init()\n");
38		return PTS_UNRESOLVED;
39	}
40
41	/* Any other return value other than 0 or ENOMEM, means the test
42	 * failed, because those are the only 2 return values for this
43	 * function. */
44	else
45	{
46		printf("Test FAILED\n");
47		return PTS_FAIL;
48	}
49
50}
51