1181624Skmacy/* 2181624Skmacy * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. 3181624Skmacy * All rights reserved. 4181624Skmacy * 5181624Skmacy * Redistribution and use in source and binary forms, with or without 6181624Skmacy * modification, are permitted provided that the following conditions 7181624Skmacy * are met: 8181624Skmacy * 1. Redistributions of source code must retain the above copyright 9181624Skmacy * notice, this list of conditions and the following disclaimer. 10181624Skmacy * 2. Redistributions in binary form must reproduce the above copyright 11181624Skmacy * notice, this list of conditions and the following disclaimer in the 12181624Skmacy * documentation and/or other materials provided with the distribution. 13181624Skmacy * 3. Neither the name of the author nor the names of any co-contributors 14181624Skmacy * may be used to endorse or promote products derived from this software 15181624Skmacy * without specific prior written permission. 16181624Skmacy * 17181624Skmacy * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 18181624Skmacy * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19181624Skmacy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20181624Skmacy * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21181624Skmacy * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22181624Skmacy * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23181624Skmacy * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24181624Skmacy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25181624Skmacy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26183375Skmacy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27183375Skmacy * SUCH DAMAGE. 28181624Skmacy * 29181624Skmacy * $FreeBSD: releng/10.3/lib/libkse/thread/thr_attr_setstackaddr.c 174689 2007-12-16 23:29:57Z deischen $ 30181624Skmacy */ 31183375Skmacy 32183375Skmacy#include "namespace.h" 33183375Skmacy#include <errno.h> 34183375Skmacy#include <pthread.h> 35181624Skmacy#include "un-namespace.h" 36181624Skmacy#include "thr_private.h" 37183375Skmacy 38181624Skmacy__weak_reference(_pthread_attr_setstackaddr, pthread_attr_setstackaddr); 39181624Skmacy 40183375Skmacyint 41181624Skmacy_pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr) 42181624Skmacy{ 43181624Skmacy int ret; 44183375Skmacy 45183375Skmacy /* Check for invalid arguments: */ 46183375Skmacy if (attr == NULL || *attr == NULL || stackaddr == NULL) 47183375Skmacy ret = EINVAL; 48181624Skmacy else { 49181624Skmacy /* Save the stack address: */ 50181624Skmacy (*attr)->stackaddr_attr = stackaddr; 51181624Skmacy ret = 0; 52251767Sgibbs } 53181624Skmacy return(ret); 54181624Skmacy} 55181624Skmacy