thr_attr_setstackaddr.c revision 55838
1139749Simp/*
265832Snyan * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
365832Snyan * All rights reserved.
465832Snyan *
565832Snyan * Redistribution and use in source and binary forms, with or without
665832Snyan * modification, are permitted provided that the following conditions
765832Snyan * are met:
865832Snyan * 1. Redistributions of source code must retain the above copyright
965832Snyan *    notice, this list of conditions and the following disclaimer.
1065832Snyan * 2. Redistributions in binary form must reproduce the above copyright
1165832Snyan *    notice, this list of conditions and the following disclaimer in the
1265832Snyan *    documentation and/or other materials provided with the distribution.
1365832Snyan * 3. All advertising materials mentioning features or use of this software
1465832Snyan *    must display the following acknowledgement:
1565832Snyan *	This product includes software developed by John Birrell.
1665832Snyan * 4. Neither the name of the author nor the names of any co-contributors
1765832Snyan *    may be used to endorse or promote products derived from this software
1865832Snyan *    without specific prior written permission.
1965832Snyan *
2065832Snyan * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
2165832Snyan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2265832Snyan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2365832Snyan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24119418Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25119418Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26119418Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2765832Snyan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2865832Snyan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2965832Snyan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3067158Sphk * SUCH DAMAGE.
3165832Snyan *
3265832Snyan * $FreeBSD: head/lib/libkse/thread/thr_attr_setstackaddr.c 55838 2000-01-12 09:28:58Z jasone $
3365832Snyan */
3465832Snyan#include <errno.h>
3565832Snyan#ifdef _THREAD_SAFE
36140543Simp#include <pthread.h>
3765832Snyan#include "pthread_private.h"
3865832Snyan
3965832Snyanint
4065832Snyanpthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
4165832Snyan{
4265832Snyan	int	ret;
4365832Snyan
4465832Snyan	/* Check for invalid arguments: */
4565832Snyan	if (attr == NULL || *attr == NULL || stackaddr == NULL)
46142135Simp		ret = EINVAL;
4765832Snyan	else {
4865832Snyan		/* Save the stack address: */
4965832Snyan		(*attr)->stackaddr_attr = stackaddr;
5065832Snyan		ret = 0;
51140528Simp	}
52129764Simp	return(ret);
53129764Simp}
54129740Simp#endif
5565832Snyan