thr_attr_setstackaddr.c revision 71581
11592Srgrimes/* 21592Srgrimes * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. 31592Srgrimes * All rights reserved. 41592Srgrimes * 51592Srgrimes * Redistribution and use in source and binary forms, with or without 61592Srgrimes * modification, are permitted provided that the following conditions 71592Srgrimes * are met: 81592Srgrimes * 1. Redistributions of source code must retain the above copyright 91592Srgrimes * notice, this list of conditions and the following disclaimer. 101592Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111592Srgrimes * notice, this list of conditions and the following disclaimer in the 121592Srgrimes * documentation and/or other materials provided with the distribution. 131592Srgrimes * 3. All advertising materials mentioning features or use of this software 141592Srgrimes * must display the following acknowledgement: 151592Srgrimes * This product includes software developed by John Birrell. 161592Srgrimes * 4. Neither the name of the author nor the names of any co-contributors 171592Srgrimes * may be used to endorse or promote products derived from this software 181592Srgrimes * without specific prior written permission. 191592Srgrimes * 201592Srgrimes * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 21262435Sbrueffer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221592Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231592Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 241592Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251592Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261592Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271592Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281592Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291592Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301592Srgrimes * SUCH DAMAGE. 311592Srgrimes * 321592Srgrimes * $FreeBSD: head/lib/libkse/thread/thr_attr_setstackaddr.c 71581 2001-01-24 13:03:38Z deischen $ 331592Srgrimes */ 341592Srgrimes#include <errno.h> 351592Srgrimes#include <pthread.h> 361592Srgrimes#include "pthread_private.h" 3727074Ssteve 381592Srgrimes#pragma weak pthread_attr_setstackaddr=_pthread_attr_setstackaddr 3927074Ssteve 401592Srgrimesint 411592Srgrimes_pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) 421592Srgrimes{ 431592Srgrimes int ret; 4431386Scharnier 4527077Ssteve /* Check for invalid arguments: */ 4631386Scharnier if (attr == NULL || *attr == NULL || stackaddr == NULL) 4731386Scharnier ret = EINVAL; 4850476Speter else { 491592Srgrimes /* Save the stack address: */ 501592Srgrimes (*attr)->stackaddr_attr = stackaddr; 511592Srgrimes ret = 0; 521592Srgrimes } 53129652Sstefanf return(ret); 541592Srgrimes} 551592Srgrimes