thr_attr_getschedparam.c revision 50476
1218885Sdim/*
2218885Sdim * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
3218885Sdim * All rights reserved.
4218885Sdim *
5218885Sdim * Redistribution and use in source and binary forms, with or without
6218885Sdim * modification, are permitted provided that the following conditions
7218885Sdim * are met:
8218885Sdim * 1. Redistributions of source code must retain the above copyright
9218885Sdim *    notice, this list of conditions and the following disclaimer.
10218885Sdim * 2. Redistributions in binary form must reproduce the above copyright
11218885Sdim *    notice, this list of conditions and the following disclaimer in the
12218885Sdim *    documentation and/or other materials provided with the distribution.
13218885Sdim * 3. All advertising materials mentioning features or use of this software
14218885Sdim *    must display the following acknowledgement:
15218885Sdim *	This product includes software developed by Daniel Eischen.
16218885Sdim * 4. Neither the name of the author nor the names of any co-contributors
17218885Sdim *    may be used to endorse or promote products derived from this software
18218885Sdim *    without specific prior written permission.
19218885Sdim *
20218885Sdim * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
21218885Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22218885Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23218885Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24218885Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25218885Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26218885Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27218885Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28218885Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29218885Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30218885Sdim * SUCH DAMAGE.
31218885Sdim *
32218885Sdim * $FreeBSD: head/lib/libkse/thread/thr_attr_getschedparam.c 50476 1999-08-28 00:22:10Z peter $
33218885Sdim */
34234353Sdim#include <errno.h>
35234353Sdim#ifdef _THREAD_SAFE
36234353Sdim#include <pthread.h>
37234353Sdim#include "pthread_private.h"
38218885Sdim
39218885Sdimint
40218885Sdimpthread_attr_getschedparam(pthread_attr_t *attr, struct sched_param *param)
41218885Sdim{
42218885Sdim	int ret = 0;
43218885Sdim
44218885Sdim	if ((attr == NULL) || (*attr == NULL) || (param == NULL))
45218885Sdim		ret = EINVAL;
46218885Sdim	else
47218885Sdim		param->sched_priority = (*attr)->prio;
48218885Sdim
49218885Sdim	return(ret);
50218885Sdim}
51218885Sdim#endif
52218885Sdim