thr_attr_setschedparam.c revision 55708
1251881Speter/*
2251881Speter * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
3251881Speter * All rights reserved.
4251881Speter *
5251881Speter * Redistribution and use in source and binary forms, with or without
6251881Speter * modification, are permitted provided that the following conditions
7251881Speter * are met:
8251881Speter * 1. Redistributions of source code must retain the above copyright
9251881Speter *    notice, this list of conditions and the following disclaimer.
10251881Speter * 2. Redistributions in binary form must reproduce the above copyright
11251881Speter *    notice, this list of conditions and the following disclaimer in the
12251881Speter *    documentation and/or other materials provided with the distribution.
13251881Speter * 3. All advertising materials mentioning features or use of this software
14251881Speter *    must display the following acknowledgement:
15251881Speter *	This product includes software developed by Daniel Eischen.
16251881Speter * 4. Neither the name of the author nor the names of any co-contributors
17251881Speter *    may be used to endorse or promote products derived from this software
18251881Speter *    without specific prior written permission.
19251881Speter *
20251881Speter * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
21251881Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22251881Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23251881Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24251881Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25251881Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26251881Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27251881Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28251881Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29251881Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30251881Speter * SUCH DAMAGE.
31251881Speter *
32251881Speter * $FreeBSD: head/lib/libkse/thread/thr_attr_setschedparam.c 55708 2000-01-10 04:14:08Z deischen $
33251881Speter */
34251881Speter#include <errno.h>
35251881Speter#ifdef _THREAD_SAFE
36251881Speter#include <pthread.h>
37251881Speter#include "pthread_private.h"
38251881Speter
39251881Speterint
40251881Speterpthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
41251881Speter{
42251881Speter	int ret = 0;
43251881Speter
44251881Speter	if ((attr == NULL) || (*attr == NULL) || (param == NULL))
45251881Speter		ret = EINVAL;
46251881Speter	else
47251881Speter		(*attr)->prio = param->sched_priority;
48251881Speter
49251881Speter	return(ret);
50251881Speter}
51251881Speter#endif
52251881Speter