OSDN Git Service

4b9bac378855737841d59fdf2bf9d7b7726bfb11
[linuxjm/LDP_man-pages.git] / original / man3 / pthread_attr_setstackaddr.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH PTHREAD_ATTR_SETSTACKADDR 3 2014-05-10 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 pthread_attr_setstackaddr, pthread_attr_getstackaddr \-
29 set/get stack address attribute in thread attributes object
30 .SH SYNOPSIS
31 .nf
32 .B #include <pthread.h>
33
34 .BI "int pthread_attr_setstackaddr(pthread_attr_t *" attr \
35 ", void *" stackaddr );
36 .BI "int pthread_attr_getstackaddr(pthread_attr_t *" attr \
37 ", void **" stackaddr );
38 .sp
39 Compile and link with \fI\-pthread\fP.
40 .fi
41 .SH DESCRIPTION
42 These functions are obsolete:
43 .B do not use them.
44 Use
45 .BR pthread_attr_setstack (3)
46 and
47 .BR pthread_attr_getstack (3)
48 instead.
49
50 The
51 .BR pthread_attr_setstackaddr ()
52 function sets the stack address attribute of the
53 thread attributes object referred to by
54 .I attr
55 to the value specified in
56 .IR stackaddr .
57 This attribute specifies the location of the stack that should
58 be used by a thread that is created using the thread attributes object
59 .IR attr .
60
61 .I stackaddr
62 should point to a buffer of at least
63 .B PTHREAD_STACK_MIN
64 bytes that was allocated by the caller.
65 The pages of the allocated buffer should be both readable and writable.
66
67 The
68 .BR pthread_attr_getstackaddr ()
69 function returns the stack address attribute of the
70 thread attributes object referred to by
71 .I attr
72 in the buffer pointed to by
73 .IR stackaddr .
74 .SH RETURN VALUE
75 On success, these functions return 0;
76 on error, they return a nonzero error number.
77 .SH ERRORS
78 No errors are defined
79 (but applications should nevertheless
80 handle a possible error return).
81 .SH VERSIONS
82 These functions are provided by glibc since version 2.1.
83 .SH ATTRIBUTES
84 .SS Multithreading (see pthreads(7))
85 The
86 .BR pthread_attr_setstackaddr ()
87 and
88 .BR pthread_attr_getstackaddr ()
89 functions are thread-safe.
90 .SH CONFORMING TO
91 POSIX.1-2001 specifies these functions but marks them as obsolete.
92 POSIX.1-2008 removes the specification of these functions.
93 .SH NOTES
94 .I Do not use these functions!
95 They cannot be portably used, since they provide no way of specifying
96 the direction of growth or the range of the stack.
97 For example, on architectures with a stack that grows downward,
98 .I stackaddr
99 specifies the next address past the
100 .I highest
101 address of the allocated stack area.
102 However, on architectures with a stack that grows upward,
103 .I stackaddr
104 specifies the
105 .I lowest
106 address in the allocated stack area.
107 By contrast, the
108 .I stackaddr
109 used by
110 .BR pthread_attr_setstack (3)
111 and
112 .BR pthread_attr_getstack (3),
113 is always a pointer to the lowest address in the allocated stack area
114 (and the
115 .I stacksize
116 argument specifies the range of the stack).
117 .SH SEE ALSO
118 .BR pthread_attr_init (3),
119 .BR pthread_attr_setstack (3),
120 .BR pthread_attr_setstacksize (3),
121 .BR pthread_create (3),
122 .BR pthreads (7)
123 .SH COLOPHON
124 This page is part of release 3.67 of the Linux
125 .I man-pages
126 project.
127 A description of the project,
128 information about reporting bugs,
129 and the latest version of this page,
130 can be found at
131 \%http://www.kernel.org/doc/man\-pages/.