OSDN Git Service

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