1.\" $OpenBSD: pthread_attr_setstackaddr.3,v 1.12 2018/04/12 17:13:34 deraadt Exp $
2.\" Manual page derived from TOG's UNIX98 documentation.
3.\"
4.\"  David Leonard, 2000. Public Domain.
5.\"
6.Dd $Mdocdate: April 12 2018 $
7.Dt PTHREAD_ATTR_SETSTACKADDR 3
8.Os
9.Sh NAME
10.Nm pthread_attr_setstackaddr ,
11.Nm pthread_attr_getstackaddr
12.Nd set and get stackaddr attribute
13.Sh SYNOPSIS
14.In pthread.h
15.Ft int
16.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
17.Ft int
18.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
19.Sh DESCRIPTION
20The functions
21.Fn pthread_attr_setstackaddr
22and
23.Fn pthread_attr_getstackaddr ,
24respectively, set and get the thread
25creation
26.Va stackaddr
27attribute in the
28.Fa attr
29object.
30.Pp
31The
32.Va stackaddr
33attribute specifies the location of storage to be
34used for the created thread's stack.
35The size of the storage is at least
36.Dv PTHREAD_STACK_MIN .
37.Pp
38On
39.Ox
40the stack must have been allocated using
41.Xr mmap
42with the
43.Va MAP_STACK
44attribute.
45Otherwise, use of the stack will cause SIGABRT faults.
46.Xr pthread_attr_setstack 3
47can avoid this problem because it knows the size of the stack to remap.
48.Sh RETURN VALUES
49Upon successful completion,
50.Fn pthread_attr_setstackaddr
51and
52.Fn pthread_attr_getstackaddr
53return a value of 0.
54Otherwise, an error number is returned to indicate the error.
55.Pp
56The
57.Fn pthread_attr_getstackaddr
58function stores the
59.Va stackaddr
60attribute value in
61.Fa stackaddr
62if successful.
63.Sh ERRORS
64No errors are defined.
65.Pp
66These functions will not return an error code of
67.Bq Er EINTR .
68.Sh SEE ALSO
69.Xr pthread_attr_init 3 ,
70.Xr pthread_attr_setdetachstate 3 ,
71.Xr pthread_attr_setguardsize 3 ,
72.Xr pthread_attr_setstack 3 ,
73.Xr pthread_attr_setstacksize 3 ,
74.Xr pthread_create 3 ,
75.Xr pthreads 3
76.Sh STANDARDS
77.Fn pthread_attr_setstackaddr
78and
79.Fn pthread_attr_getstackaddr
80conform to ISO/IEC 9945-1 ANSI/IEEE
81.Pq Dq Tn POSIX
82Std 1003.1 Second Edition 1996-07-12.
83