1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH PTHREAD_ATTR_SETSTACKADDR 3 2021-03-22 "Linux" "Linux Programmer's Manual"
28 pthread_attr_setstackaddr, pthread_attr_getstackaddr \-
29 set/get stack address attribute in thread attributes object
32 .B #include <pthread.h>
34 .BI "int pthread_attr_setstackaddr(pthread_attr_t *" attr \
35 ", void *" stackaddr );
36 .BI "int pthread_attr_getstackaddr(const pthread_attr_t *restrict " attr ,
37 .BI " void **restrict " stackaddr );
39 Compile and link with \fI\-pthread\fP.
42 These functions are obsolete:
45 .BR pthread_attr_setstack (3)
47 .BR pthread_attr_getstack (3)
51 .BR pthread_attr_setstackaddr ()
52 function sets the stack address attribute of the
53 thread attributes object referred to by
55 to the value specified in
57 This attribute specifies the location of the stack that should
58 be used by a thread that is created using the thread attributes object
62 should point to a buffer of at least
64 bytes that was allocated by the caller.
65 The pages of the allocated buffer should be both readable and writable.
68 .BR pthread_attr_getstackaddr ()
69 function returns the stack address attribute of the
70 thread attributes object referred to by
72 in the buffer pointed to by
75 On success, these functions return 0;
76 on error, they return a nonzero error number.
79 (but applications should nevertheless
80 handle a possible error return).
82 These functions are provided by glibc since version 2.1.
84 For an explanation of the terms used in this section, see
92 Interface Attribute Value
94 .BR pthread_attr_setstackaddr (),
95 .BR pthread_attr_getstackaddr ()
96 T} Thread safety MT-Safe
102 POSIX.1-2001 specifies these functions but marks them as obsolete.
103 POSIX.1-2008 removes the specification of these functions.
105 .I Do not use these functions!
106 They cannot be portably used, since they provide no way of specifying
107 the direction of growth or the range of the stack.
108 For example, on architectures with a stack that grows downward,
110 specifies the next address past the
112 address of the allocated stack area.
113 However, on architectures with a stack that grows upward,
117 address in the allocated stack area.
121 .BR pthread_attr_setstack (3)
123 .BR pthread_attr_getstack (3),
124 is always a pointer to the lowest address in the allocated stack area
127 argument specifies the range of the stack).
129 .BR pthread_attr_init (3),
130 .BR pthread_attr_setstack (3),
131 .BR pthread_attr_setstacksize (3),
132 .BR pthread_create (3),