jcs's openbsd hax
openbsd
at jcs 90 lines 2.3 kB view raw
1.\" $OpenBSD: pthread_attr_setguardsize.3,v 1.4 2025/06/07 00:16:52 schwarze Exp $ 2.\" Manual page derived from TOG's XPG6 documentation. 3.\" 4.\" David Leonard, 2000. Public Domain. 5.\" 6.Dd $Mdocdate: June 7 2025 $ 7.Dt PTHREAD_ATTR_SETGUARDSIZE 3 8.Os 9.Sh NAME 10.Nm pthread_attr_setguardsize , 11.Nm pthread_attr_getguardsize 12.Nd set and get guardsize attribute 13.Sh SYNOPSIS 14.Lb libpthread 15.In pthread.h 16.Ft int 17.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize" 18.Ft int 19.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize" 20.Sh DESCRIPTION 21The functions 22.Fn pthread_attr_setguardsize 23and 24.Fn pthread_attr_getguardsize , 25respectively, set and get the thread 26creation 27.Va guardsize 28attribute in the 29.Fa attr 30object. 31If 32.Va guardsize 33is zero, 34a guard area shall not be provided for threads created with 35.Fa attr . 36If 37.Va guardsize 38is greater than zero, 39a guard area of at least size 40.Va guardsize 41bytes shall be provided for each thread created with 42.Fa attr . 43.Pp 44The 45.Va guardsize 46attribute controls the size of the guard area for the created 47thread's stack. 48The 49.Va guardsize 50attribute provides protection against overflow of the stack pointer. 51If a thread's stack is created with guard protection, 52the implementation allocates extra memory at the overflow end of 53the stack as a buffer against stack overflow of the stack pointer. 54If an application overflows into this buffer, an error shall result 55(possibly in a SIGSEGV signal being delivered to the thread). 56.Sh RETURN VALUES 57Upon successful completion, 58.Fn pthread_attr_setguardsize 59and 60.Fn pthread_attr_getguardsize 61return a value of 0. 62Otherwise, an error number is returned to indicate the error. 63.Pp 64The 65.Fn pthread_attr_getguardsize 66function stores the 67.Va guardsize 68attribute value in 69.Fa guardsize 70if successful. 71.Sh ERRORS 72No errors are defined. 73.Pp 74These functions will not return an error code of 75.Bq Er EINTR . 76.Sh SEE ALSO 77.Xr pthread_attr_init 3 , 78.Xr pthread_attr_setdetachstate 3 , 79.Xr pthread_attr_setstack 3 , 80.Xr pthread_attr_setstackaddr 3 , 81.Xr pthread_attr_setstacksize 3 , 82.Xr pthread_create 3 , 83.Xr pthreads 3 84.Sh STANDARDS 85.Fn pthread_attr_setguardsize 86and 87.Fn pthread_attr_getguardsize 88conform to ISO/IEC 9945-1 ANSI/IEEE 89.Pq Dq Tn POSIX 90Std 1003.1, 2004 Edition.