thr_attr_setinheritsched.c revision 174112
16281Sda73024/* 26281Sda73024 * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>. 36281Sda73024 * All rights reserved. 46281Sda73024 * 56281Sda73024 * Redistribution and use in source and binary forms, with or without 66281Sda73024 * modification, are permitted provided that the following conditions 76281Sda73024 * are met: 86281Sda73024 * 1. Redistributions of source code must retain the above copyright 96281Sda73024 * notice, this list of conditions and the following disclaimer. 106281Sda73024 * 2. Redistributions in binary form must reproduce the above copyright 116281Sda73024 * notice, this list of conditions and the following disclaimer in the 126281Sda73024 * documentation and/or other materials provided with the distribution. 136281Sda73024 * 3. All advertising materials mentioning features or use of this software 146281Sda73024 * must display the following acknowledgement: 156281Sda73024 * This product includes software developed by Daniel Eischen. 166281Sda73024 * 4. Neither the name of the author nor the names of any co-contributors 176281Sda73024 * may be used to endorse or promote products derived from this software 186281Sda73024 * without specific prior written permission. 196281Sda73024 * 206281Sda73024 * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND 216281Sda73024 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 226281Sda73024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 236281Sda73024 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 246281Sda73024 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 256281Sda73024 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 266281Sda73024 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 276281Sda73024 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 286281Sda73024 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 296281Sda73024 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 306281Sda73024 * SUCH DAMAGE. 316281Sda73024 * 32 * $FreeBSD: head/lib/libkse/thread/thr_attr_setinheritsched.c 174112 2007-11-30 17:20:29Z deischen $ 33 */ 34 35#include "namespace.h" 36#include <errno.h> 37#include <pthread.h> 38#include "un-namespace.h" 39#include "thr_private.h" 40 41LT10_COMPAT_PRIVATE(_pthread_attr_setinheritsched); 42LT10_COMPAT_DEFAULT(pthread_attr_setinheritsched); 43 44__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched); 45 46int 47_pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit) 48{ 49 int ret = 0; 50 51 if ((attr == NULL) || (*attr == NULL)) 52 ret = EINVAL; 53 else if (sched_inherit != PTHREAD_INHERIT_SCHED && 54 sched_inherit != PTHREAD_EXPLICIT_SCHED) 55 ret = ENOTSUP; 56 else 57 (*attr)->sched_inherit = sched_inherit; 58 59 return(ret); 60} 61