| 1 |
'\" t |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH pthread_attr_setstackaddr 3 2025-05-17 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
pthread_attr_setstackaddr, pthread_attr_getstackaddr \- |
| 9 |
set/get stack address attribute in thread attributes object |
| 10 |
.SH LIBRARY |
| 11 |
POSIX threads library |
| 12 |
.RI ( libpthread ,\~ \-lpthread ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <pthread.h> |
| 16 |
.P |
| 17 |
.B [[deprecated]] |
| 18 |
.BI "int pthread_attr_setstackaddr(pthread_attr_t *" attr \ |
| 19 |
", void *" stackaddr ); |
| 20 |
.B [[deprecated]] |
| 21 |
.BI "int pthread_attr_getstackaddr(const pthread_attr_t *restrict " attr , |
| 22 |
.BI " void **restrict " stackaddr ); |
| 23 |
.fi |
| 24 |
.SH DESCRIPTION |
| 25 |
These functions are obsolete: |
| 26 |
.B do not use them. |
| 27 |
Use |
| 28 |
.BR pthread_attr_setstack (3) |
| 29 |
and |
| 30 |
.BR pthread_attr_getstack (3) |
| 31 |
instead. |
| 32 |
.P |
| 33 |
The |
| 34 |
.BR pthread_attr_setstackaddr () |
| 35 |
function sets the stack address attribute of the |
| 36 |
thread attributes object referred to by |
| 37 |
.I attr |
| 38 |
to the value specified in |
| 39 |
.IR stackaddr . |
| 40 |
This attribute specifies the location of the stack that should |
| 41 |
be used by a thread that is created using the thread attributes object |
| 42 |
.IR attr . |
| 43 |
.P |
| 44 |
.I stackaddr |
| 45 |
should point to a buffer of at least |
| 46 |
.B PTHREAD_STACK_MIN |
| 47 |
bytes that was allocated by the caller. |
| 48 |
The pages of the allocated buffer should be both readable and writable. |
| 49 |
.P |
| 50 |
The |
| 51 |
.BR pthread_attr_getstackaddr () |
| 52 |
function returns the stack address attribute of the |
| 53 |
thread attributes object referred to by |
| 54 |
.I attr |
| 55 |
in the buffer pointed to by |
| 56 |
.IR stackaddr . |
| 57 |
.SH RETURN VALUE |
| 58 |
On success, these functions return 0; |
| 59 |
on error, they return a nonzero error number. |
| 60 |
.SH ERRORS |
| 61 |
No errors are defined |
| 62 |
(but applications should nevertheless |
| 63 |
handle a possible error return). |
| 64 |
.SH ATTRIBUTES |
| 65 |
For an explanation of the terms used in this section, see |
| 66 |
.BR attributes (7). |
| 67 |
.TS |
| 68 |
allbox; |
| 69 |
lbx lb lb |
| 70 |
l l l. |
| 71 |
Interface Attribute Value |
| 72 |
T{ |
| 73 |
.na |
| 74 |
.nh |
| 75 |
.BR pthread_attr_setstackaddr (), |
| 76 |
.BR pthread_attr_getstackaddr () |
| 77 |
T} Thread safety MT-Safe |
| 78 |
.TE |
| 79 |
.SH STANDARDS |
| 80 |
None. |
| 81 |
.SH HISTORY |
| 82 |
glibc 2.1. |
| 83 |
Marked obsolete in POSIX.1-2001. |
| 84 |
Removed in POSIX.1-2008. |
| 85 |
.SH NOTES |
| 86 |
.I Do not use these functions! |
| 87 |
They cannot be portably used, since they provide no way of specifying |
| 88 |
the direction of growth or the range of the stack. |
| 89 |
For example, on architectures with a stack that grows downward, |
| 90 |
.I stackaddr |
| 91 |
specifies the next address past the |
| 92 |
.I highest |
| 93 |
address of the allocated stack area. |
| 94 |
However, on architectures with a stack that grows upward, |
| 95 |
.I stackaddr |
| 96 |
specifies the |
| 97 |
.I lowest |
| 98 |
address in the allocated stack area. |
| 99 |
By contrast, the |
| 100 |
.I stackaddr |
| 101 |
used by |
| 102 |
.BR pthread_attr_setstack (3) |
| 103 |
and |
| 104 |
.BR pthread_attr_getstack (3), |
| 105 |
is always a pointer to the lowest address in the allocated stack area |
| 106 |
(and the |
| 107 |
.I stacksize |
| 108 |
argument specifies the range of the stack). |
| 109 |
.SH SEE ALSO |
| 110 |
.BR pthread_attr_init (3), |
| 111 |
.BR pthread_attr_setstack (3), |
| 112 |
.BR pthread_attr_setstacksize (3), |
| 113 |
.BR pthread_create (3), |
| 114 |
.BR pthreads (7) |