OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[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 .fi
39 .SH DESCRIPTION
40 These functions are obsolete:
41 .B do not use them.
42 Use
43 .BR pthread_attr_setstack (3)
44 and
45 .BR pthread_attr_getstack (3)
46 instead.
47
48 The
49 .BR pthread_attr_setstackaddr ()
50 function sets the stack address attribute of the
51 thread attributes object referred to by
52 .I attr
53 to the value specified in
54 .IR stackaddr .
55 This attribute specifies the location of the stack that should
56 be used by a thread that is created using the thread attributes object
57 .IR attr .
58
59 .I stackaddr
60 should point to a buffer of at least
61 .B PTHREAD_STACK_MIN
62 bytes that was allocated by the caller.
63 The pages of the allocated buffer should be both readable and writable.
64
65 The
66 .BR pthread_attr_getstackaddr ()
67 function returns the stack address attribute of the
68 thread attributes object referred to by
69 .I attr
70 in the buffer pointed to by
71 .IR stackaddr .
72 .SH RETURN VALUE
73 On success, these functions return 0;
74 on error, they return a nonzero error number.
75 .SH ERRORS
76 No errors are defined
77 (but applications should nevertheless
78 handle a possible error return).
79 .SH VERSIONS
80 These functions are provided by glibc since version 2.1.
81 .SH CONFORMING TO
82 POSIX.1-2001 specifies these functions but marks them as obsolete.
83 POSIX.1-2008 removes the specification of these functions.
84 .SH NOTES
85 .I Do not use these functions!
86 They cannot be portably used, since they provide no way of specifying
87 the direction of growth or the range of the stack.
88 For example, on architectures with a stack that grows downward,
89 .I stackaddr
90 specifies the next address past the
91 .I highest
92 address of the allocated stack area.
93 However, on architectures with a stack that grows upward,
94 .I stackaddr
95 specifies the
96 .I lowest
97 address in the allocated stack area.
98 By contrast, the
99 .I stackaddr
100 used by
101 .BR pthread_attr_setstack (3)
102 and
103 .BR pthread_attr_getstack (3),
104 is always a pointer to the lowest address in the allocated stack area
105 (and the
106 .I stacksize
107 argument specifies the range of the stack).
108 .SH SEE ALSO
109 .BR pthread_attr_init (3),
110 .BR pthread_attr_setstack (3),
111 .BR pthread_attr_setstacksize (3),
112 .BR pthread_create (3),
113 .BR pthreads (7)