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