thr_attr_setinheritsched.c revision 256281
122315Sjulian/* 222315Sjulian * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. 322315Sjulian * All rights reserved. 422315Sjulian * 522315Sjulian * Redistribution and use in source and binary forms, with or without 622315Sjulian * modification, are permitted provided that the following conditions 722315Sjulian * are met: 822315Sjulian * 1. Redistributions of source code must retain the above copyright 922315Sjulian * notice, this list of conditions and the following disclaimer. 1022315Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1122315Sjulian * notice, this list of conditions and the following disclaimer in the 1222315Sjulian * documentation and/or other materials provided with the distribution. 1322315Sjulian * 3. All advertising materials mentioning features or use of this software 1422315Sjulian * must display the following acknowledgement: 1522315Sjulian * This product includes software developed by Daniel Eischen. 1622315Sjulian * 4. Neither the name of the author nor the names of any co-contributors 1722315Sjulian * may be used to endorse or promote products derived from this software 1822315Sjulian * without specific prior written permission. 1922315Sjulian * 2022315Sjulian * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND 2122315Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2222315Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2349439Sdeischen * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2422315Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2522315Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2622315Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2722315Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2822315Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2922315Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3022315Sjulian * SUCH DAMAGE. 3122315Sjulian * 3249439Sdeischen * $FreeBSD: stable/10/lib/libkse/thread/thr_attr_setinheritsched.c 174689 2007-12-16 23:29:57Z deischen $ 3322315Sjulian */ 3422315Sjulian 3522315Sjulian#include "namespace.h" 3622315Sjulian#include <errno.h> 3722315Sjulian#include <pthread.h> 3822315Sjulian#include "un-namespace.h" 3922315Sjulian#include "thr_private.h" 4022315Sjulian 4122315Sjulian__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched); 4222315Sjulian 4322315Sjulianint 4422315Sjulian_pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit) 4522315Sjulian{ 4622315Sjulian int ret = 0; 4722315Sjulian 4822315Sjulian if ((attr == NULL) || (*attr == NULL)) 4931402Salex ret = EINVAL; 5022315Sjulian else if (sched_inherit != PTHREAD_INHERIT_SCHED && 5122315Sjulian sched_inherit != PTHREAD_EXPLICIT_SCHED) 5222315Sjulian ret = ENOTSUP; 5322315Sjulian else 5422315Sjulian (*attr)->sched_inherit = sched_inherit; 5522315Sjulian 5622315Sjulian return(ret); 5722315Sjulian} 5822315Sjulian