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,
14 void **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 └─────────────────────────────┴───────────────┴─────────┘
58 POSIX.1-2001 specifies these functions but marks them as obsolete.
59 POSIX.1-2008 removes the specification of these functions.
60
62 Do not use these functions! They cannot be portably used, since they
63 provide no way of specifying the direction of growth or the range of
64 the stack. For example, on architectures with a stack that grows down‐
65 ward, stackaddr specifies the next address past the highest address of
66 the allocated stack area. However, on architectures with a stack that
67 grows upward, stackaddr specifies the lowest address in the allocated
68 stack area. By contrast, the stackaddr used by pthread_attr_set‐
69 stack(3) and pthread_attr_getstack(3), is always a pointer to the low‐
70 est address in the allocated stack area (and the stacksize argument
71 specifies the range of the stack).
72
74 pthread_attr_init(3), pthread_attr_setstack(3), pthread_attr_setstack‐
75 size(3), pthread_create(3), pthreads(7)
76
78 This page is part of release 5.10 of the Linux man-pages project. A
79 description of the project, information about reporting bugs, and the
80 latest version of this page, can be found at
81 https://www.kernel.org/doc/man-pages/.
82
83
84
85Linux 2017-09-15 PTHREAD_ATTR_SETSTACKADDR(3)