thr_attr_getschedparam.c revision 53812
1193323Sed/*
2193323Sed * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
3193323Sed * All rights reserved.
4193323Sed *
5193323Sed * Redistribution and use in source and binary forms, with or without
6193323Sed * modification, are permitted provided that the following conditions
7193323Sed * are met:
8193323Sed * 1. Redistributions of source code must retain the above copyright
9193323Sed *    notice, this list of conditions and the following disclaimer.
10193323Sed * 2. Redistributions in binary form must reproduce the above copyright
11193323Sed *    notice, this list of conditions and the following disclaimer in the
12193323Sed *    documentation and/or other materials provided with the distribution.
13193323Sed * 3. All advertising materials mentioning features or use of this software
14193323Sed *    must display the following acknowledgement:
15193323Sed *	This product includes software developed by Daniel Eischen.
16193323Sed * 4. Neither the name of the author nor the names of any co-contributors
17193323Sed *    may be used to endorse or promote products derived from this software
18193323Sed *    without specific prior written permission.
19193323Sed *
20193323Sed * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
21193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23193323Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24193323Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30193323Sed * SUCH DAMAGE.
31193323Sed *
32193323Sed * $FreeBSD: head/lib/libkse/thread/thr_attr_getschedparam.c 53812 1999-11-28 05:38:13Z alfred $
33193323Sed */
34193323Sed#include <errno.h>
35202375Srdivacky#ifdef _THREAD_SAFE
36198396Srdivacky#include <pthread.h>
37193323Sed#include "pthread_private.h"
38193323Sed
39193323Sedint
40198396Srdivackypthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
41193323Sed{
42193323Sed	int ret = 0;
43202375Srdivacky
44193323Sed	if ((attr == NULL) || (*attr == NULL) || (param == NULL))
45193323Sed		ret = EINVAL;
46193323Sed	else
47193323Sed		param->sched_priority = (*attr)->prio;
48193323Sed
49193323Sed	return(ret);
50193323Sed}
51193323Sed#endif
52193323Sed