1*41ce3b17Snaddy.\" $OpenBSD: pthread_attr_setguardsize.3,v 1.3 2022/03/31 17:27:17 naddy Exp $ 291063d07Sguenther.\" Manual page derived from TOG's XPG6 documentation. 391063d07Sguenther.\" 491063d07Sguenther.\" David Leonard, 2000. Public Domain. 591063d07Sguenther.\" 6*41ce3b17Snaddy.Dd $Mdocdate: March 31 2022 $ 791063d07Sguenther.Dt PTHREAD_ATTR_SETGUARDSIZE 3 891063d07Sguenther.Os 991063d07Sguenther.Sh NAME 1091063d07Sguenther.Nm pthread_attr_setguardsize , 1191063d07Sguenther.Nm pthread_attr_getguardsize 1291063d07Sguenther.Nd set and get guardsize attribute 1391063d07Sguenther.Sh SYNOPSIS 1486f9d4cdStedu.In pthread.h 1591063d07Sguenther.Ft int 1691063d07Sguenther.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize" 1791063d07Sguenther.Ft int 1891063d07Sguenther.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize" 1991063d07Sguenther.Sh DESCRIPTION 2091063d07SguentherThe functions 2191063d07Sguenther.Fn pthread_attr_setguardsize 2291063d07Sguentherand 2391063d07Sguenther.Fn pthread_attr_getguardsize , 2491063d07Sguentherrespectively, set and get the thread 2591063d07Sguenthercreation 2691063d07Sguenther.Va guardsize 2791063d07Sguentherattribute in the 2891063d07Sguenther.Fa attr 2991063d07Sguentherobject. 3091063d07SguentherIf 3191063d07Sguenther.Va guardsize 3291063d07Sguentheris zero, 3391063d07Sguenthera guard area shall not be provided for threads created with 3491063d07Sguenther.Fa attr . 3591063d07SguentherIf 3691063d07Sguenther.Va guardsize 3791063d07Sguentheris greater than zero, 3891063d07Sguenthera guard area of at least size 3991063d07Sguenther.Va guardsize 4091063d07Sguentherbytes shall be provided for each thread created with 4191063d07Sguenther.Fa attr . 4291063d07Sguenther.Pp 4391063d07SguentherThe 4491063d07Sguenther.Va guardsize 4591063d07Sguentherattribute controls the size of the guard area for the created 4691063d07Sguentherthread's stack. 4791063d07SguentherThe 4891063d07Sguenther.Va guardsize 4991063d07Sguentherattribute provides protection against overflow of the stack pointer. 5091063d07SguentherIf a thread's stack is created with guard protection, 5191063d07Sguentherthe implementation allocates extra memory at the overflow end of 5291063d07Sguentherthe stack as a buffer against stack overflow of the stack pointer. 53*41ce3b17SnaddyIf an application overflows into this buffer, an error shall result 5491063d07Sguenther(possibly in a SIGSEGV signal being delivered to the thread). 5591063d07Sguenther.Sh RETURN VALUES 5691063d07SguentherUpon successful completion, 5791063d07Sguenther.Fn pthread_attr_setguardsize 5891063d07Sguentherand 5991063d07Sguenther.Fn pthread_attr_getguardsize 6091063d07Sguentherreturn a value of 0. 6191063d07SguentherOtherwise, an error number is returned to indicate the error. 6291063d07Sguenther.Pp 6391063d07SguentherThe 6491063d07Sguenther.Fn pthread_attr_getguardsize 6591063d07Sguentherfunction stores the 6691063d07Sguenther.Va guardsize 6791063d07Sguentherattribute value in 6891063d07Sguenther.Fa guardsize 6991063d07Sguentherif successful. 7091063d07Sguenther.Sh ERRORS 7191063d07SguentherNo errors are defined. 7291063d07Sguenther.Pp 7391063d07SguentherThese functions will not return an error code of 7491063d07Sguenther.Bq Er EINTR . 7591063d07Sguenther.Sh SEE ALSO 7691063d07Sguenther.Xr pthread_attr_init 3 , 7791063d07Sguenther.Xr pthread_attr_setdetachstate 3 , 7891063d07Sguenther.Xr pthread_attr_setstack 3 , 7991063d07Sguenther.Xr pthread_attr_setstackaddr 3 , 8091063d07Sguenther.Xr pthread_attr_setstacksize 3 , 8191063d07Sguenther.Xr pthread_create 3 , 8291063d07Sguenther.Xr pthreads 3 8391063d07Sguenther.Sh STANDARDS 8491063d07Sguenther.Fn pthread_attr_setguardsize 8591063d07Sguentherand 8691063d07Sguenther.Fn pthread_attr_getguardsize 8791063d07Sguentherconform to ISO/IEC 9945-1 ANSI/IEEE 8891063d07Sguenther.Pq Dq Tn POSIX 8991063d07SguentherStd 1003.1, 2004 Edition. 90