1PTHREAD_ATTR_SETSTACKADDR(3)Linux Programmer's ManuaPlTHREAD_ATTR_SETSTACKADDR(3)
2
3
4
6 pthread_attr_setstackaddr, pthread_attr_getstackaddr - set/get stack
7 address attribute in thread attributes object
8
10 #include <pthread.h>
11
12 int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr);
13 int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr);
14
15 Compile and link with -pthread.
16
18 These functions are obsolete: do not use them. Use pthread_attr_set‐
19 stack(3) and pthread_attr_getstack(3) instead.
20
21 The pthread_attr_setstackaddr() function sets the stack address
22 attribute of the thread attributes object referred to by attr to the
23 value specified in stackaddr. This attribute specifies the location of
24 the stack that should be used by a thread that is created using the
25 thread attributes object attr.
26
27 stackaddr should point to a buffer of at least PTHREAD_STACK_MIN bytes
28 that was allocated by the caller. The pages of the allocated buffer
29 should be both readable and writable.
30
31 The pthread_attr_getstackaddr() function returns the stack address
32 attribute of the thread attributes object referred to by attr in the
33 buffer pointed to by stackaddr.
34
36 On success, these functions return 0; on error, they return a nonzero
37 error number.
38
40 No errors are defined (but applications should nevertheless handle a
41 possible error return).
42
44 These functions are provided by glibc since version 2.1.
45
47 For an explanation of the terms used in this section, see
48 attributes(7).
49
50 ┌─────────────────────────────┬───────────────┬─────────┐
51 │Interface │ Attribute │ Value │
52 ├─────────────────────────────┼───────────────┼─────────┤
53 │pthread_attr_setstackaddr(), │ Thread safety │ MT-Safe │
54 │pthread_attr_getstackaddr() │ │ │
55 └─────────────────────────────┴───────────────┴─────────┘
57 POSIX.1-2001 specifies these functions but marks them as obsolete.
58 POSIX.1-2008 removes the specification of these functions.
59
61 Do not use these functions! They cannot be portably used, since they
62 provide no way of specifying the direction of growth or the range of
63 the stack. For example, on architectures with a stack that grows down‐
64 ward, stackaddr specifies the next address past the highest address of
65 the allocated stack area. However, on architectures with a stack that
66 grows upward, stackaddr specifies the lowest address in the allocated
67 stack area. By contrast, the stackaddr used by pthread_attr_set‐
68 stack(3) and pthread_attr_getstack(3), is always a pointer to the low‐
69 est address in the allocated stack area (and the stacksize argument
70 specifies the range of the stack).
71
73 pthread_attr_init(3), pthread_attr_setstack(3), pthread_attr_setstack‐
74 size(3), pthread_create(3), pthreads(7)
75
77 This page is part of release 5.04 of the Linux man-pages project. A
78 description of the project, information about reporting bugs, and the
79 latest version of this page, can be found at
80 https://www.kernel.org/doc/man-pages/.
81
82
83
84Linux 2017-09-15 PTHREAD_ATTR_SETSTACKADDR(3)