1PTHREAD_ATTR_GETSTACKADDR(P)POSIX Programmer's ManuaPlTHREAD_ATTR_GETSTACKADDR(P)
2
3
4
6 pthread_attr_getstackaddr, pthread_attr_setstackaddr - get and set the
7 stackaddr attribute
8
10 #include <pthread.h>
11
12
13
14 int pthread_attr_getstackaddr(const pthread_attr_t *restrict attr,
15 void **restrict stackaddr);
16 int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr);
17
18
20 The pthread_attr_getstackaddr() and pthread_attr_setstackaddr() func‐
21 tions, respectively, shall get and set the thread creation stackaddr
22 attribute in the attr object.
23
24 The stackaddr attribute specifies the location of storage to be used
25 for the created thread's stack. The size of the storage shall be at
26 least {PTHREAD_STACK_MIN}.
27
29 Upon successful completion, pthread_attr_getstackaddr() and
30 pthread_attr_setstackaddr() shall return a value of 0; otherwise, an
31 error number shall be returned to indicate the error.
32
33 The pthread_attr_getstackaddr() function stores the stackaddr attribute
34 value in stackaddr if successful.
35
37 No errors are defined.
38
39 These functions shall not return an error code of [EINTR].
40
41 The following sections are informative.
42
44 None.
45
47 The specification of the stackaddr attribute presents several ambigui‐
48 ties that make portable use of these interfaces impossible. The
49 description of the single address parameter as a "stack" does not spec‐
50 ify a particular relationship between the address and the "stack"
51 implied by that address. For example, the address may be taken as the
52 low memory address of a buffer intended for use as a stack, or it may
53 be taken as the address to be used as the initial stack pointer regis‐
54 ter value for the new thread. These two are not the same except for a
55 machine on which the stack grows "up" from low memory to high, and on
56 which a "push" operation first stores the value in memory and then
57 increments the stack pointer register. Further, on a machine where the
58 stack grows "down" from high memory to low, interpretation of the
59 address as the "low memory" address requires a determination of the
60 intended size of the stack. IEEE Std 1003.1-2001 has introduced the new
61 interfaces pthread_attr_setstack() and pthread_attr_getstack() to
62 resolve these ambiguities.
63
65 None.
66
68 None.
69
71 pthread_attr_destroy() , pthread_attr_getdetachstate() ,
72 pthread_attr_getstack() , pthread_attr_getstacksize() ,
73 pthread_attr_setstack() , pthread_create() , the Base Definitions vol‐
74 ume of IEEE Std 1003.1-2001, <limits.h>, <pthread.h>
75
77 Portions of this text are reprinted and reproduced in electronic form
78 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79 -- Portable Operating System Interface (POSIX), The Open Group Base
80 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
81 Electrical and Electronics Engineers, Inc and The Open Group. In the
82 event of any discrepancy between this version and the original IEEE and
83 The Open Group Standard, the original IEEE and The Open Group Standard
84 is the referee document. The original Standard can be obtained online
85 at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group 2003 PTHREAD_ATTR_GETSTACKADDR(P)