1110636Salfred/* 2110636Salfred * Copyright (c) 2003 Craig Rodrigues <rodrigc@attbi.com>. 3110636Salfred * All rights reserved. 4110636Salfred * 5110636Salfred * Redistribution and use in source and binary forms, with or without 6110636Salfred * modification, are permitted provided that the following conditions 7110636Salfred * are met: 8110636Salfred * 1. Redistributions of source code must retain the above copyright 9110636Salfred * notice, this list of conditions and the following disclaimer. 10110636Salfred * 2. Redistributions in binary form must reproduce the above copyright 11110636Salfred * notice, this list of conditions and the following disclaimer in the 12110636Salfred * documentation and/or other materials provided with the distribution. 13110636Salfred * 3. All advertising materials mentioning features or use of this software 14110636Salfred * must display the following acknowledgement: 15110636Salfred * This product includes software developed by Craig Rodrigues. 16110636Salfred * 4. Neither the name of the author nor the names of any co-contributors 17110636Salfred * may be used to endorse or promote products derived from this software 18110636Salfred * without specific prior written permission. 19110636Salfred * 20110636Salfred * THIS SOFTWARE IS PROVIDED BY CRAIG RODRIGUES AND CONTRIBUTORS ``AS IS'' AND 21110636Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22110636Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23110636Salfred * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 24110636Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25110636Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26110636Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27110636Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28110636Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29110636Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30110636Salfred * SUCH DAMAGE. 31110636Salfred * 32110636Salfred * $FreeBSD$ 33110636Salfred */ 34174112Sdeischen 35174112Sdeischen#include "namespace.h" 36110636Salfred#include <errno.h> 37110636Salfred#include <pthread.h> 38174112Sdeischen#include "un-namespace.h" 39110636Salfred#include "thr_private.h" 40110636Salfred 41110636Salfred__weak_reference(_pthread_attr_setstack, pthread_attr_setstack); 42110636Salfred 43110636Salfredint 44110636Salfred_pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, 45110636Salfred size_t stacksize) 46110636Salfred{ 47110636Salfred int ret; 48110636Salfred 49110636Salfred /* Check for invalid arguments: */ 50110636Salfred if (attr == NULL || *attr == NULL || stackaddr == NULL 51110636Salfred || stacksize < PTHREAD_STACK_MIN ) 52110636Salfred ret = EINVAL; 53110636Salfred else { 54110636Salfred /* Save the stack address and stack size */ 55110636Salfred (*attr)->stackaddr_attr = stackaddr; 56110636Salfred (*attr)->stacksize_attr = stacksize; 57110636Salfred ret = 0; 58110636Salfred } 59110636Salfred return(ret); 60110636Salfred} 61110636Salfred 62