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 that pthread_mutexattr_getprotocol()
9 *
10 * Gets the protocol attribute of a mutexattr object (which was prev. created
11 * by the function pthread_mutexattr_init()).
12 *
13 * Steps:
14 * 1.  Initialize a pthread_mutexattr_t object with pthread_mutexattr_init()
15 * 2.  Call pthread_mutexattr_getprotocol() to obtain the protocol.
16 *
17 */
18
19#include <pthread.h>
20#include <stdio.h>
21#include <sched.h>
22#include "posixtest.h"
23
24int main()
25{
26
27	pthread_mutexattr_t mta;
28	int protocol,rc;
29
30	/* Initialize a mutex attributes object */
31	if(pthread_mutexattr_init(&mta) != 0)
32	{
33		perror("Error at pthread_mutexattr_init()\n");
34		return PTS_UNRESOLVED;
35	}
36
37	/* Get the protocol mutex attr. */
38	if((rc=pthread_mutexattr_getprotocol(&mta, &protocol)) != 0)
39	{
40		printf("Test FAILED: Error in pthread_mutexattr_getprotocol rc=%d\n", rc);
41		return PTS_FAIL;
42	}
43
44	printf("Test PASSED\n");
45	return PTS_PASS;
46}
47