1.\" $OpenBSD: pthread_attr_setstack.3,v 1.4 2013/06/05 03:44:50 tedu Exp $
2.\" Manual page derived from TOG's UNIX98 documentation.
3.\"
4.\"  David Leonard, 2000. Public Domain.
5.\"
6.Dd $Mdocdate: June 5 2013 $
7.Dt PTHREAD_ATTR_SETSTACK 3
8.Os
9.Sh NAME
10.Nm pthread_attr_setstack ,
11.Nm pthread_attr_getstack
12.Nd set and get stack attributes
13.Sh SYNOPSIS
14.In pthread.h
15.Ft int
16.Fn pthread_attr_setstack "pthread_attr_t *attr" "void *stackaddr" "size_t stacksize"
17.Ft int
18.Fn pthread_attr_getstack "const pthread_attr_t *attr" "void **stackaddr" "size_t *stacksize"
19.Sh DESCRIPTION
20The functions
21.Fn pthread_attr_setstack
22and
23.Fn pthread_attr_getstack ,
24respectively, set and get the thread
25creation
26.Va stackaddr
27and
28.Va stacksize
29attributes in the
30.Fa attr
31object.
32.Pp
33The stack attributes specify the area of storage to be used for the
34created thread's stack.
35The base (lowest addressable byte) of the storage shall be
36.Va stackaddr ,
37and the size of the storage shall be
38.Va stacksize
39bytes.
40The stacksize shall be at least
41.Dv PTHREAD_STACK_MIN .
42.Sh RETURN VALUES
43Upon successful completion,
44.Fn pthread_attr_setstack
45and
46.Fn pthread_attr_getstack
47return a value of 0.
48Otherwise, an error number is returned to indicate the error.
49.Pp
50The
51.Fn pthread_attr_getstack
52function stores the
53.Va stackaddr
54attribute value in
55.Fa stackaddr
56and the
57.Va stacksize
58attribute value in
59.Fa stacksize
60if successful.
61.Sh ERRORS
62The
63.Fn pthread_attr_setstack
64function will fail if:
65.Bl -tag -width Er
66.It Bq Er EINVAL
67The value of
68.Fa stacksize
69is less than
70.Dv PTHREAD_STACK_MIN
71or exceeds a system-imposed limit or the value of
72.Fa stackaddr
73is
74.Dv NULL .
75.El
76.Pp
77These functions will not return an error code of
78.Bq Er EINTR .
79.Sh SEE ALSO
80.Xr pthread_attr_init 3 ,
81.Xr pthread_attr_setdetachstate 3 ,
82.Xr pthread_attr_setguardsize 3 ,
83.Xr pthread_attr_setstackaddr 3 ,
84.Xr pthread_attr_setstacksize 3 ,
85.Xr pthread_create 3 ,
86.Xr pthreads 3
87.Sh STANDARDS
88.Fn pthread_attr_setstack
89and
90.Fn pthread_attr_getstack
91conform to ISO/IEC 9945-1 ANSI/IEEE
92.Pq Dq Tn POSIX
93Std 1003.1, 2004 Edition.
94