1pthread_attr_getstack(3C)Standard C Library Functionspthread_attr_getstack(3C)
2
3
4

NAME

6       pthread_attr_getstack,   pthread_attr_setstack   -  get  or  set  stack
7       attributes
8

SYNOPSIS

10       cc -mt  [ flag... ] file... -lpthread [ library... ]
11       #include <pthread.h>
12
13       int pthread_attr_getstack(const pthread_attr_t *restrict attr,
14            void **restrict stackaddr, size_t *restrict stacksize);
15
16
17       int pthread_attr_setstack(pthread_attr_t * attr, void *stackaddr,
18            size_t stacksize);
19
20

DESCRIPTION

22       The  pthread_attr_getstack()  and  pthread_attr_setstack()   functions,
23       respectively,  get  and set the thread creation stack attributes stack‐
24       addr and stacksize in the attr object.
25
26
27       The stack attributes specify the area of storage to  be  used  for  the
28       created thread's stack. The base (lowest addressable byte) of the stor‐
29       age is stackaddr, and the size of the storage is stacksize  bytes.  The
30       stacksize  argument must be at least {PTHREAD_STACK_MIN}. The stackaddr
31       argument must be aligned appropriately to be used as a stack; for exam‐
32       ple,  pthread_attr_setstack()  might  fail  with EINVAL if (stackaddr &
33       0x7) is not 0. All pages within the stack described  by  stackaddr  and
34       stacksize are both readable and writable by the thread.
35

RETURN VALUES

37       Upon  successful  completion, these functions return a 0; otherwise, an
38       error number is returned to indicate the error.
39
40
41       The pthread_attr_getstack() function stores the stack attribute  values
42       in stackaddr and stacksize if successful.
43

ERRORS

45       The pthread_attr_setstack() function will fail if:
46
47       EINVAL    The value of stacksize is less than {PTHREAD_STACK_MIN}.
48
49
50
51       The pthread_attr_setstack() function may fail if:
52
53       EACCES    The  stack  page(s)  described by stackaddr and stacksize are
54                 not both readable and writable by the thread.
55
56
57       EINVAL    The value of stackaddr does not have proper alignment  to  be
58                 used  as  a  stack,  or  (stackaddr + stacksize) lacks proper
59                 alignment.
60
61

USAGE

63       These functions are appropriate for use by applications in an  environ‐
64       ment  where  the  stack  for a thread must be placed in some particular
65       region of memory.
66

ATTRIBUTES

68       See attributes(5) for descriptions of the following attributes:
69
70
71
72
73       ┌─────────────────────────────┬─────────────────────────────┐
74       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
75       ├─────────────────────────────┼─────────────────────────────┤
76       │Interface Stability          │Standard                     │
77       ├─────────────────────────────┼─────────────────────────────┤
78       │MT-Level                     │Async-Signal-Safe            │
79       └─────────────────────────────┴─────────────────────────────┘
80

SEE ALSO

82       pthread_attr_init(3C),                 pthread_attr_setdetachstate(3C),
83       pthread_attr_setstacksize(3C), pthread_create(3C), attributes(5)
84
85
86
87SunOS 5.11                        23 Mar 2005        pthread_attr_getstack(3C)
Impressum