NAME
pthread_attr_setguardsize
,
pthread_attr_getguardsize
—
set and get guardsize
attribute
SYNOPSIS
#include
<pthread.h>
int
pthread_attr_setguardsize
(pthread_attr_t
*attr, size_t
guardsize);
int
pthread_attr_getguardsize
(const
pthread_attr_t *attr,
size_t *guardsize);
DESCRIPTION
The functionspthread_attr_setguardsize
()
and
pthread_attr_getguardsize
(),
respectively, set and get the thread creation guardsize
attribute in the attr object. If
guardsize is zero, a guard area shall not be provided
for threads created with attr. If
guardsize is greater than zero, a guard area of at least
size guardsize bytes shall be provided for each thread
created with attr.
The guardsize attribute controls the size of the guard area for the created thread's stack. The guardsize attribute provides protection against overflow of the stack pointer. If a thread's stack is created with guard protection, the implementation allocates extra memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer. If an application overflows into this buffer an error shall result (possibly in a SIGSEGV signal being delivered to the thread).
RETURN VALUES
Upon successful completion,
pthread_attr_setguardsize
() and
pthread_attr_getguardsize
() return a value of 0.
Otherwise, an error number is returned to indicate the error.
The pthread_attr_getguardsize
() function
stores the guardsize attribute value in
guardsize if successful.
ERRORS
No errors are defined.
These functions will not return an error code of
[EINTR
].
SEE ALSO
pthread_attr_init(3), pthread_attr_setdetachstate(3), pthread_attr_setstack(3), pthread_attr_setstackaddr(3), pthread_attr_setstacksize(3), pthread_create(3), pthreads(3)
STANDARDS
pthread_attr_setguardsize
() and
pthread_attr_getguardsize
() conform to ISO/IEC
9945-1 ANSI/IEEE (“POSIX”) Std 1003.1, 2004 Edition.