]>
Commit | Line | Data |
---|---|---|
4008a5d5 MK |
1 | .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
4008a5d5 | 5 | .\" |
1d767b55 | 6 | .TH PTHREAD_ATTR_SETSTACK 3 2021-03-22 "Linux" "Linux Programmer's Manual" |
4008a5d5 MK |
7 | .SH NAME |
8 | pthread_attr_setstack, pthread_attr_getstack \- set/get stack | |
9 | attributes in thread attributes object | |
637f4b53 AC |
10 | .SH LIBRARY |
11 | POSIX threads library | |
8fc3b2cf | 12 | .RI ( libpthread ", " \-lpthread ) |
4008a5d5 MK |
13 | .SH SYNOPSIS |
14 | .nf | |
15 | .B #include <pthread.h> | |
dbfe9c70 | 16 | .PP |
4008a5d5 MK |
17 | .BI "int pthread_attr_setstack(pthread_attr_t *" attr , |
18 | .BI " void *" stackaddr ", size_t " stacksize ); | |
5a00663a AC |
19 | .BI "int pthread_attr_getstack(const pthread_attr_t *restrict " attr , |
20 | .BI " void **restrict " stackaddr , | |
21 | .BI " size_t *restrict " stacksize ); | |
4008a5d5 | 22 | .fi |
68e4db0a | 23 | .PP |
d39ad78f | 24 | .RS -4 |
4008a5d5 MK |
25 | Feature Test Macro Requirements for glibc (see |
26 | .BR feature_test_macros (7)): | |
d39ad78f | 27 | .RE |
68e4db0a | 28 | .PP |
4008a5d5 MK |
29 | .BR pthread_attr_getstack (), |
30 | .BR pthread_attr_setstack (): | |
9d2adbae | 31 | .nf |
5c10d2c5 | 32 | _POSIX_C_SOURCE >= 200112L |
9d2adbae | 33 | .fi |
4008a5d5 MK |
34 | .SH DESCRIPTION |
35 | The | |
49c54dd8 | 36 | .BR pthread_attr_setstack () |
e0ea179f | 37 | function sets the stack address and stack size attributes of the |
4008a5d5 MK |
38 | thread attributes object referred to by |
39 | .I attr | |
40 | to the values specified in | |
1ae6b2c7 | 41 | .I stackaddr |
4008a5d5 MK |
42 | and |
43 | .IR stacksize , | |
44 | respectively. | |
45 | These attributes specify the location and size of the stack that should | |
46 | be used by a thread that is created using the thread attributes object | |
47 | .IR attr . | |
847e0d88 | 48 | .PP |
4008a5d5 MK |
49 | .I stackaddr |
50 | should point to the lowest addressable byte of a buffer of | |
51 | .I stacksize | |
52 | bytes that was allocated by the caller. | |
53 | The pages of the allocated buffer should be both readable and writable. | |
847e0d88 | 54 | .PP |
4008a5d5 MK |
55 | The |
56 | .BR pthread_attr_getstack () | |
57 | function returns the stack address and stack size attributes of the | |
58 | thread attributes object referred to by | |
59 | .I attr | |
60 | in the buffers pointed to by | |
1ae6b2c7 | 61 | .I stackaddr |
4008a5d5 MK |
62 | and |
63 | .IR stacksize , | |
64 | respectively. | |
65 | .SH RETURN VALUE | |
66 | On success, these functions return 0; | |
c7094399 | 67 | on error, they return a nonzero error number. |
4008a5d5 | 68 | .SH ERRORS |