thr_attr_getschedparam.c revision 285830
149884Ssheldonh/*
249884Ssheldonh * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
3139969Simp * All rights reserved.
449884Ssheldonh *
549884Ssheldonh * Redistribution and use in source and binary forms, with or without
649884Ssheldonh * modification, are permitted provided that the following conditions
749884Ssheldonh * are met:
849884Ssheldonh * 1. Redistributions of source code must retain the above copyright
91556Srgrimes *    notice, this list of conditions and the following disclaimer.
1049884Ssheldonh * 2. Redistributions in binary form must reproduce the above copyright
111556Srgrimes *    notice, this list of conditions and the following disclaimer in the
12218724Sjilles *    documentation and/or other materials provided with the distribution.
13218724Sjilles * 3. All advertising materials mentioning features or use of this software
14218724Sjilles *    must display the following acknowledgement:
15218724Sjilles *	This product includes software developed by Daniel Eischen.
161556Srgrimes * 4. Neither the name of the author nor the names of any co-contributors
1799110Sobrien *    may be used to endorse or promote products derived from this software
1899110Sobrien *    without specific prior written permission.
191556Srgrimes *
2049884Ssheldonh * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
211556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221556Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231556Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
241556Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251556Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2693345Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2776883Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2886619Sknu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291556Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301556Srgrimes * SUCH DAMAGE.
311556Srgrimes *
321556Srgrimes * $FreeBSD: releng/10.2/lib/libkse/thread/thr_attr_getschedparam.c 174689 2007-12-16 23:29:57Z deischen $
331556Srgrimes */
3486505Sknu
3586505Sknu#include "namespace.h"
3686505Sknu#include <errno.h>
3786618Sknu#include <pthread.h>
3888084Sache#include "un-namespace.h"
3988084Sache#include "thr_private.h"
4096376Salfred
4186618Sknu__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
4286618Sknu
4386618Sknuint
4486618Sknu_pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
4586618Sknu{
4686618Sknu	int ret = 0;
4786618Sknu
4886618Sknu	if ((attr == NULL) || (*attr == NULL) || (param == NULL))
4986618Sknu		ret = EINVAL;
5086618Sknu	else
5186618Sknu		param->sched_priority = (*attr)->prio;
5286618Sknu
5349884Ssheldonh	return(ret);
5449884Ssheldonh}
5549884Ssheldonh