pthread_attr_setguardsize_np(3) — Subroutines
NAME
pthread_attr_setguardsize_np − Changes the guardsize attribute of thread creation.
SYNOPSIS
#include <pthread.h>
usigned long pthread_attr_setguardsize_np(
pthread_attr_t ∗attr ,
long ∗guardsize );
PARAMETERS
attrThread attributes object modified.
guardsixeNew value for the guardsize attribute. The guardsize argument specifies the mimimum size (in bytes) of the guard area for the stack of a thread.
DESCRIPTION
This routine sets the minimum size (in bytes) of the guard area for the stack of a thread that is created using the attributes object specified by the attr argument.
A guard area helps to detect stack overflows by preventing memory access beyond the thread’s stack. Large guard areas are necessary when threads might allocate large structures on the stack.
RETURN VALUES
If an error condition occurs, this routine returns −1 and sets errno to the corresponding error value. Possible return values are as follows:
| Return | Error | Description |
| 0 | Successful completion. | |
| −1 | [EINVAL] | The value specified by detachstate is invalid. |
RELATED INFORMATION
pthread_attr_create(3), pthread_attr_setstacksize(3), pthread_create(3)