| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- get or set thread guardsize attribute
cc –mt [flag... ]file... –lpthread [library... ]#include <pthread.h>intpthread_attr_getguardsize(const pthread_attr_t *restrictattr,size_t *restrictguardsize);
intpthread_attr_setguardsize(pthread_attr_t *attr,size_tguardsize);
Theguardsize attribute controls the size of the guard area for thecreated thread's stack. Theguardsize attribute provides protection against overflow of thestack pointer. If a thread's stack is created with guard protection, theimplementation allocates extra memory at the overflow end of the stack as abuffer against stack overflow of the stack pointer. If an application overflowsinto this buffer an error results (possibly in aSIGSEGV signal beingdelivered to the thread).
Theguardsize attribute is provided to the application for two reasons:
Overflow protection can potentially result in wasted system resources. An application that creates a large number of threads, and which knows its threads will never overflow their stack, can save system resources by turning off guard areas.
When threads allocate large data structures on the stack, large guard areas may be needed to detect stack overflow.
Thepthread_attr_getguardsize() function gets theguardsize attribute in theattr object.This attribute is returned in theguardsize parameter.
Thepthread_attr_setguardsize() function sets theguardsize attribute in theattr object.The new value of this attribute is obtained from theguardsize parameter.Ifguardsize is0, a guard area will not be provided forthreads created withattr. Ifguardsize is greater than0, aguard area of at least sizeguardsize bytes is provided for eachthread created withattr.
A conforming implementation is permitted to round up the value contained inguardsize to a multiple of the configurable system variablePAGESIZE. Ifan implementation rounds up the value ofguardsize to a multiple ofPAGESIZE, a call topthread_attr_getguardsize() specifyingattr will store in theguardsizeparameter the guard size specified by the previouspthread_attr_setguardsize() function call.
The default value of theguardsize attribute isPAGESIZE bytes. Theactual value ofPAGESIZE is implementation-dependent and may not be thesame on all implementations.
If thestackaddr attribute has been set (that is, the caller isallocating and managing its own thread stacks), theguardsize attribute is ignoredand no protection will be provided by the implementation. It is theresponsibility of the application to manage stack overflow along with stack allocation andmanagement in this case.
If successful, thepthread_attr_getguardsize() andpthread_attr_setguardsize() functions return0. Otherwise,an error number is returned to indicate the error.
Thepthread_attr_getguardsize() andpthread_attr_setguardsize() functions will fail if:
The attributeattr is invalid.
The parameterguardsize is invalid.
The parameterguardsize contains an invalid value.
Seeattributes(5) for descriptions of the following attributes:
|
sysconf(3C),pthread_attr_init(3C),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |