Open System Services System Calls Reference Manual (G06.25+, H06.03+)

pthread_attr_setguardsize_np(2) OSS System Calls Reference Manual
NAME
pthread_attr_setguardsize_np
- Sets the guardsize attribute of a thread attributes object
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int pthread_attr_setguardsize_np(
pthread_attr_t *attr,
size_t guardsize );
PARAMETERS
attr species the address of the thread attributes object whose guardsize attribute is
to be set.
guardsize species the new value for the guardsize attribute.
DESCRIPTION
This function sets the value of the guardsize attribute of the thread attributes object specied by
the attr parameter to the value specied by the guardsize parameter.
When creating a thread, use a thread attributes object to specify nondefault values for thread
attributes. The guardsize attribute of a thread attributes object species the minimum size (in
bytes) of the guard area for the stack of a new thread.
A guard area can help a multithreaded program detect overow of a threads stack. A guard area
is a region of no-access memory that the system allocates at the overow end of the threads
stack. When any thread attempts to access a memory location within this region, a memory
addressing violation occurs.
A new thread can be created with the default value for the guardsize attribute. This value is
platform-dependent but is always at least one "hardware protection unit" (that is, at least one
page).
After this function is called, the system might reserve a larger guard area for a new thread than
was specied by the guardsize parameter.
The system allows your program to specify the size of a thread stacks guard area because:
When a thread allocates large data structures on its stack, a guard area with a size greater
than the default size might be required to detect stack overow.
Overow protection of a threads stack can potentially waste system resources, such as
for an application that creates a large number of threads that will never overow their
stacks. A multithreaded program can conserve system resources by specifying a guard-
size attribute of 0 (zero).
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
530 Hewlett-Packard Company 527186-003