180021Sjasone/*
280021Sjasone * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
380021Sjasone * All rights reserved.
480021Sjasone *
580021Sjasone * Redistribution and use in source and binary forms, with or without
680021Sjasone * modification, are permitted provided that the following conditions
780021Sjasone * are met:
880021Sjasone * 1. Redistributions of source code must retain the above copyright
980021Sjasone *    notice(s), this list of conditions and the following disclaimer
1080021Sjasone *    unmodified other than the allowable addition of one or more
1180021Sjasone *    copyright notices.
1280021Sjasone * 2. Redistributions in binary form must reproduce the above copyright
1380021Sjasone *    notice(s), this list of conditions and the following disclaimer in
1480021Sjasone *    the documentation and/or other materials provided with the
1580021Sjasone *    distribution.
1680021Sjasone *
1780021Sjasone * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
1880021Sjasone * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1980021Sjasone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2080021Sjasone * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
2180021Sjasone * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2280021Sjasone * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2380021Sjasone * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2480021Sjasone * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2580021Sjasone * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2680021Sjasone * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2780021Sjasone * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2880021Sjasone *
2980021Sjasone * $FreeBSD$
3080021Sjasone */
3180021Sjasone
32174112Sdeischen#include "namespace.h"
3380021Sjasone#include <sys/param.h>
3480021Sjasone#include <errno.h>
3580021Sjasone#include <pthread.h>
36174112Sdeischen#include "un-namespace.h"
37103388Smini#include "thr_private.h"
3880021Sjasone
3980021Sjasone__weak_reference(_pthread_attr_setguardsize, pthread_attr_setguardsize);
4080021Sjasone
4180021Sjasoneint
4280021Sjasone_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
4380021Sjasone{
4480021Sjasone	int	ret;
4580021Sjasone
4680021Sjasone	/* Check for invalid arguments. */
4780021Sjasone	if (attr == NULL || *attr == NULL)
4880021Sjasone		ret = EINVAL;
4980021Sjasone	else {
5080021Sjasone		/* Save the stack size. */
5180021Sjasone		(*attr)->guardsize_attr = guardsize;
5280021Sjasone		ret = 0;
5380021Sjasone	}
5480021Sjasone	return(ret);
5580021Sjasone}
56